Exemple #1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtMENU_CODE.Text.Trim().Length == 0)
            {
                strErr += "MENU_CODE不能为空!\\n";
            }
            if (this.txtMENU_NAME.Text.Trim().Length == 0)
            {
                strErr += "MENU_NAME不能为空!\\n";
            }
            if (this.txtMENU_UNIT.Text.Trim().Length == 0)
            {
                strErr += "MENU_UNIT不能为空!\\n";
            }
            if (this.txtPARENT_MENU_CODE.Text.Trim().Length == 0)
            {
                strErr += "PARENT_MENU_CODE不能为空!\\n";
            }
            if (this.txtUSER_CODE.Text.Trim().Length == 0)
            {
                strErr += "USER_CODE不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtIMAGE_INDEX.Text))
            {
                strErr += "IMAGE_INDEX格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string MENU_CODE        = this.txtMENU_CODE.Text;
            string MENU_NAME        = this.txtMENU_NAME.Text;
            string MENU_UNIT        = this.txtMENU_UNIT.Text;
            string PARENT_MENU_CODE = this.txtPARENT_MENU_CODE.Text;
            string USER_CODE        = this.txtUSER_CODE.Text;
            int    IMAGE_INDEX      = int.Parse(this.txtIMAGE_INDEX.Text);
            int    tempid           = int.Parse(this.lbltempid.Text);


            MyERP.Model.SYS_USER_DATARIGHT model = new MyERP.Model.SYS_USER_DATARIGHT();
            model.MENU_CODE        = MENU_CODE;
            model.MENU_NAME        = MENU_NAME;
            model.MENU_UNIT        = MENU_UNIT;
            model.PARENT_MENU_CODE = PARENT_MENU_CODE;
            model.USER_CODE        = USER_CODE;
            model.IMAGE_INDEX      = IMAGE_INDEX;
            model.tempid           = tempid;

            MyERP.BLL.SYS_USER_DATARIGHT bll = new MyERP.BLL.SYS_USER_DATARIGHT();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Exemple #2
0
 private void ShowInfo(int tempid)
 {
     MyERP.BLL.SYS_USER_DATARIGHT   bll   = new MyERP.BLL.SYS_USER_DATARIGHT();
     MyERP.Model.SYS_USER_DATARIGHT model = bll.GetModel(tempid);
     this.lblMENU_CODE.Text        = model.MENU_CODE;
     this.lblMENU_NAME.Text        = model.MENU_NAME;
     this.lblMENU_UNIT.Text        = model.MENU_UNIT;
     this.lblPARENT_MENU_CODE.Text = model.PARENT_MENU_CODE;
     this.lblUSER_CODE.Text        = model.USER_CODE;
     this.lblIMAGE_INDEX.Text      = model.IMAGE_INDEX.ToString();
     this.lbltempid.Text           = model.tempid.ToString();
 }
Exemple #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MyERP.Model.SYS_USER_DATARIGHT model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SYS_USER_DATARIGHT set ");
            strSql.Append("MENU_CODE=@MENU_CODE,");
            strSql.Append("MENU_NAME=@MENU_NAME,");
            strSql.Append("MENU_UNIT=@MENU_UNIT,");
            strSql.Append("PARENT_MENU_CODE=@PARENT_MENU_CODE,");
            strSql.Append("USER_CODE=@USER_CODE,");
            strSql.Append("IMAGE_INDEX=@IMAGE_INDEX");
            strSql.Append(" where tempid=@tempid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MENU_CODE",        SqlDbType.NVarChar, 50),
                new SqlParameter("@MENU_NAME",        SqlDbType.NVarChar, 50),
                new SqlParameter("@MENU_UNIT",        SqlDbType.NVarChar, 50),
                new SqlParameter("@PARENT_MENU_CODE", SqlDbType.NVarChar, 50),
                new SqlParameter("@USER_CODE",        SqlDbType.NVarChar, 50),
                new SqlParameter("@IMAGE_INDEX",      SqlDbType.Int,       4),
                new SqlParameter("@tempid",           SqlDbType.Int, 4)
            };
            parameters[0].Value = model.MENU_CODE;
            parameters[1].Value = model.MENU_NAME;
            parameters[2].Value = model.MENU_UNIT;
            parameters[3].Value = model.PARENT_MENU_CODE;
            parameters[4].Value = model.USER_CODE;
            parameters[5].Value = model.IMAGE_INDEX;
            parameters[6].Value = model.tempid;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(MyERP.Model.SYS_USER_DATARIGHT model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SYS_USER_DATARIGHT(");
            strSql.Append("MENU_CODE,MENU_NAME,MENU_UNIT,PARENT_MENU_CODE,USER_CODE,IMAGE_INDEX)");
            strSql.Append(" values (");
            strSql.Append("@MENU_CODE,@MENU_NAME,@MENU_UNIT,@PARENT_MENU_CODE,@USER_CODE,@IMAGE_INDEX)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MENU_CODE",        SqlDbType.NVarChar, 50),
                new SqlParameter("@MENU_NAME",        SqlDbType.NVarChar, 50),
                new SqlParameter("@MENU_UNIT",        SqlDbType.NVarChar, 50),
                new SqlParameter("@PARENT_MENU_CODE", SqlDbType.NVarChar, 50),
                new SqlParameter("@USER_CODE",        SqlDbType.NVarChar, 50),
                new SqlParameter("@IMAGE_INDEX",      SqlDbType.Int, 4)
            };
            parameters[0].Value = model.MENU_CODE;
            parameters[1].Value = model.MENU_NAME;
            parameters[2].Value = model.MENU_UNIT;
            parameters[3].Value = model.PARENT_MENU_CODE;
            parameters[4].Value = model.USER_CODE;
            parameters[5].Value = model.IMAGE_INDEX;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MyERP.Model.SYS_USER_DATARIGHT DataRowToModel(DataRow row)
 {
     MyERP.Model.SYS_USER_DATARIGHT model = new MyERP.Model.SYS_USER_DATARIGHT();
     if (row != null)
     {
         if (row["MENU_CODE"] != null)
         {
             model.MENU_CODE = row["MENU_CODE"].ToString();
         }
         if (row["MENU_NAME"] != null)
         {
             model.MENU_NAME = row["MENU_NAME"].ToString();
         }
         if (row["MENU_UNIT"] != null)
         {
             model.MENU_UNIT = row["MENU_UNIT"].ToString();
         }
         if (row["PARENT_MENU_CODE"] != null)
         {
             model.PARENT_MENU_CODE = row["PARENT_MENU_CODE"].ToString();
         }
         if (row["USER_CODE"] != null)
         {
             model.USER_CODE = row["USER_CODE"].ToString();
         }
         if (row["IMAGE_INDEX"] != null && row["IMAGE_INDEX"].ToString() != "")
         {
             model.IMAGE_INDEX = int.Parse(row["IMAGE_INDEX"].ToString());
         }
         if (row["tempid"] != null && row["tempid"].ToString() != "")
         {
             model.tempid = int.Parse(row["tempid"].ToString());
         }
     }
     return(model);
 }
Exemple #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MyERP.Model.SYS_USER_DATARIGHT GetModel(int tempid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 MENU_CODE,MENU_NAME,MENU_UNIT,PARENT_MENU_CODE,USER_CODE,IMAGE_INDEX,tempid from SYS_USER_DATARIGHT ");
            strSql.Append(" where tempid=@tempid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@tempid", SqlDbType.Int, 4)
            };
            parameters[0].Value = tempid;

            MyERP.Model.SYS_USER_DATARIGHT model = new MyERP.Model.SYS_USER_DATARIGHT();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

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