当前位置: 首页>>代码示例>>C#>>正文


C# InfoManageDataContext.SaveChanges方法代码示例

本文整理汇总了C#中InfoManage.DataModels.InfoManageDataContext.SaveChanges方法的典型用法代码示例。如果您正苦于以下问题:C# InfoManageDataContext.SaveChanges方法的具体用法?C# InfoManageDataContext.SaveChanges怎么用?C# InfoManageDataContext.SaveChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InfoManage.DataModels.InfoManageDataContext的用法示例。


在下文中一共展示了InfoManageDataContext.SaveChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: addStationAtmosphericComposition

 public ActionResult addStationAtmosphericComposition(string StationNum,
  string StationBuildDate,
  string StationName,
  int StoragesInfoID,
  int transportManageType,
  string StationType,
  string StationManufacturer,
  string StationLongitude,
  string StationLatitude,
  string StationAltitude,
  string Operator)
 {
     try
     {
         using (InfoManageDataContext context = new InfoManageDataContext())
         {
             AtmosphericCompositionStation result = context.AtmosphericCompositionStations.Where(c => c.StationNum.Equals(StationNum)).FirstOrDefault();
             if (result == null)
             {
                 AtmosphericCompositionStation newstation = new AtmosphericCompositionStation();
                 newstation.StationNum = StationNum;
                 newstation.StationBuildDate = DateTime.ParseExact(StationBuildDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
                 newstation.StationName = StationName;
                 newstation.StoragesInfoID = StoragesInfoID;
                 newstation.transportManageType = transportManageType;
                 newstation.StationType = StationType;
                 newstation.StationManufacturer = StationManufacturer;
                 newstation.StationLongitude = StationLongitude;
                 newstation.StationLatitude = StationLatitude;
                 newstation.StationAltitude = StationAltitude;
                 newstation.Operator = Operator;
                 context.AtmosphericCompositionStations.Add(newstation);
             }
             else
             {
                 result.StationName = StationName;
                 result.transportManageType = transportManageType;
                 result.StationType = StationType;
                 result.StationManufacturer = StationManufacturer;
                 result.StationLongitude = StationLongitude;
                 result.StationLatitude = StationLatitude;
                 result.StationAltitude = StationAltitude;
                 result.Operator = Operator;
             }
             context.SaveChanges();
             return Json("OK", JsonRequestBehavior.AllowGet);
         }
     }
     catch
     {
         return Json("NO", JsonRequestBehavior.AllowGet);
     }
 }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:53,代码来源:SpetialDeviceController.cs

示例2: AjaxDellUpRequest

 public ActionResult AjaxDellUpRequest(int UpRequestID)
 {
     try
     {
         using (InfoManageDataContext context = new InfoManageDataContext())
         {
             UpRequest stations123 = context.UpRequests.Where(c => c.UpRequestID.Equals(UpRequestID)).FirstOrDefault();
             if (stations123 != null)
             {
                 context.UpRequests.Remove(stations123);
             }
             context.SaveChanges();
             return Json("OK", JsonRequestBehavior.AllowGet);
         }
     }
     catch
     {
         return Json("NO", JsonRequestBehavior.AllowGet);
     }
 }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:20,代码来源:AdminController.cs

示例3: AjaxVideoConferenceMaintenanceRemove

 public ActionResult AjaxVideoConferenceMaintenanceRemove(int VideoConferenceMaintenanceID)
 {
     try
     {
         using (InfoManageDataContext context = new InfoManageDataContext())
         {
             VideoConferenceMaintenance result = context.VideoConferenceMaintenances.Find(VideoConferenceMaintenanceID);
             if (result != null)
             {
                 context.VideoConferenceMaintenances.Remove(result);
                 context.SaveChanges();
             }
             return Json("OK", JsonRequestBehavior.AllowGet);
         }
     }
     catch
     {
         return Json("NO", JsonRequestBehavior.AllowGet);
     }
 }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:20,代码来源:EquipmentManagementController.cs

示例4: AjaxUploadImgs

 public ActionResult AjaxUploadImgs(string FileType, string flag, int StationEquipmentsRepairID, string SparePartsCode)
 {
     HttpPostedFileBase upload = Request.Files["upLoadFile"];
     if (upload != null && FileType != null)
     {
         if (upload.ContentLength > 0)
         {
             using (InfoManageDataContext context = new InfoManageDataContext())
             {
                 try
                 {
                     SqlParameter[] parames = new SqlParameter[1];
                     SqlParameter filetype = new SqlParameter();
                     filetype.ParameterName = "@FileType";
                     filetype.SqlDbType = System.Data.SqlDbType.VarChar;
                     filetype.Size = 25;
                     filetype.Value = FileType;
                     parames[0] = filetype;
                     AllUNCPath result = context.Database.SqlQuery<AllUNCPath>("EXEC [dbo].[sp_SYS_GetUNCPath] @FileType", parames).FirstOrDefault();
                     string extname = System.IO.Path.GetExtension(upload.FileName);
                     string picName = SparePartsCode + flag + StationEquipmentsRepairID + extname;
                     string filePath = Path.Combine(result.UNCPath, picName);
                     FileInfo tmp = new FileInfo(filePath);
                     if (tmp.Exists)
                         tmp.Delete();
                     upload.SaveAs(filePath);
                     switch (flag)
                     {
                         case "故障图片":
                             StationEquipmentsRepair repair = context.StationEquipmentsRepairs.Where(c => c.StationEquipmentsRepairID.Equals(StationEquipmentsRepairID)).FirstOrDefault();
                             repair.PhenomenalImage = picName;
                             break;
                     }
                     context.SaveChanges();
                     return Json("OK", JsonRequestBehavior.AllowGet);
                 }
                 catch
                 {
                     return Json("NO", JsonRequestBehavior.AllowGet);
                 }
             }
         }
     }
     return Json("NO", JsonRequestBehavior.AllowGet);
 }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:45,代码来源:EquipmentManagementController.cs

示例5: AjaxSystemRepairAdd

 public ActionResult AjaxSystemRepairAdd(string SystemName, string Reportor, string ReportDate, string RepairDescription, string Repairer, string RepairDate)
 {
     try
     {
         using (InfoManageDataContext context = new InfoManageDataContext())
         {
             SystemRepair newSystemRepair = new SystemRepair();
             newSystemRepair.SystemName = SystemName;
             newSystemRepair.RepairDescription = RepairDescription;
             newSystemRepair.Repairer = Repairer;
             newSystemRepair.RepairDate = DateTime.ParseExact(RepairDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
             newSystemRepair.Reportor = Reportor;
             newSystemRepair.ReportDate = DateTime.ParseExact(ReportDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
             SystemRepair result = context.SystemRepairs.Where(c => c.SystemName.Equals(newSystemRepair.SystemName) && c.RepairDate.Equals(newSystemRepair.RepairDate)).FirstOrDefault();
             if (result == null)
                 context.SystemRepairs.Add(newSystemRepair);
             else
             {
                 result.RepairDescription = newSystemRepair.RepairDescription;
                 result.Repairer = newSystemRepair.Repairer;
                 result.ReportDate = newSystemRepair.ReportDate;
                 result.Reportor = newSystemRepair.Reportor;
             }
             context.SaveChanges();
             return Json("OK", JsonRequestBehavior.AllowGet);
         }
     }
     catch
     {
         return Json("NO", JsonRequestBehavior.AllowGet);
     }
 }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:32,代码来源:EquipmentManagementController.cs

示例6: AjaxStationEquipmentsMaintenanceAdd

 public ActionResult AjaxStationEquipmentsMaintenanceAdd(string RegionName, int StoragesInfoID, string StationNum, string StationClass, string StationType, string StationManufacturer, string MaintenanceDescription, string Maintenner, string MaintenanceDate, bool powerSta, bool communicationSta, bool samplingSta, bool senserSta, bool cleaningSta, bool stableSta, string Reportor, string ReportDate, string MaintenanceCommants)
 {
     try
     {
         using (InfoManageDataContext context = new InfoManageDataContext())
         {
             DateTime MaintenanceDatetmp = DateTime.ParseExact(MaintenanceDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
             StationEquipmentsMaintenance newStationEquipmentsMaintenance = new StationEquipmentsMaintenance();
             newStationEquipmentsMaintenance.RegionName = RegionName;
             newStationEquipmentsMaintenance.StoragesInfoID = StoragesInfoID;
             newStationEquipmentsMaintenance.StationNum = StationNum;
             newStationEquipmentsMaintenance.MaintenanceDescription = MaintenanceDescription;
             newStationEquipmentsMaintenance.Maintenner = Maintenner;
             newStationEquipmentsMaintenance.MaintenanceDate = DateTime.ParseExact(MaintenanceDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
             newStationEquipmentsMaintenance.powerSta = powerSta;
             newStationEquipmentsMaintenance.communicationSta = communicationSta;
             newStationEquipmentsMaintenance.samplingSta = samplingSta;
             newStationEquipmentsMaintenance.senserSta = senserSta;
             newStationEquipmentsMaintenance.cleaningSta = cleaningSta;
             newStationEquipmentsMaintenance.stableSta = stableSta;
             newStationEquipmentsMaintenance.Reportor = Reportor;
             newStationEquipmentsMaintenance.ReportDate = DateTime.ParseExact(ReportDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
             newStationEquipmentsMaintenance.MaintenanceCommants = MaintenanceCommants;
             StationEquipmentsMaintenance result = context.StationEquipmentsMaintenances.Where(c => c.StationNum.Equals(StationNum) && c.MaintenanceDate.Equals(MaintenanceDatetmp)).FirstOrDefault();
             if (result == null)
                 context.StationEquipmentsMaintenances.Add(newStationEquipmentsMaintenance);
             else
             {
                 result.MaintenanceDescription = newStationEquipmentsMaintenance.MaintenanceDescription;
                 result.MaintenanceCommants = newStationEquipmentsMaintenance.MaintenanceCommants;
                 result.powerSta = newStationEquipmentsMaintenance.powerSta;
                 result.communicationSta = newStationEquipmentsMaintenance.communicationSta;
                 result.samplingSta = newStationEquipmentsMaintenance.samplingSta;
                 result.senserSta = newStationEquipmentsMaintenance.senserSta;
                 result.cleaningSta = newStationEquipmentsMaintenance.cleaningSta;
                 result.stableSta = newStationEquipmentsMaintenance.stableSta;
                 result.MaintenanceDate = newStationEquipmentsMaintenance.MaintenanceDate;
                 result.ReportDate = newStationEquipmentsMaintenance.ReportDate;
                 result.Maintenner = newStationEquipmentsMaintenance.Maintenner;
                 result.Reportor = newStationEquipmentsMaintenance.Reportor;
             }
             context.SaveChanges();
             return Json("OK", JsonRequestBehavior.AllowGet);
         }
     }
     catch
     {
         return Json("NO", JsonRequestBehavior.AllowGet);
     }
 }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:50,代码来源:EquipmentManagementController.cs

示例7: AjaxNetWorkMaintanceAdd

 public ActionResult AjaxNetWorkMaintanceAdd(string NetworkEquipmentCode, string Reportor, string ReportDate, string MaintenanceDescription, string Maintenner, string MaintenanceDate)
 {
     try
     {
         using (InfoManageDataContext context = new InfoManageDataContext())
         {
             NetWorkMaintance newStationEquipmentsMaintenance = new NetWorkMaintance();
             newStationEquipmentsMaintenance.NetworkEquipmentCode = NetworkEquipmentCode;
             newStationEquipmentsMaintenance.MaintenanceDescription = MaintenanceDescription;
             newStationEquipmentsMaintenance.Maintenner = Maintenner;
             newStationEquipmentsMaintenance.MaintenanceDate = DateTime.ParseExact(MaintenanceDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
             newStationEquipmentsMaintenance.Reportor = Reportor;
             newStationEquipmentsMaintenance.ReportDate = DateTime.ParseExact(ReportDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
             NetWorkMaintance result = context.NetWorkMaintances.Where(c => c.NetworkEquipmentCode.Equals(NetworkEquipmentCode) && c.MaintenanceDate.Equals(newStationEquipmentsMaintenance.MaintenanceDate)).FirstOrDefault();
             if (result == null)
                 context.NetWorkMaintances.Add(newStationEquipmentsMaintenance);
             else
             {
                 result.MaintenanceDescription = newStationEquipmentsMaintenance.MaintenanceDescription;
                 result.MaintenanceDate = newStationEquipmentsMaintenance.MaintenanceDate;
                 result.Maintenner = newStationEquipmentsMaintenance.Maintenner;
                 result.ReportDate = newStationEquipmentsMaintenance.ReportDate;
                 result.Reportor = newStationEquipmentsMaintenance.Reportor;
             }
             context.SaveChanges();
             return Json("OK", JsonRequestBehavior.AllowGet);
         }
     }
     catch
     {
         return Json("NO", JsonRequestBehavior.AllowGet);
     }
 }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:33,代码来源:EquipmentManagementController.cs

示例8: AjaxUploadExcel


//.........这里部分代码省略.........
                                        }
                                        EquipmentsStorage newequip = context.EquipmentsStorages.Where(c => c.SparePartsCode.Equals(station.SparePartsCode)).FirstOrDefault();
                                        if (newequip == null)
                                        {
                                            context.EquipmentsStorages.Add(station);
                                            colnum++;
                                        }
                                        //else
                                        //{
                                        //    newequip.SparePartsCode = row.ItemArray[0].ToString().Trim();
                                        //    newequip.SparePartsType = row.ItemArray[2].ToString().Trim();
                                        //    newequip.ApplicableModels = row.ItemArray[3].ToString().Trim();
                                        //    newequip.SparePartsManufacturer = row.ItemArray[4].ToString().Trim();
                                        //    newequip.Operator = row.ItemArray[5].ToString().Trim();
                                        //    //newequip.SparePartsBelongingStatus = stor.StoragesInfoID;
                                        //    newequip.TurnInDate = DateTime.ParseExact(row.ItemArray[7].ToString().Trim() + " 10:30", AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
                                        //    newequip.CheckDate = DateTime.ParseExact(row.ItemArray[8].ToString().Trim() + " 10:30", AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
                                        //    newequip.ElementID = ele.ElementID;
                                        //    if (ele.ElementID.Equals(12) && ele.isHelper.Equals(false))
                                        //    {
                                        //        newequip.VaildDate = newequip.CheckDate.AddYears(1);
                                        //    }
                                        //    if ((!ele.ElementID.Equals(12)) && ele.isHelper.Equals(false))
                                        //    {
                                        //        newequip.VaildDate = newequip.CheckDate.AddYears(2);
                                        //    }
                                        //    if (ele.isHelper.Equals(true))
                                        //    {
                                        //        newequip.VaildDate = DateTime.ParseExact(AllConsts.MAX_DATE_HOUR_MINUTE, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
                                        //    }
                                        //    newequip.LastModifier = AllConsts.adminName;
                                        //    newequip.LastModifyDate = DateTime.Now;
                                        //}
                                        context.SaveChanges();
                                        totalnum++;
                                    }
                                    //else
                                    //{
                                    //    int elcount = context.Elements.Count();
                                    //    Element neweles = new Element();
                                    //    neweles.ElementID = elcount + 1;
                                    //    neweles.ElementName = row.ItemArray[1].ToString().Trim();
                                    //    neweles.ElementENName = row.ItemArray[1].ToString().Trim(); ;
                                    //    neweles.isHelper = false;
                                    //    neweles.SparePartsName = row.ItemArray[1].ToString().Trim(); ;
                                    //    context.Elements.Add(neweles);
                                    //    context.SaveChanges();

                                    //    string tmpname = row.ItemArray[1].ToString().Trim();
                                    //    Element eletmp = context.Elements.Where(c => c.SparePartsName.Equals(tmpname)).FirstOrDefault();
                                    //    if (eletmp != null)
                                    //    {
                                    //        station.ElementID = eletmp.ElementID;
                                    //        if (station.ElementID.Equals(12) && eletmp.isHelper.Equals(false))
                                    //        {
                                    //            station.VaildDate = station.CheckDate.AddYears(1);
                                    //        }
                                    //        if ((!station.ElementID.Equals(12)) && eletmp.isHelper.Equals(false))
                                    //        {
                                    //            station.VaildDate = station.CheckDate.AddYears(2);
                                    //        }
                                    //        EquipmentsStorage newequip = context.EquipmentsStorages.Where(c => c.SparePartsCode.Equals(station.SparePartsCode)).FirstOrDefault();
                                    //        if (newequip != null)
                                    //        {
                                    //            newequip.SparePartsCode = row.ItemArray[0].ToString().Trim();
                                    //            newequip.SparePartsType = row.ItemArray[2].ToString().Trim();
开发者ID:MadIHI,项目名称:InfoManage,代码行数:67,代码来源:ManageAdminController.cs

示例9: addEquipmentCheckRain


//.........这里部分代码省略.........
                    if (equip != null)
                    {
                        EquipmentCheckRain newequipment = new EquipmentCheckRain();
                        newequipment.SparePartsCode = SparePartsCode;
                        newequipment.StationNum = StationNum;
                        newequipment.StandardEquipmentSparePartsCode = StandardEquipmentSparePartsCode;
                        newequipment.SparePartsBelongingStatus = equip.SparePartsBelongingStatus;
                        newequipment.EnvironmentalT = EnvironmentalT;
                        newequipment.EnvironmentalRH = EnvironmentalRH;
                        newequipment.EnvironmentalWS = EnvironmentalWS;
                        newequipment.AppearanceCheck = AppearanceCheck;
                        newequipment.Unit = Unit;
                        newequipment.Rainfall1 = Rainfall1;
                        newequipment.Rainfall1_Intensity1 = Rainfall1_Intensity1;
                        newequipment.Rainfall1_Intensity2 = Rainfall1_Intensity2;
                        newequipment.Rainfall1_Intensity1_Standard = Rainfall1_Intensity1_Standard;
                        newequipment.Rainfall1_Intensity2_Standard = Rainfall1_Intensity2_Standard;
                        newequipment.Rainfall1_Intensity1_Check1 = Rainfall1_Intensity1_Check1;
                        newequipment.Rainfall1_Intensity1_Check2 = Rainfall1_Intensity1_Check2;
                        newequipment.Rainfall1_Intensity1_Check3 = Rainfall1_Intensity1_Check3;
                        newequipment.Rainfall1_Intensity2_Check1 = Rainfall1_Intensity2_Check1;
                        newequipment.Rainfall1_Intensity2_Check2 = Rainfall1_Intensity2_Check2;
                        newequipment.Rainfall1_Intensity2_Check3 = Rainfall1_Intensity2_Check3;
                        newequipment.Rainfall1_Intensity1_Average = Rainfall1_Intensity1_Average;
                        newequipment.Rainfall1_Intensity2_Average = Rainfall1_Intensity2_Average;
                        newequipment.Rainfall1_Intensity1_IndicatingError = Rainfall1_Intensity1_IndicatingError;
                        newequipment.Rainfall1_Intensity2_IndicatingError = Rainfall1_Intensity2_IndicatingError;
                        newequipment.Rainfall1_Intensity1_AbsoluteError = Rainfall1_Intensity1_AbsoluteError;
                        newequipment.Rainfall1_Intensity2_AbsoluteError = Rainfall1_Intensity2_AbsoluteError;
                        newequipment.CheckAccordings = CheckAccordings;
                        newequipment.CheckedResult = CheckedResult;
                        newequipment.Checker = Checker;
                        newequipment.reChecker = reChecker;
                        newequipment.isPassed = isPassed;
                        newequipment.StartDate = DateTime.ParseExact(StartDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
                        newequipment.EndDate = DateTime.ParseExact(EndDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
                        newequipment.LastModifier = Checker;
                        newequipment.LastModifyDate = DateTime.Now;
                        if (Request.Cookies["User"] != null)
                        {
                            HttpCookie aCookie = Request.Cookies["User"];
                            newequipment.LastModifier = Server.UrlDecode(aCookie["RealName"]);
                        }
                        EquipmentCheckRain equipment = context.EquipmentCheckRains.Where(c => c.SparePartsCode.Equals(newequipment.SparePartsCode) && c.StartDate.Equals(newequipment.StartDate)).FirstOrDefault();
                        if (null == equipment)
                        {
                            context.EquipmentCheckRains.Add(newequipment);
                        }
                        else
                        {
                            equipment.EnvironmentalT = newequipment.EnvironmentalT;
                            equipment.EnvironmentalRH = newequipment.EnvironmentalRH;
                            equipment.EnvironmentalWS = newequipment.EnvironmentalWS;
                            equipment.AppearanceCheck = newequipment.AppearanceCheck;
                            equipment.Rainfall1 = newequipment.Rainfall1;
                            equipment.Rainfall1_Intensity1 = newequipment.Rainfall1_Intensity1;
                            equipment.Rainfall1_Intensity2 = newequipment.Rainfall1_Intensity2;
                            equipment.Rainfall1_Intensity1_Standard = newequipment.Rainfall1_Intensity1_Standard;
                            equipment.Rainfall1_Intensity2_Standard = newequipment.Rainfall1_Intensity2_Standard;
                            equipment.Rainfall1_Intensity1_Check1 = newequipment.Rainfall1_Intensity1_Check1;
                            equipment.Rainfall1_Intensity1_Check2 = newequipment.Rainfall1_Intensity1_Check2;
                            equipment.Rainfall1_Intensity1_Check3 = newequipment.Rainfall1_Intensity1_Check3;
                            equipment.Rainfall1_Intensity2_Check1 = newequipment.Rainfall1_Intensity2_Check1;
                            equipment.Rainfall1_Intensity2_Check2 = newequipment.Rainfall1_Intensity2_Check2;
                            equipment.Rainfall1_Intensity2_Check3 = newequipment.Rainfall1_Intensity2_Check3;
                            equipment.Rainfall1_Intensity1_Average = newequipment.Rainfall1_Intensity1_Average;
                            equipment.Rainfall1_Intensity2_Average = newequipment.Rainfall1_Intensity2_Average;
                            equipment.Rainfall1_Intensity1_IndicatingError = newequipment.Rainfall1_Intensity1_IndicatingError;
                            equipment.Rainfall1_Intensity2_IndicatingError = newequipment.Rainfall1_Intensity2_IndicatingError;
                            equipment.Rainfall1_Intensity1_AbsoluteError = newequipment.Rainfall1_Intensity1_AbsoluteError;
                            equipment.Rainfall1_Intensity2_AbsoluteError = newequipment.Rainfall1_Intensity2_AbsoluteError;
                            equipment.CheckedResult = newequipment.CheckedResult;
                            equipment.Checker = newequipment.Checker;
                            equipment.reChecker = newequipment.reChecker;
                            equipment.isPassed = newequipment.isPassed;
                            equipment.EndDate = newequipment.EndDate;
                            equipment.LastModifier = newequipment.LastModifier;
                            equipment.LastModifyDate = newequipment.LastModifyDate;
                        }

                        equip.CheckDate = newequipment.EndDate;
                        if (equip.ElementID.Equals(12))
                            equip.VaildDate = newequipment.EndDate.AddYears(1);
                        else
                            equip.VaildDate = newequipment.EndDate.AddYears(2);

                        context.SaveChanges();
                        return Json("OK", JsonRequestBehavior.AllowGet);
                    }
                    else
                    {
                        return Json("NO", JsonRequestBehavior.AllowGet);
                    }
                }
            }
            catch
            {
                return Json("NO", JsonRequestBehavior.AllowGet);
            }
        }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:101,代码来源:EquipmentStaticsController.cs

示例10: AjaxRemoveStandardEquipment

 public ActionResult AjaxRemoveStandardEquipment(string SparePartsCode)
 {
     using (InfoManageDataContext context = new InfoManageDataContext())
     {
         StandardEquipment quipment = context.StandardEquipments.Where(c => c.SparePartsCode.Equals(SparePartsCode)).FirstOrDefault();
         if (quipment != null)
         {
             context.StandardEquipments.Remove(quipment);
             context.SaveChanges();
             return Json("OK", JsonRequestBehavior.AllowGet);
         }
         return Json("NO", JsonRequestBehavior.AllowGet);
     }
 }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:14,代码来源:EquipmentStaticsController.cs

示例11: AjaxRemoveNetworkEquipmentList

 public ActionResult AjaxRemoveNetworkEquipmentList(string NetworkEquipmentCode)
 {
     using (InfoManageDataContext context = new InfoManageDataContext())
     {
         NetworkEquipment quipment = context.NetworkEquipments.Where(c => c.NetworkEquipmentCode.Equals(NetworkEquipmentCode)).FirstOrDefault();
         if (quipment != null)
         {
             context.NetworkEquipments.Remove(quipment);
             context.SaveChanges();
             return Json("OK", JsonRequestBehavior.AllowGet);
         }
         return Json("NO", JsonRequestBehavior.AllowGet);
     }
 }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:14,代码来源:EquipmentStaticsController.cs

示例12: AjaxDiscardOnlineEquipment

 public ActionResult AjaxDiscardOnlineEquipment(string SparePartsCode, string Operator, string DiscardDate, string DiscardResonance)
 {
     try
     {
         using (InfoManageDataContext context = new InfoManageDataContext())
         {
             StationEquipmentsOnline onlines = context.StationEquipmentsOnlines.Where(c => c.SparePartsCode.Equals(SparePartsCode)).FirstOrDefault();
             if (onlines != null)
             {
                 EquipmentsDiscardStorage newTurnInStorage = new EquipmentsDiscardStorage();
                 newTurnInStorage.SparePartsCode = SparePartsCode;
                 newTurnInStorage.DiscardResonance = DiscardResonance;
                 newTurnInStorage.DiscardDate = DateTime.ParseExact(DiscardDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
                 newTurnInStorage.Operator = Operator;
                 EquipmentsStorage equipment = context.EquipmentsStorages.Where(c => c.SparePartsCode.Equals(newTurnInStorage.SparePartsCode)).FirstOrDefault();
                 if (equipment != null)
                 {
                     equipment.SparePartsStatus = (int)AllConsts.SparePartsStatus.Discard;
                     context.EquipmentsDiscardStorages.Add(newTurnInStorage);
                     context.StationEquipmentsOnlines.Remove(onlines);
                 }
                 context.SaveChanges();
                 return Json("OK", JsonRequestBehavior.AllowGet);
             }
             return Json("NO", JsonRequestBehavior.AllowGet);
         }
     }
     catch
     {
         return Json("NO", JsonRequestBehavior.AllowGet);
     }
 }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:32,代码来源:EquipmentStaticsController.cs

示例13: AjaxDellEquipmentStorageCheckWS

 public ActionResult AjaxDellEquipmentStorageCheckWS(int EquipmentStorageCheckWSID)
 {
     try
     {
         using (InfoManageDataContext context = new InfoManageDataContext())
         {
             EquipmentStorageCheckWS equipmentcheck_ws = context.EquipmentStorageCheckWSes.Where(c => c.EquipmentStorageCheckWSID.Equals(EquipmentStorageCheckWSID)).FirstOrDefault();
             if (equipmentcheck_ws != null)
             {
                 context.EquipmentStorageCheckWSes.Remove(equipmentcheck_ws);
                 context.SaveChanges();
             }
             return Json("OK", JsonRequestBehavior.AllowGet);
         }
     }
     catch
     {
         return Json("NO", JsonRequestBehavior.AllowGet);
     }
 }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:20,代码来源:EquipmentStaticsController.cs

示例14: AjaxAddNewStation


//.........这里部分代码省略.........
        {
            try
            {
                if (Request.Cookies["User"] != null)
                {
                    HttpCookie aCookie = Request.Cookies["User"];
                    ViewBag.RealName = Server.UrlDecode(aCookie["RealName"]);
                    int id = Convert.ToInt32(Server.UrlDecode(aCookie["ID"]));

                    using (MemberShipDataContext context = new MemberShipDataContext())
                    {
                        UserProfile usr = context.UserProfiles.Find(id);
                        if (null != usr)
                        {
                            using (InfoManageDataContext InfoManageContext = new InfoManageDataContext())
                            {
                                Station newStation = new Station();
                                newStation.StationNum = StationNum.Trim();
                                newStation.StationBuildDate = DateTime.ParseExact(StationBuildDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
                                newStation.StationName = StationName;
                                newStation.StationAdrass = StationAdrass;
                                newStation.StoragesInfoID = StoragesInfoID;
                                newStation.transportManageType = transportManageType;
                                newStation.StationClass = StationClass;
                                newStation.StationLetterCode = StationLetterCode;
                                newStation.StationType = StationType;
                                newStation.StationManufacturer = StationManufacturer;
                                newStation.StationLongitude = StationLongitude;
                                newStation.StationLatitude = StationLatitude;
                                newStation.StationAltitude = StationAltitude;
                                newStation.ElementsNum = ElementsNum;
                                newStation.samplingMod = samplingMod;
                                newStation.windDirectorHigh = windDirectorHigh;
                                newStation.windSpeederHigh = windSpeederHigh;
                                newStation.SIM = SIM;
                                newStation.IP = IP;
                                newStation.powerSupplyMod = powerSupplyMod;
                                newStation.Operator = Operator;
                                newStation.LastModifier = newStation.Operator;
                                newStation.LastModifyDate = DateTime.Now;
                                if (newStation.powerSupplyMod == (int)AllConsts.powerSupplyMod.SolarEnergy)
                                    newStation.BatteryStartDate = DateTime.ParseExact(BatteryStartDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
                                else
                                    newStation.BatteryStartDate = DateTime.ParseExact(AllConsts.MAX_DATE_HOUR_MINUTE, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
                                if (newStation.SIM.Trim() != "")
                                    newStation.SIMRenewFeeDate = DateTime.ParseExact(SIMRenewFeeDate, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
                                else
                                    newStation.SIMRenewFeeDate = DateTime.ParseExact(AllConsts.MAX_DATE_HOUR_MINUTE, AllConsts.HOUR_MINUTE, System.Globalization.DateTimeFormatInfo.CurrentInfo);
                                Station oldstation = InfoManageContext.Stations.Where(c => c.StationNum.Equals(newStation.StationNum)).FirstOrDefault();
                                if (oldstation == null)
                                    InfoManageContext.Stations.Add(newStation);
                                else
                                {
                                    oldstation.StationBuildDate = newStation.StationBuildDate;
                                    oldstation.StationName = newStation.StationName;
                                    oldstation.StationAdrass = newStation.StationAdrass;
                                    oldstation.transportManageType = newStation.transportManageType;
                                    oldstation.StationClass = newStation.StationClass;
                                    oldstation.StationLetterCode = newStation.StationLetterCode;
                                    oldstation.StationType = newStation.StationType;
                                    oldstation.StationManufacturer = newStation.StationManufacturer;
                                    oldstation.StationLongitude = newStation.StationLongitude;
                                    oldstation.StationLatitude = newStation.StationLatitude;
                                    oldstation.StationAltitude = newStation.StationAltitude;
                                    oldstation.ElementsNum = newStation.ElementsNum;
                                    oldstation.samplingMod = newStation.samplingMod;
                                    oldstation.windDirectorHigh = newStation.windDirectorHigh;
                                    oldstation.windSpeederHigh = newStation.windSpeederHigh;
                                    oldstation.SIM = newStation.SIM;
                                    oldstation.IP = newStation.IP;
                                    oldstation.powerSupplyMod = newStation.powerSupplyMod;
                                    oldstation.Operator = newStation.Operator;
                                    oldstation.BatteryStartDate = newStation.BatteryStartDate;
                                    oldstation.SIMRenewFeeDate = newStation.SIMRenewFeeDate;
                                    oldstation.StoragesInfoID = StoragesInfoID;
                                    oldstation.LastModifier = oldstation.Operator;
                                    oldstation.LastModifyDate = DateTime.Now;
                                }

                                UserAction newaction = new UserAction();
                                newaction.ID = usr.ID;
                                newaction.RealName = usr.RealName;
                                newaction.ActionName = "AjaxSetTurnInStorageList";
                                newaction.CreateTime = DateTime.Now;
                                newaction.LastModifyTime = newaction.CreateTime;
                                InfoManageContext.UserActions.Add(newaction);

                                InfoManageContext.SaveChanges();
                                return Json("OK", JsonRequestBehavior.AllowGet);
                            }
                        }
                    }
                }
                return Json("NO", JsonRequestBehavior.AllowGet);
            }
            catch
            {
                return Json("NO", JsonRequestBehavior.AllowGet);
            }
        }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:101,代码来源:EquipmentStaticsController.cs

示例15: AjaxDellCheckRain

 public ActionResult AjaxDellCheckRain(int EquipmentCheckRainID)
 {
     try
     {
         using (InfoManageDataContext context = new InfoManageDataContext())
         {
             OtherIndustriesStationCheckRain equipmentcheck_ws = context.OtherIndustriesStationCheckRains.Where(c => c.EquipmentCheckRainID.Equals(EquipmentCheckRainID)).FirstOrDefault();
             if (equipmentcheck_ws != null)
             {
                 context.OtherIndustriesStationCheckRains.Remove(equipmentcheck_ws);
                 context.SaveChanges();
             }
             return Json("OK", JsonRequestBehavior.AllowGet);
         }
     }
     catch
     {
         return Json("NO", JsonRequestBehavior.AllowGet);
     }
 }
开发者ID:MadIHI,项目名称:InfoManage,代码行数:20,代码来源:OtherIndustriesController.cs


注:本文中的InfoManage.DataModels.InfoManageDataContext.SaveChanges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。