Exemple #1
0
 private void ShowInfo(int DingID)
 {
     Maticsoft.BLL.DingProduct   bll   = new Maticsoft.BLL.DingProduct();
     Maticsoft.Model.DingProduct model = bll.GetModel(DingID);
     this.lblDingID.Text      = model.DingID.ToString();
     this.lblProName.Text     = model.ProName;
     this.lblProXingID.Text   = model.ProXingID.ToString();
     this.lblProTypeID.Text   = model.ProTypeID.ToString();
     this.lblDingNum.Text     = model.DingNum;
     this.lblDingAddress.Text = model.DingAddress;
     this.lblLinkPhoto.Text   = model.LinkPhoto;
     this.lblDingEmail.Text   = model.DingEmail;
     this.lblDingSex.Text     = model.DingSex?"ÊÇ":"·ñ";
     this.lblUsersName.Text   = model.UsersName;
     this.lblDingtime.Text    = model.Dingtime.ToString();
     this.lblDingcontent.Text = model.Dingcontent;
 }
        private void bind()
        {
            Maticsoft.BLL.DingProduct dingbll = new Maticsoft.BLL.DingProduct();
            int dingid = int.Parse(Request.QueryString["DingID"].ToString());

            Maticsoft.Model.DingProduct dingmodel = dingbll.GetModel(dingid);
            txtDingAddress.Text = dingmodel.DingAddress;
            txtDingcontent.Text = dingmodel.Dingcontent;
            txtDingEmail.Text   = dingmodel.DingEmail;
            txtDingNum.Text     = dingmodel.DingNum;

            txtLinkPhoto.Text             = dingmodel.LinkPhoto;
            txtProName.Text               = dingmodel.ProName;
            txtUsersName.Text             = dingmodel.UsersName;
            DrpProductXing.SelectedValue  = dingmodel.ProXingID.ToString();
            DrpProTypeTitle.SelectedValue = dingmodel.ProTypeID.ToString();
            DrpSex.SelectedValue          = dingmodel.DingSex.ToString();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.DingProduct dingbll = new Maticsoft.BLL.DingProduct();
            int dingid = int.Parse(Request.QueryString["DingID"].ToString());

            Maticsoft.Model.DingProduct dingmodel = dingbll.GetModel(dingid);
            if (txtUsersName.Text.Trim() == "")
            {
                lblUsersName.Text = "请填写用户名!";
                return;
            }
            dingmodel.UsersName = txtUsersName.Text.Trim();
            lblUsersName.Text   = "";
            if (txtDingAddress.Text.Trim() == "")
            {
                lblDingAddress.Text = "请您填写订货地址!";
                return;
            }
            dingmodel.DingAddress = txtDingAddress.Text.Trim();
            lblDingAddress.Text   = "";
            if (txtDingcontent.Text.Trim() == "")
            {
                lblDingContent.Text = "请填写订购描述!";
                return;
            }
            dingmodel.Dingcontent = txtDingcontent.Text.Trim();
            lblDingContent.Text   = "";
            if (txtDingEmail.Text.Trim() == "")
            {
                lblDingEmail.Text = "请填写订购邮箱!";
                return;
            }
            dingmodel.DingEmail = txtDingEmail.Text.Trim();
            lblDingEmail.Text   = "";
            if (txtDingNum.Text.Trim() == "")
            {
                lblNum.Text = "请填写订购数量!";
                return;
            }
            dingmodel.DingNum = txtDingNum.Text.Trim();
            lblNum.Text       = "";
            if (DrpSex.SelectedValue == "2")
            {
                Label1.Text = "请选择性别";
                return;
            }
            dingmodel.DingSex = DrpSex.SelectedIndex;
            Label1.Text       = "";

            dingmodel.Dingtime = Convert.ToDateTime(DateTime.Now.ToString());

            if (txtLinkPhoto.Text.Trim() == "")
            {
                lblLinkPhoto.Text = "请填写您的电话";
                return;
            }
            dingmodel.LinkPhoto = txtLinkPhoto.Text.Trim();
            lblLinkPhoto.Text   = "";
            if (txtProName.Text.Trim() == "")
            {
                lblProName.Text = "请填写产品名称!";
                return;
            }
            dingmodel.ProName   = txtProName.Text.Trim(); lblProName.Text = "";
            dingmodel.ProTypeID = int.Parse(DrpProTypeTitle.SelectedValue);
            if (DrpProductXing.SelectedValue == "")
            {
                lblxing.Text = "请选择您的产品型号";
                return;
            }
            else
            {
                dingmodel.ProXingID = int.Parse(DrpProductXing.SelectedValue);
                lblxing.Text        = "";
                dingbll.Update(dingmodel);
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>");
                bind();
            }
        }