Beispiel #1
0
        private void btnEditShipper_Click(object sender, EventArgs e)
        {
            ShippersInfo shipper = new ShippersInfo {
                ShipperId   = this.shipperId,
                ShipperTag  = this.txtShipperTag.Text.Trim(),
                ShipperName = this.txtShipperName.Text.Trim()
            };

            if (!this.ddlReggion.GetSelectedRegionId().HasValue)
            {
                this.ShowMsg("请选择地区", false);
            }
            else
            {
                shipper.RegionId  = this.ddlReggion.GetSelectedRegionId().Value;
                shipper.Address   = this.txtAddress.Text.Trim();
                shipper.CellPhone = this.txtCellPhone.Text.Trim();
                shipper.TelPhone  = this.txtTelPhone.Text.Trim();
                shipper.Zipcode   = this.txtZipcode.Text.Trim();
                shipper.Remark    = this.txtRemark.Text.Trim();
                if (this.ValidationShipper(shipper))
                {
                    if (string.IsNullOrEmpty(shipper.CellPhone) && string.IsNullOrEmpty(shipper.TelPhone))
                    {
                        this.ShowMsg("手机号码和电话号码必填其一", false);
                    }
                    else if (SalesHelper.UpdateShipper(shipper))
                    {
                        this.ShowMsg("成功修改了一个发货信息", true);
                    }
                    else
                    {
                        this.ShowMsg("修改发货信息失败", false);
                    }
                }
            }
        }
Beispiel #2
0
        protected void EditShiper(object sender, System.EventArgs e)
        {
            int shipperId = 0;

            if (int.TryParse(((System.Web.UI.WebControls.LinkButton)sender).CommandArgument, out shipperId))
            {
                ShippersInfo shipper = SalesHelper.GetShipper(shipperId);
                if (shipper == null)
                {
                    base.GotoResourceNotFound();
                    return;
                }
                Globals.EntityCoding(shipper, false);
                string shipperTag = shipper.ShipperTag;
                this.txtShipperType.ClearSelection();
                if (shipperTag == "1")
                {
                    this.txtShipperType.Items[0].Selected = true;
                }
                if (shipperTag == "2")
                {
                    this.txtShipperType.Items[1].Selected = true;
                }
                if (shipperTag == "3")
                {
                    this.txtShipperType.Items[1].Selected = true;
                    this.txtShipperType.Items[0].Selected = true;
                }
                this.txtShipperName.Text = shipper.ShipperName;
                this.ddlReggion.SetSelectedRegionId(new int?(shipper.RegionId));
                this.txtAddress.Text  = shipper.Address;
                this.txtTelPhone.Text = shipper.TelPhone;
                this.ShipperId.Value  = shipperId.ToString();
                this.Task.Value       = "EDIT";
                this.editType.Text    = "修改发货地址信息";
            }
        }
