Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(yinxiang.Model.yx_functionuser_new model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update yx_functionuser_new set ");
            strSql.Append("username=@username,");
            strSql.Append("functionname=@functionname");
            strSql.Append(" where userid=@userid and FUNCTIONID=@FUNCTIONID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@username",     SqlDbType.VarChar, 100),
                new SqlParameter("@functionname", SqlDbType.VarChar,  50),
                new SqlParameter("@userid",       SqlDbType.VarChar,  50),
                new SqlParameter("@FUNCTIONID",   SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.username;
            parameters[1].Value = model.functionname;
            parameters[2].Value = model.userid;
            parameters[3].Value = model.FUNCTIONID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(yinxiang.Model.yx_functionuser_new model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into yx_functionuser_new(");
            strSql.Append("userid,username,FUNCTIONID,functionname)");
            strSql.Append(" values (");
            strSql.Append("@userid,@username,@FUNCTIONID,@functionname)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@userid",       SqlDbType.VarChar,  50),
                new SqlParameter("@username",     SqlDbType.VarChar, 100),
                new SqlParameter("@FUNCTIONID",   SqlDbType.VarChar,  50),
                new SqlParameter("@functionname", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.userid;
            parameters[1].Value = model.username;
            parameters[2].Value = model.FUNCTIONID;
            parameters[3].Value = model.functionname;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public yinxiang.Model.yx_functionuser_new GetModel(string userid, string FUNCTIONID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 userid,username,FUNCTIONID,functionname from yx_functionuser_new ");
            strSql.Append(" where userid=@userid and FUNCTIONID=@FUNCTIONID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@userid",     SqlDbType.VarChar, 50),
                new SqlParameter("@FUNCTIONID", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = userid;
            parameters[1].Value = FUNCTIONID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #4
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtusername.Text.Trim().Length == 0)
            {
                strErr += "username不能为空!\\n";
            }
            if (this.txtfunctionname.Text.Trim().Length == 0)
            {
                strErr += "functionname不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string userid       = this.lbluserid.Text;
            string username     = this.txtusername.Text;
            string FUNCTIONID   = this.lblFUNCTIONID.Text;
            string functionname = this.txtfunctionname.Text;


            yinxiang.Model.yx_functionuser_new model = new yinxiang.Model.yx_functionuser_new();
            model.userid       = userid;
            model.username     = username;
            model.FUNCTIONID   = FUNCTIONID;
            model.functionname = functionname;

            yinxiang.BLL.yx_functionuser_new bll = new yinxiang.BLL.yx_functionuser_new();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Example #5
0
 private void ShowInfo(string userid, string FUNCTIONID)
 {
     yinxiang.BLL.yx_functionuser_new   bll   = new yinxiang.BLL.yx_functionuser_new();
     yinxiang.Model.yx_functionuser_new model = bll.GetModel(userid, FUNCTIONID);
     this.lbluserid.Text       = model.userid;
     this.lblusername.Text     = model.username;
     this.lblFUNCTIONID.Text   = model.FUNCTIONID;
     this.lblfunctionname.Text = model.functionname;
 }
Example #6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public yinxiang.Model.yx_functionuser_new DataRowToModel(DataRow row)
 {
     yinxiang.Model.yx_functionuser_new model = new yinxiang.Model.yx_functionuser_new();
     if (row != null)
     {
         if (row["userid"] != null)
         {
             model.userid = row["userid"].ToString();
         }
         if (row["username"] != null)
         {
             model.username = row["username"].ToString();
         }
         if (row["FUNCTIONID"] != null)
         {
             model.FUNCTIONID = row["FUNCTIONID"].ToString();
         }
         if (row["functionname"] != null)
         {
             model.functionname = row["functionname"].ToString();
         }
     }
     return(model);
 }