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

            strSql.Append("update smes_functionName set ");
            strSql.Append("orgId=@orgId,");
            strSql.Append("functionName=@functionName,");
            strSql.Append("functionPath=@functionPath,");
            strSql.Append("functionGroup=@functionGroup,");
            strSql.Append("creater=@creater,");
            strSql.Append("useNum=@useNum,");
            strSql.Append("lastUser=@lastUser,");
            strSql.Append("lastUseDate=@lastUseDate,");
            strSql.Append("memo=@memo,");
            strSql.Append("functioncode=@functioncode");
            strSql.Append(" where functionid=@functionid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@orgId",         SqlDbType.VarChar,  50),
                new SqlParameter("@functionName",  SqlDbType.VarChar,  50),
                new SqlParameter("@functionPath",  SqlDbType.VarChar, 250),
                new SqlParameter("@functionGroup", SqlDbType.VarChar,  50),
                new SqlParameter("@creater",       SqlDbType.VarChar,  50),
                new SqlParameter("@useNum",        SqlDbType.BigInt,    8),
                new SqlParameter("@lastUser",      SqlDbType.VarChar,  50),
                new SqlParameter("@lastUseDate",   SqlDbType.VarChar,  50),
                new SqlParameter("@memo",          SqlDbType.VarChar, 500),
                new SqlParameter("@functioncode",  SqlDbType.VarChar,  50),
                new SqlParameter("@functionid",    SqlDbType.BigInt, 8)
            };
            parameters[0].Value  = model.orgId;
            parameters[1].Value  = model.functionName;
            parameters[2].Value  = model.functionPath;
            parameters[3].Value  = model.functionGroup;
            parameters[4].Value  = model.creater;
            parameters[5].Value  = model.useNum;
            parameters[6].Value  = model.lastUser;
            parameters[7].Value  = model.lastUseDate;
            parameters[8].Value  = model.memo;
            parameters[9].Value  = model.functioncode;
            parameters[10].Value = model.functionid;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public yinxiang.Model.smes_functionName DataRowToModel(DataRow row)
 {
     yinxiang.Model.smes_functionName model = new yinxiang.Model.smes_functionName();
     if (row != null)
     {
         if (row["functionid"] != null && row["functionid"].ToString() != "")
         {
             model.functionid = long.Parse(row["functionid"].ToString());
         }
         if (row["orgId"] != null)
         {
             model.orgId = row["orgId"].ToString();
         }
         if (row["functionName"] != null)
         {
             model.functionName = row["functionName"].ToString();
         }
         if (row["functionPath"] != null)
         {
             model.functionPath = row["functionPath"].ToString();
         }
         if (row["functionGroup"] != null)
         {
             model.functionGroup = row["functionGroup"].ToString();
         }
         if (row["creater"] != null)
         {
             model.creater = row["creater"].ToString();
         }
         if (row["useNum"] != null && row["useNum"].ToString() != "")
         {
             model.useNum = long.Parse(row["useNum"].ToString());
         }
         if (row["lastUser"] != null)
         {
             model.lastUser = row["lastUser"].ToString();
         }
         if (row["lastUseDate"] != null)
         {
             model.lastUseDate = row["lastUseDate"].ToString();
         }
         if (row["memo"] != null)
         {
             model.memo = row["memo"].ToString();
         }
         if (row["functioncode"] != null)
         {
             model.functioncode = row["functioncode"].ToString();
         }
     }
     return(model);
 }
Example #3
0
 private void ShowInfo(long functionid)
 {
     yinxiang.BLL.smes_functionName   bll   = new yinxiang.BLL.smes_functionName();
     yinxiang.Model.smes_functionName model = bll.GetModel(functionid);
     this.lblfunctionid.Text    = model.functionid.ToString();
     this.lblorgId.Text         = model.orgId;
     this.lblfunctionName.Text  = model.functionName;
     this.lblfunctionPath.Text  = model.functionPath;
     this.lblfunctionGroup.Text = model.functionGroup;
     this.lblcreater.Text       = model.creater;
     this.lbluseNum.Text        = model.useNum.ToString();
     this.lbllastUser.Text      = model.lastUser;
     this.lbllastUseDate.Text   = model.lastUseDate;
     this.lblmemo.Text          = model.memo;
     this.lblfunctioncode.Text  = model.functioncode;
 }
Example #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(yinxiang.Model.smes_functionName model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into smes_functionName(");
            strSql.Append("orgId,functionName,functionPath,functionGroup,creater,useNum,lastUser,lastUseDate,memo,functioncode)");
            strSql.Append(" values (");
            strSql.Append("@orgId,@functionName,@functionPath,@functionGroup,@creater,@useNum,@lastUser,@lastUseDate,@memo,@functioncode)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@orgId",         SqlDbType.VarChar,  50),
                new SqlParameter("@functionName",  SqlDbType.VarChar,  50),
                new SqlParameter("@functionPath",  SqlDbType.VarChar, 250),
                new SqlParameter("@functionGroup", SqlDbType.VarChar,  50),
                new SqlParameter("@creater",       SqlDbType.VarChar,  50),
                new SqlParameter("@useNum",        SqlDbType.BigInt,    8),
                new SqlParameter("@lastUser",      SqlDbType.VarChar,  50),
                new SqlParameter("@lastUseDate",   SqlDbType.VarChar,  50),
                new SqlParameter("@memo",          SqlDbType.VarChar, 500),
                new SqlParameter("@functioncode",  SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.orgId;
            parameters[1].Value = model.functionName;
            parameters[2].Value = model.functionPath;
            parameters[3].Value = model.functionGroup;
            parameters[4].Value = model.creater;
            parameters[5].Value = model.useNum;
            parameters[6].Value = model.lastUser;
            parameters[7].Value = model.lastUseDate;
            parameters[8].Value = model.memo;
            parameters[9].Value = model.functioncode;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt64(obj));
            }
        }