Beispiel #3
0
        public bool AddShipper(ShippersInfo shipper)
        {
            StringBuilder builder = new StringBuilder();

            if (shipper.ShipperTag == "1")
            {
                builder.AppendLine("update Hishop_Shippers set ShipperTag='0' where ShipperTag='1' ;");
                builder.AppendLine("update Hishop_Shippers set ShipperTag='2' where ShipperTag='3' ;");
            }
            else if (shipper.ShipperTag == "2")
            {
                builder.AppendLine("update Hishop_Shippers set ShipperTag='0' where ShipperTag='2' ;");
                builder.AppendLine("update Hishop_Shippers set ShipperTag='1' where ShipperTag='3' ;");
            }
            else if (shipper.ShipperTag == "3")
            {
                builder.AppendLine("update Hishop_Shippers set ShipperTag='0' where ShipperTag='1' ;");
                builder.AppendLine("update Hishop_Shippers set ShipperTag='0' where ShipperTag='2' ;");
                builder.AppendLine("update Hishop_Shippers set ShipperTag='0' where ShipperTag='3' ;");
            }
            builder.AppendLine("IF EXISTS(select top 1 * from Hishop_Shippers where ShipperId=@ShipperId)").AppendLine("Begin").Append("UPDATE Hishop_Shippers SET ShipperTag=@ShipperTag, ShipperName=@ShipperName,").Append("RegionId=@RegionId, Address=@Address, CellPhone=@CellPhone,TelPhone=@TelPhone ").AppendLine("where ShipperId=@ShipperId;").AppendLine("End").AppendLine("ELSE").AppendLine("Begin").Append("INSERT INTO Hishop_Shippers (IsDefault, ShipperTag, ShipperName, RegionId, Address, CellPhone, TelPhone, Zipcode, Remark,wid)").AppendLine(" VALUES (@IsDefault, @ShipperTag, @ShipperName, @RegionId, @Address, @CellPhone, @TelPhone, @Zipcode, @Remark,@wid);").AppendLine("End");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(builder.ToString());

            this.database.AddInParameter(sqlStringCommand, "IsDefault", DbType.Boolean, shipper.IsDefault);
            this.database.AddInParameter(sqlStringCommand, "ShipperTag", DbType.String, shipper.ShipperTag);
            this.database.AddInParameter(sqlStringCommand, "ShipperName", DbType.String, shipper.ShipperName);
            this.database.AddInParameter(sqlStringCommand, "RegionId", DbType.Int32, shipper.RegionId);
            this.database.AddInParameter(sqlStringCommand, "Address", DbType.String, shipper.Address);
            this.database.AddInParameter(sqlStringCommand, "CellPhone", DbType.String, shipper.CellPhone);
            this.database.AddInParameter(sqlStringCommand, "TelPhone", DbType.String, shipper.TelPhone);
            this.database.AddInParameter(sqlStringCommand, "Zipcode", DbType.String, shipper.Zipcode);
            this.database.AddInParameter(sqlStringCommand, "Remark", DbType.String, shipper.Remark);
            this.database.AddInParameter(sqlStringCommand, "ShipperId", DbType.Int16, shipper.ShipperId);
            this.database.AddInParameter(sqlStringCommand, "wid", DbType.String, shipper.wid);
            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
Beispiel #4
0
        private void printdata()
        {
            this.mailNo = base.Request["mailNo"];
            int shipperId = int.Parse(base.Request["shipperId"]);

            this.orderIds = base.Request["orderIds"].Trim(',');
            string text = HttpContext.Current.Request.MapPath(string.Format("../../Storage/master/flex/{0}", base.Request["template"]));

            if (File.Exists(text))
            {
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.XmlResolver = null;
                xmlDocument.Load(text);
                XmlNode xmlNode = xmlDocument.DocumentElement.SelectSingleNode("//printer");
                this.templateName = xmlNode.SelectSingleNode("kind").InnerText;
                string innerText  = xmlNode.SelectSingleNode("pic").InnerText;
                string innerText2 = xmlNode.SelectSingleNode("size").InnerText;
                this.width  = innerText2.Split(':')[0];
                this.height = innerText2.Split(':')[1];
                DataSet printData = this.GetPrintData(this.orderIds);
                this.pringrows = printData.Tables[0].Rows.Count;
                foreach (DataRow row in printData.Tables[0].Rows)
                {
                    this.UpdateOrderIds = this.UpdateOrderIds + row["orderid"] + ",";
                    DataTable    dataTable = printData.Tables[1];
                    ShippersInfo shipper   = SalesHelper.GetShipper(shipperId);
                    string[]     array     = row["shippingRegion"].ToString().Split(',');
                    foreach (XmlNode item in xmlNode.SelectNodes("item"))
                    {
                        string   text2      = string.Empty;
                        string   innerText3 = item.SelectSingleNode("name").InnerText;
                        string   innerText4 = item.SelectSingleNode("position").InnerText;
                        string   text3      = innerText4.Split(':')[0];
                        string   text4      = innerText4.Split(':')[1];
                        string   text5      = innerText4.Split(':')[2];
                        string   text6      = innerText4.Split(':')[3];
                        string   str        = text6 + "," + text5 + "," + text3 + "," + text4;
                        string[] array2     = new string[3]
                        {
                            "",
                            "",
                            ""
                        };
                        if (shipper != null)
                        {
                            array2 = RegionHelper.GetFullRegion(shipper.RegionId, "-", true, 0).Split('-');
                        }
                        string text7 = string.Empty;
                        if (innerText3.Split('_')[0] == "收货人-姓名")
                        {
                            this.ShipTo = this.ShipTo + "'" + this.ReplaceString(row["ShipTo"].ToString()) + "',";
                            if (!string.IsNullOrEmpty(row["ShipTo"].ToString().Trim()))
                            {
                                this.SizeShipTo = this.SizeShipTo + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "收货人-电话")
                        {
                            this.ShipTelPhone = this.ShipTelPhone + "'" + row["TelPhone"].ToString() + "',";
                            if (!string.IsNullOrEmpty(row["TelPhone"].ToString().Trim()))
                            {
                                this.SizeShipTelPhone = this.SizeShipTelPhone + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "收货人-手机")
                        {
                            this.ShipCellPhone = this.ShipCellPhone + "'" + row["CellPhone"].ToString() + "',";
                            if (!string.IsNullOrEmpty(row["CellPhone"].ToString().Trim()))
                            {
                                this.SizeShipCellPhone = this.SizeShipCellPhone + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "收货人-邮编")
                        {
                            this.ShipZipCode = this.ShipZipCode + "'" + row["ZipCode"].ToString() + "',";
                            if (!string.IsNullOrEmpty(row["ZipCode"].ToString().Trim()))
                            {
                                this.SizeShipZipCode = this.SizeShipZipCode + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "收货人-地址")
                        {
                            this.ShipAddress = this.ShipAddress + "'" + this.ReplaceString(row["Address"].ToString()) + "',";
                            if (!string.IsNullOrEmpty(row["Address"].ToString().Trim()))
                            {
                                this.ShipSizeAddress = this.ShipSizeAddress + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "收货人-地区1级")
                        {
                            if (array.Length != 0)
                            {
                                text2 = array[0];
                            }
                            this.ShipProvince = this.ShipProvince + "'" + text2 + "',";
                            if (!string.IsNullOrEmpty(text2.Trim()))
                            {
                                this.ShipSizeProvnce = this.ShipSizeProvnce + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "收货人-地区2级")
                        {
                            text2 = string.Empty;
                            if (array.Length > 1)
                            {
                                text2 = array[1];
                            }
                            this.ShipCity = this.ShipCity + "'" + text2 + "',";
                            if (!string.IsNullOrEmpty(text2.Trim()))
                            {
                                this.ShipSizeCity = this.ShipSizeCity + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "目的地-地区")
                        {
                            text2 = string.Empty;
                            if (array.Length > 1)
                            {
                                text2 = array[1];
                            }
                            this.Destination = this.Destination + "'" + text2 + "',";
                            if (!string.IsNullOrEmpty(text2.Trim()))
                            {
                                this.SizeDestination = this.SizeDestination + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "收货人-地区3级")
                        {
                            text2 = string.Empty;
                            if (array.Length > 2)
                            {
                                text2 = array[2];
                            }
                            this.ShipDistrict = this.ShipDistrict + "'" + text2 + "',";
                            if (!string.IsNullOrEmpty(text2.Trim()))
                            {
                                this.ShipSizeDistrict = this.ShipSizeDistrict + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "送货-上门时间")
                        {
                            this.ShipToDate = this.ShipToDate + "'" + row["ShipToDate"].ToString() + "',";
                            if (!string.IsNullOrEmpty(row["ShipToDate"].ToString().Trim()))
                            {
                                this.SizeShipToDate = this.SizeShipToDate + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "订单-订单号")
                        {
                            this.OrderId = this.OrderId + "'订单号:" + row["OrderId"].ToString() + "',";
                            if (!string.IsNullOrEmpty(row["OrderId"].ToString().Trim()))
                            {
                                this.SizeOrderId = this.SizeOrderId + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "订单-总金额")
                        {
                            if (!string.IsNullOrEmpty(row["OrderTotal"].ToString().Trim()))
                            {
                                this.OrderTotal = this.OrderTotal + decimal.Parse(row["OrderTotal"].ToString()).F2ToString("f2") + "',";
                            }
                            if (!string.IsNullOrEmpty(row["OrderTotal"].ToString().Trim()))
                            {
                                this.SizeOrderTotal = this.SizeOrderTotal + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "订单-详情")
                        {
                            DataRow[] array3 = dataTable.Select(" OrderId='" + row["OrderId"] + "'");
                            string    text8  = string.Empty;
                            if (array3.Length != 0)
                            {
                                DataRow[] array4 = array3;
                                foreach (DataRow dataRow2 in array4)
                                {
                                    text8 = text8 + "规格" + dataRow2["SKUContent"] + " 数量" + dataRow2["ShipmentQuantity"] + "货号 :" + dataRow2["SKU"];
                                }
                                text8 = text8.Replace(";", "");
                            }
                            if (!string.IsNullOrEmpty(text8.Trim()))
                            {
                                this.SizeitemInfos = this.SizeitemInfos + "'" + str + "',";
                            }
                            this.ShipitemInfos = this.ShipitemInfos + "'" + this.ReplaceString(text8) + "',";
                        }
                        if (innerText3.Split('_')[0] == "订单-物品总重量")
                        {
                            decimal num = default(decimal);
                            decimal.TryParse(row["Weight"].ToString(), out num);
                            this.Shipitemweith = this.Shipitemweith + "'" + num.F2ToString("f2") + "',";
                            if (!string.IsNullOrEmpty(num.ToString().Trim()))
                            {
                                this.SizeShipitemweith = this.SizeShipitemweith + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "订单-备注")
                        {
                            this.Remark = this.Remark + "'" + this.ReplaceString(row["Remark"].ToString()) + "',";
                            if (!string.IsNullOrEmpty(row["Remark"].ToString().Trim()))
                            {
                                this.SizeRemark = this.SizeRemark + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "发货人-姓名")
                        {
                            this.ShipperName = this.ShipperName + "'" + this.ReplaceString(shipper.ShipperName) + "',";
                            if (!string.IsNullOrEmpty(shipper.ShipperName.Trim()))
                            {
                                this.SizeShipperName = this.SizeShipperName + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "发货人-电话")
                        {
                            this.TelPhone = this.TelPhone + "'" + shipper.TelPhone + "',";
                            if (!string.IsNullOrEmpty(shipper.TelPhone.Trim()))
                            {
                                this.SizeTelPhone = this.SizeTelPhone + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "发货人-手机")
                        {
                            this.CellPhone = this.CellPhone + "'" + shipper.CellPhone + "',";
                            if (!string.IsNullOrEmpty(shipper.CellPhone.Trim()))
                            {
                                this.SizeCellPhone = this.SizeCellPhone + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "发货人-邮编")
                        {
                            this.Zipcode = this.Zipcode + "'" + shipper.Zipcode + "',";
                            if (!string.IsNullOrEmpty(shipper.Zipcode.Trim()))
                            {
                                this.SizeZipcode = this.SizeZipcode + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "发货人-地址")
                        {
                            this.Address = this.Address + "'" + this.ReplaceString(shipper.Address) + "',";
                            if (!string.IsNullOrEmpty(shipper.Address.Trim()))
                            {
                                this.SizeAddress = this.SizeAddress + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "发货人-地区1级")
                        {
                            if (array2.Length != 0)
                            {
                                text7 = array2[0];
                            }
                            this.Province = this.Province + "'" + text7 + "',";
                            if (!string.IsNullOrEmpty(text7.Trim()))
                            {
                                this.SizeProvnce = this.SizeProvnce + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "发货人-地区2级")
                        {
                            text7 += string.Empty;
                            if (array2.Length > 1)
                            {
                                text7 = array2[1];
                            }
                            this.City = this.City + "'" + text7 + "',";
                            if (!string.IsNullOrEmpty(text7.Trim()))
                            {
                                this.SizeCity = this.SizeCity + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "始发地-地区")
                        {
                            text7 += string.Empty;
                            if (array2.Length > 1)
                            {
                                text7 = array2[1];
                            }
                            this.Departure = this.Departure + "'" + text7 + "',";
                            if (!string.IsNullOrEmpty(text7.Trim()))
                            {
                                this.SizeDeparture = this.SizeDeparture + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "发货人-地区3级")
                        {
                            text7 += string.Empty;
                            if (array2.Length > 2)
                            {
                                text7 = array2[2];
                            }
                            this.District = this.District + "'" + text7 + "',";
                            if (!string.IsNullOrEmpty(text7.Trim()))
                            {
                                this.SizeDistrict = this.SizeDistrict + "'" + str + "',";
                            }
                        }
                        if (innerText3.Split('_')[0] == "网店名称")
                        {
                            this.SiteName = this.SiteName + "'" + this.ReplaceString(HiContext.Current.SiteSettings.SiteName) + "',";
                            if (!string.IsNullOrEmpty(HiContext.Current.SiteSettings.SiteName.Trim()))
                            {
                                this.SizeSiteName = this.SizeSiteName + "'" + str + "',";
                            }
                        }
                    }
                }
                this.UpdateOrderIds = this.UpdateOrderIds.TrimEnd(',');
                this.PrintPage(this.width, this.height);
            }
        }
 public abstract bool AddShipper(ShippersInfo shipper);
Beispiel #6
0
        private void btnAddShipper_Click(object sender, EventArgs e)
        {
            ShippersInfo shipper = new ShippersInfo();
            string       str     = "0";

            if (this.txtShipperType.Items[0].Selected && !this.txtShipperType.Items[1].Selected)
            {
                str = "1";
            }
            else if (!this.txtShipperType.Items[0].Selected && this.txtShipperType.Items[1].Selected)
            {
                str = "2";
            }
            else if (this.txtShipperType.Items[0].Selected && this.txtShipperType.Items[1].Selected)
            {
                str = "3";
            }
            shipper.ShipperTag  = str;
            shipper.ShipperName = this.txtShipperName.Text.Trim();
            if (!this.ddlReggion.GetSelectedRegionId().HasValue)
            {
                this.ShowMsg("请选择地区", false);
            }
            else
            {
                shipper.RegionId  = this.ddlReggion.GetSelectedRegionId().Value;
                shipper.Address   = this.txtAddress.Text.Trim();
                shipper.CellPhone = this.txtTelPhone.Text.Trim();
                shipper.TelPhone  = this.txtTelPhone.Text.Trim();
                shipper.Zipcode   = "";
                shipper.IsDefault = true;
                shipper.Remark    = "";
                shipper.wid       = this.wid;
                int result = 0;
                int.TryParse(this.ShipperId.Value, out result);
                shipper.ShipperId = result;
                if (this.ValidationShipper(shipper))
                {
                    if (string.IsNullOrEmpty(shipper.CellPhone) && string.IsNullOrEmpty(shipper.TelPhone))
                    {
                        this.ShowMsg("手机号码和电话号码必填其一", false);
                    }
                    else if (SalesHelper.AddShipper(shipper))
                    {
                        if (this.Task.Value == "EDIT")
                        {
                            this.Task.Value = "ADD";
                            this.txtShipperType.SelectedValue = "";
                            this.txtShipperType.Enabled       = true;
                            this.txtShipperName.Text          = "";
                            this.ddlReggion.SetSelectedRegionId(0);
                            this.txtAddress.Text  = "";
                            this.ShipperId.Value  = "";
                            this.txtTelPhone.Text = "";
                            this.txtShipperType.ClearSelection();
                            this.editType.Text = "新增发货地址信息";
                            this.ShowMsg("成功修改了一个发货信息", true);
                        }
                        else
                        {
                            this.ShowMsg("成功添加了一个发货信息", true);
                        }
                        this.BindShippers(wid);
                    }
                    else
                    {
                        this.ShowMsg("添加发货信息失败", false);
                    }
                }
            }
        }
Beispiel #7
0
 public static bool UpdateShipper(ShippersInfo shipper)
 {
     Globals.EntityCoding(shipper, true);
     return(new ShipperDao().Update(shipper, null));
 }
Beispiel #8
0
 public static bool AddShipper(ShippersInfo shipper)
 {
     Globals.EntityCoding(shipper, true);
     return(new ShipperDao().AddShipper(shipper));
 }
Beispiel #9
0
        public void bindReplaceInfo()
        {
            int         replaceId   = this.Page.Request["replaceId"].ToInt(0);
            ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(replaceId);

            if (replaceInfo == null)
            {
                this.ShowMsg("换货信息错误!", false);
            }
            else
            {
                OrderInfo   orderInfo   = TradeHelper.GetOrderInfo(replaceInfo.OrderId);
                HiddenField hiddenField = this.hidReplaceStatus;
                int         num         = (int)replaceInfo.HandleStatus;
                hiddenField.Value = num.ToString();
                if (orderInfo == null)
                {
                    this.ShowMsg("错误的订单信息!", false);
                }
                else
                {
                    if (string.IsNullOrEmpty(replaceInfo.SkuId))
                    {
                        this.listPrducts.DataSource = orderInfo.LineItems.Values;
                    }
                    else
                    {
                        Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>();
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            if (value.SkuId == replaceInfo.SkuId)
                            {
                                dictionary.Add(value.SkuId, value);
                            }
                        }
                        this.listPrducts.DataSource = dictionary.Values;
                    }
                    this.txtAdminRemark.Text = replaceInfo.AdminRemark;
                    this.listPrducts.DataBind();
                    this.litOrderId.Text      = orderInfo.PayOrderId;
                    this.litOrderTotal.Text   = orderInfo.GetTotal(false).F2ToString("f2");
                    this.litRefundReason.Text = replaceInfo.ReplaceReason;
                    this.litRemark.Text       = replaceInfo.UserRemark;
                    Literal literal = this.litReturnQuantity;
                    num          = replaceInfo.Quantity;
                    literal.Text = num.ToString();
                    string userCredentials = replaceInfo.UserCredentials;
                    if (!string.IsNullOrEmpty(userCredentials))
                    {
                        string[] array = userCredentials.Split('|');
                        userCredentials = "";
                        string[] array2 = array;
                        foreach (string str in array2)
                        {
                            userCredentials += string.Format(this.credentialsImgHtml, Globals.GetImageServerUrl() + str);
                        }
                        this.litImageList.Text = userCredentials;
                    }
                    else
                    {
                        this.divCredentials.Visible = false;
                    }
                    if (replaceInfo.HandleStatus == ReplaceStatus.Applied)
                    {
                        this.btnAcceptReplace.Visible = true;
                        this.btnRefuseReplace.Visible = true;
                    }
                    if (replaceInfo.HandleStatus != 0)
                    {
                        this.txtAdminCellPhone.Visible   = false;
                        this.txtAdminShipAddress.Visible = false;
                        this.txtAdminShipTo.Visible      = false;
                        this.litAdminCellPhone.Visible   = true;
                        this.litAdminShipAddrss.Visible  = true;
                        this.litAdminShipTo.Visible      = true;
                        this.litAdminCellPhone.Text      = replaceInfo.AdminCellPhone;
                        this.litAdminShipTo.Text         = replaceInfo.AdminShipTo;
                        this.litAdminShipAddrss.Text     = replaceInfo.AdminShipAddress;
                    }
                    else
                    {
                        ShippersInfo defaultGetGoodsShipperBysupplierId = SalesHelper.GetDefaultGetGoodsShipperBysupplierId(orderInfo.SupplierId);
                        if (defaultGetGoodsShipperBysupplierId != null)
                        {
                            Literal literal2 = this.litAdminShipAddrss;
                            TextBox textBox  = this.txtAdminShipAddress;
                            string  text3    = literal2.Text = (textBox.Text = RegionHelper.GetFullRegion(defaultGetGoodsShipperBysupplierId.RegionId, " ", true, 0) + " " + defaultGetGoodsShipperBysupplierId.Address);
                            Literal literal3 = this.litAdminShipTo;
                            TextBox textBox2 = this.txtAdminShipTo;
                            text3 = (literal3.Text = (textBox2.Text = defaultGetGoodsShipperBysupplierId.ShipperName));
                            Literal literal4 = this.litAdminCellPhone;
                            TextBox textBox3 = this.txtAdminCellPhone;
                            text3 = (literal4.Text = (textBox3.Text = defaultGetGoodsShipperBysupplierId.CellPhone));
                        }
                    }
                    if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery)
                    {
                        this.btnViewUserLogistic.Visible = true;
                        AttributeCollection attributes = this.btnViewUserLogistic.Attributes;
                        num = replaceInfo.ReplaceId;
                        attributes.Add("replaceid", num.ToString());
                    }
                    if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced)
                    {
                        this.btnViewMallLogistic.Visible = true;
                        AttributeCollection attributes2 = this.btnViewMallLogistic.Attributes;
                        num = replaceInfo.ReplaceId;
                        attributes2.Add("replaceid", num.ToString());
                    }
                    string str2 = string.IsNullOrEmpty(orderInfo.RealName) ? "" : (orderInfo.RealName.Replace("\n\r", "").Replace("\n", "").Replace("\r", "") + " (" + (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone) + ")");
                    str2 = str2 + orderInfo.ShippingRegion + " " + orderInfo.Address;
                    this.litUserAddress.Text = str2;
                    this.txtStatus.Text      = EnumDescription.GetEnumDescription((Enum)(object)replaceInfo.HandleStatus, 0);
                    Literal literal5 = this.txtAfterSaleId;
                    num           = replaceInfo.ReplaceId;
                    literal5.Text = num.ToString();
                }
            }
        }
        protected override void AttachChildControls()
        {
            string orderId = this.Page.Request.QueryString["orderId"];

            this.LogisticsInfo = (HtmlGenericControl)this.FindControl("LogisticsInfoPanel");
            Literal literal = this.FindControl("litLogisiticType") as Literal;

            this.hylExpress100Search = (HyperLink)this.FindControl("hylExpress100Search");
            this.ulExpress           = (HtmlGenericControl)this.FindControl("ulExpress");
            int num = 0;

            int.TryParse(this.Page.Request.QueryString["returnsId"], out num);
            int num2 = 0;

            int.TryParse(this.Page.Request.QueryString["replaceId"], out num2);
            string          text            = "";
            string          text2           = "";
            string          text3           = "";
            string          text4           = "";
            string          text5           = "";
            string          text6           = "";
            bool            flag            = false;
            HtmlInputHidden htmlInputHidden = this.FindControl("hidReplaceType") as HtmlInputHidden;
            OrderInfo       orderInfo       = ShoppingProcessor.GetOrderInfo(orderId);

            if (orderInfo == null || orderInfo.UserId != HiContext.Current.UserId)
            {
                if (num > 0)
                {
                    ReturnInfo returnInfo = TradeHelper.GetReturnInfo(num);
                    if (returnInfo != null && (returnInfo.HandleStatus == ReturnStatus.Deliverying || returnInfo.HandleStatus == ReturnStatus.GetGoods || returnInfo.HandleStatus == ReturnStatus.Returned))
                    {
                        text  = returnInfo.ExpressCompanyName;
                        text2 = returnInfo.ShipOrderNumber;
                        text3 = returnInfo.AdminShipTo;
                        text4 = returnInfo.AdminCellPhone;
                        text5 = returnInfo.AdminShipAddress;
                        text6 = returnInfo.ExpressCompanyAbb;
                        flag  = true;
                    }
                }
                if (num2 > 0)
                {
                    ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(num2);
                    orderInfo = ShoppingProcessor.GetOrderInfo(replaceInfo.OrderId);
                    if (orderInfo == null)
                    {
                        this.LogisticsInfo.InnerHtml = "订单不存在或已被删除";
                        return;
                    }
                    if (replaceInfo != null)
                    {
                        if (replaceInfo.HandleStatus == ReplaceStatus.UserDelivery)
                        {
                            htmlInputHidden.Value = "User";
                            text  = replaceInfo.UserExpressCompanyName;
                            text2 = replaceInfo.UserShipOrderNumber;
                            text3 = replaceInfo.AdminShipTo;
                            text4 = replaceInfo.AdminCellPhone;
                            text5 = replaceInfo.AdminShipAddress;
                            text6 = replaceInfo.ExpressCompanyAbb;
                            flag  = true;
                        }
                        if (replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery || replaceInfo.HandleStatus == ReplaceStatus.Replaced)
                        {
                            htmlInputHidden.Value = "Mall";
                            text  = replaceInfo.ExpressCompanyName;
                            text2 = replaceInfo.ShipOrderNumber;
                            text3 = orderInfo.ShipTo;
                            text4 = (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone);
                            text5 = orderInfo.ShippingRegion + "   " + orderInfo.Address;
                            text6 = orderInfo.ExpressCompanyAbb;
                        }
                        else
                        {
                            this.LogisticsInfo.InnerHtml = "商家还未发货";
                        }
                    }
                }
            }
            else
            {
                flag  = true;
                text  = orderInfo.ExpressCompanyName;
                text2 = orderInfo.ShipOrderNumber;
                text3 = orderInfo.ShipTo;
                text4 = (string.IsNullOrEmpty(orderInfo.CellPhone) ? orderInfo.TelPhone : orderInfo.CellPhone);
                text5 = orderInfo.ShippingRegion + "   " + orderInfo.Address;
                text6 = orderInfo.ExpressCompanyAbb;
            }
            if (!flag)
            {
                base.GotoResourceNotFound("错误的物流数据");
            }
            Literal         literal2         = this.FindControl("ltlExpressCompanyName") as Literal;
            Literal         literal3         = this.FindControl("ltlShipOrderNumber") as Literal;
            Literal         literal4         = this.FindControl("ltlReceiveName") as Literal;
            Literal         literal5         = this.FindControl("ltlTel") as Literal;
            Literal         literal6         = this.FindControl("ltlShipAddress") as Literal;
            Literal         literal7         = this.FindControl("Repeater") as Literal;
            HtmlInputHidden htmlInputHidden2 = this.FindControl("hidOrderId") as HtmlInputHidden;

            htmlInputHidden2.Value = ((orderInfo != null) ? orderInfo.OrderId : string.Empty);
            HtmlInputHidden htmlInputHidden3 = this.FindControl("hidIsShowDadaGIS") as HtmlInputHidden;
            HtmlInputHidden htmlInputHidden4 = this.FindControl("hidUserLatlng") as HtmlInputHidden;
            HtmlInputHidden htmlInputHidden5 = this.FindControl("hidStoreLatlng") as HtmlInputHidden;
            HtmlInputHidden htmlInputHidden6 = this.FindControl("hidBaseURL") as HtmlInputHidden;

            htmlInputHidden6.Value = Globals.HostPath(this.Page.Request.Url);
            if (orderInfo != null)
            {
                if (orderInfo.ExpressCompanyName.ToNullString() == "同城物流配送")
                {
                    htmlInputHidden3.Value = "1";
                }
                if (orderInfo.ShippingId > 0)
                {
                    ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(orderInfo.ShippingId);
                    if (shippingAddress != null && !string.IsNullOrWhiteSpace(shippingAddress.LatLng))
                    {
                        htmlInputHidden4.Value = shippingAddress.LatLng;
                    }
                }
                if (orderInfo.StoreId > 0)
                {
                    StoresInfo storeById = StoresHelper.GetStoreById(orderInfo.StoreId);
                    if (storeById != null && !string.IsNullOrWhiteSpace(storeById.LatLng))
                    {
                        htmlInputHidden5.Value = storeById.LatLng;
                    }
                }
                else
                {
                    ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0);
                    if (defaultOrFirstShipper != null)
                    {
                        htmlInputHidden5.Value = defaultOrFirstShipper.Latitude + "," + defaultOrFirstShipper.Longitude;
                    }
                }
            }
            literal2.Text = text;
            literal3.Text = text2;
            if (!string.IsNullOrEmpty(text2))
            {
                string text7 = HttpContext.Current.Request.Url.ToString().ToLower();
                if (text7.IndexOf("/wapshop/") != -1)
                {
                    if (text6.ToLower() == "sf")
                    {
                        this.hylExpress100Search.NavigateUrl = $"http://www.sf-express.com/mobile/cn/sc/dynamic_function/waybill/waybill_query_info.html?billno={text2}";
                        this.hylExpress100Search.Text        = "顺丰官网查询>";
                    }
                    else
                    {
                        this.hylExpress100Search.NavigateUrl = $"https://m.kuaidi100.com/result.jsp?nu={text2}";
                    }
                }
                else if (text6.ToLower() == "sf")
                {
                    this.hylExpress100Search.NavigateUrl = $"http://www.sf-express.com/mobile/cn/sc/dynamic_function/waybill/waybill_query_info.html?billno={text2}";
                    this.hylExpress100Search.Text        = "顺丰官网查询>";
                }
                else
                {
                    this.hylExpress100Search.NavigateUrl = $"https://www.kuaidi100.com/chaxun?nu={text2}";
                }
            }
            else
            {
                this.ulExpress.Visible = false;
            }
            literal4.Text = text3;
            literal5.Text = text4;
            literal6.Text = text5;
            PageTitle.AddSiteNameTitle("查看物流");
        }
		private void UserPayOrder()
		{
			if (this.Order != null && this.Order.OrderStatus == OrderStatus.Closed)
			{
				OrderHelper.SetExceptionOrder(this.Order.OrderId, "支付异常,请联系买家退款");
				Messenger.OrderException(Users.GetUser(this.Order.UserId), this.Order, "订单支付异常,请联系卖家退款.订单号:" + this.Order.OrderId);
				base.Response.Write("success");
			}
			else if (this.Order.OrderStatus == OrderStatus.BuyerAlreadyPaid)
			{
				Globals.WriteLog(new NameValueCollection
				{
					this.Page.Request.Form,
					this.Page.Request.QueryString
				}, "订单状态为已支付", "", "", "alipay");
				base.Response.Write("success");
			}
			else
			{
				int maxCount = 0;
				int yetOrderNum = 0;
				int currentOrderNum = 0;
				if (this.Order.GroupBuyId > 0)
				{
					GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(this.Order.GroupBuyId);
					if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay)
					{
						Globals.WriteLog(new NameValueCollection
						{
							this.Page.Request.Form,
							this.Page.Request.QueryString
						}, "错误的团购信息或者状态", "", "", "alipay");
						base.Response.Write("success");
						return;
					}
					yetOrderNum = TradeHelper.GetOrderCount(this.Order.GroupBuyId);
					currentOrderNum = this.Order.GetGroupBuyOerderNumber();
					maxCount = groupBuy.MaxCount;
					if (maxCount < yetOrderNum + currentOrderNum)
					{
						Globals.WriteLog(new NameValueCollection
						{
							this.Page.Request.Form,
							this.Page.Request.QueryString
						}, "团购数量已超过指定数量错", "", "", "alipay");
						base.Response.Write("success");
						return;
					}
				}
				if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UpdateOrderStatus(this.Order))
				{
					Task.Factory.StartNew(delegate
					{
						TradeHelper.UserPayOrder(this.Order, false, true);
						try
						{
							if (this.offlineOrder != null)
							{
								OrderHelper.UpdateOrderPaymentTypeOfAPI(this.Order);
								OrderHelper.ConfirmTakeGoods(this.Order, true);
							}
							if (this.Order.GroupBuyId > 0 && maxCount == yetOrderNum + currentOrderNum)
							{
								TradeHelper.SetGroupBuyEndUntreated(this.Order.GroupBuyId);
							}
							if (this.Order.UserId != 0 && this.Order.UserId != 1100)
							{
								Hidistro.Entities.Members.MemberInfo user = Users.GetUser(this.Order.UserId);
								string verificationPasswords = "";
								if (this.Order.OrderType == OrderType.ServiceOrder)
								{
									verificationPasswords = OrderHelper.GetVerificationPasswordsOfOrderId(this.Order.OrderId);
								}
								if (user != null)
								{
									Messenger.OrderPayment(user, this.Order, this.Order.GetTotal(false), verificationPasswords);
								}
							}
							StoresInfo storesInfo = null;
							if (this.Order.StoreId > 0)
							{
								storesInfo = DepotHelper.GetStoreById(this.Order.StoreId);
							}
							if (storesInfo != null)
							{
								VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderPayed);
								if (this.offlineOrder == null)
								{
									if (this.Order.ShippingModeId == -2)
									{
										VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.TakeOnStoreOrderWaitConfirm);
									}
									else
									{
										VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderWaitSendGoods);
									}
								}
							}
							if (this.offlineOrder == null)
							{
								ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0);
								Messenger.OrderPaymentToShipper(defaultOrFirstShipper, storesInfo, null, this.Order, this.Order.GetTotal(false));
							}
							this.Order.OnPayment();
						}
						catch (Exception ex)
						{
							IDictionary<string, string> dictionary = new Dictionary<string, string>();
							dictionary.Add("ErrorMessage", ex.Message);
							dictionary.Add("StackTrace", ex.StackTrace);
							if (ex.InnerException != null)
							{
								dictionary.Add("InnerException", ex.InnerException.ToString());
							}
							if (ex.GetBaseException() != null)
							{
								dictionary.Add("BaseException", ex.GetBaseException().Message);
							}
							if (ex.TargetSite != (MethodBase)null)
							{
								dictionary.Add("TargetSite", ex.TargetSite.ToString());
							}
							dictionary.Add("ExSource", ex.Source);
							Globals.AppendLog(dictionary, "支付更新订单收款记录或者消息通知时出错:" + ex.Message, "", "", "UserPay");
						}
					});
					base.Response.Write("success");
				}
				else
				{
					Globals.WriteLog(new NameValueCollection
					{
						this.Page.Request.Form,
						this.Page.Request.QueryString
					}, "订单不是待支付状态,或者更新订单状态失败", "", "", "alipay");
					base.Response.Write("success");
				}
			}
		}
Beispiel #12
0
        private string WriteOrderInfo(System.Data.DataRow order, ShippersInfo shipper, System.Data.DataTable dtLine, System.Data.DataSet ds)
        {
            string[] array = order["shippingRegion"].ToString().Split(new char[]
            {
                ','
            });
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            stringBuilder.AppendLine("<order>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-姓名</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order["ShipTo"]);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-电话</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order["TelPhone"]);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-手机</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order["CellPhone"]);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-邮编</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order["ZipCode"]);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-地址</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order["Address"]);
            stringBuilder.AppendLine("</item>");
            string arg = string.Empty;

            if (array.Length > 0)
            {
                arg = array[0];
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-地区1级</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", arg);
            stringBuilder.AppendLine("</item>");
            arg = string.Empty;
            if (array.Length > 1)
            {
                arg = array[1];
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-地区2级</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", arg);
            stringBuilder.AppendLine("</item>");
            arg = string.Empty;
            if (array.Length > 2)
            {
                arg = array[2];
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-地区3级</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", arg);
            stringBuilder.AppendLine("</item>");
            string[] array2 = new string[]
            {
                "",
                "",
                ""
            };
            if (shipper != null)
            {
                array2 = RegionHelper.GetFullRegion(shipper.RegionId, "-").Split(new char[]
                {
                    '-'
                });
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>发货人-姓名</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", (shipper != null) ? shipper.ShipperName : "");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>发货人-手机</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", (shipper != null) ? shipper.CellPhone : "");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>发货人-电话</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", (shipper != null) ? shipper.TelPhone : "");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>发货人-地址</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", (shipper != null) ? shipper.Address : "");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>发货人-邮编</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", (shipper != null) ? shipper.Zipcode : "");
            stringBuilder.AppendLine("</item>");
            string arg2 = string.Empty;

            if (array2.Length > 0)
            {
                arg2 = array2[0];
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>发货人-地区1级</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", arg2);
            stringBuilder.AppendLine("</item>");
            arg2 = string.Empty;
            if (array2.Length > 1)
            {
                arg2 = array2[1];
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>发货人-地区2级</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", arg2);
            stringBuilder.AppendLine("</item>");
            arg2 = string.Empty;
            if (array2.Length > 2)
            {
                arg2 = array2[2];
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>发货人-地区3级</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", arg2);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-订单号</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order["OrderId"]);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-总金额</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", this.CalculateOrderTotal(order, ds));
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-物品总重量</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order["Weight"]);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-备注</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order["Remark"]);
            stringBuilder.AppendLine("</item>");
            System.Data.DataRow[] array3 = dtLine.Select(" OrderId='" + order["OrderId"] + "'");
            string text = string.Empty;

            if (array3.Length > 0)
            {
                System.Data.DataRow[] array4 = array3;
                for (int i = 0; i < array4.Length; i++)
                {
                    System.Data.DataRow dataRow = array4[i];
                    text = string.Concat(new object[]
                    {
                        text,
                        "货号 ",
                        dataRow["SKU"],
                        " ×",
                        dataRow["ShipmentQuantity"],
                        "\n"
                    });
                }
                text = text.Replace(";", "");
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-详情</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", text);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-送货时间</name>");
            stringBuilder.AppendFormat("<rename></rename>", new object[0]);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>网店名称</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", Hidistro.Membership.Context.HiContext.Current.SiteSettings.SiteName);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>自定义内容</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", "null");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("</order>");
            return(stringBuilder.ToString());
        }
Beispiel #13
0
        private void WritPurchaseOrderInfo(PurchaseOrderInfo prurchaseOrder, ShippersInfo shipper)
        {
            string fullRegion = RegionHelper.GetFullRegion(prurchaseOrder.RegionId, ",");

            string[] array = fullRegion.Split(new char[]
            {
                ','
            });
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            stringBuilder.AppendLine("<nodes>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-姓名</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.ShipTo);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-电话</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.TelPhone + "_");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-手机</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.CellPhone + "_");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-邮编</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.ZipCode + "_");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-地址</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.Address);
            stringBuilder.AppendLine("</item>");
            if (array.Length > 0)
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>收货人-地区1级</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", array[0]);
                stringBuilder.AppendLine("</item>");
            }
            if (array.Length > 1)
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>收货人-地区2级</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", array[1]);
                stringBuilder.AppendLine("</item>");
            }
            if (array.Length > 2)
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>收货人-地区3级</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", array[2]);
                stringBuilder.AppendLine("</item>");
            }
            if (shipper != null)
            {
                string   fullRegion2 = RegionHelper.GetFullRegion(shipper.RegionId, ",");
                string[] array2      = fullRegion2.Split(new char[]
                {
                    ','
                });
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-姓名</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.ShipperName);
                stringBuilder.AppendLine("</item>");
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-手机</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.CellPhone + "_");
                stringBuilder.AppendLine("</item>");
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-电话</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.TelPhone + "_");
                stringBuilder.AppendLine("</item>");
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-地址</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.Address);
                stringBuilder.AppendLine("</item>");
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-邮编</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.Zipcode + "_");
                stringBuilder.AppendLine("</item>");
                if (array2.Length > 0)
                {
                    stringBuilder.AppendLine("<item>");
                    stringBuilder.AppendLine("<name>发货人-地区1级</name>");
                    stringBuilder.AppendFormat("<rename>{0}</rename>", array2[0]);
                    stringBuilder.AppendLine("</item>");
                }
                if (array2.Length > 1)
                {
                    stringBuilder.AppendLine("<item>");
                    stringBuilder.AppendLine("<name>发货人-地区2级</name>");
                    stringBuilder.AppendFormat("<rename>{0}</rename>", array2[1]);
                    stringBuilder.AppendLine("</item>");
                }
                if (array2.Length > 2)
                {
                    stringBuilder.AppendLine("<item>");
                    stringBuilder.AppendLine("<name>发货人-地区3级</name>");
                    stringBuilder.AppendFormat("<rename>{0}</rename>", array2[2]);
                    stringBuilder.AppendLine("</item>");
                }
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-订单号</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.PurchaseOrderId);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-总金额</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.GetPurchaseTotal() + "_");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-物品总重量</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.Weight);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-备注</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.ManagerRemark);
            stringBuilder.AppendLine("</item>");
            string text = "";

            if (prurchaseOrder.PurchaseOrderItems != null && prurchaseOrder.PurchaseOrderItems.Count > 0)
            {
                foreach (PurchaseOrderItemInfo current in prurchaseOrder.PurchaseOrderItems)
                {
                    object obj = text;
                    text = string.Concat(new object[]
                    {
                        obj,
                        "货号 ",
                        current.SKU,
                        " ",
                        current.SKUContent,
                        " ×",
                        current.Quantity,
                        "\n"
                    });
                }
                text = text.Replace(";", "").Replace(";", "").Replace(":", ":");
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-详情</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", text);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-送货时间</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.ShippingDate);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>网店名称</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", Hidistro.Membership.Context.HiContext.Current.SiteSettings.SiteName);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>√</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", "√");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>自定义内容</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", "null");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("</nodes>");
            base.Response.Write(stringBuilder.ToString());
        }
        public void bindReturnInfo()
        {
            int        returnId   = this.Page.Request["ReturnId"].ToInt(0);
            ReturnInfo returnInfo = TradeHelper.GetReturnInfo(returnId);

            if (returnInfo == null)
            {
                this.ShowMsg("退货信息错误!", false);
            }
            else
            {
                HiddenField hiddenField = this.hidReturnStatus;
                int         num         = (int)returnInfo.HandleStatus;
                hiddenField.Value = num.ToString();
                OrderInfo orderInfo = TradeHelper.GetOrderInfo(returnInfo.OrderId);
                if (orderInfo == null)
                {
                    this.ShowMsg("错误的订单信息!", false);
                }
                else if (orderInfo.SupplierId != HiContext.Current.Manager.StoreId)
                {
                    this.ShowMsg("订单不是当前供应商订单,请勿非法操作。", false);
                }
                else
                {
                    if (string.IsNullOrEmpty(returnInfo.SkuId))
                    {
                        this.listPrducts.DataSource = orderInfo.LineItems.Values;
                    }
                    else
                    {
                        Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>();
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            if (value.SkuId == returnInfo.SkuId)
                            {
                                dictionary.Add(value.SkuId, value);
                            }
                        }
                        this.listPrducts.DataSource = dictionary.Values;
                    }
                    this.listPrducts.DataBind();
                    if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund)
                    {
                        this.AfterSaleType = "退款";
                    }
                    this.litOrderId.Text      = orderInfo.OrderId;
                    this.litRefundReason.Text = returnInfo.ReturnReason;
                    this.litRemark.Text       = returnInfo.UserRemark;
                    Literal literal = this.litReturnQuantity;
                    num          = returnInfo.Quantity;
                    literal.Text = num.ToString();
                    string userCredentials = returnInfo.UserCredentials;
                    if (!string.IsNullOrEmpty(userCredentials))
                    {
                        string[] array = userCredentials.Split('|');
                        userCredentials = "";
                        string[] array2 = array;
                        foreach (string str in array2)
                        {
                            userCredentials += string.Format(this.credentialsImgHtml, Globals.GetImageServerUrl() + str);
                        }
                        this.litImageList.Text = userCredentials;
                    }
                    else
                    {
                        this.divCredentials.Visible = false;
                    }
                    if (returnInfo.HandleStatus == ReturnStatus.Deliverying)
                    {
                        Button button  = this.btnGetGoods;
                        Button button2 = this.btnGetGood2;
                        bool   visible = button2.Visible = true;
                        button.Visible = visible;
                    }
                    if (returnInfo.HandleStatus != 0)
                    {
                        this.litAdminCellPhone.Text  = returnInfo.AdminCellPhone;
                        this.litAdminShipTo.Text     = returnInfo.AdminShipTo;
                        this.litAdminShipAddrss.Text = returnInfo.AdminShipAddress;
                    }
                    else
                    {
                        ShippersInfo defaultGetGoodsShipperBysupplierId = SalesHelper.GetDefaultGetGoodsShipperBysupplierId(HiContext.Current.Manager.StoreId);
                        if (defaultGetGoodsShipperBysupplierId != null)
                        {
                            this.litAdminShipAddrss.Text = RegionHelper.GetFullRegion(defaultGetGoodsShipperBysupplierId.RegionId, " ", true, 0) + " " + defaultGetGoodsShipperBysupplierId.Address;
                            this.litAdminShipTo.Text     = defaultGetGoodsShipperBysupplierId.ShipperName;
                            this.litAdminCellPhone.Text  = defaultGetGoodsShipperBysupplierId.CellPhone;
                        }
                    }
                    this.liAdminRemark.Text = returnInfo.AdminRemark;
                    if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund)
                    {
                        this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 3);
                    }
                    else
                    {
                        this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 0);
                    }
                    Literal literal2 = this.txtAfterSaleId;
                    num           = returnInfo.ReturnId;
                    literal2.Text = num.ToString();
                    HiddenField hiddenField2 = this.hidAfterSaleType;
                    num = (int)returnInfo.AfterSaleType;
                    hiddenField2.Value            = num.ToString();
                    this.hidRefundMaxAmount.Value = orderInfo.GetCanRefundAmount(returnInfo.SkuId, null, 0).F2ToString("f2");
                    if (returnInfo.AfterSaleType == AfterSaleTypes.ReturnAndRefund && (returnInfo.HandleStatus == ReturnStatus.Deliverying || returnInfo.HandleStatus == ReturnStatus.GetGoods || returnInfo.HandleStatus == ReturnStatus.Returned))
                    {
                        this.btnViewLogistic.Visible = true;
                        AttributeCollection attributes = this.btnViewLogistic.Attributes;
                        num = returnInfo.ReturnId;
                        attributes.Add("returnsid", num.ToString());
                        this.btnViewLogistic.Attributes.Add("expresscompanyname", returnInfo.ExpressCompanyName.ToString());
                        this.btnViewLogistic.Attributes.Add("shipordernumber", returnInfo.ShipOrderNumber.ToString());
                    }
                }
            }
        }
 private void UserPayOrder()
 {
     if (this.Order.OrderStatus == OrderStatus.Closed)
     {
         OrderHelper.SetExceptionOrder(this.Order.OrderId, "支付异常,请联系买家退款");
         Messenger.OrderException(Users.GetUser(this.Order.UserId), this.Order, "订单支付异常,请联系卖家退款.订单号:" + this.Order.OrderId);
     }
     else if (this.Order.OrderStatus == OrderStatus.BuyerAlreadyPaid)
     {
         base.Response.Write(string.Format("<p style=\"font-size:16px;\">恭喜您,订单已成功完成支付:{0}</br>支付金额:{1}<br><a href=\"{2}\">查看订单</a></p>", this.OrderId, this.Amount.ToString("F"), this.GetReturnLink(this.Order.OrderSource)));
     }
     else
     {
         int maxCount        = 0;
         int yetOrderNum     = 0;
         int currentOrderNum = 0;
         if (this.Order.GroupBuyId > 0)
         {
             GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(this.Order.GroupBuyId);
             if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay)
             {
                 base.Response.Write($"<p style=\"font-size:16px;\">订单为团购订单,团购活动已结束,支付失败<br><a href=\"{this.GetReturnLink(this.Order.OrderSource)}\">查看订单</a></p>");
                 return;
             }
             yetOrderNum     = TradeHelper.GetOrderCount(this.Order.GroupBuyId);
             currentOrderNum = this.Order.GetGroupBuyOerderNumber();
             maxCount        = groupBuy.MaxCount;
             if (maxCount < yetOrderNum + currentOrderNum)
             {
                 base.Response.Write($"<p style=\"font-size:16px;\">订单为团购订单,订购数量超过订购总数,支付失败<br><a href=\"{this.GetReturnLink(this.Order.OrderSource)}\">查看订单</a></p>");
                 return;
             }
         }
         if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UpdateOrderStatus(this.Order))
         {
             Task.Factory.StartNew(delegate
             {
                 TradeHelper.UserPayOrder(this.Order, false, true);
                 try
                 {
                     if (this.offlineOrder != null)
                     {
                         OrderHelper.UpdateOrderPaymentTypeOfAPI(this.Order);
                         OrderHelper.ConfirmTakeGoods(this.Order, true);
                     }
                     if (this.Order.GroupBuyId > 0 && maxCount == yetOrderNum + currentOrderNum)
                     {
                         TradeHelper.SetGroupBuyEndUntreated(this.Order.GroupBuyId);
                     }
                     if (this.Order.UserId != 0 && this.Order.UserId != 1100)
                     {
                         Hidistro.Entities.Members.MemberInfo user = Users.GetUser(this.Order.UserId);
                         string verificationPasswords = "";
                         if (this.Order.OrderType == OrderType.ServiceOrder)
                         {
                             verificationPasswords = OrderHelper.GetVerificationPasswordsOfOrderId(this.Order.OrderId);
                         }
                         if (user != null)
                         {
                             Messenger.OrderPayment(user, this.Order, this.Order.GetTotal(false), verificationPasswords);
                         }
                     }
                     StoresInfo storesInfo = null;
                     if (this.Order.StoreId > 0)
                     {
                         storesInfo = DepotHelper.GetStoreById(this.Order.StoreId);
                     }
                     if (storesInfo != null)
                     {
                         VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderPayed);
                         if (this.offlineOrder == null)
                         {
                             if (this.Order.ShippingModeId == -2)
                             {
                                 VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.TakeOnStoreOrderWaitConfirm);
                             }
                             else
                             {
                                 VShopHelper.AppPsuhRecordForStore(storesInfo.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderWaitSendGoods);
                             }
                         }
                     }
                     if (this.offlineOrder == null)
                     {
                         ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0);
                         Messenger.OrderPaymentToShipper(defaultOrFirstShipper, storesInfo, null, this.Order, this.Order.GetTotal(false));
                     }
                     this.Order.OnPayment();
                 }
                 catch (Exception ex)
                 {
                     IDictionary <string, string> dictionary = new Dictionary <string, string>();
                     dictionary.Add("ErrorMessage", ex.Message);
                     dictionary.Add("StackTrace", ex.StackTrace);
                     if (ex.InnerException != null)
                     {
                         dictionary.Add("InnerException", ex.InnerException.ToString());
                     }
                     if (ex.GetBaseException() != null)
                     {
                         dictionary.Add("BaseException", ex.GetBaseException().Message);
                     }
                     if (ex.TargetSite != (MethodBase)null)
                     {
                         dictionary.Add("TargetSite", ex.TargetSite.ToString());
                     }
                     dictionary.Add("ExSource", ex.Source);
                     Globals.AppendLog(dictionary, "支付更新订单收款记录或者消息通知时出错:" + ex.Message, "", "", "UserPay");
                 }
                 this.Order.OnPayment();
             });
             base.Response.Write(string.Format("<p style=\"font-size:16px;\">恭喜您,订单已成功完成支付:{0}</br>支付金额:{1}<br><a href=\"{2}\">查看订单</a></p>", this.OrderId, this.Amount.ToString("F"), this.GetReturnLink(this.Order.OrderSource)));
         }
         else
         {
             base.Response.Write(string.Format("<p style=\"font-size:16px;\">恭喜您,订单已成功完成支付:{0}</br>支付金额:{1}<br><a href=\"{2}\">查看订单</a></p>", this.OrderId, this.Amount.ToString("F"), this.GetReturnLink(this.Order.OrderSource)));
         }
     }
 }
