Ejemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public CUSTOMRP.Model.USERGROUP DataRowToModel(DataRow row)
 {
     CUSTOMRP.Model.USERGROUP model = new CUSTOMRP.Model.USERGROUP();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = Int32.Parse(row["ID"].ToString());
         }
         if (row["DATABASEID"] != null && row["DATABASEID"].ToString() != "")
         {
             model.DATABASEID = Int32.Parse(row["DATABASEID"].ToString());
         }
         if (row["NAME"] != null)
         {
             model.NAME = row["NAME"].ToString();
         }
         if (row["DESCRIPTION"] != null)
         {
             model.DESCRIPTION = row["DESCRIPTION"].ToString();
         }
         if (row["AUDODATE"] != null && row["AUDODATE"].ToString() != "")
         {
             model.AUDODATE = DateTime.Parse(row["AUDODATE"].ToString());
         }
         if (row["EXTEND"] != null)
         {
             model.EXTEND = row["EXTEND"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 2
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(Request.QueryString["id"]))
     {
         if (me.checkUserGroupRight(CUSTOMRP.Model.APPModuleID.usergroupright_usergroup, "Add", me.LoginID) == false)
         {
             Common.JScript.AlertAndRedirect(AppNum.ErrorMsg.accesserror, "UserGroup.aspx");
             Response.End();
         }
         this.Button2.Visible = false;
     }
     else
     {
         if (me.checkUserGroupRight(CUSTOMRP.Model.APPModuleID.usergroupright_usergroup, "Modify", me.LoginID) == false)
         {
             Common.JScript.AlertAndRedirect(AppNum.ErrorMsg.accesserror, "UserGroup.aspx");
             Response.End();
         }
         int id = Int32.Parse(Request.QueryString["id"]);
         myrpgroup = WebHelper.bllUserGroup.GetModel(me.ID, id);
         if (myrpgroup == null)
         {
             Common.JScript.AlertAndRedirect(AppNum.ErrorMsg.parameter_error, "UserGroup.aspx");
             Response.End();
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(int UserID, CUSTOMRP.Model.USERGROUP model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update USERGROUP set ");
            strSql.Append("DATABASEID=@DATABASEID,");
            strSql.Append("NAME=@NAME,");
            strSql.Append("DESCRIPTION=@DESCRIPTION,");
            strSql.Append("AUDODATE=@AUDODATE,");
            strSql.Append("EXTEND=@EXTEND");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DATABASEID",  SqlDbType.Int,        4),
                new SqlParameter("@NAME",        SqlDbType.NVarChar,  50),
                new SqlParameter("@DESCRIPTION", SqlDbType.NVarChar,  -1),
                new SqlParameter("@AUDODATE",    SqlDbType.DateTime),
                new SqlParameter("@EXTEND",      SqlDbType.NVarChar,  -1),
                new SqlParameter("@ID",          SqlDbType.Int, 4)
            };
            parameters[0].Value = model.DATABASEID;
            parameters[1].Value = model.NAME;
            parameters[2].Value = model.DESCRIPTION;
            parameters[3].Value = model.AUDODATE;
            parameters[4].Value = model.EXTEND;
            parameters[5].Value = model.ID;

            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.USERGROUP.Update";
                auditobj.Message     = String.Format(AppNum.AuditMessage.UserGroupUpdateSuccess, model.ID);

                AUDITLOG.Add(auditobj);

                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(int UserID, CUSTOMRP.Model.USERGROUP model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into USERGROUP(");
            strSql.Append("DATABASEID,NAME,DESCRIPTION,AUDODATE,EXTEND)");
            strSql.Append(" values (");
            strSql.Append("@DATABASEID,@NAME,@DESCRIPTION,@AUDODATE,@EXTEND)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DATABASEID",  SqlDbType.Int,        4),
                new SqlParameter("@NAME",        SqlDbType.NVarChar,  50),
                new SqlParameter("@DESCRIPTION", SqlDbType.NVarChar,  -1),
                new SqlParameter("@AUDODATE",    SqlDbType.DateTime),
                new SqlParameter("@EXTEND",      SqlDbType.NVarChar, -1)
            };
            parameters[0].Value = model.DATABASEID;
            parameters[1].Value = model.NAME;
            parameters[2].Value = model.DESCRIPTION;
            parameters[3].Value = model.AUDODATE;
            parameters[4].Value = model.EXTEND;

            object obj = DbHelperSQL.GetSingle(UserID, strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                model.ID = Convert.ToInt32(obj);

                Model.AUDITLOG auditobj = model.GetAuditLogObject(null);
                auditobj.UserID      = UserID;
                auditobj.CreateDate  = DateTime.Now;
                auditobj.MessageType = Model.AUDITLOG.Severity.Audit;
                auditobj.ModuleName  = "DAL.USERGROUP.Add";
                auditobj.Message     = String.Format(AppNum.AuditMessage.UserGroupInsertSuccess, model.ID);

                AUDITLOG.Add(auditobj);

                return(model.ID);
            }
        }
Ejemplo n.º 5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string name        = this.TextBox1.Text.Trim();
            string description = this.TextBox2.Text.Trim();


            if (myrpgroup == null)
            {
                if (WebHelper.bllUserGroup.GetList(me.ID, "NAME='" + name + "'").Tables[0].Rows.Count > 0)
                {
                    //Common.JScript.Alert(AppNum.Commonexits);
                    //Common.JScript.GoHistory(-1);
                    Common.JScript.AlertAndRedirect(AppNum.ErrorMsg.Commonexits, "UserGroup.aspx");
                    Response.End();
                }

                CUSTOMRP.Model.USERGROUP mylevel = new CUSTOMRP.Model.USERGROUP();
                mylevel.DATABASEID  = me.DatabaseID;
                mylevel.DESCRIPTION = description;
                mylevel.NAME        = name;
                mylevel.EXTEND      = "";

                WebHelper.bllUserGroup.Add(me.ID, mylevel);
            }
            else
            {
                CUSTOMRP.Model.USERGROUP mylevel = WebHelper.bllUserGroup.GetModel(me.ID, myrpgroup.ID);
                mylevel.DESCRIPTION = description;
                mylevel.NAME        = name;
                mylevel.EXTEND      = "";

                WebHelper.bllUserGroup.Update(me.ID, mylevel);
            }

            Common.JScript.AlertAndRedirect(AppNum.ErrorMsg.success, "UserGroup.aspx");
            Response.End();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 批量删除数据
        /// </summary>
        //public bool DeleteList(int UserID, string IDlist)
        //{
        //    StringBuilder strSql=new StringBuilder();
        //    strSql.Append("delete from USERGROUP ");
        //    strSql.Append(" where ID in ("+IDlist + ")  ");
        //    int rows=DbHelperSQL.ExecuteSql(UserID, strSql.ToString());
        //    if (rows > 0)
        //    {
        //        return true;
        //    }
        //    else
        //    {
        //        return false;
        //    }
        //}


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public CUSTOMRP.Model.USERGROUP GetModel(int UserID, int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,DATABASEID,NAME,DESCRIPTION,AUDODATE,EXTEND from USERGROUP ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            CUSTOMRP.Model.USERGROUP model = new CUSTOMRP.Model.USERGROUP();
            DataSet ds = DbHelperSQL.Query(UserID, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }