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


C# LDLLogisticsEntities.SaveChanges方法代码示例

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


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

示例1: DeleteQuoteMain

 /// <summary>
 /// 删除报价
 /// </summary>
 public static void DeleteQuoteMain(string guid)
 {
     try
     {
         LDLLogisticsEntities context = new LDLLogisticsEntities();
         //查找该站点是否存在
         QuoteMain quoteMain = context.QuoteMain.FirstOrDefault(obj => obj.Guid == guid);
         if (quoteMain == null)
             throw new FaultException(string.Format("报价不存在!"));
         quoteMain.Valid = false;
         //context.QuoteMain.DeleteObject(quoteMain); //删除
         //删除报价关系表
         //IQueryable<QuoteMainRelation> queryQuoteMainRelation = context.QuoteMainRelation.Where(obj => obj.SrcID == quoteMain.Guid);
         //foreach (QuoteMainRelation obj in queryQuoteMainRelation)
         //    context.QuoteMainRelation.DeleteObject(obj);
         //删除报价公式表
         //IQueryable<QuoteExpression> queryQuoteExpression = context.QuoteExpression.Where(obj => obj.SrcID == quoteMain.Guid);
         //foreach (QuoteExpression obj in queryQuoteExpression)
         //    context.QuoteExpression.DeleteObject(obj);
         context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("QuoteMainAdapter02", Define.Delete, quoteMain));   //记录日志
         context.SaveChanges();  //提交保存
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
开发者ID:hjqcan,项目名称:LDL,代码行数:30,代码来源:QuoteMainAdapter.cs

示例2: Delete

 /// <summary>
 /// 删除员工
 /// </summary>
 public static void Delete(CoEmployee employee, bool delUser)
 {
     try
     {
         LDLLogisticsEntities context = new LDLLogisticsEntities();
         //查找该员工是否存在
         CoEmployee _employee = context.CoEmployee.FirstOrDefault(obj => obj.ID == employee.ID);
         if (_employee == null)
             throw new FaultException(string.Format("该员工[{0}]不存在!", employee.Name));
         EntityObjectHelper.Copyto(employee, ref _employee); //利用反射动态赋值
         if (delUser)
         {
             SysUser user = context.SysUser.FirstOrDefault(obj => obj.EmployeeID == employee.ID);
             if (user != null)
                 context.SysUser.DeleteObject(user);
             context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("CoEmployeeAdapter04", Define.Delete, user));   //记录日志
         }
         context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("CoEmployeeAdapter05", Define.Delete, employee));   //记录日志
         context.SaveChanges();  //提交保存
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
开发者ID:haiming929,项目名称:LDL,代码行数:28,代码来源:CoEmployeeAdapter.cs

示例3: DeleteStockWaybillProvide

        /// <summary>
        /// 运单发放删除
        /// </summary>
        public static void DeleteStockWaybillProvide(int id)
        {
            try
            {
                LDLLogisticsEntities context = new LDLLogisticsEntities();
                StockWaybillProvide objProvide = context.StockWaybillProvide.FirstOrDefault(obj => obj.ID == id && obj.Valid == true);
                if (objProvide == null)
                    throw new Exception("运单发放记录不存在");
                //StockWaybill State 0:已报损报废 1:已使用 2:未使用 3:审核中
                long startCode = long.Parse(objProvide.StartCode);
                long endCode = long.Parse(objProvide.EndCode);
                for (long i = startCode; i <= endCode; i++)
                {
                    string currentCode = i.ToString();
                    StockWaybill objWaybill = context.StockWaybill.FirstOrDefault(obj => obj.OwnerSite == objProvide.DestSite && obj.Code == currentCode);
                    if (objWaybill == null)
                        throw new Exception(string.Format("运单号[{0}]不存在", currentCode));
                    objWaybill.OwnerSite = objProvide.SrcSite;
                    objWaybill.Type = "库存";
                    objWaybill.State = "2";
                }

                //设置物料发放记录无效
                objProvide.Valid = false;
                context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("StockWaybillAdapter04", Define.Delete, objProvide));   //记录日志
                context.SaveChanges();  //提交保存
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.Message);
            }
        }
开发者ID:hjqcan,项目名称:LDL,代码行数:35,代码来源:StockWaybillAdapter.cs

示例4: DeleteStockGoodsRegister

        /// <summary>
        /// 删除入库登记
        /// </summary>
        public static void DeleteStockGoodsRegister(int id)
        {
            try
            {
                LDLLogisticsEntities context = new LDLLogisticsEntities();
                StockGoodsRegister objRegister = context.StockGoodsRegister.FirstOrDefault(obj => obj.ID == id && obj.Valid == true);
                if (objRegister == null)
                    throw new Exception("该入库登记记录不存在");

                StockGoods objGoods = context.StockGoods.FirstOrDefault(obj => obj.OwnerSite == objRegister.OwnerSite && obj.Goods == objRegister.Goods);
                if (objGoods == null)
                    throw new Exception("库存记录不存在");
                if (objRegister.ActionType == "入库")
                {
                    if (objGoods.Number < objRegister.Number)
                        throw new Exception(string.Format("库存数量({0})低于入库登记的数量({1})", objGoods.Number, objRegister.Number));
                    objGoods.Number -= objRegister.Number;
                }
                else
                {
                    objGoods.Number += objRegister.Number;
                }
                //设置入库登记记录无效
                objRegister.Valid = false;

                context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("StockGoodsAdapter02", Define.Delete, objRegister));   //记录日志
                context.SaveChanges();  //提交保存
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.Message);
            }
        }
