Example #1
0
        public void Address_Add()
        {
            M_UserRecei model = new M_UserRecei();

            if (Mid > 0)
            {
                model = receBll.GetSelect(Mid, mu.UserID);
            }
            model.UserID = mu.UserID;
            model.Email  = mu.Email;
            //model.Provinces = Request.Form["province_dp"] + "|" + Request.Form["city_dp"] + "|" + Request.Form["county_dp"];
            //model.CityCode = Request.Form["province_dp"] + "|" + Request.Form["city_dp"] + "|" + Request.Form["county_dp"];
            //model.CityCode = province_dp.SelectedValue + " " + city_dp.ValueSelectedValue + " " + county_dp.SelectedValue;
            model.Provinces  = Request["pro_hid"];
            model.Street     = Request["Street_T"];
            model.Zipcode    = Request["ZipCode_T"];
            model.ReceivName = Request["ReceName_T"];
            model.MobileNum  = Request["MobileNum_T"];
            //model.phone = Request.Form["Area_T"] + "-" + Request.Form["Phone_T"];
            model.isDefault = DataConvert.CLng(Request["Def_chk"]);
            if (Mid > 0)
            {
                receBll.GetUpdate(model);
            }
            else
            {
                model.ID = receBll.GetInsert(model);
            }
            if (model.isDefault == 1)
            {
                receBll.SetDef(model.ID);
            }
            function.WriteSuccessMsg("保存地址成功!", "UserRecei"); return;
        }
        protected void SaveBtn_Click(object sender, EventArgs e)
        {
            M_UserInfo  mu       = buser.GetLogin();
            M_UserRecei model    = new M_UserRecei();
            bool        isupdate = false;

            if (Mid > 0)
            {
                model    = receBll.GetSelect(Mid, mu.UserID);
                isupdate = true;
            }
            model.UserID = mu.UserID;
            model.Email  = mu.Email;
            //model.Provinces = Request.Form["province_dp"] + "|" + Request.Form["city_dp"] + "|" + Request.Form["county_dp"];
            model.CityCode = Request.Form["province_dp"] + "|" + Request.Form["city_dp"] + "|" + Request.Form["county_dp"];
            //model.CityCode = province_dp.SelectedValue + " " + city_dp.ValueSelectedValue + " " + county_dp.SelectedValue;
            model.Provinces  = pro_hid.Value;
            model.Street     = Street_T.Text;
            model.Zipcode    = ZipCode_T.Text;
            model.ReceivName = ReceName_T.Text;
            model.MobileNum  = MobileNum_T.Text;
            model.phone      = Area_T.Text + "-" + Phone_T.Text;
            model.isDefault  = Def_chk.Checked ? 1 : 0;
            if (isupdate)
            {
                receBll.GetUpdate(model);
            }
            else
            {
                model.ID = receBll.GetInsert(model);
            }
            if (Def_chk.Checked)
            {
                receBll.SetDef(model.ID);
            }
            if (!string.IsNullOrEmpty(Request.QueryString["ReturnUrl"]))
            {
                function.WriteSuccessMsg("保存地址成功!", Request.QueryString["ReturnUrl"]);
            }
            else
            {
                function.Script(this, "Refresh()");
            }
        }