/// <summary>
        /// 修改角色记录
        /// </summary>
        /// <returns>DataTable</returns>
        public static bool UpdateRoleInfo(RoleInfoModel model, string loginUserID, int RoleID)
        {
            //SQL拼写
            StringBuilder sql = new StringBuilder();
            sql.AppendLine("UPDATE officedba.RoleInfo			     ");
            sql.AppendLine("SET                                      ");
            sql.AppendLine("		RoleName = @RoleName,             ");
            sql.AppendLine("		remark = @remark ,            ");
            sql.AppendLine("		ModifiedDate = @ModifiedDate             ");
            sql.AppendLine("		,ModifiedUserID = '" + loginUserID + "'                ");
            sql.AppendLine("WHERE                                    ");
            sql.AppendLine("		RoleID = " + RoleID + " and CompanyCD=@CompanyCD        ");

            //设置参数
            SqlParameter[] param = new SqlParameter[4];
            param[0] = SqlHelper.GetParameter("@RoleName", model.RoleName);
            param[1] = SqlHelper.GetParameter("@remark", model.Remark);
            param[2] = SqlHelper.GetParameter("@CompanyCD",model.CompanyCD);
            param[3] = SqlHelper.GetParameter("@ModifiedDate", System.DateTime.Now);

            SqlHelper.ExecuteTransSql(sql.ToString(), param);
            return SqlHelper.Result.OprateCount > 0 ? true : false;

        }
Esempio n. 2
0
        /// <summary>
        /// 角色信息修改
        /// </summary>
        /// <param name="model">角色信息</param>
        /// <returns>更新成功与否</returns>
        public static bool UpdateRoleInfo(RoleInfoModel model,int RoleID)
        {
            //获取登陆用户ID
            string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; //带修改
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            //登陆日志
            try
            {
                bool succ = false;
                LogInfoModel logModel = InitLogInfo(model.RoleName);
                logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;
                succ = RoleInfoDBHelper.UpdateRoleInfo(model, loginUserID, RoleID);
                if (!succ)
                    logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
                else
                    logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
                LogDBHelper.InsertLog(logModel);
                return succ;
            }
            catch (Exception)
            {
                return false;
                throw;
            }

        }
        /// <summary>
        /// 添加角色记录
        /// </summary>
        /// <returns>DataTable</returns>
        public static bool InsertRoleInfo(RoleInfoModel model, string loginUserID, out string ID)
        {
            //SQL拼写
            StringBuilder sql = new StringBuilder();
            sql.AppendLine("INSERT INTO officedba.RoleInfo");
            sql.AppendLine("		(CompanyCD      ");
            sql.AppendLine("		,RoleName         ");
            sql.AppendLine("		,remark         ");
            sql.AppendLine("		,ModifiedUserID)        ");
            sql.AppendLine("VALUES                  ");
            sql.AppendLine("		(@CompanyCD     ");
            sql.AppendLine("		,@RoleName        ");
            sql.AppendLine("		,@remark       ");
            sql.AppendLine("		,'" + loginUserID + "')       ");
            sql.AppendLine("set @ID= @@IDENTITY");

            //设置参数
            SqlParameter[] param = new SqlParameter[4];
            param[0] = SqlHelper.GetParameter("@CompanyCD", model.CompanyCD);
            param[1] = SqlHelper.GetParameter("@remark", model.Remark);
            param[2] = SqlHelper.GetParameter("@RoleName", model.RoleName);
            param[3] = SqlHelper.GetOutputParameter("@ID", SqlDbType.Int);
            SqlHelper.ExecuteTransSql(sql.ToString(), param);
            ID = param[3].Value.ToString();
            return SqlHelper.Result.OprateCount > 0 ? true : false;

        }
Esempio n. 4
0
        /// <summary>
        /// 角色信息插入
        /// </summary>
        /// <param name="model">角色信息</param>
        /// <returns>插入成功与否</returns>
        public static bool InsertRoleInfo(RoleInfoModel model,out string ID)
        {
            ID="0";
            //获取登陆用户ID
            string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID;// 待修改
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            //登陆日志
            try
            {
                bool succ = false;
                LogInfoModel logModel = InitLogInfo(model.RoleName);
                logModel.Element = ConstUtil.LOG_PROCESS_INSERT;
                succ = RoleInfoDBHelper.InsertRoleInfo(model, loginUserID, out ID);
                if (!succ)
                    logModel.Remark = ConstUtil.LOG_PROCESS_FAILED;
                else
                    logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS;
                LogDBHelper.InsertLog(logModel);
                return succ;
            }
            catch (Exception ex)
            {
                WriteSystemLog(userInfo, ex);
                return false;
            }

        }