Пример #1
0
 /// <summary>
 /// 添加/编辑自定义表单
 /// </summary>
 /// <param name="Model"></param>
 /// <returns></returns>
 public int EditFormInfo(FormInfoEdit Model)
 {
     MySqlConnection conn = DbMySqlConnectionWrite();
     int iBack = 0;
     try
     {
         using (conn)
         {
              if (string.IsNullOrEmpty(Model.ID))
             {
            
                 string strGUID = Guid.NewGuid().ToString();
                 iBack = conn.Insert("FormInfo")
                 .Field("PK_Form", DbType.AnsiString, strGUID)
                 .Field("PK_Group", DbType.AnsiString, Model.GroupID)
                 .Field("Name", DbType.AnsiString, Model.Name)
                 .Field("ControlSort", DbType.AnsiString, Model.ControlSort)
                 .Field("ControlJson", DbType.AnsiString, Model.ControlJson)
                 .Field("Remark", DbType.AnsiString, Model.Remark)
                 .Field("T_Deleted", DbType.Int32, 0)
                 .Field("T_Creater", DbType.AnsiString, Model.OperatorID)
                 .Field("T_CreaterName", DbType.AnsiString, Model.OperatorName)
                 .Field("T_CreateTime", DbType.DateTime, Model.OperateTime)
                 .Field("T_Updater", DbType.AnsiString, Model.OperatorID)
                 .Field("T_UpdaterName", DbType.AnsiString, Model.OperatorName)
                 .Field("T_UpdateTime", DbType.DateTime, Model.OperateTime)
                 .Execute();
             }
             else
             {
                 iBack = conn.Update("FormInfo")
                     .Set("Name", DbType.AnsiString, Model.Name)
                     .Set("ControlSort", DbType.AnsiString, Model.ControlSort)
                     .Set("ControlJson", DbType.AnsiString, Model.ControlJson)
                     .Set("Remark", DbType.AnsiString, Model.Remark)
                     .Set("T_Deleted", DbType.Int32, 0)
                     .Set("T_Updater", DbType.AnsiString, Model.OperatorID)
                     .Set("T_UpdaterName", DbType.AnsiString, Model.OperatorName)
                     .Set("T_UpdateTime", DbType.DateTime, Model.OperateTime)
                     .Where(WhereMySQL.Equal("PK_Form", DbType.AnsiString, Model.ID))
                     .Execute();
             }
         }
         return iBack;
     }
     catch
     {
         return 0;
     }
 }
Пример #2
0
 public DataResult EditFormInfo(FormInfoEdit Model)
 {
     //BForm bWorkOrder = new BForm();
     ///操作员信息获取、测试阶段改信息来自常量的引用中。
     ///当后台能获取操作员信息后,需取消using OTG.OA.Framework.Const的引用。
     UserInfo mUser = BusinessConst.GetDefault();
     Model.GroupID = mUser.GroupID;
     Model.OperatorID = mUser.ID;
     Model.OperatorName = mUser.Name;
     Model.OperateTime = DateTime.Now;
     int iBack = formService.EditFormInfo(Model);
     if (iBack == 1)
     {
         dataResult.Code = ResponseStatusCode.Success;
         dataResult.Msg = "操作成功!";
     }
     else
     {
         dataResult.Code = ResponseStatusCode.Error;
         dataResult.Msg = "操作失败!";
     }
     return dataResult;
 }