예제 #1
0
 public ActionResult Edit(UserroleInfo userroleInfo)
 {
     if (userroleInfo.Indx == 0)
     {
         return Insert(userroleInfo);
     }
     else
     {
         return Update(userroleInfo);
     }
 }
예제 #2
0
파일: UserroleDA.cs 프로젝트: jerryxi/GXP
 /// <summary>
 /// 设置SQL参数表
 /// </summary>
 /// <param name="Userrole">Userrole对象</param>
 /// <returns>Userrole参数数组</returns>
 private SqlParameter[] Set_Userrole_Parameters(UserroleInfo userroleInfo)
 {
     SqlParameter[] paramArray = new SqlParameter[] {new SqlParameter("@Indx",userroleInfo.Indx),
                                                         new SqlParameter("@UserID",userroleInfo.UserID),
                                                         new SqlParameter("@RoleID",userroleInfo.RoleID),
                                                         new SqlParameter("@CreatedBy",string.IsNullOrEmpty(userroleInfo.CreatedBy)?"":userroleInfo.CreatedBy)
                                                     };
     return paramArray;
 }
예제 #3
0
파일: UserroleDA.cs 프로젝트: jerryxi/GXP
 /// <summary>
 /// 初始化UserroleInfo
 /// </summary>
 private UserroleInfo InitUserroleInfoByDataReader(UserroleInfo userroleInfo, IDataReader reader)
 {
     userroleInfo = new UserroleInfo(reader["Indx"].ToString() != "" ? Int32.Parse(reader["Indx"].ToString()) : 0,
     reader["UserID"].ToString() != "" ? Int32.Parse(reader["UserID"].ToString()) : 0,
     reader["RoleID"].ToString() != "" ? Int32.Parse(reader["RoleID"].ToString()) : 0,
     reader["CreatedBy"].ToString(),
     reader["CreatedDate"].ToString() != "" ? DateTime.Parse(reader["CreatedDate"].ToString()) : new DateTime());
     return userroleInfo;
 }
예제 #4
0
파일: UserroleDA.cs 프로젝트: jerryxi/GXP
 /// <summary>
 /// 更新一条Userrole记录
 /// </summary>
 /// <param name="db">DataBase对象</param>
 /// <param name="tran">一个有效的DbTransaction</param>
 /// <param name="userrole">Userrole对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateUserrole(Database db, DbTransaction tran, UserroleInfo userroleInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Userrole_Parameters(userroleInfo);
     if (paras != null)
     {
         result += DBHelper.ExecuteNonQuery(db, tran, CommandType.Text, SQL_UPDATE_USERROLE, paras);
     }
     return result;
 }
예제 #5
0
파일: UserroleDA.cs 프로젝트: jerryxi/GXP
 /// <summary>
 /// 新增一条Userrole记录
 /// </summary>
 /// <param name="userrole">Userrole对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertUserrole(UserroleInfo userroleInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Userrole_Parameters(userroleInfo);
     if (paras != null)
     {
         result = DBHelper.ExecuteNonQuery(CommandType.Text, SQL_INSERT_USERROLE, paras);
     }
     return result;
 }
예제 #6
0
 /// <summary>
 /// 更新一条Userrole记录
 /// </summary>
 /// <param name="userrole">Userrole对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateUserrole(UserroleInfo userroleInfo)
 {
     return userroleDA.UpdateUserrole(userroleInfo);
 }
예제 #7
0
 /// <summary>
 /// 新增一条Userrole记录
 /// </summary>
 /// <param name="userrole">Userrole对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertUserrole(UserroleInfo userroleInfo)
 {
     return userroleDA.InsertUserrole(userroleInfo);
 }
예제 #8
0
 public ActionResult Insert(UserroleInfo userroleInfo)
 {
     try
     {
         userroleInfo.CreatedDate = DateTime.Now;
         //userroleInfo.UpdatedDate = DateTime.Now;
         userroleInfo.CreatedBy = CurrentUserInfo.UserCode;
         //userroleInfo.UpdatedBy = CurrentUserInfo.UserCode;
         IUserroleService userroleService = UnityHelper.UnityResolve<IUserroleService>();
         var data = userroleService.InsertUserrole(userroleInfo);
         LogHelper.LogOperation(CurrentUserInfo.UserCode, string.Format("Insert UserroleInfo {0},{1}", LogHelper.ChangeEntityToLog(userroleInfo), 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);
     }
 }