Beispiel #16
0
 private void UserPayOrder()
 {
     if (this.Order != null && this.Order.OrderStatus == OrderStatus.Closed)
     {
         OrderHelper.SetExceptionOrder(this.Order.OrderId, "支付异常,请联系买家退款");
         Messenger.OrderException(Users.GetUser(this.Order.UserId), this.Order, "订单支付异常,请联系卖家退款.订单号:" + this.Order.OrderId);
         this.ResponseReturn(true, "");
     }
     else if ((this.Order != null && this.Order.OrderStatus == OrderStatus.BuyerAlreadyPaid) || (this.offlineOrder != null && this.offlineOrder.Status == 1))
     {
         this.ResponseReturn(true, "");
     }
     else
     {
         try
         {
             int maxCount        = 0;
             int yetOrderNum     = 0;
             int currentOrderNum = 0;
             if (this.Order != null)
             {
                 if (this.Order.GroupBuyId > 0)
                 {
                     GroupBuyInfo groupBuy = TradeHelper.GetGroupBuy(this.Order.GroupBuyId);
                     if (groupBuy == null || groupBuy.Status != GroupBuyStatus.UnderWay)
                     {
                         return;
                     }
                     yetOrderNum     = TradeHelper.GetOrderCount(this.Order.GroupBuyId);
                     currentOrderNum = this.Order.GetGroupBuyOerderNumber();
                     maxCount        = groupBuy.MaxCount;
                     if (maxCount < yetOrderNum + currentOrderNum)
                     {
                         return;
                     }
                 }
                 if (this.Order.CheckAction(OrderActions.BUYER_PAY) && TradeHelper.UpdateOrderStatus(this.Order))
                 {
                     Task.Factory.StartNew(delegate
                     {
                         TradeHelper.UserPayOrder(this.Order, false, true);
                         try
                         {
                             if (this.offlineOrder != null)
                             {
                                 OrderHelper.UpdateOrderPaymentTypeOfAPI(this.Order);
                                 OrderHelper.ConfirmTakeGoods(this.Order, true);
                             }
                             if (this.Order.GroupBuyId > 0 && maxCount == yetOrderNum + currentOrderNum)
                             {
                                 TradeHelper.SetGroupBuyEndUntreated(this.Order.GroupBuyId);
                             }
                             if (this.Order.UserId != 0 && this.Order.UserId != 1100)
                             {
                                 string verificationPasswords = "";
                                 if (this.Order.OrderType == OrderType.ServiceOrder)
                                 {
                                     verificationPasswords = OrderHelper.GetVerificationPasswordsOfOrderId(this.Order.OrderId);
                                 }
                                 Hidistro.Entities.Members.MemberInfo user = Users.GetUser(this.Order.UserId);
                                 if (user != null)
                                 {
                                     Messenger.OrderPayment(user, this.Order, this.Order.GetTotal(true), verificationPasswords);
                                 }
                             }
                             StoresInfo storesInfo2 = null;
                             if (this.Order.StoreId > 0)
                             {
                                 storesInfo2 = DepotHelper.GetStoreById(this.Order.StoreId);
                             }
                             if (storesInfo2 != null)
                             {
                                 VShopHelper.AppPsuhRecordForStore(storesInfo2.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderPayed);
                                 if (this.offlineOrder == null)
                                 {
                                     if (this.Order.ShippingModeId == -2)
                                     {
                                         VShopHelper.AppPsuhRecordForStore(storesInfo2.StoreId, this.Order.OrderId, "", EnumPushStoreAction.TakeOnStoreOrderWaitConfirm);
                                     }
                                     else
                                     {
                                         VShopHelper.AppPsuhRecordForStore(storesInfo2.StoreId, this.Order.OrderId, "", EnumPushStoreAction.StoreOrderWaitSendGoods);
                                     }
                                 }
                             }
                             if (this.offlineOrder == null)
                             {
                                 ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0);
                                 Messenger.OrderPaymentToShipper(defaultOrFirstShipper, storesInfo2, null, this.Order, this.Order.GetTotal(true));
                             }
                             this.Order.OnPayment();
                         }
                         catch (Exception ex2)
                         {
                             IDictionary <string, string> dictionary2 = new Dictionary <string, string>();
                             dictionary2.Add("ErrorMessage", ex2.Message);
                             dictionary2.Add("StackTrace", ex2.StackTrace);
                             if (ex2.InnerException != null)
                             {
                                 dictionary2.Add("InnerException", ex2.InnerException.ToString());
                             }
                             if (ex2.GetBaseException() != null)
                             {
                                 dictionary2.Add("BaseException", ex2.GetBaseException().Message);
                             }
                             if (ex2.TargetSite != (MethodBase)null)
                             {
                                 dictionary2.Add("TargetSite", ex2.TargetSite.ToString());
                             }
                             dictionary2.Add("ExSource", ex2.Source);
                             Globals.AppendLog(dictionary2, "支付更新订单收款记录或者消息通知时出错:" + ex2.Message, "", "", "UserPay");
                         }
                         this.Order.OnPayment();
                         this.ResponseReturn(true, "");
                     });
                 }
                 if (this.Order.FightGroupId > 0)
                 {
                     VShopHelper.SetFightGroupSuccess(this.Order.FightGroupId);
                 }
             }
             if (this.offlineOrder != null && this.offlineOrder.Status == 0)
             {
                 this.offlineOrder.Status  = 1;
                 this.offlineOrder.PayTime = DateTime.Now;
                 if (StoresHelper.UpdateStoreCollectionInfo(this.offlineOrder) && this.isOfflineOrder)
                 {
                     string     text      = "";
                     StoresInfo storeById = DepotHelper.GetStoreById(this.offlineOrder.StoreId);
                     if (storeById != null)
                     {
                         text = storeById.StoreName;
                         StoreBalanceDetailInfo storeBalanceDetailInfo = new StoreBalanceDetailInfo();
                         storeBalanceDetailInfo.StoreId         = this.offlineOrder.StoreId;
                         storeBalanceDetailInfo.TradeDate       = DateTime.Now;
                         storeBalanceDetailInfo.TradeType       = StoreTradeTypes.OfflineCashier;
                         storeBalanceDetailInfo.Expenses        = default(decimal);
                         storeBalanceDetailInfo.Income          = this.offlineOrder.PayAmount;
                         storeBalanceDetailInfo.Balance         = storeById.Balance + this.offlineOrder.PayAmount;
                         storeBalanceDetailInfo.Remark          = "线下收银(" + this.offlineOrder.OrderId + ")";
                         storeBalanceDetailInfo.ManagerUserName = "";
                         storeBalanceDetailInfo.TradeNo         = this.offlineOrder.OrderId;
                         storeBalanceDetailInfo.CreateTime      = DateTime.Now;
                         storeBalanceDetailInfo.PlatCommission  = decimal.Zero;
                         if (StoreBalanceHelper.AddBalanceDetailInfo(storeBalanceDetailInfo))
                         {
                             StoresInfo storesInfo = storeById;
                             storesInfo.Balance += this.offlineOrder.PayAmount;
                             StoresHelper.UpdateStore(storeById);
                         }
                     }
                     if (storeById != null)
                     {
                         VShopHelper.AppPsuhRecordForStore(storeById.StoreId, this.offlineOrder.OrderId, "", EnumPushStoreAction.StoreOrderPayed);
                     }
                 }
             }
         }
         catch (Exception ex)
         {
             IDictionary <string, string> dictionary = new Dictionary <string, string>();
             dictionary.Add("ErrorMessage", ex.Message);
             dictionary.Add("StackTrace", ex.StackTrace);
             if (ex.InnerException != null)
             {
                 dictionary.Add("InnerException", ex.InnerException.ToString());
             }
             if (ex.GetBaseException() != null)
             {
                 dictionary.Add("BaseException", ex.GetBaseException().Message);
             }
             if (ex.TargetSite != (MethodBase)null)
             {
                 dictionary.Add("TargetSite", ex.TargetSite.ToString());
             }
             dictionary.Add("ExSource", ex.Source);
             Globals.AppendLog(dictionary, "支付更新订单收款记录或者消息通知时出错:" + ex.Message, "", "", "UserPay1");
         }
         this.ResponseReturn(true, "");
     }
 }
Beispiel #17
0
        public void bindReturnInfo()
        {
            int        returnId   = this.Page.Request["ReturnId"].ToInt(0);
            ReturnInfo returnInfo = TradeHelper.GetReturnInfo(returnId);

            if (returnInfo == null)
            {
                this.ShowMsg("退货信息错误!", false);
            }
            else
            {
                HiddenField hiddenField = this.hidReturnStatus;
                int         num         = (int)returnInfo.HandleStatus;
                hiddenField.Value = num.ToString();
                OrderInfo orderInfo = TradeHelper.GetOrderInfo(returnInfo.OrderId);
                if (orderInfo == null)
                {
                    this.ShowMsg("错误的订单信息!", false);
                }
                else
                {
                    if (string.IsNullOrEmpty(returnInfo.SkuId))
                    {
                        this.listPrducts.DataSource = orderInfo.LineItems.Values;
                    }
                    else
                    {
                        Dictionary <string, LineItemInfo> dictionary = new Dictionary <string, LineItemInfo>();
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            if (value.SkuId == returnInfo.SkuId)
                            {
                                dictionary.Add(value.SkuId, value);
                            }
                        }
                        this.listPrducts.DataSource = dictionary.Values;
                    }
                    this.listPrducts.DataBind();
                    this.litOrderId.Text      = orderInfo.PayOrderId;
                    this.litOrderTotal.Text   = orderInfo.GetTotal(false).F2ToString("f2");
                    this.litRefundReason.Text = returnInfo.ReturnReason;
                    this.litRefundTotal.Text  = returnInfo.RefundAmount.F2ToString("f2");
                    this.litRemark.Text       = returnInfo.UserRemark;
                    Literal literal = this.litReturnQuantity;
                    num          = returnInfo.Quantity;
                    literal.Text = num.ToString();
                    if (returnInfo.RefundType == RefundTypes.InBankCard)
                    {
                        this.litType.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.RefundType, 0) + "(" + returnInfo.BankName + "  " + returnInfo.BankAccountName + "  " + returnInfo.BankAccountNo + ")";
                    }
                    else
                    {
                        this.litType.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.RefundType, 0);
                    }
                    string userCredentials = returnInfo.UserCredentials;
                    if (!string.IsNullOrEmpty(userCredentials))
                    {
                        string[] array = userCredentials.Split('|');
                        userCredentials = "";
                        string[] array2 = array;
                        foreach (string str in array2)
                        {
                            userCredentials += string.Format(this.credentialsImgHtml, Globals.GetImageServerUrl() + str);
                        }
                        this.litImageList.Text = userCredentials;
                    }
                    else
                    {
                        this.divCredentials.Visible = false;
                    }
                    if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund)
                    {
                        this.btnAcceptReturn.Text = "确认退款";
                        this.btnRefuseReturn.Text = "拒绝退款";
                        this.AfterSaleType        = "退款";
                    }
                    if (returnInfo.HandleStatus == ReturnStatus.Applied && !orderInfo.IsStoreCollect)
                    {
                        this.btnAcceptReturn.Visible = true;
                        this.btnRefuseReturn.Visible = true;
                    }
                    if (returnInfo.HandleStatus == ReturnStatus.Deliverying && this.UserStoreId > 0 && !orderInfo.IsStoreCollect)
                    {
                        this.btnGetGoods.Visible = true;
                    }
                    if ((orderInfo.StoreId == this.UserStoreId || orderInfo.StoreId <= 0 || (!orderInfo.IsStoreCollect && this.UserStoreId == 0)) && (returnInfo.HandleStatus == ReturnStatus.GetGoods || (returnInfo.HandleStatus == ReturnStatus.Deliverying && orderInfo.StoreId <= 0)))
                    {
                        if (returnInfo.HandleStatus == ReturnStatus.Deliverying)
                        {
                            this.btnFinishReturn.Text = "确认收货并完成退款";
                        }
                        this.btnFinishReturn.Visible = true;
                    }
                    if (returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned)
                    {
                        this.inputPanel.Visible = true;
                        this.showPanel.Visible  = false;
                    }
                    else
                    {
                        this.inputPanel.Visible = false;
                        this.showPanel.Visible  = true;
                    }
                    if (returnInfo.HandleStatus != 0)
                    {
                        this.txtAdminCellPhone.Visible   = false;
                        this.txtAdminShipAddress.Visible = false;
                        this.txtAdminShipTo.Visible      = false;
                        this.litAdminCellPhone.Visible   = true;
                        this.litAdminShipAddrss.Visible  = true;
                        this.litAdminShipTo.Visible      = true;
                        this.litAdminCellPhone.Text      = returnInfo.AdminCellPhone;
                        this.litAdminShipTo.Text         = returnInfo.AdminShipTo;
                        this.litAdminShipAddrss.Text     = returnInfo.AdminShipAddress;
                    }
                    else if (orderInfo.SupplierId > 0)
                    {
                        ShippersInfo defaultGetGoodsShipperBysupplierId = SalesHelper.GetDefaultGetGoodsShipperBysupplierId(orderInfo.SupplierId);
                        if (defaultGetGoodsShipperBysupplierId != null)
                        {
                            Literal literal2 = this.litAdminShipAddrss;
                            TextBox textBox  = this.txtAdminShipAddress;
                            string  text3    = literal2.Text = (textBox.Text = RegionHelper.GetFullRegion(defaultGetGoodsShipperBysupplierId.RegionId, " ", true, 0) + " " + defaultGetGoodsShipperBysupplierId.Address);
                            Literal literal3 = this.litAdminShipTo;
                            TextBox textBox2 = this.txtAdminShipTo;
                            text3 = (literal3.Text = (textBox2.Text = defaultGetGoodsShipperBysupplierId.ShipperName));
                            Literal literal4 = this.litAdminCellPhone;
                            TextBox textBox3 = this.txtAdminCellPhone;
                            text3 = (literal4.Text = (textBox3.Text = defaultGetGoodsShipperBysupplierId.CellPhone));
                        }
                    }
                    else if (orderInfo.StoreId > 0)
                    {
                        StoresInfo storeById = DepotHelper.GetStoreById(orderInfo.StoreId);
                        if (storeById != null)
                        {
                            Literal literal5 = this.litAdminShipAddrss;
                            TextBox textBox4 = this.txtAdminShipAddress;
                            string  text3    = literal5.Text = (textBox4.Text = RegionHelper.GetFullRegion(storeById.RegionId, " ", true, 0) + " " + storeById.Address);
                            Literal literal6 = this.litAdminShipTo;
                            TextBox textBox5 = this.txtAdminShipTo;
                            text3 = (literal6.Text = (textBox5.Text = storeById.ContactMan));
                            Literal literal7 = this.litAdminCellPhone;
                            TextBox textBox6 = this.txtAdminCellPhone;
                            text3 = (literal7.Text = (textBox6.Text = storeById.Tel));
                        }
                    }
                    else
                    {
                        ShippersInfo defaultOrFirstGetGoodShipper = TradeHelper.GetDefaultOrFirstGetGoodShipper();
                        if (defaultOrFirstGetGoodShipper != null)
                        {
                            Literal literal8 = this.litAdminShipAddrss;
                            TextBox textBox7 = this.txtAdminShipAddress;
                            string  text3    = literal8.Text = (textBox7.Text = RegionHelper.GetFullRegion(defaultOrFirstGetGoodShipper.RegionId, " ", true, 0) + " " + defaultOrFirstGetGoodShipper.Address);
                            Literal literal9 = this.litAdminShipTo;
                            TextBox textBox8 = this.txtAdminShipTo;
                            text3 = (literal9.Text = (textBox8.Text = defaultOrFirstGetGoodShipper.ShipperName));
                            Literal literal10 = this.litAdminCellPhone;
                            TextBox textBox9  = this.txtAdminCellPhone;
                            text3 = (literal10.Text = (textBox9.Text = defaultOrFirstGetGoodShipper.CellPhone));
                        }
                    }
                    this.litRefundMoney.Text = returnInfo.RefundAmount.F2ToString("f2") + "元";
                    this.txtAdminRemark.Text = returnInfo.AdminRemark;
                    if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund)
                    {
                        this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 3);
                    }
                    else
                    {
                        this.txtStatus.Text = EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 0);
                    }
                    this.litRefundMoney.Text = returnInfo.RefundAmount.F2ToString("f2") + "元";
                    Literal literal11 = this.txtAfterSaleId;
                    num                      = returnInfo.ReturnId;
                    literal11.Text           = num.ToString();
                    this.txtPayMoney.Text    = orderInfo.GetTotal(false).F2ToString("f2");
                    this.txtRefundMoney.Text = returnInfo.RefundAmount.F2ToString("f2");
                    HiddenField hiddenField2 = this.hidAfterSaleType;
                    num = (int)returnInfo.AfterSaleType;
                    hiddenField2.Value            = num.ToString();
                    this.hidRefundMaxAmount.Value = orderInfo.GetCanRefundAmount(returnInfo.SkuId, null, 0).F2ToString("f2");
                    if (returnInfo.AfterSaleType == AfterSaleTypes.ReturnAndRefund && (returnInfo.HandleStatus == ReturnStatus.Deliverying || returnInfo.HandleStatus == ReturnStatus.GetGoods || returnInfo.HandleStatus == ReturnStatus.Returned))
                    {
                        this.btnViewLogistic.Visible = true;
                        AttributeCollection attributes = this.btnViewLogistic.Attributes;
                        num = returnInfo.ReturnId;
                        attributes.Add("returnsid", num.ToString());
                        AttributeCollection attributes2 = this.btnViewLogistic.Attributes;
                        num = returnInfo.ReturnId;
                        attributes2.Add("returnsid", num.ToString());
                        this.btnViewLogistic.Attributes.Add("expresscompanyname", returnInfo.ExpressCompanyName.ToString());
                        this.btnViewLogistic.Attributes.Add("shipordernumber", returnInfo.ShipOrderNumber.ToString());
                    }
                    if (orderInfo.SupplierId > 0)
                    {
                        this.btnGetGoods.Visible = false;
                    }
                }
            }
        }
Beispiel #18
0
        private void printdata()
        {
            this.mailNo = this.txtStartCode.Text.Trim();
            int    shipperId = int.Parse(this.ddlShoperTag.SelectedValue.ToString());
            string path      = HttpContext.Current.Request.MapPath(string.Format("../../Storage/master/flex/{0}", this.ddlTemplates.SelectedValue));

            if (File.Exists(path))
            {
                XmlDocument document = new XmlDocument();
                document.Load(path);
                XmlNode node = document.DocumentElement.SelectSingleNode("//printer");
                this.templateName = node.SelectSingleNode("kind").InnerText;
                string innerText = node.SelectSingleNode("pic").InnerText;
                string str2      = node.SelectSingleNode("size").InnerText;
                this.width  = str2.Split(new char[] { ':' })[0];
                this.height = str2.Split(new char[] { ':' })[1];
                DataSet printData = this.GetPrintData(orderIds);
                this.pringrows = printData.Tables[0].Rows.Count;
                foreach (DataRow row in printData.Tables[0].Rows)
                {
                    this.UpdateOrderIds = this.UpdateOrderIds + row["orderid"] + ",";
                    DataTable    table    = printData.Tables[1];
                    ShippersInfo shipper  = SalesHelper.GetShipper(shipperId);
                    string[]     strArray = row["shippingRegion"].ToString().Split(new char[] { ',' });
                    foreach (XmlNode node2 in node.SelectNodes("item"))
                    {
                        string   str3      = string.Empty;
                        string   str4      = node2.SelectSingleNode("name").InnerText;
                        string   str5      = node2.SelectSingleNode("position").InnerText;
                        string   str6      = str5.Split(new char[] { ':' })[0];
                        string   str7      = str5.Split(new char[] { ':' })[1];
                        string   str8      = str5.Split(new char[] { ':' })[2];
                        string   str9      = str5.Split(new char[] { ':' })[3];
                        string   str10     = str9 + "," + str8 + "," + str6 + "," + str7;
                        string[] strArray2 = new string[] { "", "", "" };
                        if (shipper != null)
                        {
                            strArray2 = RegionHelper.GetFullRegion(shipper.RegionId, "-").Split(new char[] { '-' });
                        }
                        string str11 = string.Empty;
                        if (str4.Split(new char[] { '_' })[0] == "收货人-姓名")
                        {
                            this.ShipTo = this.ShipTo + "'" + this.ReplaceString(row["ShipTo"].ToString()) + "',";
                            if (!string.IsNullOrEmpty(row["ShipTo"].ToString().Trim()))
                            {
                                this.SizeShipTo = this.SizeShipTo + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeShipTo = this.SizeShipTo + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "收货人-电话")
                        {
                            this.ShipTelPhone = this.ShipTelPhone + "'" + row["TelPhone"].ToString() + "',";
                            if (!string.IsNullOrEmpty(row["TelPhone"].ToString().Trim()))
                            {
                                this.SizeShipTelPhone = this.SizeShipTelPhone + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeShipTelPhone = this.SizeShipTelPhone + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "收货人-手机")
                        {
                            this.ShipCellPhone = this.ShipCellPhone + "'" + row["CellPhone"].ToString() + "',";
                            if (!string.IsNullOrEmpty(row["CellPhone"].ToString().Trim()))
                            {
                                this.SizeShipCellPhone = this.SizeShipCellPhone + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeShipCellPhone = this.SizeShipCellPhone + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "收货人-邮编")
                        {
                            this.ShipZipCode = this.ShipZipCode + "'" + row["ZipCode"].ToString() + "',";
                            if (!string.IsNullOrEmpty(row["ZipCode"].ToString().Trim()))
                            {
                                this.SizeShipZipCode = this.SizeShipZipCode + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeShipZipCode = this.SizeShipZipCode + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "收货人-地址")
                        {
                            this.ShipAddress = this.ShipAddress + "'" + this.ReplaceString(row["Address"].ToString()) + "',";
                            if (!string.IsNullOrEmpty(row["Address"].ToString().Trim()))
                            {
                                this.ShipSizeAddress = this.ShipSizeAddress + "'" + str10 + "',";
                            }
                            else
                            {
                                this.ShipSizeAddress = this.ShipSizeAddress + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "收货人-地区1级")
                        {
                            if (strArray.Length > 0)
                            {
                                str3 = strArray[0];
                            }
                            this.ShipProvince = this.ShipProvince + "'" + str3 + "',";
                            if (!string.IsNullOrEmpty(str3.Trim()))
                            {
                                this.ShipSizeProvnce = this.ShipSizeProvnce + "'" + str10 + "',";
                            }
                            else
                            {
                                this.ShipSizeProvnce = this.ShipSizeProvnce + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "收货人-地区2级")
                        {
                            str3 = string.Empty;
                            if (strArray.Length > 1)
                            {
                                str3 = strArray[1];
                            }
                            this.ShipCity = this.ShipCity + "'" + str3 + "',";
                            if (!string.IsNullOrEmpty(str3.Trim()))
                            {
                                this.ShipSizeCity = this.ShipSizeCity + "'" + str10 + "',";
                            }
                            else
                            {
                                this.ShipSizeCity = this.ShipSizeCity + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "目的地-地区")
                        {
                            str3 = string.Empty;
                            if (strArray.Length > 1)
                            {
                                str3 = strArray[1];
                            }
                            this.Destination = this.Destination + "'" + str3 + "',";
                            if (!string.IsNullOrEmpty(str3.Trim()))
                            {
                                this.SizeDestination = this.SizeDestination + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeDestination = this.SizeDestination + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "收货人-地区3级")
                        {
                            str3 = string.Empty;
                            if (strArray.Length > 2)
                            {
                                str3 = strArray[2];
                            }
                            this.ShipDistrict = this.ShipDistrict + "'" + str3 + "',";
                            if (!string.IsNullOrEmpty(str3.Trim()))
                            {
                                this.ShipSizeDistrict = this.ShipSizeDistrict + "'" + str10 + "',";
                            }
                            else
                            {
                                this.ShipSizeDistrict = this.ShipSizeDistrict + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "送货-上门时间")
                        {
                            this.ShipToDate = this.ShipToDate + "'" + row["ShipToDate"].ToString() + "',";
                            if (!string.IsNullOrEmpty(row["ShipToDate"].ToString().Trim()))
                            {
                                this.SizeShipToDate = this.SizeShipToDate + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeShipToDate = this.SizeShipToDate + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "订单-订单号")
                        {
                            this.OrderId = this.OrderId + "'订单号:" + row["OrderId"].ToString() + "',";
                            if (!string.IsNullOrEmpty(row["OrderId"].ToString().Trim()))
                            {
                                this.SizeOrderId = this.SizeOrderId + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeOrderId = this.SizeOrderId + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "订单-总金额")
                        {
                            if (!string.IsNullOrEmpty(row["OrderTotal"].ToString().Trim()))
                            {
                                this.OrderTotal = this.OrderTotal + decimal.Parse(row["OrderTotal"].ToString()).ToString("F2") + "',";
                            }
                            if (!string.IsNullOrEmpty(row["OrderTotal"].ToString().Trim()))
                            {
                                this.SizeOrderTotal = this.SizeOrderTotal + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeOrderTotal = this.SizeOrderTotal + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "订单-详情")
                        {
                            DataRow[] rowArray = table.Select(" OrderId='" + row["OrderId"] + "'");
                            string    str      = string.Empty;
                            if (rowArray.Length > 0)
                            {
                                foreach (DataRow row2 in rowArray)
                                {
                                    str = string.Concat(new object[] { str, "规格", row2["SKUContent"], " 数量", row2["ShipmentQuantity"], "货号 :", row2["SKU"] });
                                }
                                str = str.Replace(";", "");
                            }
                            if (!string.IsNullOrEmpty(str.Trim()))
                            {
                                this.SizeitemInfos = this.SizeitemInfos + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeitemInfos = this.SizeitemInfos + "'0,0,0,0',";
                            }
                            this.ShipitemInfos = this.ShipitemInfos + "'" + this.ReplaceString(str) + "',";
                        }
                        if (str4.Split(new char[] { '_' })[0] == "订单-物品总重量")
                        {
                            decimal result = 0M;
                            decimal.TryParse(row["Weight"].ToString(), out result);
                            this.Shipitemweith = this.Shipitemweith + "'" + result.ToString("F2") + "',";
                            if (!string.IsNullOrEmpty(result.ToString().Trim()))
                            {
                                this.SizeShipitemweith = this.SizeShipitemweith + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeShipitemweith = this.SizeShipitemweith + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "订单-备注")
                        {
                            this.Remark = this.Remark + "'" + this.ReplaceString(row["Remark"].ToString()) + "',";
                            if (!string.IsNullOrEmpty(row["Remark"].ToString().Trim()))
                            {
                                this.SizeRemark = this.SizeRemark + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeRemark = this.SizeRemark + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "发货人-姓名")
                        {
                            this.ShipperName = this.ShipperName + "'" + this.ReplaceString(shipper.ShipperName) + "',";
                            if (!string.IsNullOrEmpty(shipper.ShipperName.Trim()))
                            {
                                this.SizeShipperName = this.SizeShipperName + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeShipperName = this.SizeShipperName + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "发货人-电话")
                        {
                            this.TelPhone = this.TelPhone + "'" + shipper.TelPhone + "',";
                            if (!string.IsNullOrEmpty(shipper.TelPhone.Trim()))
                            {
                                this.SizeTelPhone = this.SizeTelPhone + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeTelPhone = this.SizeTelPhone + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "发货人-手机")
                        {
                            this.CellPhone = this.CellPhone + "'" + shipper.CellPhone + "',";
                            if (!string.IsNullOrEmpty(shipper.CellPhone.Trim()))
                            {
                                this.SizeCellPhone = this.SizeCellPhone + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeCellPhone = this.SizeCellPhone + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "发货人-邮编")
                        {
                            this.Zipcode = this.Zipcode + "'" + shipper.Zipcode + "',";
                            if (!string.IsNullOrEmpty(shipper.Zipcode.Trim()))
                            {
                                this.SizeZipcode = this.SizeZipcode + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeZipcode = this.SizeZipcode + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "发货人-地址")
                        {
                            this.Address = this.Address + "'" + this.ReplaceString(shipper.Address) + "',";
                            if (!string.IsNullOrEmpty(shipper.Address.Trim()))
                            {
                                this.SizeAddress = this.SizeAddress + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeAddress = this.SizeAddress + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "发货人-地区1级")
                        {
                            if (strArray2.Length > 0)
                            {
                                str11 = strArray2[0];
                            }
                            this.Province = this.Province + "'" + str11 + "',";
                            if (!string.IsNullOrEmpty(str11.Trim()))
                            {
                                this.SizeProvnce = this.SizeProvnce + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeProvnce = this.SizeProvnce + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "发货人-地区2级")
                        {
                            str11 = str11 + string.Empty;
                            if (strArray2.Length > 1)
                            {
                                str11 = strArray2[1];
                            }
                            this.City = this.City + "'" + str11 + "',";
                            if (!string.IsNullOrEmpty(str11.Trim()))
                            {
                                this.SizeCity = this.SizeCity + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeCity = this.SizeCity + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "始发地-地区")
                        {
                            str11 = str11 + string.Empty;
                            if (strArray2.Length > 1)
                            {
                                str11 = strArray2[1];
                            }
                            this.Departure = this.Departure + "'" + str11 + "',";
                            if (!string.IsNullOrEmpty(str11.Trim()))
                            {
                                this.SizeDeparture = this.SizeDeparture + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeDeparture = this.SizeDeparture + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "发货人-地区3级")
                        {
                            str11 = str11 + string.Empty;
                            if (strArray2.Length > 2)
                            {
                                str11 = strArray2[2];
                            }
                            this.District = this.District + "'" + str11 + "',";
                            if (!string.IsNullOrEmpty(str11.Trim()))
                            {
                                this.SizeDistrict = this.SizeDistrict + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeDistrict = this.SizeDistrict + "'0,0,0,0',";
                            }
                        }
                        if (str4.Split(new char[] { '_' })[0] == "网店名称")
                        {
                            this.SiteName = this.SiteName + "'" + this.ReplaceString(this.siteSettings.SiteName) + "',";
                            if (!string.IsNullOrEmpty(this.siteSettings.SiteName.Trim()))
                            {
                                this.SizeSiteName = this.SizeSiteName + "'" + str10 + "',";
                            }
                            else
                            {
                                this.SizeSiteName = this.SizeSiteName + "'0,0,0,0',";
                            }
                        }
                    }
                }
                this.UpdateOrderIds = this.UpdateOrderIds.TrimEnd(new char[] { ',' });
                this.PrintPage(this.width, this.height);
            }
        }
Beispiel #19
0
 public static bool UpdateShipper(ShippersInfo shipper)
 {
     Globals.EntityCoding(shipper, true);
     return(SalesProvider.Instance().UpdateShipper(shipper));
 }
Beispiel #20
0
        private void WriteOrderInfo(OrderInfo order, ShippersInfo shipper)
        {
            string fullRegion = RegionHelper.GetFullRegion(order.RegionId, ",", true, 0);

            string[]      array         = fullRegion.Split(',');
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("<nodes>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-姓名</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.ShipTo);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-电话</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.TelPhone + "_");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-手机</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.CellPhone + "_");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-邮编</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.ZipCode + "_");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-地址</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.Address);
            stringBuilder.AppendLine("</item>");
            if (array.Length != 0)
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>收货人-地区1级</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", array[0]);
                stringBuilder.AppendLine("</item>");
            }
            if (array.Length > 1)
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>收货人-地区2级</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", array[1]);
                stringBuilder.AppendLine("</item>");
            }
            if (array.Length > 2)
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>收货人-地区3级</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", array[2]);
                stringBuilder.AppendLine("</item>");
            }
            if (array.Length > 3)
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>收货人-地区4级</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", array[3]);
                stringBuilder.AppendLine("</item>");
            }
            if (shipper != null)
            {
                string   fullRegion2 = RegionHelper.GetFullRegion(shipper.RegionId, ",", true, 0);
                string[] array2      = fullRegion2.Split(',');
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-姓名</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.ShipperName);
                stringBuilder.AppendLine("</item>");
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-手机</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.CellPhone + "_");
                stringBuilder.AppendLine("</item>");
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-电话</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.TelPhone + "_");
                stringBuilder.AppendLine("</item>");
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-地址</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.Address);
                stringBuilder.AppendLine("</item>");
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-邮编</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.Zipcode + "_");
                stringBuilder.AppendLine("</item>");
                if (array2.Length != 0)
                {
                    stringBuilder.AppendLine("<item>");
                    stringBuilder.AppendLine("<name>发货人-地区1级</name>");
                    stringBuilder.AppendFormat("<rename>{0}</rename>", array2[0]);
                    stringBuilder.AppendLine("</item>");
                }
                if (array2.Length > 1)
                {
                    stringBuilder.AppendLine("<item>");
                    stringBuilder.AppendLine("<name>发货人-地区2级</name>");
                    stringBuilder.AppendFormat("<rename>{0}</rename>", array2[1]);
                    stringBuilder.AppendLine("</item>");
                }
                if (array2.Length > 2)
                {
                    stringBuilder.AppendLine("<item>");
                    stringBuilder.AppendLine("<name>发货人-地区3级</name>");
                    stringBuilder.AppendFormat("<rename>{0}</rename>", array2[2]);
                    stringBuilder.AppendLine("</item>");
                }
                if (array2.Length > 3)
                {
                    stringBuilder.AppendLine("<item>");
                    stringBuilder.AppendLine("<name>发货人-地区4级</name>");
                    stringBuilder.AppendFormat("<rename>{0}</rename>", array2[3]);
                    stringBuilder.AppendLine("</item>");
                }
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-订单号</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.PayOrderId);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-总金额</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.GetTotal(false) + "_");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-物品总重量</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.Weight);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-备注</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.ManagerRemark);
            stringBuilder.AppendLine("</item>");
            string text = "";

            if (order.LineItems != null && order.LineItems.Count > 0)
            {
                foreach (LineItemInfo value in order.LineItems.Values)
                {
                    text = text + "货号 " + value.SKU + " " + value.SKUContent + " ×" + value.ShipmentQuantity + "\n";
                }
                text = text.Replace(";", "").Replace(";", "").Replace(":", ":");
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-详情</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", text);
            stringBuilder.AppendLine("</item>");
            if (order.ShippingDate == DateTime.Parse("0001-1-1"))
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>订单-送货时间</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", "null");
                stringBuilder.AppendLine("</item>");
            }
            else
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>订单-送货时间</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", order.ShippingDate);
                stringBuilder.AppendLine("</item>");
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>网店名称</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", HiContext.Current.SiteSettings.SiteName);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>自定义内容</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", "null");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("</nodes>");
            base.Response.Write(stringBuilder.ToString());
        }
Beispiel #21
0
 public static long AddShipperRetrunID(ShippersInfo shipper)
 {
     Globals.EntityCoding(shipper, true);
     return(new ShipperDao().AddShipperReurnID(shipper));
 }
Beispiel #22
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!base.IsPostBack)
     {
         this.mailNo = base.Request["mailNo"];
         int shipperId = int.Parse(base.Request["shipperId"]);
         this.orderIds = base.Request["orderIds"].Trim(new char[]
         {
             ','
         });
         string text = System.Web.HttpContext.Current.Request.MapPath(string.Format("../../Storage/master/flex/{0}", base.Request["template"]));
         if (System.IO.File.Exists(text))
         {
             System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
             xmlDocument.Load(text);
             System.Xml.XmlNode xmlNode = xmlDocument.DocumentElement.SelectSingleNode("//printer");
             this.templateName = xmlNode.SelectSingleNode("kind").InnerText;
             string innerText  = xmlNode.SelectSingleNode("pic").InnerText;
             string innerText2 = xmlNode.SelectSingleNode("size").InnerText;
             this.width = innerText2.Split(new char[]
             {
                 ':'
             })[0];
             this.height = innerText2.Split(new char[]
             {
                 ':'
             })[1];
             System.Data.DataSet printData = this.GetPrintData(this.orderIds);
             int num = 0;
             foreach (System.Data.DataRow dataRow in printData.Tables[0].Rows)
             {
                 System.Web.UI.HtmlControls.HtmlGenericControl htmlGenericControl = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
                 if (!string.IsNullOrEmpty(innerText) && innerText != "noimage")
                 {
                     using (Image image = Image.FromFile(System.Web.HttpContext.Current.Request.MapPath(string.Format("../../Storage/master/flex/{0}", innerText))))
                     {
                         htmlGenericControl.Attributes["style"] = string.Format("background-image: url(../../Storage/master/flex/{0}); width: {1}px; height: {2}px;text-align: center; position: relative;", innerText, image.Width, image.Height);
                     }
                 }
                 System.Data.DataTable dataTable = printData.Tables[1];
                 ShippersInfo          shipper   = SalesHelper.GetShipper(shipperId);
                 string[] array = dataRow["shippingRegion"].ToString().Split(new char[]
                 {
                     ','
                 });
                 foreach (System.Xml.XmlNode xmlNode2 in xmlNode.SelectNodes("item"))
                 {
                     string text2 = xmlNode2.SelectSingleNode("name").InnerText;
                     System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(text2);
                     stringBuilder.Replace("收货人-姓名", dataRow["ShipTo"].ToString());
                     stringBuilder.Replace("收货人-电话", dataRow["TelPhone"].ToString());
                     stringBuilder.Replace("收货人-手机", dataRow["CellPhone"].ToString());
                     stringBuilder.Replace("收货人-邮编", dataRow["ZipCode"].ToString());
                     stringBuilder.Replace("收货人-地址", dataRow["Address"].ToString());
                     string newValue = string.Empty;
                     if (array.Length > 0)
                     {
                         newValue = array[0];
                     }
                     stringBuilder.Replace("收货人-地区1级", newValue);
                     newValue = string.Empty;
                     if (array.Length > 1)
                     {
                         newValue = array[1];
                     }
                     stringBuilder.Replace("收货人-地区2级", newValue);
                     newValue = string.Empty;
                     if (array.Length > 2)
                     {
                         newValue = array[2];
                     }
                     stringBuilder.Replace("收货人-地区3级", newValue);
                     string[] array2 = new string[]
                     {
                         "",
                         "",
                         ""
                     };
                     if (shipper != null)
                     {
                         array2 = RegionHelper.GetFullRegion(shipper.RegionId, "-").Split(new char[]
                         {
                             '-'
                         });
                     }
                     stringBuilder.Replace("发货人-姓名", (shipper != null) ? shipper.ShipperName : "");
                     stringBuilder.Replace("发货人-手机", (shipper != null) ? shipper.CellPhone : "");
                     stringBuilder.Replace("发货人-电话", (shipper != null) ? shipper.TelPhone : "");
                     stringBuilder.Replace("发货人-地址", (shipper != null) ? shipper.Address : "");
                     stringBuilder.Replace("发货人-邮编", (shipper != null) ? shipper.Zipcode : "");
                     string newValue2 = string.Empty;
                     if (array2.Length > 0)
                     {
                         newValue2 = array2[0];
                     }
                     stringBuilder.Replace("发货人-地区1级", newValue2);
                     newValue2 = string.Empty;
                     if (array2.Length > 1)
                     {
                         newValue2 = array2[1];
                     }
                     stringBuilder.Replace("发货人-地区2级", newValue2);
                     newValue2 = string.Empty;
                     if (array2.Length > 2)
                     {
                         newValue2 = array2[2];
                     }
                     stringBuilder.Replace("发货人-地区3级", newValue2);
                     stringBuilder.Replace("订单-订单号", "订单号:" + dataRow["OrderId"].ToString());
                     stringBuilder.Replace("订单-总金额", this.CalculateOrderTotal(dataRow, printData).ToString());
                     stringBuilder.Replace("订单-物品总重量", dataRow["Weight"].ToString());
                     stringBuilder.Replace("订单-备注", dataRow["Remark"].ToString());
                     System.Data.DataRow[] array3 = dataTable.Select(" OrderId='" + dataRow["OrderId"] + "'");
                     string text3 = string.Empty;
                     if (array3.Length > 0)
                     {
                         System.Data.DataRow[] array4 = array3;
                         for (int i = 0; i < array4.Length; i++)
                         {
                             System.Data.DataRow dataRow2 = array4[i];
                             text3 = string.Concat(new object[]
                             {
                                 text3,
                                 "规格 ",
                                 dataRow2["SKUContent"],
                                 " ×",
                                 dataRow2["ShipmentQuantity"],
                                 "\n"
                             });
                         }
                         text3 = text3.Replace(";", "");
                     }
                     stringBuilder.Replace("订单-详情", text3);
                     stringBuilder.Replace("订单-送货时间", "");
                     stringBuilder.Replace("网店名称", Hidistro.Membership.Context.HiContext.Current.SiteSettings.SiteName);
                     stringBuilder.Replace("自定义内容", "");
                     text2 = stringBuilder.ToString();
                     string innerText3 = xmlNode2.SelectSingleNode("font").InnerText;
                     string arg_685_0  = xmlNode2.SelectSingleNode("fontsize").InnerText;
                     string innerText4 = xmlNode2.SelectSingleNode("position").InnerText;
                     string innerText5 = xmlNode2.SelectSingleNode("align").InnerText;
                     string str        = innerText4.Split(new char[]
                     {
                         ':'
                     })[0];
                     string str2 = innerText4.Split(new char[]
                     {
                         ':'
                     })[1];
                     string str3 = innerText4.Split(new char[]
                     {
                         ':'
                     })[2];
                     string str4 = innerText4.Split(new char[]
                     {
                         ':'
                     })[3];
                     System.Web.UI.HtmlControls.HtmlGenericControl htmlGenericControl2 = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
                     htmlGenericControl2.Visible   = true;
                     htmlGenericControl2.InnerText = text2.Split(new char[]
                     {
                         '_'
                     })[0];
                     htmlGenericControl2.Style["font-family"] = innerText3;
                     htmlGenericControl2.Style["font-size"]   = "16px";
                     htmlGenericControl2.Style["width"]       = str + "px";
                     htmlGenericControl2.Style["height"]      = str2 + "px";
                     htmlGenericControl2.Style["text-align"]  = innerText5;
                     htmlGenericControl2.Style["position"]    = "absolute";
                     htmlGenericControl2.Style["left"]        = str3 + "px";
                     htmlGenericControl2.Style["top"]         = str4 + "px";
                     htmlGenericControl2.Style["padding"]     = "0";
                     htmlGenericControl2.Style["margin-left"] = "0px";
                     htmlGenericControl2.Style["margin-top"]  = "0px";
                     htmlGenericControl.Controls.Add(htmlGenericControl2);
                 }
                 this.divContent.Controls.Add(htmlGenericControl);
                 num++;
                 if (num < printData.Tables[0].Rows.Count)
                 {
                     System.Web.UI.HtmlControls.HtmlGenericControl htmlGenericControl3 = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
                     htmlGenericControl3.Attributes["class"] = "PageNext";
                     this.divContent.Controls.Add(htmlGenericControl3);
                 }
             }
         }
     }
 }
Beispiel #23
0
        private void WriteOrderInfo(OrderInfo order, ShippersInfo shipper)
        {
            string fullRegion = RegionHelper.GetFullRegion(order.RegionId, ",");

            string[] array = fullRegion.Split(new char[]
            {
                ','
            });
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            stringBuilder.AppendLine("<nodes>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-姓名</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.ShipTo);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-电话</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.TelPhone + "_");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-手机</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.CellPhone + "_");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-邮编</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.ZipCode + "_");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>收货人-地址</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.Address);
            stringBuilder.AppendLine("</item>");
            if (array.Length > 0)
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>收货人-地区1级</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", array[0]);
                stringBuilder.AppendLine("</item>");
            }
            if (array.Length > 1)
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>收货人-地区2级</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", array[1]);
                stringBuilder.AppendLine("</item>");
            }
            if (array.Length > 2)
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>收货人-地区3级</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", array[2]);
                stringBuilder.AppendLine("</item>");
            }
            if (shipper != null)
            {
                string   fullRegion2 = RegionHelper.GetFullRegion(shipper.RegionId, ",");
                string[] array2      = fullRegion2.Split(new char[]
                {
                    ','
                });
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-姓名</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.ShipperName);
                stringBuilder.AppendLine("</item>");
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-手机</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.CellPhone + "_");
                stringBuilder.AppendLine("</item>");
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-电话</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.TelPhone + "_");
                stringBuilder.AppendLine("</item>");
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-地址</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.Address);
                stringBuilder.AppendLine("</item>");
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>发货人-邮编</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", shipper.Zipcode + "_");
                stringBuilder.AppendLine("</item>");
                if (array2.Length > 0)
                {
                    stringBuilder.AppendLine("<item>");
                    stringBuilder.AppendLine("<name>发货人-地区1级</name>");
                    stringBuilder.AppendFormat("<rename>{0}</rename>", array2[0]);
                    stringBuilder.AppendLine("</item>");
                }
                if (array2.Length > 1)
                {
                    stringBuilder.AppendLine("<item>");
                    stringBuilder.AppendLine("<name>发货人-地区2级</name>");
                    stringBuilder.AppendFormat("<rename>{0}</rename>", array2[1]);
                    stringBuilder.AppendLine("</item>");
                }
                if (array2.Length > 2)
                {
                    stringBuilder.AppendLine("<item>");
                    stringBuilder.AppendLine("<name>发货人-地区3级</name>");
                    stringBuilder.AppendFormat("<rename>{0}</rename>", array2[2]);
                    stringBuilder.AppendLine("</item>");
                }
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-订单号</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.OrderId);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-总金额</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.GetTotal() + "_");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-物品总重量</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.Weight);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-备注</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", order.ManagerRemark);
            stringBuilder.AppendLine("</item>");
            string text = "";

            if (order.LineItems != null && order.LineItems.Count > 0)
            {
                foreach (LineItemInfo current in order.LineItems.Values)
                {
                    object obj = text;
                    text = string.Concat(new object[]
                    {
                        obj,
                        "货号 ",
                        current.SKU,
                        " ",
                        current.SKUContent,
                        " ×",
                        current.ShipmentQuantity,
                        "\n"
                    });
                }
                text = text.Replace(";", "").Replace(";", "").Replace(":", ":");
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>订单-详情</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", text);
            stringBuilder.AppendLine("</item>");
            if (order.ShippingDate == System.DateTime.Parse("0001-1-1"))
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>订单-送货时间</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", "null");
                stringBuilder.AppendLine("</item>");
            }
            else
            {
                stringBuilder.AppendLine("<item>");
                stringBuilder.AppendLine("<name>订单-送货时间</name>");
                stringBuilder.AppendFormat("<rename>{0}</rename>", order.ShippingDate);
                stringBuilder.AppendLine("</item>");
            }
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>网店名称</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", SettingsManager.GetMasterSettings(true).SiteName);
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("<item>");
            stringBuilder.AppendLine("<name>自定义内容</name>");
            stringBuilder.AppendFormat("<rename>{0}</rename>", "null");
            stringBuilder.AppendLine("</item>");
            stringBuilder.AppendLine("</nodes>");
            base.Response.Write(stringBuilder.ToString());
        }
