Example #1
0
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     //ChkAdminLevel("address_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.address bll = new BLL.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(DTEnums.ActionEnum.Delete.ToString(), "删除收货地址" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!",
         Utils.CombUrlTxt("address_list.aspx", "user_id={0}", this.user_id.ToString()), "Success");
 }
Example #2
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            //ChkAdminLevel("address_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.address bll = new BLL.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(DTEnums.ActionEnum.Delete.ToString(), "删除收货地址" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!",
                       Utils.CombUrlTxt("address_list.aspx", "user_id={0}", this.user_id.ToString()), "Success");
        }
Example #3
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);

            BLL.address bll = new BLL.address();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("address_list.aspx", "user_id={0}&page={1}",
                                              this.user_id.ToString(), "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Example #4
0
 protected DataTable get_address_list(int pageSize, int pageIndex, string strWhere, string strorder, out int totalcount)
 {
     BLL.address bll = new BLL.address();
     return bll.GetList(pageSize, pageIndex, strWhere, strorder, out totalcount).Tables[0];
 }
Example #5
0
 protected DataTable get_address_list(int top,string strwhere,string strorder)
 {
     BLL.address bll = new BLL.address();
     return bll.GetList(top, strwhere, strorder).Tables[0];
 }
Example #6
0
        private void car_add_address(HttpContext context)
        {
            Model.users model = new BasePage().GetUserInfo();
            if (model == null)
            {
                context.Response.Write("Lost");
                return;
            }
            int province = DTRequest.GetFormInt("car_province");
            int city = DTRequest.GetFormInt("car_city");
            int district = DTRequest.GetFormInt("car_district");
            string address = DTRequest.GetFormString("car_address");
            string consignee = DTRequest.GetFormString("car_consignee");
            string consignee_mobile = DTRequest.GetFormString("car_consignee_mobile");
            string consignee_company = DTRequest.GetFormString("car_consignee_company");
            //非必填
            string zip_phone = DTRequest.GetFormString("car_zip_phone");
            string phone = DTRequest.GetFormString("car_phone");

            BLL.address bll = new BLL.address();
            Model.address model_address = new Model.address();
            model_address.user_id = model.id;
            model_address.province = province;
            model_address.city = city;
            model_address.distract = district;
            model_address.content = address;

            model_address.consignee = consignee;
            model_address.consignee_mobile = consignee_mobile;
            model_address.add_time = DateTime.Now;
            model_address.company_address = consignee_company;
            model_address.consignee_phone = zip_phone + "-" + phone;

            int new_id = bll.Add(model_address);
            if (new_id <= 0)
            {
                context.Response.Write("Error");
                return;
            }
            DataTable dt = bll.GetList("user_id=" + model.id).Tables[0];
            DataTable ret_dt = new DataTable();
            ret_dt.Columns.Add("id");
            ret_dt.Columns.Add("address");
            ret_dt.Columns.Add("selected");
            ret_dt.PrimaryKey = new DataColumn[] { ret_dt.Columns["id"] };

            foreach (DataRow dr in dt.Rows)
            {
                DataRow ret_dr = ret_dt.NewRow();
                ret_dr["id"] = dr["id"];
                string province1 = new BasePage().get_province_title(Convert.ToInt32(dr["province"]));
                string city1 = new BasePage().get_city_title(Convert.ToInt32(dr["city"]));
                string district1 = new BasePage().get_district_title(Convert.ToInt32(dr["distract"]));
                string address1 = dr["content"].ToString();
                string consignee1 = dr["consignee"].ToString();
                string consignee_mobile1 = dr["consignee_mobile"].ToString();
                string company_address = dr["company_address"].ToString();
                ret_dr["address"] = province1 + " " + city1 + " " + district1 + " " + address1 + "(公司地址:" + company_address + ")" + " " + consignee1 + ":" + consignee_mobile1;
                if (Convert.ToInt32(dr["id"]) == new_id)
                {
                    ret_dr["selected"] = 1;
                }
                else
                {
                    ret_dr["selected"] = 0;
                }
                ret_dt.Rows.Add(ret_dr);
            }

            if (ret_dt != null && ret_dt.Rows.Count > 0)
            {
                context.Response.Write(myJson.getJson(ret_dt));
                return;
            }
            else
            {
                context.Response.Write("Null");
                return;
            }
        }
Example #7
0
        private void add_order(HttpContext context)
        {
            int address_id = DTRequest.GetQueryInt("address");
            int freight_id = DTRequest.GetQueryInt("freight");
            string car_ids = DTRequest.GetQueryString("car_ids");

            Model.users model = new BasePage().GetUserInfo();
            if (model == null)
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"对不起,请重新登录!\"}");
                return;
            }

            //统计购物车
            BLL.express bll_express = new BLL.express();
            Model.express model_express = bll_express.GetModel(freight_id);
            if (model_express == null)
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"对不起,该配送方式不存在或已删除!\"}");
                return;
            }

            BLL.address bll_address = new BLL.address();
            Model.address model_address = bll_address.GetModel(address_id);
            if (model_address == null)
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"对不起,该收货信息不存在或已删除!\"}");
                return;
            }

            IList<Model.cart_items> iList = DTcms.Web.UI.ShopCart.GetList(model.group_id);
            if (iList == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,购物车为空,无法结算!\"}");
                return;
            }

            //保存订单=======================================================================
            Model.orders model_order = new Model.orders();

            model_order.order_no = "B" + Utils.GetOrderNumber(); //订单号B开头为商品订单
            model_order.user_id = model.id;
            model_order.user_name = model.user_name;
            model_order.payment_id = 0;
            model_order.express_id = model_express.id;
            model_order.accept_name = model_address.consignee;
            model_order.post_code = model_address.zipcode;
            model_order.telphone = model_address.consignee_phone;
            model_order.mobile = model_address.consignee_mobile;
            model_order.address = new BLL.province().GetModel(model_address.province).ProvinceName + "|" + new BLL.city().GetModel(model_address.city).CityName + "|" + new BLL.district().GetModel(model_address.distract).DistrictName + "|" + model_address.content;
            model_order.message = "";

            model_order.express_status = 1;
            model_order.express_fee = model_express.express_fee; //物流费用
            //如果是先款后货的话

            //购物积分,可为负数

            model_order.add_time = DateTime.Now;
            //商品详细列表
            decimal real_amount = 0;
            decimal payable_amount = 0;
            int total_point = 0;
            List<Model.order_goods> gls = new List<Model.order_goods>();
            BLL.standard bll_standard = new BLL.standard();
            foreach (Model.cart_items item in iList)
            {
                string[] arr_car_id = car_ids.Split('_');
                foreach (string str in arr_car_id)
                {

                    if ((item.id + "-" + item.standard + "-" + item.unit_id).Trim() == str)
                    {
                        //{   //40-1|红色,2|黑色_10-1|红色,2|黑色      商品ID-规格ID|规格值ID,规格ID|规格值ID-单位ID
                        //    string[] arr_good_standard=str.Split('-');
                        //    string str_standard = "";
                        //    foreach (string str1 in arr_good_standard)
                        //    {
                        //        BLL.standard bll_standard = new BLL.standard();
                        //        Model.standard model_standard = bll_standard.GetModel(Convert.ToInt32(str1.Split('|')[0]));
                        //        if (model_standard != null)
                        //        {
                        //            str_standard += model_standard.title + ":" + str1.Split('|')[1];
                        //        }
                        //    }
                        string str_standard = "";
                        //190-14|41-4650
                        string standard_title_id = "";
                        string standard_value_id = "";
                        Model.article model_good = new BLL.article().GetModel(item.id);
                        if (model_good == null)
                        {
                            return;
                        }
                        string good_no = model_good.fields["goods_no"];
                        //规格
                        if (!string.IsNullOrEmpty(item.standard))
                        {
                            string[] arr_standard = item.standard.Split(',');
                            for (int i = 0; i < arr_standard.Length; i++)
                            {
                                Model.standard model_standard = bll_standard.GetModel(Convert.ToInt32(arr_standard[i].Split('|')[0]));
                                Model.standard_value model_standard_value = new BLL.standard_value().GetModel(Convert.ToInt32(arr_standard[i].Split('|')[1]));
                                if (model_standard != null && model_standard_value != null)
                                {

                                    str_standard += model_standard.title + ":" + arr_standard[i].Split('|')[1] + ",";
                                    standard_title_id += model_standard.id + ",";
                                    standard_value_id += model_standard_value.id + ",";
                                }
                            }
                        }

                        if (!string.IsNullOrEmpty(standard_title_id) && !string.IsNullOrEmpty(standard_value_id))
                        {
                            DataTable dt_standard_value = new BLL.standard_price().GetList("good_id='" + item.id + "' and standard_ids='" + standard_title_id.Substring(0, standard_title_id.Length - 1) + "' and standard_value_ids='" + standard_value_id.Substring(0, standard_value_id.Length - 1) + "'").Tables[0];
                            if (dt_standard_value != null && dt_standard_value.Rows.Count == 1)
                            {
                                good_no = dt_standard_value.Rows[0]["good_no"].ToString();
                            }
                        }

                        real_amount += item.user_price * item.quantity;
                        payable_amount += item.price * item.quantity;
                        total_point += item.point * item.quantity;

                        BLL.unit bll_unit = new BLL.unit();
                        Model.unit model_unit = bll_unit.GetModel(item.unit_id);
                        string str_unit = "";
                        if (model_unit != null)
                        {
                            str_unit = model_unit.title;
                            if (!string.IsNullOrEmpty(model_unit.content))
                            {
                                str_unit += "(" + model_unit.content + ")";
                            }
                        }

                        gls.Add(new Model.order_goods { goods_id = item.id, good_no = good_no, goods_title = item.title, goods_price = item.price, real_price = item.user_price, quantity = item.quantity, point = item.point, standard = (string.IsNullOrEmpty(str_standard) ? "" : str_standard.Substring(0, str_standard.Length - 1)), unit_id = item.unit_id, unit = str_unit });
                    }
                }

            }

            model_order.payable_amount = payable_amount;
            model_order.real_amount = real_amount;
            model.point = total_point;
            //订单总金额=实付商品金额+运费+支付手续费
            model_order.order_amount = model_order.real_amount + model_order.express_fee + model_order.payment_fee;
            model_order.order_goods = gls;
            int result = new BLL.orders().Add(model_order);
            if (result < 1)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"订单保存过程中发生错误,请重新提交!\"}");
                return;
            }
            else
            {
                string[] arr_car_id = car_ids.Split('_');
                foreach (string str in arr_car_id)
                {
                    //清空购物车
                    DTcms.Web.UI.ShopCart.Clear(str);
                }
                context.Response.Write("{\"status\":1, \"msg\":\"提交订单成功!\",\"order_no\":\"" + model_order.order_no + "\",\"order_money\":\"" + model_order.order_amount + "\",\"user_money\":\"" + model.amount + "\",\"order_id\":\"" + result + "\"}");
                return;
            }
        }
