/// <summary>
        /// 添加按钮
        /// </summary>
        /// <param name="moduleButtonEntity">按钮实体</param>
        public void AddEntity(ModuleButtonEntity moduleButtonEntity)
        {
            moduleButtonEntity.Create();
            Base_ModuleButton modelButton = new Base_ModuleButton();

            modelButton = EntityConvertTools.CopyToModel <ModuleButtonEntity, Base_ModuleButton>(moduleButtonEntity, null);
            modelButton.Insert();
        }
Beispiel #2
0
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="moduleEntity">功能实体</param>
 /// <param name="moduleButtonList">按钮实体列表</param>
 /// <param name="moduleColumnList">视图实体列表</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, ModuleEntity moduleEntity, List <ModuleButtonEntity> moduleButtonList, List <ModuleColumnEntity> moduleColumnList)
 {
     try
     {
         using (var tran = QSDMS_SQLDB.GetInstance().GetTransaction())
         {
             if (!string.IsNullOrEmpty(keyValue))
             {
                 moduleEntity.Modify(keyValue);
                 Base_Module moudle = Base_Module.SingleOrDefault("where ModuleId=@0", keyValue);
                 //if (moduleEntity.UrlAddress == null)
                 //{
                 //    moduleEntity.UrlAddress = "";
                 //}
                 moudle          = EntityConvertTools.CopyToModel <ModuleEntity, Base_Module>(moduleEntity, moudle);
                 moudle.ModuleId = keyValue;
                 moudle.Update();
             }
             else
             {
                 moduleEntity.Create();
                 Base_Module moudle = new Base_Module();
                 moudle = EntityConvertTools.CopyToModel <ModuleEntity, Base_Module>(moduleEntity, null);
                 moudle.Insert();
             }
             //删除操作按钮
             Base_ModuleButton.Delete("where ModuleId=@0", keyValue);
             if (moduleButtonList != null)
             {
                 foreach (ModuleButtonEntity buttonItem in moduleButtonList)
                 {
                     Base_ModuleButton modulebutton = new Base_ModuleButton();
                     modulebutton = EntityConvertTools.CopyToModel <ModuleButtonEntity, Base_ModuleButton>(buttonItem, null);
                     modulebutton.Insert();
                 }
             }
             //删除字段
             Base_ModuleColumn.Delete("where ModuleId=@0", keyValue);
             if (moduleColumnList != null)
             {
                 foreach (ModuleColumnEntity columnItem in moduleColumnList)
                 {
                     Base_ModuleColumn modulecolumn = new Base_ModuleColumn();
                     modulecolumn = EntityConvertTools.CopyToModel <ModuleColumnEntity, Base_ModuleColumn>(columnItem, null);
                     modulecolumn.Insert();
                 }
             }
             tran.Complete();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }