Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(int UserID, CUSTOMRP.Model.GROUPRIGHT model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update GROUPRIGHT set ");
            strSql.Append("COMPANY=@COMPANY,");
            strSql.Append("REPORTGROUP=@REPORTGROUP,");
            strSql.Append("CATEGARY=@CATEGARY,");
            strSql.Append("SECURITY=@SECURITY,");
            strSql.Append("QUERY=@QUERY,");
            strSql.Append("USERGROUP=@USERGROUP,");
            strSql.Append("USERGROUPRIGHT=@USERGROUPRIGHT,");
            strSql.Append("USERSETUP=@USERSETUP,");
            strSql.Append("AUDODATE=@AUDODATE,");
            strSql.Append("EXTEND1=@EXTEND1,");
            strSql.Append("EXTEND2=@EXTEND2,");
            strSql.Append("EXTEND3=@EXTEND3");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@COMPANY",        SqlDbType.NVarChar,  50),
                new SqlParameter("@REPORTGROUP",    SqlDbType.NVarChar,  50),
                new SqlParameter("@CATEGARY",       SqlDbType.NVarChar,  50),
                new SqlParameter("@SECURITY",       SqlDbType.NVarChar,  50),
                new SqlParameter("@QUERY",          SqlDbType.NVarChar,  50),
                new SqlParameter("@USERGROUP",      SqlDbType.NVarChar,  50),
                new SqlParameter("@USERGROUPRIGHT", SqlDbType.NVarChar,  50),
                new SqlParameter("@USERSETUP",      SqlDbType.NVarChar,  50),
                new SqlParameter("@AUDODATE",       SqlDbType.DateTime),
                new SqlParameter("@EXTEND1",        SqlDbType.NVarChar,  50),
                new SqlParameter("@EXTEND2",        SqlDbType.NVarChar,  50),
                new SqlParameter("@EXTEND3",        SqlDbType.NVarChar,  -1),
                new SqlParameter("@ID",             SqlDbType.Int,        4),
                new SqlParameter("@GID",            SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.COMPANY;
            parameters[1].Value  = model.REPORTGROUP;
            parameters[2].Value  = model.CATEGARY;
            parameters[3].Value  = model.SECURITY;
            parameters[4].Value  = model.QUERY;
            parameters[5].Value  = model.USERGROUP;
            parameters[6].Value  = model.USERGROUPRIGHT;
            parameters[7].Value  = model.USERSETUP;
            parameters[8].Value  = model.AUDODATE;
            parameters[9].Value  = model.EXTEND1;
            parameters[10].Value = model.EXTEND2;
            parameters[11].Value = model.EXTEND3;
            parameters[12].Value = model.ID;
            parameters[13].Value = model.GID;

            int rows = DbHelperSQL.ExecuteSql(UserID, strSql.ToString(), parameters);

            if (rows > 0)
            {
                Model.AUDITLOG auditobj = model.GetAuditLogObject(null);
                auditobj.UserID      = UserID;
                auditobj.CreateDate  = DateTime.Now;
                auditobj.MessageType = Model.AUDITLOG.Severity.Audit;
                auditobj.ModuleName  = "DAL.GROUPRIGHT.Update";
                auditobj.Message     = String.Format(AppNum.AuditMessage.GroupRightUpdateSuccess, model.ID);

                AUDITLOG.Add(auditobj);

                return(true);
            }
            else
            {
                return(false);
            }
        }