Example #8
0
        private void save_user_info(HttpContext context)
        {
            string nick_name = DTRequest.GetFormString("nick_name");
            string email = DTRequest.GetFormString("email");
            string mobile = DTRequest.GetFormString("mobile");
            string sex = DTRequest.GetFormString("sex");
            string txtBirthday = DTRequest.GetFormString("txtBirthday");
            int province = DTRequest.GetFormInt("province");
            int city = DTRequest.GetFormInt("city");
            int district = DTRequest.GetFormInt("district");
            string address = DTRequest.GetFormString("address");

            string purchase = DTRequest.GetFormString("purchase");
            string purchase_mobile = DTRequest.GetFormString("purchase_mobile");

            Model.users model = new BasePage().GetUserInfo();
            if (model == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请重新登录!\"}");
                return;
            }
            BLL.users bll = new BLL.users();

            model.nick_name = nick_name;
            model.email = email;
            model.mobile = mobile;
            if (!string.IsNullOrEmpty(sex))
            {
                model.sex = sex;
            }
            else
            {
                model.sex = "保密";
            }
            if (!string.IsNullOrEmpty(txtBirthday))
            {
                model.birthday = Convert.ToDateTime(txtBirthday);
            }
            model.province = province;
            model.city = city;
            model.district = district;
            model.address = address;
            model.purchase = purchase;
            model.purchase_mobile = purchase_mobile;
            if (bll.Update(model))
            {
                BLL.address bll_address = new BLL.address();
                if (bll_address.GetList("user_id=" + model.id).Tables[0].Rows.Count <= 0)
                {
                    Model.address model_address = new Model.address();

                    if (model.user_type == 2)
                    {
                        model_address.consignee = purchase;
                        model_address.consignee_mobile = purchase_mobile;
                    }
                    else
                    {
                        model_address.consignee = nick_name;
                        model_address.consignee_mobile = mobile;
                    }
                    model_address.user_id = model.id;
                    model_address.province = model.province;
                    model_address.city = model.city;
                    model_address.distract = model.district;
                    model_address.content = model.address;
                    model_address.add_time = DateTime.Now;

                    bll_address.Add(model_address);
                }
                context.Response.Write("{\"status\":1, \"msg\":\"保存成功!\"}");
                return;
            }
            else
            {
                context.Response.Write("{\"status\":0, \"msg\":\"保存失败!\"}");
                return;
            }
        }
