Esempio n. 1
0
 /// <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);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 用于向 SysFunction EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToSysFunction(SysFunction sysFunction)
 {
     base.AddObject("SysFunction", sysFunction);
 }
Esempio n. 3
0
 /// <summary>
 /// 创建新的 SysFunction 对象。
 /// </summary>
 /// <param name="code">Code 属性的初始值。</param>
 /// <param name="name">Name 属性的初始值。</param>
 /// <param name="parentCode">ParentCode 属性的初始值。</param>
 /// <param name="orderID">OrderID 属性的初始值。</param>
 /// <param name="valid">Valid 属性的初始值。</param>
 public static SysFunction CreateSysFunction(global::System.String code, global::System.String name, global::System.String parentCode, global::System.Int32 orderID, global::System.Boolean valid)
 {
     SysFunction sysFunction = new SysFunction();
     sysFunction.Code = code;
     sysFunction.Name = name;
     sysFunction.ParentCode = parentCode;
     sysFunction.OrderID = orderID;
     sysFunction.Valid = valid;
     return sysFunction;
 }
Esempio n. 4
0
 public void UpdateFunction(SysFunction function)
 {
     SysFunctionAdapter.Update(function);
 }
Esempio n. 5
0
 public void InsertFunction(SysFunction function)
 {
     SysFunctionAdapter.Insert(function);
 }
Esempio n. 6
0
        /// <summary>
        /// 修改菜单
        /// </summary>
        public static void Update(SysFunction function)
        {
            try
            {
                LDLLogisticsEntities context = new LDLLogisticsEntities();
                //查找该用户是否存在
                SysFunction _function = context.SysFunction.FirstOrDefault(obj => obj.Code == function.Code);
                if (_function == null)
                    throw new FaultException(string.Format("菜单[{0}]不存在!", function.Name));
                EntityObjectHelper.Copyto(function, ref _function); //利用反射动态赋值

                context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("SysFunctionAdapter03", Define.Update, _function));   //记录日志
                context.SaveChanges();  //提交保存
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.Message);
            }
        }