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

            if (!PageValidate.IsNumber(txtOrderNo.Text))
            {
                strErr += "OrderNo格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtQuickMenuNum.Text))
            {
                strErr += "QuickMenuNum格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int OperatorID   = int.Parse(this.lblOperatorID.Text);
            int MenuID       = int.Parse(this.lblMenuID.Text);
            int OrderNo      = int.Parse(this.txtOrderNo.Text);
            int QuickMenuNum = int.Parse(this.txtQuickMenuNum.Text);


            WebDemo.Model.WebDemo.OperQuickMenu model = new WebDemo.Model.WebDemo.OperQuickMenu();
            model.OperatorID   = OperatorID;
            model.MenuID       = MenuID;
            model.OrderNo      = OrderNo;
            model.QuickMenuNum = QuickMenuNum;

            WebDemo.BLL.WebDemo.OperQuickMenu bll = new WebDemo.BLL.WebDemo.OperQuickMenu();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Exemple #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WebDemo.Model.WebDemo.OperQuickMenu model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update OperQuickMenu set ");
            strSql.Append("OrderNo=@OrderNo,");
            strSql.Append("QuickMenuNum=@QuickMenuNum");
            strSql.Append(" where OperatorID=@OperatorID and MenuID=@MenuID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderNo",      SqlDbType.Int, 4),
                new SqlParameter("@QuickMenuNum", SqlDbType.Int, 4),
                new SqlParameter("@OperatorID",   SqlDbType.Int, 4),
                new SqlParameter("@MenuID",       SqlDbType.Int, 4)
            };
            parameters[0].Value = model.OrderNo;
            parameters[1].Value = model.QuickMenuNum;
            parameters[2].Value = model.OperatorID;
            parameters[3].Value = model.MenuID;

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

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

            strSql.Append("insert into OperQuickMenu(");
            strSql.Append("OperatorID,MenuID,OrderNo,QuickMenuNum)");
            strSql.Append(" values (");
            strSql.Append("@OperatorID,@MenuID,@OrderNo,@QuickMenuNum)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OperatorID",   SqlDbType.Int, 4),
                new SqlParameter("@MenuID",       SqlDbType.Int, 4),
                new SqlParameter("@OrderNo",      SqlDbType.Int, 4),
                new SqlParameter("@QuickMenuNum", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.OperatorID;
            parameters[1].Value = model.MenuID;
            parameters[2].Value = model.OrderNo;
            parameters[3].Value = model.QuickMenuNum;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WebDemo.Model.WebDemo.OperQuickMenu GetModel(int OperatorID, int MenuID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 OperatorID,MenuID,OrderNo,QuickMenuNum from OperQuickMenu ");
            strSql.Append(" where OperatorID=@OperatorID and MenuID=@MenuID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OperatorID", SqlDbType.Int, 4),
                new SqlParameter("@MenuID",     SqlDbType.Int, 4)
            };
            parameters[0].Value = OperatorID;
            parameters[1].Value = MenuID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #5
0
 private void ShowInfo(int OperatorID, int MenuID)
 {
     WebDemo.BLL.WebDemo.OperQuickMenu   bll   = new WebDemo.BLL.WebDemo.OperQuickMenu();
     WebDemo.Model.WebDemo.OperQuickMenu model = bll.GetModel(OperatorID, MenuID);
     this.lblOperatorID.Text   = model.OperatorID.ToString();
     this.lblMenuID.Text       = model.MenuID.ToString();
     this.txtOrderNo.Text      = model.OrderNo.ToString();
     this.txtQuickMenuNum.Text = model.QuickMenuNum.ToString();
 }
Exemple #6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WebDemo.Model.WebDemo.OperQuickMenu DataRowToModel(DataRow row)
 {
     WebDemo.Model.WebDemo.OperQuickMenu model = new WebDemo.Model.WebDemo.OperQuickMenu();
     if (row != null)
     {
         if (row["OperatorID"] != null && row["OperatorID"].ToString() != "")
         {
             model.OperatorID = int.Parse(row["OperatorID"].ToString());
         }
         if (row["MenuID"] != null && row["MenuID"].ToString() != "")
         {
             model.MenuID = int.Parse(row["MenuID"].ToString());
         }
         if (row["OrderNo"] != null && row["OrderNo"].ToString() != "")
         {
             model.OrderNo = int.Parse(row["OrderNo"].ToString());
         }
         if (row["QuickMenuNum"] != null && row["QuickMenuNum"].ToString() != "")
         {
             model.QuickMenuNum = int.Parse(row["QuickMenuNum"].ToString());
         }
     }
     return(model);
 }