Example #9
0
        private void save_address(HttpContext context)
        {
            int id = DTRequest.GetQueryInt("id");

            int province = DTRequest.GetFormInt("province");
            int city = DTRequest.GetFormInt("city");
            int district = DTRequest.GetFormInt("district");
            string address = DTRequest.GetFormString("address");
            string zipcode = DTRequest.GetFormString("zipcode");
            string consignee = DTRequest.GetFormString("consignee");
            string consignee_mobile = DTRequest.GetFormString("consignee_mobile");
            string company_address = DTRequest.GetFormString("consignee_company");
            //非必填
            string zip_phone = DTRequest.GetFormString("zip_phone");
            string phone = DTRequest.GetFormString("phone");

            Model.users model = new BasePage().GetUserInfo();
            if (model == null)
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"对不起,请重新登录!\"}");
                return;
            }

            BLL.address bll = new BLL.address();
            Model.address model_address = bll.GetModel(id);
            if (model_address == null)
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"当前内容不存在或已删除!\"}");
                return;
            }

            model_address.province = province;
            model_address.city = city;
            model_address.distract = district;
            model_address.content = address;

            model_address.consignee = consignee;
            model_address.consignee_mobile = consignee_mobile;
            model_address.company_address = company_address;
            model_address.consignee_phone = zip_phone + "-" + phone;
            model_address.zipcode = zipcode;

            if (bll.Update(model_address))
            {
                context.Response.Write("{\"status\":\"1\", \"msg\":\"修改收货地址成功!\"}");
                return;
            }
            else
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"修改收货地址失败!\"}");
                return;
            }
        }
