Ejemplo n.º 1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Model.Get g = new Model.Get
            {
                Get_Site1     = this.txtSite1.Text,
                Get_Phone1    = this.txtPhone1.Text,
                Get_Site2     = this.txtSite2.Text,
                Get_Phone2    = this.txtPhone2.Text,
                Get_Site3     = this.txtSite3.Text,
                Get_Phone3    = this.txtPhone3.Text,
                Get_Image     = upFileName(this.FileUpload1, "../../upload/Get/"),
                Get_ProductId = Guid.Parse(this.ddlProductId.SelectedValue)
            };
            var       res = getSvc.Add(g);
            ReturnMsg rm  = res > 0
                ? new ReturnMsg()
            {
                Code    = StatusCode.OK,
                Message = "新增用户信息成功",
                Data    = null
            }
                : new ReturnMsg()
            {
                Code    = StatusCode.Error,
                Message = "新增用户信息失败",
                Data    = null
            };

            Session["Msg"] = rm; //用于传递执行信息的
            Response.Redirect("Get_List.aspx");
        }
Ejemplo n.º 2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string photo = upFileName(this.FileUpload1, "../../upload/Get/");

            Model.Get u = getSvc.GetGetById(Guid.Parse(this.hfId.Value));
            if (photo == "")
            {
                u.Get_Site1      = this.txtSite1.Text;
                u.Get_Phone1     = this.txtPhone1.Text;
                u.Get_Site2      = this.txtSite2.Text;
                u.Get_Phone2     = this.txtPhone2.Text;
                u.Get_Site3      = this.txtSite3.Text;
                u.Get_Phone3     = this.txtPhone3.Text;
                u.Get_ProductId  = Guid.Parse(this.ddlProductId.SelectedValue);
                u.Get_UpdateTime = DateTime.Now;
            }
            else
            {
                u.Get_Site1      = this.txtSite1.Text;
                u.Get_Phone1     = this.txtPhone1.Text;
                u.Get_Site2      = this.txtSite2.Text;
                u.Get_Phone2     = this.txtPhone2.Text;
                u.Get_Site3      = this.txtSite3.Text;
                u.Get_Phone3     = this.txtPhone3.Text;
                u.Get_Image      = photo;
                u.Get_ProductId  = Guid.Parse(this.ddlProductId.SelectedValue);
                u.Get_UpdateTime = DateTime.Now;
            }

            var       res = getSvc.Edit(u);
            ReturnMsg rm  = res > 0
                ? new ReturnMsg()
            {
                Code    = StatusCode.OK,
                Message = "编辑用户信息成功",
                Data    = null
            }
                : new ReturnMsg()
            {
                Code    = StatusCode.Error,
                Message = "编辑用户信息失败",
                Data    = null
            };

            Session["Msg"] = rm; //用于传递执行信息的
            Response.Redirect("Get_List.aspx");
        }