Esempio n. 1
0
        public static string TotalFreight(int Distribution, float ProductWeight,float ProductPrice,int ProductCount)
        {
            ShowShop.BLL.SystemInfo.PostArea pabll = new ShowShop.BLL.SystemInfo.PostArea();
            ShowShop.Model.SystemInfo.PostArea pamodel = pabll.GetModelID(Distribution);
            double freight = 0;
            if (pamodel != null)
            {
                switch (pamodel.Deliverymode)
                {
                    case 2:
                        if (pamodel.Freeamount >= ProductPrice)
                        {
                            freight = Convert.ToDouble(pamodel.Basicfees);
                        }
                        break;
                    case 3:
                        if (pamodel.Freeamount >= ProductPrice)
                        {
                            if (pamodel.Feescalculationway == 1)
                            {
                                if (ProductWeight <= 500)
                                {
                                    freight = pamodel.Basicfees;
                                }
                                else if (ProductWeight > 500)
                                {
                                    int freightCount = Convert.ToInt32(ProductWeight / 500);
                                    if (ProductWeight % 500 != 0)
                                    {
                                        freightCount = freightCount + 1;
                                    }
                                    freight = pamodel.Overweight * (freightCount - 1);
                                }
                            }
                            else
                            {
                                freight = pamodel.Initialfees * ProductCount;
                            }
                        }

                        break;
                    case 4:
                        if (pamodel.Freeamount >= ProductPrice)
                        {
                            freight = Convert.ToDouble(pamodel.Basicfees);
                        }
                        break;
                    case 6:
                        if (pamodel.Freeamount >= ProductPrice)
                        {
                            if (pamodel.Feescalculationway == 1)
                            {
                                if (ProductWeight <= 1000)
                                {
                                    freight = Convert.ToDouble(pamodel.Basicfees);
                                }
                                else if (ProductWeight <= 5000 && 1000 < ProductWeight)
                                {
                                    int freightCount = Convert.ToInt32(ProductWeight / 500);
                                    if (ProductWeight % 500 != 0)
                                    {
                                        freightCount = freightCount + 1;
                                    }
                                    freight = pamodel.Overweight * (freightCount - 1);
                                }
                                else if (ProductWeight > 5000)
                                {
                                    int freightCount = Convert.ToInt32(ProductWeight / 500);
                                    if (ProductWeight % 500 != 0)
                                    {
                                        freightCount = freightCount + 1;
                                    }
                                    freight = pamodel.Overweight2 * (freightCount - 1);
                                }
                            }
                            else
                            {
                                freight = pamodel.Initialfees * ProductCount;
                            }
                        }
                        break;
                    case 7:
                        if (pamodel.Freeamount >= ProductPrice)
                        {
                            if (pamodel.Feescalculationway == 1)
                            {
                                if (ProductWeight <= 1000)
                                {
                                    freight = Convert.ToDouble(pamodel.Basicfees + pamodel.Packagingcosts);
                                }
                                else if (ProductWeight <= 5000 && 1000 < ProductWeight)
                                {
                                    int freightCount = Convert.ToInt32(ProductWeight / 1000);
                                    if (ProductWeight % 1000 != 0)
                                    {
                                        freightCount = freightCount + 1;
                                    }
                                    freight = (pamodel.Overweight * (freightCount - 1)) + pamodel.Packagingcosts;
                                }
                                else if (ProductWeight > 5000)
                                {
                                    int freightCount = Convert.ToInt32(ProductWeight / 1000);
                                    if (ProductWeight % 1000 != 0)
                                    {
                                        freightCount = freightCount + 1;
                                    }
                                    freight = (pamodel.Overweight2 * (freightCount - 1)) + pamodel.Packagingcosts;
                                }
                            }
                            else
                            {
                                freight = pamodel.Initialfees * ProductCount;
                            }
                        }
                        break;
                    case 8:
                        if (pamodel.Freeamount >= ProductPrice)
                        {
                            if (pamodel.Feescalculationway == 1)
                            {
                                if (ProductWeight <= 1000)
                                {
                                    freight = pamodel.Basicfees;
                                }
                                else if (ProductWeight > 1000)
                                {
                                    int freightCount = Convert.ToInt32(ProductWeight / 1000);
                                    if (ProductWeight % 1000 != 0)
                                    {
                                        freightCount = freightCount + 1;
                                    }
                                    freight = pamodel.Overweight * (freightCount - 1);
                                }
                            }
                            else
                            {
                                freight = pamodel.Initialfees * ProductCount;
                            }
                        }
                        break;
                    case 9:
                        if (pamodel.Freeamount >= ProductPrice)
                        {
                            if (pamodel.Feescalculationway == 1)
                            {
                                if (ProductWeight <= 1000)
                                {
                                    freight = pamodel.Basicfees;
                                }
                                else if (ProductWeight > 1000)
                                {
                                    int freightCount = Convert.ToInt32(ProductWeight / 1000);
                                    if (ProductWeight % 1000 != 0)
                                    {
                                        freightCount = freightCount + 1;
                                    }
                                    freight = pamodel.Overweight * (freightCount - 1);
                                }
                            }
                            else
                            {
                                freight = pamodel.Initialfees * ProductCount;
                            }
                        }
                        break;
                    case 10:
                        if (pamodel.Freeamount >= ProductPrice)
                        {
                            if (pamodel.Feescalculationway == 1)
                            {
                                if (ProductWeight <= 1000)
                                {
                                    freight = pamodel.Basicfees;
                                }
                                else if (ProductWeight > 1000)
                                {
                                    freight = pamodel.Basicfees + pamodel.Overweight;
                                }
                            }
                            else
                            {
                                freight = pamodel.Initialfees * ProductCount;
                            }
                        }
                        break;
                    case 11:
                        if (pamodel.Freeamount >= ProductPrice)
                        {
                            if (pamodel.Feescalculationway == 1)
                            {
                                if (ProductWeight <= 1000)
                                {
                                    freight = pamodel.Basicfees;
                                }
                                else if (ProductWeight > 1000)
                                {
                                    int freightCount = Convert.ToInt32(ProductWeight / 1000);
                                    if (ProductWeight % 1000 != 0)
                                    {
                                        freightCount = freightCount + 1;
                                    }
                                    freight = pamodel.Overweight * (freightCount - 1);
                                }
                            }
                            else
                            {
                                freight = pamodel.Initialfees * ProductCount;
                            }
                        }
                        break;
                }

            }
            return freight.ToString("f2");
        }
 private string Courier(int id)
 {
     string reStr = string.Empty;
     ShowShop.BLL.SystemInfo.PostArea bll = new ShowShop.BLL.SystemInfo.PostArea();
     ShowShop.Model.SystemInfo.PostArea model = bll.GetModelByAreaID(id);
     if (model != null)
     {
         if (model.Deliverymode > 0)
         {
             ShowShop.BLL.SystemInfo.Deliver dbll = new ShowShop.BLL.SystemInfo.Deliver();
             ShowShop.Model.SystemInfo.Deliver dmodel = dbll.GetModelByID(model.Deliverymode);
             if (dmodel != null)
             {
                 reStr = dmodel.Distributionname;
             }
         }
     }
     return reStr;
 }
Esempio n. 3
0
 //<summary>
 //删除
 //</summary>
 //<param name="id"></param>
 private void Del(int id)
 {
     ShowShop.BLL.SystemInfo.PostArea bll = new ShowShop.BLL.SystemInfo.PostArea();
     bll.Delete(id);
     Response.Write("ok");
 }
Esempio n. 4
0
        ///// <summary>
        ///// 列表
        ///// </summary>
        ///// <returns></returns>
        protected string GetList()
        {
            ChangeHope.WebPage.Table table = new ChangeHope.WebPage.Table();
            ShowShop.BLL.SystemInfo.PostArea bll = new ShowShop.BLL.SystemInfo.PostArea();

            ChangeHope.DataBase.DataByPage dataPage=null;

            //从url获取配送方式ID
            idform = ChangeHope.WebPage.PageRequest.GetQueryInt("delivermode");
            this.HyperLink1.NavigateUrl = "deliver_edit.aspx?delivermode=" + idform.ToString();
            if (idform != 0 && idform != -1)
            {
                dataPage = bll.GetAreasByPostMethod(this.idform);

            }
            else
            {
                dataPage = bll.GetAreasByPostMethod(this.idform);
            }

            //第一步先添加表头
            table.AddHeadCol("5%", "序号");
            table.AddHeadCol("20%", "配送区域名称");
            table.AddHeadCol("18%", "配送方式");
            table.AddHeadCol("", "配送区域");
            table.AddHeadCol("", "发布人");
            table.AddHeadCol("10%", "操作");
            table.AddRow();
            //添加表的内容
            if (dataPage.DataReader != null)
            {
                int curpage = ChangeHope.WebPage.PageRequest.GetInt("pageindex");
                if (curpage < 0)
                {
                    curpage = 1;
                }
                int count = 0;
                while (dataPage.DataReader.Read())
                {
                    count++;
                    string No = (15 * (curpage - 1) + count).ToString();
                    table.AddCol(No);
                    table.AddCol(dataPage.DataReader["AreaName"].ToString());
                    //根据ID查询配送方式名称
                    ShowShop.BLL.SystemInfo.Deliver deliverbll = new ShowShop.BLL.SystemInfo.Deliver();
                    ShowShop.Model.SystemInfo.Deliver modeldeli = deliverbll.GetModelByID(int.Parse(dataPage.DataReader["DeliveryMode"].ToString()));
                    table.AddCol(modeldeli.Distributionname);
                    //根据ID查询城市名称
                    ShowShop.BLL.SystemInfo.Provinces areaid = new ShowShop.BLL.SystemInfo.Provinces();
                    ShowShop.Model.SystemInfo.Provinces modelpro;
                    string citys = "";
                    string[] arr = dataPage.DataReader["AreaId"].ToString().Split(',');
                    foreach(string i in arr)
                    {
                        modelpro=areaid.GetModel(int.Parse(i));
                        citys += modelpro.CityName + "&nbsp;&nbsp;";
                    }
                    table.AddCol(citys);
                    string userName = "";
                    if (dataPage.DataReader["putouttyid"].ToString() == "0")
                    {
                        userName = "******";
                    }
                    else
                    {
                        if (dataPage.DataReader["putoutid"].ToString() != "")
                        {
                            ShowShop.BLL.Member.MemberAccount memberbll = new ShowShop.BLL.Member.MemberAccount();
                            ShowShop.Model.Member.MemberAccount member = memberbll.GetModel(Convert.ToInt32(dataPage.DataReader["putoutid"].ToString()));
                            if (member != null)
                            {
                                userName = "******" + member.UserId.ToString();
                            }
                        }
                    }
                    table.AddCol(userName);
                    table.AddCol(string.Format("<a href=deliver_edit.aspx?delivermode={0}&areaid={1}>编辑</a> <a href='javascript:void(0)' onclick='Del({1})'>删除</a>", dataPage.DataReader["DeliveryMode"].ToString(), dataPage.DataReader["Id"].ToString()));
                    table.AddRow();
                }

            }
            string view = table.GetTable() + dataPage.PageToolBar;
            dataPage.Dispose();
            dataPage = null;
            return view;
        }