Example #10
0
        private void add_address(HttpContext context)
        {
            int province = DTRequest.GetFormInt("province");
            int city = DTRequest.GetFormInt("city");
            int district = DTRequest.GetFormInt("district");
            string address = DTRequest.GetFormString("address");
            string zipcode = DTRequest.GetFormString("zipcode");
            string consignee = DTRequest.GetFormString("consignee");
            string consignee_mobile = DTRequest.GetFormString("consignee_mobile");
            string company_address = DTRequest.GetFormString("consignee_company");
            //非必填
            string zip_phone = DTRequest.GetFormString("zip_phone");
            string phone = DTRequest.GetFormString("phone");

            Model.users model = new BasePage().GetUserInfo();
            if (model == null)
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"对不起,请重新登录!\"}");
                return;
            }

            BLL.address bll = new BLL.address();
            Model.address model_address = new Model.address();
            model_address.user_id = model.id;
            model_address.province = province;
            model_address.city = city;
            model_address.distract = district;
            model_address.content = address;

            model_address.consignee = consignee;
            model_address.consignee_mobile = consignee_mobile;
            model_address.add_time = DateTime.Now;
            model_address.company_address = company_address;

            model_address.consignee_phone = zip_phone + "-" + phone;
            model_address.zipcode = zipcode;

            if (bll.Add(model_address) > 0)
            {
                context.Response.Write("{\"status\":\"1\", \"msg\":\"新增收货地址成功!\"}");
                return;
            }
            else
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"新增收货地址失败!\"}");
                return;
            }
        }