Beispiel #24
0
        private void WriteOrderInfo(OrderInfo order, ShippersInfo shipper)
        {
            string[]      strArray = RegionHelper.GetFullRegion(order.RegionId, ",").Split(new char[] { ',' });
            StringBuilder builder  = new StringBuilder();

            builder.AppendLine("<nodes>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-姓名</name>");
            builder.AppendFormat("<rename>{0}</rename>", order.ShipTo);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-电话</name>");
            builder.AppendFormat("<rename>{0}</rename>", order.TelPhone + "_");
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-手机</name>");
            builder.AppendFormat("<rename>{0}</rename>", order.CellPhone + "_");
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-邮编</name>");
            builder.AppendFormat("<rename>{0}</rename>", order.ZipCode + "_");
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-地址</name>");
            builder.AppendFormat("<rename>{0}</rename>", order.Address);
            builder.AppendLine("</item>");
            if (strArray.Length > 0)
            {
                builder.AppendLine("<item>");
                builder.AppendLine("<name>收货人-地区1级</name>");
                builder.AppendFormat("<rename>{0}</rename>", strArray[0]);
                builder.AppendLine("</item>");
            }
            if (strArray.Length > 1)
            {
                builder.AppendLine("<item>");
                builder.AppendLine("<name>收货人-地区2级</name>");
                builder.AppendFormat("<rename>{0}</rename>", strArray[1]);
                builder.AppendLine("</item>");
            }
            if (strArray.Length > 2)
            {
                builder.AppendLine("<item>");
                builder.AppendLine("<name>收货人-地区3级</name>");
                builder.AppendFormat("<rename>{0}</rename>", strArray[2]);
                builder.AppendLine("</item>");
            }
            if (shipper != null)
            {
                string[] strArray2 = RegionHelper.GetFullRegion(shipper.RegionId, ",").Split(new char[] { ',' });
                builder.AppendLine("<item>");
                builder.AppendLine("<name>发货人-姓名</name>");
                builder.AppendFormat("<rename>{0}</rename>", shipper.ShipperName);
                builder.AppendLine("</item>");
                builder.AppendLine("<item>");
                builder.AppendLine("<name>发货人-手机</name>");
                builder.AppendFormat("<rename>{0}</rename>", shipper.CellPhone + "_");
                builder.AppendLine("</item>");
                builder.AppendLine("<item>");
                builder.AppendLine("<name>发货人-电话</name>");
                builder.AppendFormat("<rename>{0}</rename>", shipper.TelPhone + "_");
                builder.AppendLine("</item>");
                builder.AppendLine("<item>");
                builder.AppendLine("<name>发货人-地址</name>");
                builder.AppendFormat("<rename>{0}</rename>", shipper.Address);
                builder.AppendLine("</item>");
                builder.AppendLine("<item>");
                builder.AppendLine("<name>发货人-邮编</name>");
                builder.AppendFormat("<rename>{0}</rename>", shipper.Zipcode + "_");
                builder.AppendLine("</item>");
                if (strArray2.Length > 0)
                {
                    builder.AppendLine("<item>");
                    builder.AppendLine("<name>发货人-地区1级</name>");
                    builder.AppendFormat("<rename>{0}</rename>", strArray2[0]);
                    builder.AppendLine("</item>");
                }
                if (strArray2.Length > 1)
                {
                    builder.AppendLine("<item>");
                    builder.AppendLine("<name>发货人-地区2级</name>");
                    builder.AppendFormat("<rename>{0}</rename>", strArray2[1]);
                    builder.AppendLine("</item>");
                }
                if (strArray2.Length > 2)
                {
                    builder.AppendLine("<item>");
                    builder.AppendLine("<name>发货人-地区3级</name>");
                    builder.AppendFormat("<rename>{0}</rename>", strArray2[2]);
                    builder.AppendLine("</item>");
                }
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-订单号</name>");
            builder.AppendFormat("<rename>{0}</rename>", order.OrderId);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-总金额</name>");
            builder.AppendFormat("<rename>{0}</rename>", order.GetTotal() + "_");
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-物品总重量</name>");
            builder.AppendFormat("<rename>{0}</rename>", order.Weight);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-备注</name>");
            builder.AppendFormat("<rename>{0}</rename>", order.ManagerRemark);
            builder.AppendLine("</item>");
            string shipperId = "";

            if ((order.LineItems != null) && (order.LineItems.Count > 0))
            {
                foreach (LineItemInfo info in order.LineItems.Values)
                {
                    object obj2 = shipperId;
                    shipperId = string.Concat(new object[] { obj2, "货号 ", info.SKU, " ", info.SKUContent, " \x00d7", info.ShipmentQuantity, "\n" });
                }
                shipperId = shipperId.Replace(";", "").Replace(";", "").Replace(":", ":");
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-详情</name>");
            builder.AppendFormat("<rename>{0}</rename>", shipperId);
            builder.AppendLine("</item>");
            if (order.ShippingDate == DateTime.Parse("0001-1-1"))
            {
                builder.AppendLine("<item>");
                builder.AppendLine("<name>订单-送货时间</name>");
                builder.AppendFormat("<rename>{0}</rename>", "null");
                builder.AppendLine("</item>");
            }
            else
            {
                builder.AppendLine("<item>");
                builder.AppendLine("<name>订单-送货时间</name>");
                builder.AppendFormat("<rename>{0}</rename>", order.ShippingDate);
                builder.AppendLine("</item>");
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>网店名称</name>");
            builder.AppendFormat("<rename>{0}</rename>", HiContext.Current.SiteSettings.SiteName);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>自定义内容</name>");
            builder.AppendFormat("<rename>{0}</rename>", "null");
            builder.AppendLine("</item>");
            builder.AppendLine("</nodes>");
            base.Response.Write(builder.ToString());
        }
 public abstract bool UpdateShipper(ShippersInfo shipper);
        private string WriteOrderInfo(DataRow order, ShippersInfo shipper, DataTable dtLine, DataSet ds)
        {
            string[]      strArray = order["shippingRegion"].ToString().Split(new char[] { ',' });
            StringBuilder builder  = new StringBuilder();

            builder.AppendLine("<order>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-姓名</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["ShipTo"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-电话</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["TelPhone"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-手机</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["CellPhone"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-邮编</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["ZipCode"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-地址</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["Address"]);
            builder.AppendLine("</item>");
            string str = string.Empty;

            if (strArray.Length > 0)
            {
                str = strArray[0];
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-地区1级</name>");
            builder.AppendFormat("<rename>{0}</rename>", str);
            builder.AppendLine("</item>");
            str = string.Empty;
            if (strArray.Length > 1)
            {
                str = strArray[1];
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-地区2级</name>");
            builder.AppendFormat("<rename>{0}</rename>", str);
            builder.AppendLine("</item>");
            str = string.Empty;
            if (strArray.Length > 2)
            {
                str = strArray[2];
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-地区3级</name>");
            builder.AppendFormat("<rename>{0}</rename>", str);
            builder.AppendLine("</item>");
            string[] strArray2 = new string[] { "", "", "" };
            if (shipper != null)
            {
                strArray2 = RegionHelper.GetFullRegion(shipper.RegionId, "-").Split(new char[] { '-' });
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-姓名</name>");
            builder.AppendFormat("<rename>{0}</rename>", (shipper != null) ? shipper.ShipperName : "");
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-手机</name>");
            builder.AppendFormat("<rename>{0}</rename>", (shipper != null) ? shipper.CellPhone : "");
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-电话</name>");
            builder.AppendFormat("<rename>{0}</rename>", (shipper != null) ? shipper.TelPhone : "");
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-地址</name>");
            builder.AppendFormat("<rename>{0}</rename>", (shipper != null) ? shipper.Address : "");
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-邮编</name>");
            builder.AppendFormat("<rename>{0}</rename>", (shipper != null) ? shipper.Zipcode : "");
            builder.AppendLine("</item>");
            string str2 = string.Empty;

            if (strArray2.Length > 0)
            {
                str2 = strArray2[0];
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-地区1级</name>");
            builder.AppendFormat("<rename>{0}</rename>", str2);
            builder.AppendLine("</item>");
            str2 = string.Empty;
            if (strArray2.Length > 1)
            {
                str2 = strArray2[1];
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-地区2级</name>");
            builder.AppendFormat("<rename>{0}</rename>", str2);
            builder.AppendLine("</item>");
            str2 = string.Empty;
            if (strArray2.Length > 2)
            {
                str2 = strArray2[2];
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-地区3级</name>");
            builder.AppendFormat("<rename>{0}</rename>", str2);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-订单号</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["OrderId"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-总金额</name>");
            builder.AppendFormat("<rename>{0}</rename>", this.CalculateOrderTotal(order, ds));
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-物品总重量</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["Weight"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-备注</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["Remark"]);
            builder.AppendLine("</item>");
            DataRow[] rowArray = dtLine.Select(" OrderId='" + order["OrderId"] + "'");
            string    str3     = string.Empty;

            if (rowArray.Length > 0)
            {
                foreach (DataRow row in rowArray)
                {
                    str3 = string.Concat(new object[] { str3, "货号 ", row["SKU"], " \x00d7", row["ShipmentQuantity"], "\n" });
                }
                str3 = str3.Replace(";", "");
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-详情</name>");
            builder.AppendFormat("<rename>{0}</rename>", str3);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-送货时间</name>");
            builder.AppendFormat("<rename></rename>", new object[0]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>网店名称</name>");
            builder.AppendFormat("<rename>{0}</rename>", HiContext.Current.SiteSettings.SiteName);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>自定义内容</name>");
            builder.AppendFormat("<rename>{0}</rename>", "null");
            builder.AppendLine("</item>");
            builder.AppendLine("</order>");
            return(builder.ToString());
        }
Beispiel #27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.btprint.Click += this.ButPrint_Click;
     if (!base.IsPostBack)
     {
         this.mailNo = base.Request["mailNo"];
         int shipperId = int.Parse(base.Request["shipperId"]);
         this.orderIds = base.Request["orderIds"].Trim(',');
         string text = HttpContext.Current.Request.MapPath(string.Format("../../Storage/master/flex/{0}", base.Request["template"]));
         if (File.Exists(text))
         {
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.XmlResolver = null;
             xmlDocument.Load(text);
             XmlNode xmlNode = xmlDocument.DocumentElement.SelectSingleNode("//printer");
             this.templateName = xmlNode.SelectSingleNode("kind").InnerText;
             string innerText  = xmlNode.SelectSingleNode("pic").InnerText;
             string innerText2 = xmlNode.SelectSingleNode("size").InnerText;
             this.width  = innerText2.Split(':')[0];
             this.height = innerText2.Split(':')[1];
             DataSet printData = this.GetPrintData(this.orderIds);
             int     num       = 0;
             foreach (DataRow row in printData.Tables[0].Rows)
             {
                 this.UpdateOrderIds = this.UpdateOrderIds + row["orderid"] + ",";
                 HtmlGenericControl htmlGenericControl = new HtmlGenericControl("div");
                 if (!string.IsNullOrEmpty(innerText) && innerText != "noimage")
                 {
                     using (System.Drawing.Image image = System.Drawing.Image.FromFile(HttpContext.Current.Request.MapPath($"../../Storage/master/flex/{innerText}")))
                     {
                         htmlGenericControl.Attributes["style"] = $"background-image: url(../../Storage/master/flex/{innerText}); width: {image.Width}px; height: {image.Height}px;text-align: center; position: relative;";
                     }
                 }
                 DataTable    dataTable = printData.Tables[1];
                 ShippersInfo shipper   = SalesHelper.GetShipper(shipperId);
                 string[]     array     = row["shippingRegion"].ToString().Split(',');
                 foreach (XmlNode item in xmlNode.SelectNodes("item"))
                 {
                     string        innerText3    = item.SelectSingleNode("name").InnerText;
                     StringBuilder stringBuilder = new StringBuilder(innerText3);
                     stringBuilder.Replace("收货人-姓名", row["ShipTo"].ToString());
                     stringBuilder.Replace("收货人-电话", row["TelPhone"].ToString());
                     stringBuilder.Replace("收货人-手机", row["CellPhone"].ToString());
                     stringBuilder.Replace("收货人-邮编", row["ZipCode"].ToString());
                     stringBuilder.Replace("收货人-地址", row["Address"].ToString());
                     string newValue = string.Empty;
                     if (array.Length != 0)
                     {
                         newValue = array[0];
                     }
                     stringBuilder.Replace("收货人-地区1级", newValue);
                     newValue = string.Empty;
                     if (array.Length > 1)
                     {
                         newValue = array[1];
                     }
                     stringBuilder.Replace("收货人-地区2级", newValue);
                     stringBuilder.Replace("目的地-地区", newValue);
                     newValue = string.Empty;
                     if (array.Length > 2)
                     {
                         newValue = array[2];
                     }
                     stringBuilder.Replace("收货人-地区3级", newValue);
                     string[] array2 = new string[3]
                     {
                         "",
                         "",
                         ""
                     };
                     if (shipper != null)
                     {
                         array2 = RegionHelper.GetFullRegion(shipper.RegionId, "-", true, 0).Split('-');
                     }
                     stringBuilder.Replace("发货人-姓名", (shipper != null) ? shipper.ShipperName : "");
                     stringBuilder.Replace("发货人-手机", (shipper != null) ? shipper.CellPhone : "");
                     stringBuilder.Replace("发货人-电话", (shipper != null) ? shipper.TelPhone : "");
                     stringBuilder.Replace("发货人-地址", (shipper != null) ? shipper.Address : "");
                     stringBuilder.Replace("发货人-邮编", (shipper != null) ? shipper.Zipcode : "");
                     string newValue2 = string.Empty;
                     if (array2.Length != 0)
                     {
                         newValue2 = array2[0];
                     }
                     stringBuilder.Replace("发货人-地区1级", newValue2);
                     newValue2 = string.Empty;
                     if (array2.Length > 1)
                     {
                         newValue2 = array2[1];
                     }
                     stringBuilder.Replace("发货人-地区2级", newValue2);
                     stringBuilder.Replace("始发地-地区", newValue2);
                     newValue2 = string.Empty;
                     if (array2.Length > 2)
                     {
                         newValue2 = array2[2];
                     }
                     decimal num2 = default(decimal);
                     decimal.TryParse(row["Weight"].ToString(), out num2);
                     stringBuilder.Replace("发货人-地区3级", newValue2);
                     stringBuilder.Replace("送货-上门时间", row["ShipToDate"].ToString());
                     stringBuilder.Replace("订单-订单号", "订单号:" + row["OrderId"].ToString());
                     stringBuilder.Replace("订单-总金额", decimal.Parse(row["OrderTotal"].ToString()).F2ToString("f2"));
                     stringBuilder.Replace("订单-物品总重量", num2.F2ToString("f2"));
                     stringBuilder.Replace("订单-备注", row["Remark"].ToString());
                     DataRow[] array3 = dataTable.Select(" OrderId='" + row["OrderId"] + "'");
                     string    text2  = string.Empty;
                     if (array3.Length != 0)
                     {
                         DataRow[] array4 = array3;
                         foreach (DataRow dataRow2 in array4)
                         {
                             text2 = text2 + "规格" + dataRow2["SKUContent"] + " 数量" + dataRow2["ShipmentQuantity"] + "货号 :" + dataRow2["SKU"];
                         }
                         text2 = text2.Replace(";", "");
                     }
                     stringBuilder.Replace("订单-详情", text2);
                     stringBuilder.Replace("订单-送货时间", "");
                     stringBuilder.Replace("网店名称", HiContext.Current.SiteSettings.SiteName);
                     stringBuilder.Replace("自定义内容", "");
                     innerText3 = stringBuilder.ToString();
                     string             innerText4          = item.SelectSingleNode("font").InnerText;
                     string             innerText5          = item.SelectSingleNode("fontsize").InnerText;
                     string             innerText6          = item.SelectSingleNode("position").InnerText;
                     string             innerText7          = item.SelectSingleNode("align").InnerText;
                     string             str                 = innerText6.Split(':')[0];
                     string             str2                = innerText6.Split(':')[1];
                     string             str3                = innerText6.Split(':')[2];
                     string             str4                = innerText6.Split(':')[3];
                     string             innerText8          = item.SelectSingleNode("border").InnerText;
                     HtmlGenericControl htmlGenericControl2 = new HtmlGenericControl("div");
                     htmlGenericControl2.Visible              = true;
                     htmlGenericControl2.InnerText            = innerText3.Split('_')[0];
                     htmlGenericControl2.Style["font-family"] = innerText4;
                     htmlGenericControl2.Style["font-size"]   = "16px";
                     htmlGenericControl2.Style["width"]       = str + "px";
                     htmlGenericControl2.Style["height"]      = str2 + "px";
                     htmlGenericControl2.Style["text-align"]  = innerText7;
                     htmlGenericControl2.Style["position"]    = "absolute";
                     htmlGenericControl2.Style["left"]        = str3 + "px";
                     htmlGenericControl2.Style["top"]         = str4 + "px";
                     htmlGenericControl2.Style["padding"]     = "0";
                     htmlGenericControl2.Style["margin-left"] = "0px";
                     htmlGenericControl2.Style["margin-top"]  = "0px";
                     htmlGenericControl2.Style["font-weight"] = "bold";
                     htmlGenericControl.Controls.Add(htmlGenericControl2);
                 }
                 this.divContent.Controls.Add(htmlGenericControl);
                 num++;
                 if (num < printData.Tables[0].Rows.Count)
                 {
                     HtmlGenericControl htmlGenericControl3 = new HtmlGenericControl("div");
                     htmlGenericControl3.Attributes["class"] = "PageNext";
                     this.divContent.Controls.Add(htmlGenericControl3);
                 }
             }
             this.UpdateOrderIds = this.UpdateOrderIds.TrimEnd(',');
         }
     }
 }
        private string WritePurchaseOrderInfo(DataRow order, ShippersInfo shipper, DataTable dtLine, DataSet ds)
        {
            string[]      strArray = order["shippingRegion"].ToString().Split(new char[] { ',' });
            StringBuilder builder  = new StringBuilder();

            builder.AppendLine("<order>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-姓名</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["ShipTo"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-电话</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["TelPhone"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-手机</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["CellPhone"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-邮编</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["ZipCode"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-地址</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["Address"]);
            builder.AppendLine("</item>");
            string str = string.Empty;

            if (strArray.Length > 0)
            {
                str = strArray[0];
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-地区1级</name>");
            builder.AppendFormat("<rename>{0}</rename>", str);
            builder.AppendLine("</item>");
            str = string.Empty;
            if (strArray.Length > 1)
            {
                str = strArray[1];
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-地区2级</name>");
            builder.AppendFormat("<rename>{0}</rename>", str);
            builder.AppendLine("</item>");
            str = string.Empty;
            if (strArray.Length > 2)
            {
                str = strArray[2];
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-地区3级</name>");
            builder.AppendFormat("<rename>{0}</rename>", str);
            builder.AppendLine("</item>");
            int          currentRegionId = 0;
            string       shipperName     = string.Empty;
            string       cellPhone       = string.Empty;
            string       telPhone        = string.Empty;
            string       address         = string.Empty;
            string       zipcode         = string.Empty;
            ShippersInfo info            = this.ForDistorShipper(ds, order);

            if (info != null)
            {
                shipperName     = info.ShipperName;
                cellPhone       = info.CellPhone;
                telPhone        = info.TelPhone;
                address         = info.Address;
                zipcode         = info.Zipcode;
                currentRegionId = info.RegionId;
            }
            else if (shipper != null)
            {
                shipperName     = shipper.ShipperName;
                cellPhone       = shipper.CellPhone;
                telPhone        = shipper.TelPhone;
                address         = shipper.Address;
                zipcode         = shipper.Zipcode;
                currentRegionId = shipper.RegionId;
            }
            string[] strArray2 = new string[] { "", "", "" };
            if (currentRegionId > 0)
            {
                strArray2 = RegionHelper.GetFullRegion(currentRegionId, "-").Split(new char[] { '-' });
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-姓名</name>");
            builder.AppendFormat("<rename>{0}</rename>", shipperName);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-手机</name>");
            builder.AppendFormat("<rename>{0}</rename>", cellPhone);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-电话</name>");
            builder.AppendFormat("<rename>{0}</rename>", telPhone);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-地址</name>");
            builder.AppendFormat("<rename>{0}</rename>", address);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-邮编</name>");
            builder.AppendFormat("<rename>{0}</rename>", zipcode);
            builder.AppendLine("</item>");
            string str7 = string.Empty;

            if (strArray2.Length > 0)
            {
                str7 = strArray2[0];
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-地区1级</name>");
            builder.AppendFormat("<rename>{0}</rename>", str7);
            builder.AppendLine("</item>");
            str7 = string.Empty;
            if (strArray2.Length > 1)
            {
                str7 = strArray2[1];
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-地区2级</name>");
            builder.AppendFormat("<rename>{0}</rename>", str7);
            builder.AppendLine("</item>");
            str7 = string.Empty;
            if (strArray2.Length > 2)
            {
                str7 = strArray2[2];
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>发货人-地区3级</name>");
            builder.AppendFormat("<rename>{0}</rename>", str7);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-订单号</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["OrderId"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-总金额</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["OrderTotal"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-物品总重量</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["Weight"]);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-备注</name>");
            builder.AppendFormat("<rename>{0}</rename>", order["Remark"]);
            builder.AppendLine("</item>");
            DataRow[] rowArray = dtLine.Select(" PurchaseOrderId='" + order["PurchaseOrderId"] + "'");
            string    str8     = string.Empty;

            if (rowArray.Length > 0)
            {
                foreach (DataRow row in rowArray)
                {
                    str8 = string.Concat(new object[] { str8, "货号 ", row["SKU"], " \x00d7", row["Quantity"], "\n" });
                }
                str8 = str8.Replace(";", "");
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-详情</name>");
            builder.AppendFormat("<rename>{0}</rename>", str8);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-送货时间</name>");
            builder.AppendFormat("<rename></rename>", new object[0]);
            builder.AppendLine("</item>");
            SiteSettings siteSettings = SettingsManager.GetSiteSettings((int)order["DistributorId"]);

            builder.AppendLine("<item>");
            builder.AppendLine("<name>网店名称</name>");
            builder.AppendFormat("<rename>{0}</rename>", (siteSettings != null) ? siteSettings.SiteName : HiContext.Current.SiteSettings.SiteName);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>自定义内容</name>");
            builder.AppendFormat("<rename>{0}</rename>", "null");
            builder.AppendLine("</item>");
            builder.AppendLine("</order>");
            return(builder.ToString());
        }
Beispiel #29
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!base.IsPostBack)
     {
         this.mailNo = base.Request["mailNo"];
         int shipperId = int.Parse(base.Request["shipperId"]);
         this.orderIds = base.Request["orderIds"].Trim(new char[]
         {
             ','
         });
         string path = System.Web.HttpContext.Current.Request.MapPath(string.Format("../../Storage/master/flex/{0}", base.Request["template"]));
         if (System.IO.File.Exists(path))
         {
             XmlDocument document = new XmlDocument();
             document.Load(path);
             XmlNode node = document.DocumentElement.SelectSingleNode("//printer");
             this.templateName = node.SelectSingleNode("kind").InnerText;
             string innerText = node.SelectSingleNode("pic").InnerText;
             string str3      = node.SelectSingleNode("size").InnerText;
             this.width = str3.Split(new char[]
             {
                 ':'
             })[0];
             this.height = str3.Split(new char[]
             {
                 ':'
             })[1];
             System.Data.DataSet printData = this.GetPrintData(this.orderIds);
             int num2 = 0;
             foreach (System.Data.DataRow row in printData.Tables[0].Rows)
             {
                 this.UpdateOrderIds = this.UpdateOrderIds + row["orderid"] + ",";
                 System.Web.UI.HtmlControls.HtmlGenericControl child = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
                 if (!string.IsNullOrEmpty(innerText) && innerText != "noimage")
                 {
                     using (Image image = Image.FromFile(System.Web.HttpContext.Current.Request.MapPath(string.Format("../../Storage/master/flex/{0}", innerText))))
                     {
                         child.Attributes["style"] = string.Format("background-image: url(../../Storage/master/flex/{0}); width: {1}px; height: {2}px;text-align: center; position: relative;", innerText, image.Width, image.Height);
                     }
                 }
                 System.Data.DataTable table   = printData.Tables[1];
                 ShippersInfo          shipper = SalesHelper.GetShipper(shipperId);
                 string   str4     = (row["shippingRegion"] != null) ? row["shippingRegion"].ToString().Replace(",", " ").Replace(",", " ") : "";
                 char     ch       = ' ';
                 string[] strArray = str4.Split(new char[]
                 {
                     ch
                 });
                 foreach (XmlNode node2 in node.SelectNodes("item"))
                 {
                     System.Text.StringBuilder builder = new System.Text.StringBuilder(node2.SelectSingleNode("name").InnerText);
                     builder.Replace("收货人-姓名", row["ShipTo"].ToString());
                     builder.Replace("收货人-电话", row["TelPhone"].ToString());
                     builder.Replace("收货人-手机", row["CellPhone"].ToString());
                     builder.Replace("收货人-邮编", row["ZipCode"].ToString());
                     builder.Replace("收货人-地址", row["Address"].ToString());
                     string newValue = string.Empty;
                     if (strArray.Length > 0)
                     {
                         newValue = strArray[0];
                     }
                     builder.Replace("收货人-地区1级", newValue);
                     newValue = string.Empty;
                     if (strArray.Length > 1)
                     {
                         newValue = strArray[1];
                     }
                     builder.Replace("收货人-地区2级", newValue);
                     newValue = string.Empty;
                     if (strArray.Length > 2)
                     {
                         newValue = strArray[2];
                     }
                     builder.Replace("收货人-地区3级", newValue);
                     string[] strArray2 = new string[]
                     {
                         "",
                         "",
                         ""
                     };
                     if (shipper != null)
                     {
                         strArray2 = RegionHelper.GetFullRegion(shipper.RegionId, "-").Split(new char[]
                         {
                             '-'
                         });
                     }
                     builder.Replace("发货人-姓名", (shipper != null) ? shipper.ShipperName : "");
                     builder.Replace("发货人-手机", (shipper != null) ? shipper.CellPhone : "");
                     builder.Replace("发货人-电话", (shipper != null) ? shipper.TelPhone : "");
                     builder.Replace("发货人-地址", (shipper != null) ? shipper.Address : "");
                     builder.Replace("发货人-邮编", (shipper != null) ? shipper.Zipcode : "");
                     string str5 = string.Empty;
                     if (strArray2.Length > 0)
                     {
                         str5 = strArray2[0];
                     }
                     builder.Replace("发货人-地区1级", str5);
                     str5 = string.Empty;
                     if (strArray2.Length > 1)
                     {
                         str5 = strArray2[1];
                     }
                     builder.Replace("发货人-地区2级", str5);
                     str5 = string.Empty;
                     if (strArray2.Length > 2)
                     {
                         str5 = strArray2[2];
                     }
                     builder.Replace("发货人-地区3级", str5);
                     builder.Replace("订单-订单号", "订单号:" + row["OrderId"].ToString());
                     builder.Replace("订单-总金额", decimal.Parse(row["OrderTotal"].ToString()).ToString("F2"));
                     builder.Replace("订单-物品总重量", row["Weight"].ToString());
                     builder.Replace("订单-备注", row["Remark"].ToString());
                     System.Data.DataRow[] rowArray = table.Select(" OrderId='" + row["OrderId"] + "'");
                     string str6 = string.Empty;
                     if (rowArray.Length > 0)
                     {
                         System.Data.DataRow[] array = rowArray;
                         for (int i = 0; i < array.Length; i++)
                         {
                             System.Data.DataRow row2 = array[i];
                             str6 = string.Concat(new object[]
                             {
                                 str6,
                                 "规格 ",
                                 row2["SKUContent"],
                                 " ×",
                                 row2["ShipmentQuantity"],
                                 "\n货号 :",
                                 row2["SKU"]
                             });
                         }
                         str6 = str6.Replace(";", "");
                     }
                     builder.Replace("订单-详情", str6);
                     builder.Replace("订单-送货时间", "");
                     builder.Replace("网店名称", SettingsManager.GetMasterSettings(true).SiteName);
                     builder.Replace("自定义内容", "");
                     string str7  = builder.ToString();
                     string str8  = node2.SelectSingleNode("font").InnerText;
                     string text  = node2.SelectSingleNode("fontsize").InnerText;
                     string str9  = node2.SelectSingleNode("position").InnerText;
                     string str10 = node2.SelectSingleNode("align").InnerText;
                     string str11 = str9.Split(new char[]
                     {
                         ':'
                     })[0];
                     string str12 = str9.Split(new char[]
                     {
                         ':'
                     })[1];
                     string str13 = str9.Split(new char[]
                     {
                         ':'
                     })[2];
                     string str14 = str9.Split(new char[]
                     {
                         ':'
                     })[3];
                     System.Web.UI.HtmlControls.HtmlGenericControl control2 = new System.Web.UI.HtmlControls.HtmlGenericControl("div")
                     {
                         Visible   = true,
                         InnerText = str7.Split(new char[]
                         {
                             '_'
                         })[0]
                     };
                     control2.Style["font-family"] = str8;
                     control2.Style["font-size"]   = "16px";
                     control2.Style["width"]       = str11 + "px";
                     control2.Style["height"]      = str12 + "px";
                     control2.Style["text-align"]  = str10;
                     control2.Style["position"]    = "absolute";
                     control2.Style["left"]        = str13 + "px";
                     control2.Style["top"]         = str14 + "px";
                     control2.Style["padding"]     = "0";
                     control2.Style["margin-left"] = "0px";
                     control2.Style["margin-top"]  = "0px";
                     child.Controls.Add(control2);
                 }
                 this.divContent.Controls.Add(child);
                 num2++;
                 if (num2 < printData.Tables[0].Rows.Count)
                 {
                     System.Web.UI.HtmlControls.HtmlGenericControl control3 = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
                     control3.Attributes["class"] = "PageNext";
                     this.divContent.Controls.Add(control3);
                 }
             }
             this.UpdateOrderIds = this.UpdateOrderIds.TrimEnd(new char[]
             {
                 ','
             });
         }
     }
 }
Beispiel #30
0
        private void QueryDeliverFee(HttpContext context)
        {
            string       text           = context.Request["OrderId"].ToNullString();
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();

            if (string.IsNullOrEmpty(text))
            {
                context.Response.Write(this.GetFailResultJson("订单号不能为空"));
            }
            else
            {
                OrderInfo orderInfo = TradeHelper.GetOrderInfo(text);
                if (orderInfo == null)
                {
                    context.Response.Write(this.GetFailResultJson("错误的订单号"));
                }
                else if ((orderInfo.OrderStatus != OrderStatus.BuyerAlreadyPaid && (orderInfo.OrderStatus != OrderStatus.WaitBuyerPay || !(orderInfo.Gateway == EnumDescription.GetEnumDescription((Enum)(object)EnumPaymentType.CashOnDelivery, 1)))) || orderInfo.RealShippingModeId == -2)
                {
                    context.Response.Write(this.GetFailResultJson("错误的订单状态"));
                }
                else
                {
                    string text2 = "";
                    try
                    {
                        string  value   = DadaHelper.cityCodeList(masterSettings.DadaSourceID);
                        JObject jObject = JsonConvert.DeserializeObject(value) as JObject;
                        JArray  jArray  = (JArray)jObject["result"];
                        foreach (JToken item in (IEnumerable <JToken>)jArray)
                        {
                            if (orderInfo.ShippingRegion.Contains(item["cityName"].ToString()))
                            {
                                text2 = item["cityCode"].ToString();
                                break;
                            }
                        }
                    }
                    catch
                    {
                    }
                    if (text2 == "")
                    {
                        context.Response.Write(this.GetFailResultJson("配送范围超区,无法配送"));
                    }
                    else
                    {
                        ShippersInfo defaultOrFirstShipper = SalesHelper.GetDefaultOrFirstShipper(0);
                        string       orderId             = orderInfo.OrderId;
                        string       city_code           = text2;
                        double       cargo_price         = orderInfo.GetTotal(false).F2ToString("f2").ToDouble(0);
                        int          is_prepay           = 0;
                        long         expected_fetch_time = Globals.DateTimeToUnixTimestamp(DateTime.Now.AddMinutes(15.0));
                        string       shipTo  = orderInfo.ShipTo;
                        string       address = orderInfo.Address;
                        string       latLng  = orderInfo.LatLng;
                        if (string.IsNullOrWhiteSpace(latLng))
                        {
                            ShippingAddressInfo shippingAddress = MemberProcessor.GetShippingAddress(orderInfo.ShippingId);
                            latLng = shippingAddress.LatLng;
                        }
                        double  receiver_lat      = latLng.Split(',')[0].ToDouble(0);
                        double  receiver_lng      = latLng.Split(',')[1].ToDouble(0);
                        string  callback          = Globals.FullPath("/pay/dadaOrderNotify");
                        string  cellPhone         = orderInfo.CellPhone;
                        string  telPhone          = orderInfo.TelPhone;
                        bool    isQueryDeliverFee = true;
                        string  value2            = DadaHelper.addOrder(masterSettings.DadaSourceID, "P_" + defaultOrFirstShipper.ShipperId, orderId, city_code, cargo_price, is_prepay, expected_fetch_time, shipTo, address, receiver_lat, receiver_lng, callback, cellPhone, telPhone, -1.0, -1.0, -1.0, -1.0, -1L, "", -1, -1.0, -1, -1L, "", "", "", false, isQueryDeliverFee);
                        JObject jObject2          = JsonConvert.DeserializeObject(value2) as JObject;
                        string  a = jObject2["status"].ToString();
                        if (a == "success")
                        {
                            JObject jObject3 = JsonConvert.DeserializeObject(jObject2["result"].ToString()) as JObject;
                            string  s        = JsonConvert.SerializeObject(new
                            {
                                Result = new
                                {
                                    Status     = "SUCCESS",
                                    distance   = jObject3["distance"].ToNullString(),
                                    fee        = "预计运费:¥" + jObject3["fee"].ToNullString(),
                                    deliveryNo = jObject3["deliveryNo"].ToNullString()
                                }
                            });
                            context.Response.Write(s);
                            context.Response.End();
                        }
                        else
                        {
                            context.Response.Write(this.GetFailResultJson(jObject2["msg"].ToNullString()));
                        }
                    }
                }
            }
        }