Esempio n. 1
0
 public ActionResult Edit(SyscodeInfo syscodeInfo)
 {
     if (syscodeInfo.CodeID == 0)
     {
         return Insert(syscodeInfo);
     }
     else
     {
         return Update(syscodeInfo);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 设置SQL参数表
 /// </summary>
 /// <param name="Syscode">Syscode对象</param>
 /// <returns>Syscode参数数组</returns>
 private SqlParameter[] Set_Syscode_Parameters(SyscodeInfo syscodeInfo)
 {
     SqlParameter[] paramArray = new SqlParameter[] {new SqlParameter("@CodeID",syscodeInfo.CodeID),
                                                         new SqlParameter("@GroupID",syscodeInfo.GroupID),
                                                         new SqlParameter("@CodeName",syscodeInfo.CodeName),
                                                         new SqlParameter("@SeqNo",syscodeInfo.SeqNo),
                                                         new SqlParameter("@IsActive",string.IsNullOrEmpty(syscodeInfo.IsActive)?"":syscodeInfo.IsActive),
                                                         new SqlParameter("@CreatedBy",string.IsNullOrEmpty(syscodeInfo.CreatedBy)?"":syscodeInfo.CreatedBy),
                                                         new SqlParameter("@UpdatedBy",string.IsNullOrEmpty(syscodeInfo.UpdatedBy)?"":syscodeInfo.UpdatedBy)
                                                     };
     return paramArray;
 }
Esempio n. 3
0
 /// <summary>
 /// 初始化SyscodeInfo
 /// </summary>
 private SyscodeInfo InitSyscodeInfoByDataReader(SyscodeInfo syscodeInfo, IDataReader reader)
 {
     syscodeInfo = new SyscodeInfo(reader["CodeID"].ToString() != "" ? Int32.Parse(reader["CodeID"].ToString()) : 0,
     reader["GroupID"].ToString(),
     reader["CodeName"].ToString(),
     reader["SeqNo"].ToString() != "" ? Int32.Parse(reader["SeqNo"].ToString()) : 0,
     reader["IsActive"].ToString(),
     reader["CreatedBy"].ToString(),
     reader["CreatedDate"].ToString() != "" ? DateTime.Parse(reader["CreatedDate"].ToString()) : new DateTime(),
     reader["UpdatedBy"].ToString(),
     reader["UpdatedDate"].ToString() != "" ? DateTime.Parse(reader["UpdatedDate"].ToString()) : new DateTime());
     return syscodeInfo;
 }
Esempio n. 4
0
 /// <summary>
 /// 更新一条Syscode记录
 /// </summary>
 /// <param name="db">DataBase对象</param>
 /// <param name="tran">一个有效的DbTransaction</param>
 /// <param name="syscode">Syscode对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateSyscode(Database db, DbTransaction tran, SyscodeInfo syscodeInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Syscode_Parameters(syscodeInfo);
     if (paras != null)
     {
         result += DBHelper.ExecuteNonQuery(db, tran, CommandType.Text, SQL_UPDATE_SYSCODE, paras);
     }
     return result;
 }
Esempio n. 5
0
 /// <summary>
 /// 新增一条Syscode记录
 /// </summary>
 /// <param name="syscode">Syscode对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertSyscode(SyscodeInfo syscodeInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Syscode_Parameters(syscodeInfo);
     if (paras != null)
     {
         result = DBHelper.ExecuteNonQuery(CommandType.Text, SQL_INSERT_SYSCODE, paras);
     }
     return result;
 }
Esempio n. 6
0
 /// <summary>
 /// 更新一条Syscode记录
 /// </summary>
 /// <param name="syscode">Syscode对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateSyscode(SyscodeInfo syscodeInfo)
 {
     return syscodeDA.UpdateSyscode(syscodeInfo);
 }
Esempio n. 7
0
 /// <summary>
 /// 新增一条Syscode记录
 /// </summary>
 /// <param name="syscode">Syscode对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertSyscode(SyscodeInfo syscodeInfo)
 {
     return syscodeDA.InsertSyscode(syscodeInfo);
 }
Esempio n. 8
0
 public ActionResult Insert(SyscodeInfo syscodeInfo)
 {
     try
     {
         syscodeInfo.CreatedDate = DateTime.Now;
         syscodeInfo.UpdatedDate = DateTime.Now;
         syscodeInfo.CreatedBy = CurrentUserInfo.UserCode;
         syscodeInfo.UpdatedBy = CurrentUserInfo.UserCode;
         ISyscodeService syscodeService = UnityHelper.UnityResolve<ISyscodeService>();
         var data = syscodeService.InsertSyscode(syscodeInfo);
         LogHelper.LogOperation(CurrentUserInfo.UserCode, string.Format("Insert SyscodeInfo {0},{1}", LogHelper.ChangeEntityToLog(syscodeInfo), data));
         if (data > 0)
         {
             return Content("OK");
         }
         else
         {
             return Content("Failed");
         }
     }
     catch (BusinessException bex)
     {
         return Content(bex.Message);
     }
     catch (Exception ex)
     {
         LogHelper.LogError(ex, "");
         return Content(ex.Message);
     }
 }