开发者ID:hjqcan,项目名称:LDL,代码行数:36,代码来源:StockGoodsAdapter.cs

示例5: DeleteStockWaybillRegister

        /// <summary>
        /// 删除入库登记
        /// </summary>
        public static void DeleteStockWaybillRegister(int id)
        {
            try
            {
                LDLLogisticsEntities context = new LDLLogisticsEntities();
                StockWaybillRegister objRegister = context.StockWaybillRegister.FirstOrDefault(obj => obj.ID == id && obj.Valid == true);
                if (objRegister == null)
                    throw new Exception("该入库登记记录不存在");
                //StockWaybill State 0:已报损报废 1:已使用 2:未使用 3:审核中
                long startCode = long.Parse(objRegister.StartCode);
                long endCode = long.Parse(objRegister.EndCode);
                for (long i = startCode; i <= endCode; i++)
                {
                    string currentCode = i.ToString();
                    StockWaybill objWaybill = context.StockWaybill.FirstOrDefault(obj => obj.Code == currentCode);
                    if (objWaybill == null)
                        throw new Exception(string.Format("运单号[{0}]不存在", currentCode));
                    else if (objWaybill.Type == "发放")
                        throw new Exception(string.Format("运单号[{0}]已发放", currentCode));
                    else if (objWaybill.OwnerSite != objWaybill.OwnerSite)
                        throw new Exception(string.Format("运单号[{0}]不属于该站点", currentCode));
                    context.StockWaybill.DeleteObject(objWaybill);
                }

                //设置入库登记记录无效
                objRegister.Valid = false;

                context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("StockWaybillAdapter02", Define.Delete, objRegister));   //记录日志
                context.SaveChanges();  //提交保存
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.Message);
            }
        }
开发者ID:hjqcan,项目名称:LDL,代码行数:38,代码来源:StockWaybillAdapter.cs

