Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request.QueryString["ProID"] != null)
         {
             if (Request.QueryString["ProID"].ToString() != "")
             {
                 int proid = int.Parse(Request.QueryString["ProID"].ToString());
                 Maticsoft.BLL.Product       probll    = new Maticsoft.BLL.Product();
                 Maticsoft.Model.Product     promodel  = probll.GetModel(proid);
                 Maticsoft.BLL.ProductType   typebll   = new Maticsoft.BLL.ProductType();
                 Maticsoft.Model.ProductType typemodel = typebll.GetModel(int.Parse(promodel.ProTypeID.ToString()));
                 Maticsoft.BLL.ProductXing   xingbll   = new Maticsoft.BLL.ProductXing();
                 Maticsoft.Model.ProductXing xingmodel = xingbll.GetModel(int.Parse(promodel.ProXingID.ToString()));
                 lblFatime.Text = Convert.ToDateTime(promodel.Fatime.ToString()).ToString("yyyy-MM-dd");
                 int hitnum = 0;
                 if (promodel.HitNum != null)
                 {
                     promodel.HitNum = promodel.HitNum + 1;
                     probll.Update(promodel);
                     lblHitNum.Text = promodel.HitNum.ToString();
                 }
                 else
                 {
                     promodel.HitNum = 1;
                     probll.Update(promodel);
                     lblHitNum.Text = promodel.HitNum.ToString();
                 }
                 lblProcontent.Text   = promodel.Procontent;
                 lblProName.Text      = promodel.ProName;
                 lblProName1.Text     = promodel.ProName;
                 lblProTypeTitle.Text = typemodel.ProTypeTitle;
                 lblProXingTitle.Text = xingmodel.ProXingTitle;
                 ImgImageURL.ImageUrl = promodel.ImageURL;
             }
             else
             {
                 Response.Redirect("product.aspx");
             }
         }
         else
         {
             Response.Redirect("product.aspx");
         }
     }
 }
Ejemplo n.º 2
0
        protected void btnok_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.Product probll = new Maticsoft.BLL.Product();
            int index = int.Parse(Request.QueryString["ProID"].ToString());

            Maticsoft.Model.Product promodel = probll.GetModel(index);
            promodel.Toujian = 1;
            probll.Update(promodel);
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<scripe>alert('推荐成功....')</script>");
            bind();
        }
Ejemplo n.º 3
0
        protected void btnok_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.Product probll = new Maticsoft.BLL.Product();
            int index = int.Parse(Request.QueryString["ProID"].ToString());

            Maticsoft.Model.Product promodel = probll.GetModel(index);
            if (txtprotitle.Text.Trim() == "")
            {
                lbltitle.Text = "请填写产品名称";
                return;
            }
            promodel.ProName = txtprotitle.Text.Trim();
            lbltitle.Text    = "";
            try
            {
                promodel.ProTypeID = int.Parse(drptype.SelectedValue);
            }
            catch (Exception e1)
            { }
            try
            {
                promodel.ProXingID = int.Parse(drpxing.SelectedValue);
            }
            catch (Exception e2)
            { }
            if (txttme.Text.Trim() == "")
            {
                lblprotime.Text = "请填写产品出品时间";
                return;
            }
            promodel.Prochutime = Convert.ToDateTime(txttme.Text.Trim());
            lblprotime.Text     = "";
            if (txtfatime.Text.Trim() == "")
            {
                lbltime.Text = "请填写发布时间";
                return;
            }
            promodel.Fatime     = Convert.ToDateTime(txtfatime.Text.Trim());
            lbltime.Text        = "";
            promodel.ImageURL   = Image1.ImageUrl;
            promodel.Procontent = txtprocontent.Text.Trim();
            probll.Update(promodel);
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>");
            bind();
        }
Ejemplo n.º 4
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtProName.Text.Trim().Length == 0)
            {
                strErr += "ProName不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtProTypeID.Text))
            {
                strErr += "ProTypeID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtProXingID.Text))
            {
                strErr += "ProXingID格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtProchutime.Text))
            {
                strErr += "Prochutime格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtFatime.Text))
            {
                strErr += "Fatime格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtHitNum.Text))
            {
                strErr += "HitNum格式错误!\\n";
            }
            if (this.txtProcontent.Text.Trim().Length == 0)
            {
                strErr += "Procontent不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      ProID      = int.Parse(this.lblProID.Text);
            string   ProName    = this.txtProName.Text;
            int      ProTypeID  = int.Parse(this.txtProTypeID.Text);
            int      ProXingID  = int.Parse(this.txtProXingID.Text);
            DateTime Prochutime = DateTime.Parse(this.txtProchutime.Text);
            DateTime Fatime     = DateTime.Parse(this.txtFatime.Text);
            bool     Toujian    = this.chkToujian.Checked;
            int      HitNum     = int.Parse(this.txtHitNum.Text);
            string   Procontent = this.txtProcontent.Text;


            Maticsoft.Model.Product model = new Maticsoft.Model.Product();
            model.ProID      = ProID;
            model.ProName    = ProName;
            model.ProTypeID  = ProTypeID;
            model.ProXingID  = ProXingID;
            model.Prochutime = Prochutime;
            model.Fatime     = Fatime;
            model.Toujian    = Toujian;
            model.HitNum     = HitNum;
            model.Procontent = Procontent;

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