Example #11
0
        private void get_address(HttpContext context)
        {
            Model.users model = new BasePage().GetUserInfo();
            if (model == null)
            {
                context.Response.Write("Error");
                return;
            }

            BLL.address bll = new BLL.address();
            DataTable dt = bll.GetList("user_id=" + model.id).Tables[0];

            DataTable ret_dt = new DataTable();
            ret_dt.Columns.Add("id");
            ret_dt.Columns.Add("address");
            ret_dt.PrimaryKey = new DataColumn[] { ret_dt.Columns["id"] };

            foreach (DataRow dr in dt.Rows)
            {
                DataRow ret_dr = ret_dt.NewRow();
                ret_dr["id"] = dr["id"];
                string province = new BasePage().get_province_title(Convert.ToInt32(dr["province"]));
                string city = new BasePage().get_city_title(Convert.ToInt32(dr["city"]));
                string district = new BasePage().get_district_title(Convert.ToInt32(dr["distract"]));
                string address = dr["content"].ToString();
                string consignee = dr["consignee"].ToString();
                string consignee_mobile = dr["consignee_mobile"].ToString();
                string company_address = dr["company_address"].ToString();
                ret_dr["address"] = province + " " + city + " " + district + " " + address + "(公司地址:" + company_address + ")" + " " + consignee + ":" + consignee_mobile;

                ret_dt.Rows.Add(ret_dr);
            }

            if (ret_dt != null && ret_dt.Rows.Count > 0)
            {
                context.Response.Write(myJson.getJson(ret_dt));
                return;
            }
            else
            {
                context.Response.Write("Null");
                return;
            }
        }
Example #12
0
        private void del_address(HttpContext context)
        {
            int id = DTRequest.GetQueryInt("id");
            if (!new BasePage().IsUserLogin())
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"请先登录!\"}");
                return;
            }
            BLL.address bll_address = new BLL.address();
            if (!bll_address.Exists(id))
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"该地址不存在或已删除!\"}");
                return;
            }

            if (bll_address.Delete(id))
            {
                context.Response.Write("{\"status\":\"1\", \"msg\":\"删除成功!\"}");
                return;
            }
            else
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"删除失败!\"}");
                return;
            }
        }
Example #13
0
 protected DataTable get_address_list(int pageSize, int pageIndex, string strWhere, string strorder, out int totalcount)
 {
     BLL.address bll = new BLL.address();
     return(bll.GetList(pageSize, pageIndex, strWhere, strorder, out totalcount).Tables[0]);
 }
Example #14
0
 protected DataTable get_address_list(int top, string strwhere, string strorder)
 {
     BLL.address bll = new BLL.address();
     return(bll.GetList(top, strwhere, strorder).Tables[0]);
 }
Example #15
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);

            BLL.address bll = new BLL.address();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("address_list.aspx", "user_id={0}&page={1}",
                this.user_id.ToString(), "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }