//保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_user_address", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
            BLL.user_address   bll   = new BLL.user_address();
            Model.user_address model = bll.GetModel(this.id);

            model.type       = Convert.ToInt32(txttype.Text);
            model.type_name  = Convert.ToString(txttype_name.Text);
            model.user_id    = Convert.ToInt32(txtuser_id.Text);
            model.name       = Convert.ToString(txtname.Text);
            model.mobile     = Convert.ToString(txtmobile.Text);
            model.tel        = Convert.ToString(txttel.Text);
            model.sheng      = Convert.ToString(txtsheng.Text);
            model.shi        = Convert.ToString(txtshi.Text);
            model.xian       = Convert.ToString(txtxian.Text);
            model.area       = Convert.ToString(txtarea.Text);
            model.address    = Convert.ToString(txtaddress.Text);
            model.postcode   = Convert.ToString(txtpostcode.Text);
            model.IDCard     = Convert.ToString(txtIDCard.Text);
            model.is_default = Convert.ToInt32(txtis_default.Text);
            model.add_time   = Convert.ToDateTime(txtadd_time.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改收货地址信息,主键:" + id); //记录日志
                JscriptMsg("修改收货地址信息成功!", "Manage.aspx");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
 private void BindInfo()
 {
     BLL.user_address   bll   = new BLL.user_address();
     Model.user_address model = bll.GetModel(this.id);
     if (model == null)
     {
         JscriptMsg("信息不存在或已被删除!", "back");
         return;
     }
     txttype.Text       = model.type + "";
     txttype_name.Text  = model.type_name + "";
     txtuser_id.Text    = model.user_id + "";
     txtname.Text       = model.name + "";
     txtmobile.Text     = model.mobile + "";
     txttel.Text        = model.tel + "";
     txtsheng.Text      = model.sheng + "";
     txtshi.Text        = model.shi + "";
     txtxian.Text       = model.xian + "";
     txtarea.Text       = model.area + "";
     txtaddress.Text    = model.address + "";
     txtpostcode.Text   = model.postcode + "";
     txtIDCard.Text     = model.IDCard + "";
     txtis_default.Text = model.is_default + "";
     txtadd_time.Text   = model.add_time + "";
 }
        private void BindData()
        {
            #region 组装查询条件
            string whereStr = " 1 = 1 ";
            string _keywords = keywords.Replace("'", "");

            if (!string.IsNullOrEmpty(_keywords))
            {
                if (Utils.IsSafeSqlString(_keywords))
                {
                    whereStr += " and (Title like  '%" + _keywords + "%')";
                }
                else
                {
                    JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", ""));
                    return;
                }                
            }
            #endregion

            this.page = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.user_address bll = new BLL.user_address();
            this.rptList.DataSource = bll.GetListByPage(whereStr, "ID DESC", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("Manage.aspx", "keywords={0}&page={1}", this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("_ybd_user_address", EnumCollection.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.user_address bll = new BLL.user_address();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             if (bll.Delete(id))
             {
                 sucCount += 1;
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(EnumCollection.ActionEnum.Delete.ToString(), "删除收货地址" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("Manage.aspx", "keywords={0}", this.keywords));
 }
Example #5
0
        public string GetSelectAddress(int addressid)
        {
            BLL.user_address art = new BLL.user_address();
            var info             = art.GetModel(addressid);

            // Vincent._Json json = new _Json();


            return(ObjectToJSON(info));
        }
Example #6
0
        private void ShowInfo(int _id)
        {
            BLL.user_address   bll   = new BLL.user_address();
            Model.user_address model = bll.GetModel(_id);

            txtNickName.Text = model.nick_name;
            txtTelphone.Text = model.telphone;
            txtMobile.Text   = model.mobile;
            txtAddress.Text  = model.address;
            txtPost.Text     = model.post_code;
            txtCity.Text     = model.city;
        }
Example #7
0
        public string GetAddress1(string userid)
        {
            string outresult = "";

            BLL.user_address bll = new BLL.user_address();
            DataTable        dt  = bll.GetList(1, "user_id=" + userid, "is_default desc").Tables[0];

            if (dt != null)
            {
                return(CreateJsonParameters(dt));
            }
            else
            {
                return(outresult = "n");
            }
        }
Example #8
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.user_address   bll   = new BLL.user_address();
            Model.user_address model = bll.GetModel(_id);
            model.address   = txtAddress.Text.Trim();;
            model.mobile    = txtMobile.Text.Trim();
            model.nick_name = txtNickName.Text.Trim();
            model.telphone  = txtTelphone.Text.Trim();
            model.city      = txtCity.Text.Trim();
            model.post_code = txtPost.Text.Trim();
            if (bll.Update(model))
            {
                result = true;
            }

            return(result);
        }
Example #9
0
        private bool DoAdd()
        {
            bool result = false;

            Model.user_address model     = new Model.user_address();
            BLL.user_address   bll       = new BLL.user_address();
            Model.users        userModel = new Web.UI.BasePage().GetUserInfo();
            model.address   = txtAddress.Text;
            model.is_check  = 0;
            model.mobile    = txtMobile.Text.Trim();
            model.telphone  = txtTelphone.Text.Trim();
            model.user_name = userModel.user_name;
            model.nick_name = txtNickName.Text.Trim();
            model.city      = txtCity.Text.Trim();
            model.post_code = txtPost.Text.Trim();
            if (bll.Add(model) > 0)
            {
                result = true;
            }
            return(result);
        }
Example #10
0
        public string addAddress(int userid, string name, string province, string city, string area, string street, int zipcode, string tel)
        {
            string returnvalue = "";

            Model.user_address addressModel = new Model.user_address();
            BLL.user_address   addressBll   = new BLL.user_address();

            addressModel.user_id    = userid;
            addressModel.acceptName = name;
            addressModel.provinces  = province;
            addressModel.citys      = city;
            addressModel.area       = area;
            addressModel.street     = street;
            addressModel.mobile     = tel;
            addressModel.add_time   = DateTime.Now;
            addressModel.postcode   = zipcode;
            //执行新增操作
            if (addressBll.Add(addressModel) > 0)
            {
                return(returnvalue = "{\"info\":\"新增收货地址成功!\", \"status\":1}");
            }
            return(returnvalue = "{\"info\":\"新增收货地址失败!\", \"status\":0}");
        }
Example #11
0
        public string SubmitOrder(string goods, string addressId, string expressId, string totalprice, string bill_type, string bill_rise, string down_order, string coupon_no, string store_name, string store_address, string store_id, string user_id, string remark)
        {
            string returnvalue = "";

            Model.orders model = new Model.orders();
            BLL.orders   bll   = new BLL.orders();

            //验证优惠券
            var j = 0;

            BLL.user_coupon   couponbll = new BLL.user_coupon();
            Model.user_coupon coupon    = null;
            if (coupon_no != "")
            {
                coupon = couponbll.GetModel(" str_code='" + coupon_no + "'");
                if (coupon == null)
                {
                    j = 1;
                }
                else
                {
                    if (DateTime.Compare(coupon.end_time, DateTime.Now) <= 0)
                    {
                        j = 2;
                    }
                    if (coupon.status == 2)
                    {
                        j = 3;
                    }
                }
            }
            if (j == 1)
            {
                return(returnvalue = "{\"status\":0,\"msg\":\"优惠券编码输入有误!\"}");
            }
            if (j == 2)
            {
                return(returnvalue = "{\"status\":0,\"msg\":\"优惠券已经过期!\"}");
            }
            if (j == 3)
            {
                return(returnvalue = "{\"status\":0,\"msg\":\"优惠券已使用!\"}");
            }

            BLL.users   bll1     = new BLL.users();
            Model.users userinfo = bll1.GetModel(int.Parse(user_id));

            if (addressId != "0")//快递收货
            {
                //订单信息
                Model.user_address modelAddress = new BLL.user_address().GetModel(int.Parse(addressId));
                Model.express      modelExpress = new BLL.express().GetModel(int.Parse(expressId));

                model.order_no       = CreateOrderNo();
                model.accept_name    = modelAddress.acceptName;
                model.area           = modelAddress.id.ToString();
                model.mobile         = modelAddress.mobile;
                model.address        = modelAddress.address;
                model.post_code      = modelAddress.postcode.ToString();
                model.add_time       = DateTime.Now;
                model.user_id        = userinfo.id;
                model.user_name      = userinfo.user_name;
                model.express_id     = int.Parse(expressId);
                model.express_fee    = modelExpress.express_fee;
                model.express_status = 1;
                model.status         = 1;
                decimal real_amount = Decimal.Parse(totalprice) - modelExpress.express_fee;
                model.real_amount  = real_amount;
                model.order_amount = Decimal.Parse(totalprice);
                model.bill_type    = int.Parse(bill_type);
                if (int.Parse(bill_type) != 0)
                {
                    model.is_bill = 1;
                }
                model.invoice_rise = bill_rise;
                model.down_order   = down_order;
                model.remark       = remark;
            }
            else
            {
                //订单信息
                Model.express modelExpress = new BLL.express().GetModel(int.Parse(expressId));


                model.order_no       = CreateOrderNo();
                model.add_time       = DateTime.Now;
                model.user_id        = userinfo.id;
                model.user_name      = userinfo.user_name;
                model.express_id     = int.Parse(expressId);
                model.express_fee    = modelExpress.express_fee;
                model.express_status = 1;
                model.status         = 1;
                decimal real_amount = Decimal.Parse(totalprice) - modelExpress.express_fee;
                model.real_amount  = real_amount;
                model.order_amount = Decimal.Parse(totalprice);
                model.bill_type    = int.Parse(bill_type);
                if (int.Parse(bill_type) != 0)
                {
                    model.is_bill = 1;
                }
                model.invoice_rise  = bill_rise;
                model.down_order    = down_order;
                model.store_name    = store_name;
                model.store_address = store_address;
                model.store_id      = int.Parse(store_id);
                model.remark        = remark;
            }

            var k = 0;
            var p = 0;

            if (coupon != null)
            {
                decimal payamount = Decimal.Parse(totalprice) - coupon.amount;
                if (payamount > 0)
                {
                    model.payable_amount = payamount;//实付款
                    model.str_code       = coupon_no;
                }
                else
                {
                    model.payable_amount = 0M;//实付款
                    model.str_code       = coupon_no;
                    model.status         = 2;
                    model.payment_status = 2;
                    p = bll.Add(model);
                    k = 1;
                }
            }



            ////商品信息value="<%#Eval("id") %>|<%#Eval("type") %>|<%#Eval("price") %>|<%#Eval("quantity") %>|<%#Eval("weight") %>|<%#Eval("img_url") %>"

            List <Model.order_goods> list = new List <Model.order_goods>();

            string[] strArr = Vincent._DTcms.Utils.DelLastChar(goods, "&").Split('&');
            foreach (var item in strArr)
            {
                string[]          strArr2    = item.Split('|');
                Model.order_goods modelGoods = new Model.order_goods();
                modelGoods.goods_id    = int.Parse(strArr2[0].ToString());
                modelGoods.goods_price = decimal.Parse(strArr2[1].ToString());
                modelGoods.quantity    = int.Parse(strArr2[2].ToString());
                modelGoods.goods_pic   = strArr2[3].ToString();
                modelGoods.goods_title = strArr2[4].ToString();
                list.Add(modelGoods);
            }

            model.order_goods = list;
            int orderId = bll.Add(model);


            //优惠券使用记录
            BLL.user_coupon_log   cbll   = new BLL.user_coupon_log();
            Model.user_coupon_log cmodel = new Model.user_coupon_log();
            if (coupon != null)
            {
                cmodel.user_id   = userinfo.id;
                cmodel.user_name = userinfo.user_name;
                cmodel.coupon_id = coupon.id;
                cmodel.str_code  = coupon.str_code;
                cmodel.order_id  = orderId;
                cmodel.order_no  = model.order_no;
                cmodel.add_time  = coupon.add_time;
                cmodel.use_time  = DateTime.Now;
                cmodel.status    = 1;
            }

            if (k == 1 && p > 0)
            {
                cmodel.status = 2;
                cbll.Add(cmodel);

                return(returnvalue = "{\"status\":3,\"msg\":\"订单提交成功!\"}");
            }

            if (orderId > 0)
            {
                if (coupon != null)
                {
                    cbll.Add(cmodel);
                }

                return(returnvalue = "{\"status\":1,\"msg\":\"订单提交成功,请付款!\",\"orderId\":" + orderId + "}");

                Web.UI.ShopCart.ClearCart("0");
            }
            else
            {
                if (coupon != null)
                {
                    cbll.Add(cmodel);
                }

                return(returnvalue = "{\"status\":0,\"msg\":\"订单提交失败,请重新提交订单!\"}");
            }
        }
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_user_address", EnumCollection.ActionEnum.Add.ToString()); //检查权限

            #region
            string strError = string.Empty;
            if (txttype.Text.Trim() == "" || txttype.Text.Trim().Length > 4)
            {
                strError += "地址类型id为空或超出长度![br]";
            }
            if (txttype_name.Text.Trim() == "" || txttype_name.Text.Trim().Length > 50)
            {
                strError += "地址类型名称为空或超出长度![br]";
            }
            if (txtuser_id.Text.Trim() == "" || txtuser_id.Text.Trim().Length > 4)
            {
                strError += "用户id为空或超出长度![br]";
            }
            if (txtname.Text.Trim() == "" || txtname.Text.Trim().Length > 50)
            {
                strError += "收货人姓名为空或超出长度![br]";
            }
            if (txtmobile.Text.Trim() == "" || txtmobile.Text.Trim().Length > 50)
            {
                strError += "手机号为空或超出长度![br]";
            }
            if (txttel.Text.Trim() == "" || txttel.Text.Trim().Length > 50)
            {
                strError += "联系电话为空或超出长度![br]";
            }
            if (txtsheng.Text.Trim() == "" || txtsheng.Text.Trim().Length > 50)
            {
                strError += "省为空或超出长度![br]";
            }
            if (txtshi.Text.Trim() == "" || txtshi.Text.Trim().Length > 50)
            {
                strError += "市为空或超出长度![br]";
            }
            if (txtxian.Text.Trim() == "" || txtxian.Text.Trim().Length > 50)
            {
                strError += "区县为空或超出长度![br]";
            }
            if (txtarea.Text.Trim() == "" || txtarea.Text.Trim().Length > 50)
            {
                strError += "区域为空或超出长度![br]";
            }
            if (txtaddress.Text.Trim() == "" || txtaddress.Text.Trim().Length > 100)
            {
                strError += "详细地址为空或超出长度![br]";
            }
            if (txtpostcode.Text.Trim() == "" || txtpostcode.Text.Trim().Length > 20)
            {
                strError += "邮政编码为空或超出长度![br]";
            }
            if (txtIDCard.Text.Trim() == "" || txtIDCard.Text.Trim().Length > 50)
            {
                strError += "身份证号为空或超出长度![br]";
            }
            if (txtis_default.Text.Trim() == "" || txtis_default.Text.Trim().Length > 4)
            {
                strError += "是否是默认地址为空或超出长度![br]";
            }
            if (txtadd_time.Text.Trim() == "" || txtadd_time.Text.Trim().Length > 8)
            {
                strError += "添加时间为空或超出长度![br]";
            }

            if (strError != string.Empty)
            {
                JscriptMsg(strError, "", "Error");
                return;
            }
            #endregion

            Model.user_address model = new Model.user_address();
            BLL.user_address   bll   = new BLL.user_address();

            model.type       = Convert.ToInt32(txttype.Text);
            model.type_name  = Convert.ToString(txttype_name.Text);
            model.user_id    = Convert.ToInt32(txtuser_id.Text);
            model.name       = Convert.ToString(txtname.Text);
            model.mobile     = Convert.ToString(txtmobile.Text);
            model.tel        = Convert.ToString(txttel.Text);
            model.sheng      = Convert.ToString(txtsheng.Text);
            model.shi        = Convert.ToString(txtshi.Text);
            model.xian       = Convert.ToString(txtxian.Text);
            model.area       = Convert.ToString(txtarea.Text);
            model.address    = Convert.ToString(txtaddress.Text);
            model.postcode   = Convert.ToString(txtpostcode.Text);
            model.IDCard     = Convert.ToString(txtIDCard.Text);
            model.is_default = Convert.ToInt32(txtis_default.Text);
            model.add_time   = Convert.ToDateTime(txtadd_time.Text);

            int id = bll.Add(model);
            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加收货地址信息,主键:" + id); //记录日志
                JscriptMsg("添加收货地址信息成功!", "Manage.aspx", "");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }