Пример #1
0
 public int InsertRolefunction(int roleID, string functionID)
 {
     int result = 0;
     string[] functionIDs = functionID.Split(new char[] { ',' });
     rolefunctionDA.DeleteRoleFunctionByRoleID(roleID);
     for (int i = 0; i < functionIDs.Length; i++)
     {
         RolefunctionInfo rf = new RolefunctionInfo();
         rf.RoleID = roleID;
         rf.FunctionID = Int32.Parse(functionIDs[i]);
         rf.CreatedBy = "admin";
         rf.CreatedDate = DateTime.Now;
         result += rolefunctionDA.InsertRolefunction(rf);
     }
     return result;
 }
Пример #2
0
 /// <summary>
 /// 更新一条Rolefunction记录
 /// </summary>
 /// <param name="rolefunction">Rolefunction对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateRolefunction(RolefunctionInfo rolefunctionInfo)
 {
     return rolefunctionDA.UpdateRolefunction(rolefunctionInfo);
 }
Пример #3
0
 /// <summary>
 /// 设置SQL参数表
 /// </summary>
 /// <param name="Rolefunction">Rolefunction对象</param>
 /// <returns>Rolefunction参数数组</returns>
 private SqlParameter[] Set_Rolefunction_Parameters(RolefunctionInfo rolefunctionInfo)
 {
     SqlParameter[] paramArray = new SqlParameter[] {new SqlParameter("@Indx",rolefunctionInfo.Indx),
                                                         new SqlParameter("@RoleID",rolefunctionInfo.RoleID),
                                                         new SqlParameter("@FunctionID",rolefunctionInfo.FunctionID),
                                                         new SqlParameter("@CreatedBy",string.IsNullOrEmpty(rolefunctionInfo.CreatedBy)?"":rolefunctionInfo.CreatedBy)
                                                     };
     return paramArray;
 }
Пример #4
0
 /// <summary>
 /// 新增一条Rolefunction记录
 /// </summary>
 /// <param name="rolefunction">Rolefunction对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertRolefunction(RolefunctionInfo rolefunctionInfo)
 {
     return rolefunctionDA.InsertRolefunction(rolefunctionInfo);
 }
Пример #5
0
 /// <summary>
 /// 初始化RolefunctionInfo
 /// </summary>
 private RolefunctionInfo InitRolefunctionInfoByDataReader(RolefunctionInfo rolefunctionInfo, IDataReader reader)
 {
     rolefunctionInfo = new RolefunctionInfo(reader["Indx"].ToString() != "" ? Int32.Parse(reader["Indx"].ToString()) : 0,
     reader["RoleID"].ToString() != "" ? Int32.Parse(reader["RoleID"].ToString()) : 0,
     reader["FunctionID"].ToString() != "" ? Int32.Parse(reader["FunctionID"].ToString()) : 0,
     reader["CreatedBy"].ToString(),
     reader["CreatedDate"].ToString() != "" ? DateTime.Parse(reader["CreatedDate"].ToString()) : new DateTime());
     return rolefunctionInfo;
 }
Пример #6
0
 /// <summary>
 /// 更新一条Rolefunction记录
 /// </summary>
 /// <param name="db">DataBase对象</param>
 /// <param name="tran">一个有效的DbTransaction</param>
 /// <param name="rolefunction">Rolefunction对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateRolefunction(Database db, DbTransaction tran, RolefunctionInfo rolefunctionInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Rolefunction_Parameters(rolefunctionInfo);
     if (paras != null)
     {
         result += DBHelper.ExecuteNonQuery(db, tran, CommandType.Text, SQL_UPDATE_ROLEFUNCTION, paras);
     }
     return result;
 }
Пример #7
0
 /// <summary>
 /// 新增一条Rolefunction记录
 /// </summary>
 /// <param name="rolefunction">Rolefunction对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertRolefunction(RolefunctionInfo rolefunctionInfo)
 {
     int result = 0;
     SqlParameter[] paras = Set_Rolefunction_Parameters(rolefunctionInfo);
     if (paras != null)
     {
         result = DBHelper.ExecuteNonQuery(CommandType.Text, SQL_INSERT_ROLEFUNCTION, paras);
     }
     return result;
 }
Пример #8
0
 public ActionResult Edit(RolefunctionInfo rolefunctionInfo)
 {
     if (rolefunctionInfo.Indx == 0)
     {
         return Insert(rolefunctionInfo);
     }
     else
     {
         return Update(rolefunctionInfo);
     }
 }
Пример #9
0
 public ActionResult Update(RolefunctionInfo rolefunctionInfo)
 {
     try
     {
         //rolefunctionInfo.UpdatedBy = CurrentUserInfo.UserName;
         //rolefunctionInfo.UpdatedDate = DateTime.Now;
         IRolefunctionService rolefunctionService = UnityHelper.UnityResolve<IRolefunctionService>();
         var data = rolefunctionService.UpdateRolefunction(rolefunctionInfo);
         LogHelper.LogOperation(CurrentUserInfo.UserCode, string.Format("Update RolefunctionInfo {0},{1}", LogHelper.ChangeEntityToLog(rolefunctionInfo), 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);
     }
 }