示例6: Insert

 /// <summary>
 /// 新增客户
 /// </summary>
 public static void Insert(CoCustomers customers)
 {
     try
     {
         LDLLogisticsEntities context = new LDLLogisticsEntities();
         //查找该客户是否存在
         if (context.CoCustomers.Any(obj => obj.Code.Trim().ToLower() == customers.Code.Trim().ToLower() && obj.Valid == true))
             throw new FaultException(string.Format("客户编码[{0}]已存在!", customers.Code));
         context.CoCustomers.AddObject(customers);    //新增
         context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("CoCustomersAdapter01", Define.Insert, customers));   //记录日志
         context.SaveChanges();  //提交保存
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
开发者ID:hjqcan,项目名称:LDL,代码行数:20,代码来源:CoCustomersAdapter.cs

示例7: Insert

 /// <summary>
 /// 新增角色
 /// </summary>
 public static void Insert(SysRole role)
 {
     try
     {
         LDLLogisticsEntities context = new LDLLogisticsEntities();
         //查找该角色是否存在
         if (context.SysRole.FirstOrDefault(obj => obj.RoleCode.ToLower().Trim() == role.RoleCode.ToLower().Trim()) != null)
             throw new FaultException(string.Format("角色编码[{0}]已存在!", role.RoleCode));
         context.SysRole.AddObject(role);    //新增
         context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("SysRoleAdapter01", Define.Insert, role));   //记录日志
         context.SaveChanges();  //提交保存
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
开发者ID:haiming929,项目名称:LDL,代码行数:20,代码来源:SysRoleAdapter.cs

示例8: Insert

 /// <summary>
 /// 新增菜单
 /// </summary>
 public static void Insert(SysFunction function)
 {
     try
     {
         LDLLogisticsEntities context = new LDLLogisticsEntities();
         //查找该菜单是否存在
         if (context.SysFunction.FirstOrDefault(obj => obj.Code == function.Code) != null)
             throw new FaultException(string.Format("菜单编码[{0}]已存在!", function.Code));
         context.SysFunction.AddObject(function);    //新增
         context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("SysFunctionAdapter01", Define.Insert, function));   //记录日志
         context.SaveChanges();  //提交保存
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
开发者ID:haiming929,项目名称:LDL,代码行数:20,代码来源:SysFunctionAdapter.cs

示例9: Insert

 /// <summary>
 /// 新增司机
 /// </summary>
 public static void Insert(CoDriver driver)
 {
     try
     {
         LDLLogisticsEntities context = new LDLLogisticsEntities();
         //查找该司机是否存在
         if (context.CoDriver.Any(obj => obj.Code == driver.Code && obj.Valid == true) )
             throw new FaultException(string.Format("司机编码[{0}]已存在!", driver.Code));
         context.CoDriver.AddObject(driver);    //新增
         context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("CoDriverAdapter01", Define.Insert, driver));   //记录日志
         context.SaveChanges();  //提交保存
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
开发者ID:hjqcan,项目名称:LDL,代码行数:20,代码来源:CoDriverAdapter.cs

示例10: Insert

 /// <summary>
 /// 新增员工
 /// </summary>
 public static void Insert(CoEmployee employee)
 {
     try
     {
         LDLLogisticsEntities context = new LDLLogisticsEntities();
         //查找该员工是否存在
         if (context.CoEmployee.FirstOrDefault(obj => obj.Code.Trim().ToLower() == employee.Code.Trim().ToLower() && obj.Valid == true) != null)
             throw new FaultException(string.Format("员工编号[{0}]已存在!", employee.Code));
         context.CoEmployee.AddObject(employee);    //新增
         context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("CoEmployeeAdapter01", Define.Insert, employee));   //记录日志
         context.SaveChanges();  //提交保存
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
开发者ID:haiming929,项目名称:LDL,代码行数:20,代码来源:CoEmployeeAdapter.cs

示例11: Delete

 /// <summary>
 /// 删除客户
 /// </summary>
 public static void Delete(int id)
 {
     try
     {
         LDLLogisticsEntities context = new LDLLogisticsEntities();
         //查找该客户是否存在
         CoCustomers customers = context.CoCustomers.FirstOrDefault(obj => obj.ID == id);
         if (customers == null)
             throw new FaultException(string.Format("客户不存在!"));
         context.CoCustomers.DeleteObject(customers); //删除
         context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("CoCustomersAdapter02", Define.Delete, customers));   //记录日志
         context.SaveChanges();  //提交保存
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
开发者ID:hjqcan,项目名称:LDL,代码行数:21,代码来源:CoCustomersAdapter.cs

示例12: Delete

 /// <summary>
 /// 删除菜单
 /// </summary>
 /// <param name="userName"></param>
 public static void Delete(string code)
 {
     try
     {
         LDLLogisticsEntities context = new LDLLogisticsEntities();
         //查找该用户是否存在
         SysFunction function = context.SysFunction.FirstOrDefault(obj => obj.Code == code);
         if (function == null)
             throw new FaultException(string.Format("菜单[{0}]不存在!", code));
         context.SysFunction.DeleteObject(function); //删除
         context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("SysFunctionAdapter02", Define.Delete, function));   //记录日志
         context.SaveChanges();  //提交保存
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
开发者ID:haiming929,项目名称:LDL,代码行数:22,代码来源:SysFunctionAdapter.cs

示例13: Delete

 /// <summary>
 /// 删除司机
 /// </summary>
 public static void Delete(int id)
 {
     try
     {
         LDLLogisticsEntities context = new LDLLogisticsEntities();
         //查找该司机是否存在
         CoDriver driver = context.CoDriver.FirstOrDefault(obj => obj.ID == id);
         if (driver == null)
             throw new FaultException(string.Format("司机不存在!"));
         context.CoDriver.DeleteObject(driver); //删除
         context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("CoDriverAdapter02", Define.Delete, driver));   //记录日志
         context.SaveChanges();  //提交保存
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message);
     }
 }
开发者ID:hjqcan,项目名称:LDL,代码行数:21,代码来源:CoDriverAdapter.cs

示例14: Update

        /// <summary>
        /// 修改客户
        /// </summary>
        public static void Update(CoCustomers customers)
        {
            try
            {
                LDLLogisticsEntities context = new LDLLogisticsEntities();
                //查找该客户是否存在
                CoCustomers _customers = context.CoCustomers.FirstOrDefault(obj => obj.ID == customers.ID);
                if (_customers == null)
                    throw new FaultException(string.Format("该客户[{0}]不存在!", customers.Name));
                EntityObjectHelper.Copyto(customers, ref _customers); //利用反射动态赋值

                context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("CoCustomersAdapter03", Define.Update, _customers));   //记录日志
                context.SaveChanges();  //提交保存
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.Message);
            }
        }
开发者ID:hjqcan,项目名称:LDL,代码行数:22,代码来源:CoCustomersAdapter.cs

示例15: Delete

        /// <summary>
        /// 删除站点
        /// </summary>
        public static void Delete(string id)
        {
            try
            {
                LDLLogisticsEntities context = new LDLLogisticsEntities();
                //查找该站点是否存在
                CoSite site = context.CoSite.FirstOrDefault(obj => obj.ID == id);
                if (site == null)
                    throw new FaultException(string.Format("站点不存在!"));

                context.CoSite.DeleteObject(site);
                context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("CoSiteAdapter02", Define.Delete, site));   //记录日志
                context.SaveChanges();  //提交保存
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.Message);
            }
        }
开发者ID:haiming929,项目名称:LDL,代码行数:22,代码来源:CoSiteAdapter.cs


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