Esempio n. 5
0
        protected void lbtnSave_Click(object sender, EventArgs e)
        {
            if (this.Request.Form["getid"] == "" || this.Request.Form["getid"] == null)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "MsgBox", "<script>alert('请选择所辖地区!');</script>");
                return;
            }
            ShowShop.BLL.SystemInfo.PostArea areabll = new ShowShop.BLL.SystemInfo.PostArea();
            ShowShop.Model.SystemInfo.PostArea area = new ShowShop.Model.SystemInfo.PostArea();
            urlid = ChangeHope.WebPage.PageRequest.GetQueryInt("delivermode");
            if (urlid != -1 && urlid != 0)
            {
                area.Deliverymode = urlid;
                area.Areaid = Request.Form["getid"].ToString();
                area.Putoutid = ViewState["PutoutID"] == null ? 0 : Convert.ToInt32(ViewState["PutoutID"].ToString());
                area.Putouttyid = ViewState["PutoutTypeID"] == null ? 0 : Convert.ToInt32(ViewState["PutoutTypeID"].ToString());
                switch(urlid)
                {
                    case 1:
                        area.Areaname = this.txtAreaName1.Text;
                        break;
                    case 2:
                        area.Areaname = this.txtAreaName2.Text;
                        area.Basicfees = float.Parse(this.txtBasicFees2.Text);
                        area.CODpayfees = float.Parse(this.txtCODPayFees2.Text);
                        area.Freeamount = float.Parse(this.txtFreeAmount2.Text);
                        break;
                    case 3:
                        area.Areaname = this.txtAreaName3.Text;

                        if (this.rdtype1.Checked)
                        {
                            area.Basicfees = float.Parse(this.txtBasicFrees3.Text);
                            area.Overweight = float.Parse(this.txtOverweight3.Text);
                            area.Feescalculationway = 1;
                        }
                        else
                        {
                            area.Initialfees = float.Parse(this.txtSingle3.Text);
                            area.Feescalculationway = 2;
                        }

                        area.Freeamount = float.Parse(this.txtFreeAmount3.Text);
                        break;
                    case 4:
                        area.Areaname = this.txtAreaName4.Text;
                        area.Basicfees = float.Parse(this.txtBasicFrees4.Text);
                        area.CODpayfees = float.Parse(this.txtCODPayFees4.Text);
                        area.Freeamount = float.Parse(this.txtFreeAmount4.Text);
                        break;
                    case 5:
                        area.Areaname = this.txtAreaName5.Text;
                        area.Freeamount = float.Parse(this.txtFreeAmount5.Text);
                        break;
                    case 6:
                        area.Areaname = this.txtAreaName6.Text;
                        if (this.rdtype3.Checked)
                        {
                            area.Basicfees = float.Parse(this.txtBasicFrees6.Text);
                            area.Overweight = float.Parse(this.txtOverweight6.Text);
                            area.Overweight2 = float.Parse(this.txtOverweight26.Text.Trim());
                            area.Feescalculationway = 1;
                        }
                        else
                        {
                            area.Initialfees = float.Parse(this.txtSingle6.Text);
                            area.Feescalculationway = 2;
                        }
                        area.Freeamount = float.Parse(this.txtFreeAmount6.Text);
                        break;
                    case 7:
                        area.Areaname = this.txtAreaName7.Text;
                        if (this.rdtype5.Checked)
                        {
                            area.Basicfees = float.Parse(this.txtBasicFrees7.Text);
                            area.Overweight = float.Parse(this.txtOverweight7.Text);
                            area.Overweight2 = float.Parse(this.txtOverweight27.Text);
                            area.Feescalculationway = 1;
                        }
                        else
                        {
                            area.Initialfees = float.Parse(this.txtSingle7.Text);
                            area.Feescalculationway = 2;
                        }
                        area.Freeamount = float.Parse(this.txtFreeAmount7.Text);
                        area.Packagingcosts = float.Parse(this.txtPackagingCosts7.Text);
                        break;
                    case 8:
                        area.Areaname = this.txtAreaName8.Text;
                        if (this.rdtype7.Checked)
                        {
                            area.Basicfees = float.Parse(this.txtBasicFrees8.Text);
                            area.Overweight = float.Parse(this.txtOverweight8.Text);
                            area.Feescalculationway = 1;
                        }
                        else
                        {
                            area.Initialfees = float.Parse(this.txtSingle8.Text);
                            area.Feescalculationway = 2;
                        }

                        area.Freeamount = float.Parse(this.txtFreeAmount8.Text);
                        break;
                    case 9:
                        area.Areaname = this.txtAreaName9.Text;
                        if (this.rdtype9.Checked)
                        {
                            area.Basicfees = float.Parse(this.txtBasicFrees9.Text);
                            area.Overweight = float.Parse(this.txtOverweight9.Text);
                            area.Feescalculationway = 1;
                        }
                        else
                        {
                            area.Initialfees = float.Parse(this.txtSingle9.Text);
                            area.Feescalculationway = 2;
                        }
                        area.Freeamount = float.Parse(this.txtFreeAmount9.Text);
                        break;
                    case 10:
                        area.Areaname = this.txtAreaName10.Text;
                        if (this.rdtype11.Checked)
                        {
                            area.Basicfees = float.Parse(this.txtBasicFrees10.Text);
                            area.Overweight = float.Parse(this.txtOverweight10.Text);
                            area.Feescalculationway = 1;
                        }
                        else
                        {
                            area.Initialfees = float.Parse(this.txtSingle10.Text);
                            area.Feescalculationway = 2;
                        }
                        area.Freeamount = float.Parse(this.txtFreeAmount10.Text);
                        area.CODpayfees = float.Parse(this.txtCODPayFees10.Text);
                        break;
                    case 11:
                        area.Areaname = this.txtAreaName11.Text;
                        if (this.rdtype11.Checked)
                        {
                            area.Basicfees = float.Parse(this.txtBasicFrees11.Text);
                            area.Overweight = float.Parse(this.txtOverweight11.Text);
                            area.Feescalculationway = 1;
                        }
                        else
                        {
                            area.Initialfees = float.Parse(this.txtSingle11.Text);
                            area.Feescalculationway = 2;
                        }
                        area.Freeamount = float.Parse(this.txtFreeAmount11.Text);
                        break;

                }

                areaid = ChangeHope.WebPage.PageRequest.GetQueryInt("areaid");
                if (areaid!=0 && areaid!= -1)
                {
                    area.Id = areaid;
                    areabll.Update(area);
                    ChangeHope.WebPage.BasePage.PageRight("修改成功!","area_list.aspx?delivermode="+area.Deliverymode.ToString());

                }
                else
                {
                    areabll.Add(area);
                }
                this.ltlMsg.Text = "操作成功,已保存该信息";
                this.pnlMsg.Visible = true;
                this.pnlMsg.CssClass = "actionOk";
            }
        }