Example #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public yinxiang.Model.smes_functionName GetModel(long functionid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 functionid,orgId,functionName,functionPath,functionGroup,creater,useNum,lastUser,lastUseDate,memo,functioncode from smes_functionName ");
            strSql.Append(" where functionid=@functionid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@functionid", SqlDbType.BigInt)
            };
            parameters[0].Value = functionid;

            yinxiang.Model.smes_functionName model = new yinxiang.Model.smes_functionName();
            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 #6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtorgId.Text.Trim().Length == 0)
            {
                strErr += "orgId不能为空!\\n";
            }
            if (this.txtfunctionName.Text.Trim().Length == 0)
            {
                strErr += "functionName不能为空!\\n";
            }
            if (this.txtfunctionPath.Text.Trim().Length == 0)
            {
                strErr += "functionPath不能为空!\\n";
            }
            if (this.txtfunctionGroup.Text.Trim().Length == 0)
            {
                strErr += "functionGroup不能为空!\\n";
            }
            if (this.txtcreater.Text.Trim().Length == 0)
            {
                strErr += "creater不能为空!\\n";
            }
            if (this.txtuseNum.Text.Trim().Length == 0)
            {
                strErr += "useNum不能为空!\\n";
            }
            if (this.txtlastUser.Text.Trim().Length == 0)
            {
                strErr += "lastUser不能为空!\\n";
            }
            if (this.txtlastUseDate.Text.Trim().Length == 0)
            {
                strErr += "lastUseDate不能为空!\\n";
            }
            if (this.txtmemo.Text.Trim().Length == 0)
            {
                strErr += "memo不能为空!\\n";
            }
            if (this.txtfunctioncode.Text.Trim().Length == 0)
            {
                strErr += "functioncode不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string orgId         = this.txtorgId.Text;
            string functionName  = this.txtfunctionName.Text;
            string functionPath  = this.txtfunctionPath.Text;
            string functionGroup = this.txtfunctionGroup.Text;
            string creater       = this.txtcreater.Text;
            string useNum        = this.txtuseNum.Text;
            string lastUser      = this.txtlastUser.Text;
            string lastUseDate   = this.txtlastUseDate.Text;
            string memo          = this.txtmemo.Text;
            string functioncode  = this.txtfunctioncode.Text;

            yinxiang.Model.smes_functionName model = new yinxiang.Model.smes_functionName();
            model.orgId         = orgId;
            model.functionName  = functionName;
            model.functionPath  = functionPath;
            model.functionGroup = functionGroup;
            model.creater       = creater;
            model.useNum        = 1;
            model.lastUser      = lastUser;
            model.lastUseDate   = lastUseDate;
            model.memo          = memo;
            model.functioncode  = functioncode;

            yinxiang.BLL.smes_functionName bll = new yinxiang.BLL.smes_functionName();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Example #7
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtorgId.Text.Trim().Length == 0)
            {
                strErr += "orgId不能为空!\\n";
            }
            if (this.txtfunctionName.Text.Trim().Length == 0)
            {
                strErr += "functionName不能为空!\\n";
            }
            if (this.txtfunctionPath.Text.Trim().Length == 0)
            {
                strErr += "functionPath不能为空!\\n";
            }
            if (this.txtfunctionGroup.Text.Trim().Length == 0)
            {
                strErr += "functionGroup不能为空!\\n";
            }
            if (this.txtcreater.Text.Trim().Length == 0)
            {
                strErr += "creater不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtuseNum.Text))
            {
                strErr += "useNum格式错误!\\n";
            }
            if (this.txtlastUser.Text.Trim().Length == 0)
            {
                strErr += "lastUser不能为空!\\n";
            }
            if (this.txtlastUseDate.Text.Trim().Length == 0)
            {
                strErr += "lastUseDate不能为空!\\n";
            }
            if (this.txtmemo.Text.Trim().Length == 0)
            {
                strErr += "memo不能为空!\\n";
            }
            if (this.txtfunctioncode.Text.Trim().Length == 0)
            {
                strErr += "functioncode不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            long   functionid    = long.Parse(this.lblfunctionid.Text);
            string orgId         = this.txtorgId.Text;
            string functionName  = this.txtfunctionName.Text;
            string functionPath  = this.txtfunctionPath.Text;
            string functionGroup = this.txtfunctionGroup.Text;
            string creater       = this.txtcreater.Text;
            long   useNum        = long.Parse(this.txtuseNum.Text);
            string lastUser      = this.txtlastUser.Text;
            string lastUseDate   = this.txtlastUseDate.Text;
            string memo          = this.txtmemo.Text;
            string functioncode  = this.txtfunctioncode.Text;


            yinxiang.Model.smes_functionName model = new yinxiang.Model.smes_functionName();
            model.functionid    = functionid;
            model.orgId         = orgId;
            model.functionName  = functionName;
            model.functionPath  = functionPath;
            model.functionGroup = functionGroup;
            model.creater       = creater;
            model.useNum        = useNum;
            model.lastUser      = lastUser;
            model.lastUseDate   = lastUseDate;
            model.memo          = memo;
            model.functioncode  = functioncode;

            yinxiang.BLL.smes_functionName bll = new yinxiang.BLL.smes_functionName();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }