Ejemplo n.º 1
0
    protected void TmgBtnExit_Click(object sender, ImageClickEventArgs e)
    {
        if (Page.IsValid)
        {//实例化类
            DelGoodMon delm = new DelGoodMon();
            delm.CusID        = ddlCustomer.SelectedValue;
            delm.DelUnitPrice = Convert.ToInt32(txtprice.Text);
            delm.Remark       = txtRemar.Text;


            //添加功能
            if (Request.QueryString["DelID"] == null)
            {
                int cnt = delMon.InsertDelMon(delm);
                if (cnt > 0)
                {
                    lblMessage.Visible = true;
                    lblMessage.Text    = "添加成功!";
                }
            }
            if (Request.QueryString["DelID"] != null)
            {
                delm.DelID = Convert.ToInt32(Request.QueryString["DelID"]);
                int cnt = delMon.UpdateDel(delm);

                if (cnt > 0)
                {
                    lblMessage.Visible = true;
                    lblMessage.Text    = "修改成功!";
                }
            }
        }
    }
Ejemplo n.º 2
0
        //插入功能
        public int InsertDelMon(DelGoodMon del)
        {
            string strsql = "insert into DelGoodsMonTB values(@CusID,@DelUnitPrice,@Remark)";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@CusID", del.CusID),
                new SqlParameter("@DelUnitPrice", del.DelUnitPrice),
                new SqlParameter("@Remark", del.Remark)
            };
            return(DBHelper.ExecuteCommand(strsql, para));
        }
Ejemplo n.º 3
0
        //修改
        public int UpdateDel(DelGoodMon del)
        {
            string strsql = "Update DelGoodsMonTB set CusID=@CusID,DelUnitPrice=@DelUnitPrice,Remark=@Remark where DelID=@DelID";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@CusID", del.CusID),
                new SqlParameter("@DelUnitPrice", del.DelUnitPrice),
                new SqlParameter("@Remark", del.Remark),
                new SqlParameter("@DelID", del.DelID)
            };
            return(DBHelper.ExecuteCommand(strsql, para));
        }
Ejemplo n.º 4
0
        public List <DelGoodMon> GetInfoBysql(string strsql)
        {
            DataTable ds = DBHelper.GetTable(strsql);

            List <DelGoodMon> allDelGoods = new List <DelGoodMon>();

            foreach (DataRow r in ds.Rows)
            {
                DelGoodMon Del = new DelGoodMon();
                Del.DelID = Convert.ToInt32(r["DelID"]);
                CustomersService CS = new CustomersService();
                Del.customer     = CS.GetCusmoerByid(Convert.ToInt32(r["CusID"]));
                Del.DelUnitPrice = Convert.ToDouble(r["DelUnitPrice"]);
                Del.Remark       = r["Remark"].ToString();

                allDelGoods.Add(Del);
            }
            return(allDelGoods);
        }
Ejemplo n.º 5
0
        //根据客户ID得到客户姓名
        public DelGoodMon GetAllDelGoodsInfoByID(int DelID)
        {
            string     strsql = "select * from DelGoodsMonTB where DelID=" + @DelID;
            DelGoodMon Del    = new DelGoodMon();

            try
            {
                DataTable dt = DBHelper.GetTable(strsql, new SqlParameter("@DelID", DelID));
                foreach (DataRow row in dt.Rows)
                {
                    Del.CusID = row["CusID"].ToString();
                    Del.DelID = Convert.ToInt32(row["DelID"]);
                    CustomersService CS = new CustomersService();
                    Del.customer     = CS.GetCusmoerByid(Convert.ToInt32(Del.CusID));
                    Del.DelUnitPrice = Convert.ToDouble(row["DelUnitPrice"]);
                    Del.Remark       = row["Remark"].ToString();
                }
                return(Del);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Usermanager"] == null)
        {
            Response.Redirect("~/Login.aspx");
        }
        else
        {
            if (!IsPostBack)
            {
                //窗体加载标签不显示
                lblMessage.Visible = false;

                //填充DropDownlist控件客户
                this.ddlCustomer.DataSource     = CusMan.GetAllCustomers();
                this.ddlCustomer.DataTextField  = "CusName";
                this.ddlCustomer.DataValueField = "CusID";
                ddlCustomer.DataBind();

                if (Request.QueryString["DelID"] == null)
                {
                    txtprice.Text = "";
                    txtRemar.Text = "";
                }
                //窗体加载传值
                if (Request.QueryString["DelID"] != null)
                {
                    int        del  = Convert.ToInt32(Request.QueryString["DelID"]);
                    DelGoodMon dels = delMon.GetAllDelGoodsInfoByID(del);
                    ddlCustomer.SelectedValue = dels.CusID;
                    txtprice.Text             = dels.DelUnitPrice.ToString();
                    txtRemar.Text             = dels.Remark;
                }
            }
        }
    }
Ejemplo n.º 7
0
 //插入功能
 public int InsertDelMon(DelGoodMon del)
 {
     return(dgm.InsertDelMon(del));
 }
Ejemplo n.º 8
0
 public int UpdateDel(DelGoodMon del)
 {
     return(dgm.UpdateDel(del));
 }