protected void Page_Load(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(base.Request.QueryString["PurchaseOrderId"]))
     {
         base.GotoResourceNotFound();
     }
     else
     {
         purchaseOrderId = base.Request.QueryString["PurchaseOrderId"];
         if (!base.IsPostBack)
         {
             PurchaseOrderInfo purchaseOrder = SalesHelper.GetPurchaseOrder(purchaseOrderId);
             if (purchaseOrder == null)
             {
                 base.GotoResourceNotFound();
             }
             else if (purchaseOrder.RefundStatus != RefundStatus.Refund)
             {
                 base.GotoResourceNotFound();
             }
             else
             {
                 litOrderId.Text         = purchaseOrder.OrderId;
                 litPurchaseOrderId.Text = purchaseOrder.PurchaseOrderId;
                 lblPurchaseDate.Time    = purchaseOrder.PurchaseDate;
                 lblTotalPrice.Money     = purchaseOrder.GetPurchaseTotal();
                 lblRefundDate.Time      = purchaseOrder.FinishDate;
                 lblRefundAmount.Money   = purchaseOrder.RefundAmount;
                 lblPaymentAmount.Money  = purchaseOrder.GetPurchaseTotal() - purchaseOrder.RefundAmount;
                 litRefundRemark.Text    = purchaseOrder.RefundRemark;
             }
         }
     }
 }
예제 #2
0
 private void BindEditOrderPrice(PurchaseOrderInfo purchaseOrder)
 {
     this.lblPurchaseOrderAmount.Text  = (purchaseOrder.GetPurchaseTotal() - purchaseOrder.AdjustedDiscount).ToString("F", System.Globalization.CultureInfo.InvariantCulture);
     this.lblPurchaseOrderAmount1.Text = this.lblPurchaseOrderAmount.Text;
     this.lblPurchaseOrderAmount2.Text = purchaseOrder.AdjustedDiscount.ToString("F", System.Globalization.CultureInfo.InvariantCulture);
     this.lblPurchaseOrderAmount3.Text = purchaseOrder.GetPurchaseTotal().ToString("F", System.Globalization.CultureInfo.InvariantCulture);
 }
예제 #3
0
        private void btnConfirmPay_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtTradePassword.Text))
            {
                ShowMsg("请输入交易密码", false);
            }
            else if (((decimal)lblUseableBalance.Money) < ((decimal)lblTotalPrice.Money))
            {
                ShowMsg("您的预付款金额不足", false);
            }
            else
            {
                Distributor user = SubsiteStoreHelper.GetDistributor();

                if ((user.Balance - user.RequestBalance) < purchaseOrder.GetPurchaseTotal())
                {
                    ShowMsg("您的预付款金额不足", false);
                }
                else
                {
                    BalanceDetailInfo balance = new BalanceDetailInfo();

                    balance.UserId     = user.UserId;
                    balance.UserName   = user.Username;
                    balance.TradeType  = TradeTypes.Consume;
                    balance.TradeDate  = DateTime.Now;
                    balance.Expenses   = new decimal?(purchaseOrder.GetPurchaseTotal());
                    balance.Balance    = user.Balance - purchaseOrder.GetPurchaseTotal();
                    user.TradePassword = txtTradePassword.Text;

                    if (Users.ValidTradePassword(user))
                    {
                        if (!SubsiteSalesHelper.ConfirmPay(balance, purchaseOrder))
                        {
                            ShowMsg("付款失败", false);
                        }
                        else
                        {
                            PaySucceess.Visible = true;
                        }
                    }
                    else
                    {
                        ShowMsg("交易密码错误", false);
                    }
                }
            }
        }
예제 #4
0
 private void SetControl(PurchaseOrderInfo purchaseOrder)
 {
     if (!purchaseOrder.CheckAction(PurchaseOrderActions.MASTER_REJECT_REFUND))
     {
         base.GotoResourceNotFound();
     }
     else
     {
         Distributor distributor = DistributorHelper.GetDistributor(purchaseOrder.DistributorId);
         if (distributor == null)
         {
             base.GotoResourceNotFound();
         }
         else
         {
             litDistributorName.Text             = distributor.Username;
             litOrderId.Text                     = purchaseOrder.OrderId;
             lblOrderDate.Time                   = purchaseOrder.PurchaseDate;
             litPurchaseOrderId.Text             = purchaseOrder.PurchaseOrderId;
             lblTotalPrice.Money                 = purchaseOrder.GetPurchaseTotal();
             lblPurchaseStatus.PuchaseStatusCode = (int)purchaseOrder.PurchaseStatus;
             if (purchaseOrder.PurchaseStatus == OrderStatus.SellerAlreadySent)
             {
                 lblRefundTotal.Visible = false;
                 litRefundComment.Text  = "退款金额不得大于" + lblTotalPrice.Money + "元.已发货订单允许全额或部分退款。";
             }
             else
             {
                 txtRefundTotal.Style.Add(HtmlTextWriterStyle.Display, "none");
                 lblRefundTotal.Money  = lblTotalPrice.Money;
                 litRefundComment.Text = "已付款等待发货订单只允许全额退款.退款后采购单自动变为关闭状态。";
             }
         }
     }
 }
예제 #5
0
        public static bool SendPurchaseOrderGoods(PurchaseOrderInfo purchaseOrder)
        {
            Globals.EntityCoding(purchaseOrder, true);
            ManagerHelper.CheckPrivilege(Privilege.PurchaseorderSendGood);
            bool result;

            if (purchaseOrder.CheckAction(PurchaseOrderActions.MASTER_SEND_GOODS))
            {
                bool flag;
                if (flag = SalesProvider.Instance().SendPurchaseOrderGoods(purchaseOrder))
                {
                    if (purchaseOrder.Gateway == "hishop.plugins.payment.podrequest")
                    {
                        SalesProvider.Instance().UpdateProductStock(purchaseOrder.PurchaseOrderId);
                        SalesProvider.Instance().UpdateDistributorAccount(purchaseOrder.GetPurchaseTotal(), purchaseOrder.DistributorId);
                        Users.ClearUserCache(Users.GetUser(purchaseOrder.DistributorId));
                    }
                    EventLogs.WriteOperationLog(Privilege.PurchaseorderSendGood, string.Format(CultureInfo.InvariantCulture, "对编号为\"{0}\"的采购单发货", new object[]
                    {
                        purchaseOrder.PurchaseOrderId
                    }));
                }
                result = flag;
            }
            else
            {
                result = false;
            }
            return(result);
        }
예제 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     grdOrders.RowDataBound         += new GridViewRowEventHandler(grdOrders_RowDataBound);
     grdPurchaseOrders.RowDataBound += new GridViewRowEventHandler(grdPurchaseOrders_RowDataBound);
     btnEditOrder.Click             += new EventHandler(btnEditOrder_Click);
     if (!Page.IsPostBack)
     {
         int num;
         if (int.TryParse(base.Request.QueryString["Status"], out num))
         {
             hidStatus.Value = num.ToString();
         }
         AdminStatisticsInfo statistics = SalesHelper.GetStatistics();
         BindStatistics(statistics);
         BindPurchaseOrders();
         BindOrders();
     }
     if ((Page.Request["action"] == "EditPurchaseOrder") && (Page.Request["PurchaseId"] != null))
     {
         PurchaseOrderInfo purchaseOrder = SalesHelper.GetPurchaseOrder(Page.Request["PurchaseId"].ToString());
         StringBuilder     builder       = new StringBuilder();
         if (purchaseOrder != null)
         {
             builder.Append("{");
             builder.Append("\"PurchaseTotal\":\"" + purchaseOrder.GetPurchaseTotal().ToString("F", CultureInfo.InvariantCulture) + "\"");
             builder.Append("}");
             Page.Response.ContentType = "text/plain";
             base.Response.Write(builder.ToString());
             base.Response.End();
         }
     }
 }
예제 #7
0
        public void LoadControl()
        {
            if ((purchaseOrder.PurchaseStatus == OrderStatus.WaitBuyerPay) || (purchaseOrder.PurchaseStatus == OrderStatus.BuyerAlreadyPaid))
            {
                lkBtnEditshipingMode.Visible = true;
            }
            if ((purchaseOrder.PurchaseStatus == OrderStatus.Finished) || (purchaseOrder.PurchaseStatus == OrderStatus.SellerAlreadySent))
            {
                lblModeName.Text = purchaseOrder.RealModeName;
            }
            else
            {
                lblModeName.Text = purchaseOrder.ModeName;
            }
            litFreight.Text     = Globals.FormatMoney(purchaseOrder.AdjustedFreight);
            litOptionPrice.Text = Globals.FormatMoney(purchaseOrder.GetOptionPrice());
            litDiscount.Text    = Globals.FormatMoney(purchaseOrder.AdjustedDiscount);
            litTotalPrice.Text  = Globals.FormatMoney(purchaseOrder.GetPurchaseTotal());
            string str = string.Empty;

            if (purchaseOrder.PurchaseOrderOptions.Count > 0)
            {
                foreach (PurchaseOrderOptionInfo info in purchaseOrder.PurchaseOrderOptions)
                {
                    string str2 = str;
                    str = str2 + info.ListDescription + ":" + info.ItemDescription + ";" + info.CustomerTitle + ":" + info.CustomerDescription;
                }
            }
            if (!string.IsNullOrEmpty(str))
            {
                litOderItem.Text = "(" + str + ")";
            }
        }
예제 #8
0
 private void BindCharges(PurchaseOrderInfo purchaseOrder)
 {
     this.lblModeName.Text   = purchaseOrder.ModeName;
     this.litFreight.Text    = Globals.FormatMoney(purchaseOrder.AdjustedFreight);
     this.litDiscount.Text   = Globals.FormatMoney(purchaseOrder.AdjustedDiscount);
     this.litTotalPrice.Text = Globals.FormatMoney(purchaseOrder.GetPurchaseTotal());
 }
예제 #9
0
 private void BindRemark(PurchaseOrderInfo purchaseOrder)
 {
     this.spanOrderId.Text                = purchaseOrder.OrderId;
     this.spanpurcharseOrderId.Text       = purchaseOrder.PurchaseOrderId;
     this.lblpurchaseDateForRemark.Time   = purchaseOrder.PurchaseDate;
     this.lblpurchaseTotalForRemark.Money = purchaseOrder.GetPurchaseTotal();
     this.txtRemark.Text = Globals.HtmlDecode(purchaseOrder.ManagerRemark);
     this.orderRemarkImageForRemark.SelectedValue = purchaseOrder.ManagerMark;
 }
예제 #10
0
        public static bool ConfirmPayPurchaseOrder(PurchaseOrderInfo purchaseOrder)
        {
            ManagerHelper.CheckPrivilege(Privilege.EditPurchaseorder);
            bool flag = SalesProvider.Instance().ConfirmPayPurchaseOrder(purchaseOrder);

            if (flag)
            {
                SalesProvider.Instance().UpdateProductStock(purchaseOrder.PurchaseOrderId);
                SalesProvider.Instance().UpdateDistributorAccount(purchaseOrder.GetPurchaseTotal(), purchaseOrder.DistributorId);
                Users.ClearUserCache(Users.GetUser(purchaseOrder.DistributorId));
                EventLogs.WriteOperationLog(Privilege.EditPurchaseorder, string.Format(CultureInfo.InvariantCulture, "对编号为\"{0}\"的采购单线下收款", new object[] { purchaseOrder.PurchaseOrderId }));
            }
            return(flag);
        }
예제 #11
0
        private decimal GetPayTotal()
        {
            decimal num = 0M;

            new List <PurchaseOrderInfo>();
            foreach (string str in this.purchaseorderIds.Split(new char[] { ',' }))
            {
                PurchaseOrderInfo purchaseOrder = SubsiteSalesHelper.GetPurchaseOrder(str);
                if ((purchaseOrder.PurchaseStatus == OrderStatus.WaitBuyerPay) && (purchaseOrder.Gateway != "hishop.plugins.payment.podrequest"))
                {
                    num += purchaseOrder.GetPurchaseTotal();
                }
            }
            return(num);
        }
예제 #12
0
        public static bool ConfirmPay(BalanceDetailInfo balance, PurchaseOrderInfo purchaseOrder)
        {
            if (!purchaseOrder.CheckAction(PurchaseOrderActions.DISTRIBUTOR_CONFIRM_PAY))
            {
                return(false);
            }
            bool flag = SubsiteSalesProvider.Instance().ConfirmPay(balance, purchaseOrder.PurchaseOrderId);

            if (flag)
            {
                SubsiteSalesProvider.Instance().UpdateProductStock(purchaseOrder.PurchaseOrderId);
                SubsiteSalesProvider.Instance().UpdateDistributorAccount(purchaseOrder.GetPurchaseTotal());
                Users.ClearUserCache(Users.GetUser(purchaseOrder.DistributorId));
            }
            return(flag);
        }
예제 #13
0
        private void btnEditOrder_Click(object sender, EventArgs e)
        {
            decimal           num;
            PurchaseOrderInfo purchaseOrder = SalesHelper.GetPurchaseOrder(lblPurchaseOrderId.Value);
            int length = 0;

            if (txtPurchaseOrderDiscount.Text.Trim().IndexOf(".") > 0)
            {
                length = txtPurchaseOrderDiscount.Text.Trim().Substring(txtPurchaseOrderDiscount.Text.Trim().IndexOf(".") + 1).Length;
            }
            if (!(decimal.TryParse(txtPurchaseOrderDiscount.Text.Trim(), out num) && (length <= 2)))
            {
                ShowMsg("折扣只能是数值,且不能超过2位小数", false);
            }
            else
            {
                purchaseOrder.AdjustedDiscount += num;
                ValidationResults results = Hishop.Components.Validation.Validation.Validate <PurchaseOrderInfo>(purchaseOrder, new string[] { "ValPurchaseOrder" });
                string            msg     = string.Empty;
                if (!results.IsValid)
                {
                    foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                    {
                        msg = msg + Formatter.FormatErrorMessage(result.Message);
                        ShowMsg(msg, false);
                        return;
                    }
                }
                if (purchaseOrder.GetPurchaseTotal() >= 0M)
                {
                    if (SalesHelper.UpdatePurchaseOrderAmount(purchaseOrder))
                    {
                        BindPurchaseOrders();
                        ShowMsg("修改成功", true);
                    }
                    else
                    {
                        ShowMsg("修改失败", false);
                    }
                }
                else
                {
                    ShowMsg("折扣值不能使得采购单总金额为负", false);
                }
            }
        }
예제 #14
0
        private void btnEditOrder_Click(object sender, System.EventArgs e)
        {
            string            value         = this.lblPurchaseOrderId.Value;
            PurchaseOrderInfo purchaseOrder = SalesHelper.GetPurchaseOrder(value);
            string            text          = string.Empty;
            decimal           adjustedDiscount;

            if (!this.ValidateValues(out adjustedDiscount))
            {
                return;
            }
            purchaseOrder.AdjustedDiscount = adjustedDiscount;
            ValidationResults validationResults = Validation.Validate <PurchaseOrderInfo>(purchaseOrder, new string[]
            {
                "ValPurchaseOrder"
            });

            if (!validationResults.IsValid)
            {
                using (System.Collections.Generic.IEnumerator <ValidationResult> enumerator = ((System.Collections.Generic.IEnumerable <ValidationResult>)validationResults).GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        ValidationResult current = enumerator.Current;
                        text += Formatter.FormatErrorMessage(current.Message);
                        this.ShowMsg(text, false);
                        return;
                    }
                }
            }
            if (purchaseOrder.GetPurchaseTotal() < 0m)
            {
                this.ShowMsg("折扣值不能使得采购单总金额为负", false);
            }
            else
            {
                if (SalesHelper.UpdatePurchaseOrderAmount(purchaseOrder))
                {
                    this.BindPurchaseOrders();
                    this.ShowMsg("修改成功", true);
                    return;
                }
                this.ShowMsg("修改失败", false);
                return;
            }
        }
예제 #15
0
        private decimal GetPayTotal()
        {
            decimal num = 0m;

            new System.Collections.Generic.List <PurchaseOrderInfo>();
            string[] array = this.purchaseorderIds.Split(new char[]
            {
                ','
            });
            for (int i = 0; i < array.Length; i++)
            {
                string            purchaseOrderId = array[i];
                PurchaseOrderInfo purchaseOrder   = SubsiteSalesHelper.GetPurchaseOrder(purchaseOrderId);
                if (purchaseOrder.PurchaseStatus == OrderStatus.WaitBuyerPay && purchaseOrder.Gateway != "hishop.plugins.payment.podrequest")
                {
                    num += purchaseOrder.GetPurchaseTotal();
                }
            }
            return(num);
        }
예제 #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     btnConfirmPay.Click += new EventHandler(btnConfirmPay_Click);
     btnBack.Click       += new EventHandler(btnBack_Click);
     btnBack1.Click      += new EventHandler(btnBack_Click);
     imgBtnBack.Click    += new System.Web.UI.ImageClickEventHandler(btnBack_Click);
     if (string.IsNullOrEmpty(base.Request.QueryString["PurchaseOrderId"]))
     {
         base.GotoResourceNotFound();
     }
     else
     {
         purchaseOrderId = base.Request.QueryString["PurchaseOrderId"];
         purchaseOrder   = SubsiteSalesHelper.GetPurchaseOrder(purchaseOrderId);
         if (!base.IsPostBack)
         {
             if (purchaseOrder == null)
             {
                 base.GotoResourceNotFound();
             }
             else
             {
                 if (purchaseOrder.IsManualPurchaseOrder)
                 {
                     litorder.Visible   = false;
                     litOrderId.Visible = false;
                 }
                 else
                 {
                     litOrderId.Text = purchaseOrder.OrderId;
                 }
                 litPurchaseOrderId.Text = purchaseOrder.PurchaseOrderId;
                 lblPurchaseDate.Time    = purchaseOrder.PurchaseDate;
                 lblTotalPrice.Money     = purchaseOrder.GetPurchaseTotal();
                 AccountSummaryInfo myAccountSummary = SubsiteStoreHelper.GetMyAccountSummary();
                 lblUseableBalance.Money = myAccountSummary.UseableBalance;
             }
         }
     }
 }
        private void BindCharges(PurchaseOrderInfo purchaseOrder)
        {
            lblModeName.Text    = purchaseOrder.ModeName;
            litFreight.Text     = Globals.FormatMoney(purchaseOrder.AdjustedFreight);
            litOptionPrice.Text = Globals.FormatMoney(purchaseOrder.GetOptionPrice());
            litDiscount.Text    = Globals.FormatMoney(purchaseOrder.AdjustedDiscount);
            litTotalPrice.Text  = Globals.FormatMoney(purchaseOrder.GetPurchaseTotal());
            string str = string.Empty;

            if (purchaseOrder.PurchaseOrderOptions.Count > 0)
            {
                foreach (PurchaseOrderOptionInfo info in purchaseOrder.PurchaseOrderOptions)
                {
                    string str2 = str;
                    str = str2 + info.ListDescription + ":" + info.ItemDescription + ";" + info.CustomerTitle + ":" + info.CustomerDescription;
                }
            }
            if (!string.IsNullOrEmpty(str))
            {
                litOderItem.Text = "(" + str + ")";
            }
        }
예제 #18
0
        private void btnEditOrder_Click(object sender, EventArgs e)
        {
            decimal           num;
            PurchaseOrderInfo purchaseOrder = SalesHelper.GetPurchaseOrder(lblPurchaseOrderId.Value);
            string            msg           = string.Empty;

            if (ValidateValues(out num))
            {
                purchaseOrder.AdjustedDiscount += num;
                ValidationResults results = Hishop.Components.Validation.Validation.Validate <PurchaseOrderInfo>(purchaseOrder, new string[] { "ValPurchaseOrder" });
                if (!results.IsValid)
                {
                    foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                    {
                        msg = msg + Formatter.FormatErrorMessage(result.Message);
                        ShowMsg(msg, false);
                        return;
                    }
                }
                if (purchaseOrder.GetPurchaseTotal() >= 0M)
                {
                    if (SalesHelper.UpdatePurchaseOrderAmount(purchaseOrder))
                    {
                        BindPurchaseOrders();
                        ShowMsg("修改成功", true);
                    }
                    else
                    {
                        ShowMsg("修改失败", false);
                    }
                }
                else
                {
                    ShowMsg("折扣值不能使得采购单总金额为负", false);
                }
            }
        }
예제 #19
0
        public override bool CreatePurchaseOrder(OrderInfo order, DbTransaction dbTran)
        {
            string            str;
            PurchaseOrderInfo info = ConvertOrderToPurchaseOrder(order);

            if (info == null)
            {
                return(false);
            }
            DbCommand     sqlStringCommand = database.GetSqlStringCommand(" ");
            StringBuilder builder          = new StringBuilder();

            builder.Append("INSERT INTO Hishop_PurchaseOrders(PurchaseOrderId, OrderId, Remark, ManagerMark, ManagerRemark, AdjustedDiscount,PurchaseStatus, CloseReason, PurchaseDate, DistributorId, Distributorname,DistributorEmail, DistributorRealName, DistributorQQ, DistributorWangwang, DistributorMSN,ShippingRegion, Address, ZipCode, ShipTo, TelPhone, CellPhone, ShippingModeId, ModeName,RealShippingModeId, RealModeName, RegionId, Freight, AdjustedFreight, ShipOrderNumber, Weight,RefundStatus, RefundAmount, RefundRemark, OrderTotal, PurchaseProfit, PurchaseTotal,ExpressCompanyName,ExpressCompanyAbb)VALUES (@PurchaseOrderId, @OrderId, @Remark, @ManagerMark, @ManagerRemark, @AdjustedDiscount,@PurchaseStatus, @CloseReason, @PurchaseDate, @DistributorId, @Distributorname,@DistributorEmail, @DistributorRealName, @DistributorQQ, @DistributorWangwang, @DistributorMSN,@ShippingRegion, @Address, @ZipCode, @ShipTo, @TelPhone, @CellPhone, @ShippingModeId, @ModeName,@RealShippingModeId, @RealModeName, @RegionId, @Freight, @AdjustedFreight, @ShipOrderNumber, @PurchaseWeight,@RefundStatus, @RefundAmount, @RefundRemark, @OrderTotal, @PurchaseProfit, @PurchaseTotal,@ExpressCompanyName,@ExpressCompanyAbb);");
            database.AddInParameter(sqlStringCommand, "PurchaseOrderId", DbType.String, info.PurchaseOrderId);
            database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, info.OrderId);
            database.AddInParameter(sqlStringCommand, "Remark", DbType.String, info.Remark);
            if (info.ManagerMark.HasValue)
            {
                database.AddInParameter(sqlStringCommand, "ManagerMark", DbType.Int32, (int)info.ManagerMark.Value);
            }
            else
            {
                database.AddInParameter(sqlStringCommand, "ManagerMark", DbType.Int32, DBNull.Value);
            }
            database.AddInParameter(sqlStringCommand, "ManagerRemark", DbType.String, info.ManagerRemark);
            database.AddInParameter(sqlStringCommand, "AdjustedDiscount", DbType.Currency, info.AdjustedDiscount);
            database.AddInParameter(sqlStringCommand, "PurchaseStatus", DbType.Int32, (int)info.PurchaseStatus);
            database.AddInParameter(sqlStringCommand, "CloseReason", DbType.String, info.CloseReason);
            database.AddInParameter(sqlStringCommand, "PurchaseDate", DbType.DateTime, DateTime.Now);
            database.AddInParameter(sqlStringCommand, "DistributorId", DbType.Int32, info.DistributorId);
            database.AddInParameter(sqlStringCommand, "Distributorname", DbType.String, info.Distributorname);
            database.AddInParameter(sqlStringCommand, "DistributorEmail", DbType.String, info.DistributorEmail);
            database.AddInParameter(sqlStringCommand, "DistributorRealName", DbType.String, info.DistributorRealName);
            database.AddInParameter(sqlStringCommand, "DistributorQQ", DbType.String, info.DistributorQQ);
            database.AddInParameter(sqlStringCommand, "DistributorWangwang", DbType.String, info.DistributorWangwang);
            database.AddInParameter(sqlStringCommand, "DistributorMSN", DbType.String, info.DistributorMSN);
            database.AddInParameter(sqlStringCommand, "ShippingRegion", DbType.String, info.ShippingRegion);
            database.AddInParameter(sqlStringCommand, "Address", DbType.String, info.Address);
            database.AddInParameter(sqlStringCommand, "ZipCode", DbType.String, info.ZipCode);
            database.AddInParameter(sqlStringCommand, "ShipTo", DbType.String, info.ShipTo);
            database.AddInParameter(sqlStringCommand, "TelPhone", DbType.String, info.TelPhone);
            database.AddInParameter(sqlStringCommand, "CellPhone", DbType.String, info.CellPhone);
            database.AddInParameter(sqlStringCommand, "ShippingModeId", DbType.Int32, info.ShippingModeId);
            database.AddInParameter(sqlStringCommand, "ModeName", DbType.String, info.ModeName);
            database.AddInParameter(sqlStringCommand, "RealShippingModeId", DbType.Int32, info.RealShippingModeId);
            database.AddInParameter(sqlStringCommand, "RealModeName", DbType.String, info.RealModeName);
            database.AddInParameter(sqlStringCommand, "RegionId", DbType.Int32, info.RegionId);
            database.AddInParameter(sqlStringCommand, "Freight", DbType.Currency, info.Freight);
            database.AddInParameter(sqlStringCommand, "AdjustedFreight", DbType.Currency, info.AdjustedFreight);
            database.AddInParameter(sqlStringCommand, "ShipOrderNumber", DbType.String, info.ShipOrderNumber);
            database.AddInParameter(sqlStringCommand, "PurchaseWeight", DbType.Int32, info.Weight);
            database.AddInParameter(sqlStringCommand, "RefundStatus", DbType.Int32, (int)info.RefundStatus);
            database.AddInParameter(sqlStringCommand, "RefundAmount", DbType.Currency, info.RefundAmount);
            database.AddInParameter(sqlStringCommand, "RefundRemark", DbType.String, info.RefundRemark);
            database.AddInParameter(sqlStringCommand, "OrderTotal", DbType.Currency, info.OrderTotal);
            database.AddInParameter(sqlStringCommand, "PurchaseProfit", DbType.Currency, info.GetPurchaseProfit());
            database.AddInParameter(sqlStringCommand, "PurchaseTotal", DbType.Currency, info.GetPurchaseTotal());
            database.AddInParameter(sqlStringCommand, "ExpressCompanyAbb", DbType.String, info.ExpressCompanyAbb);
            database.AddInParameter(sqlStringCommand, "ExpressCompanyName", DbType.String, info.ExpressCompanyName);
            int num = 0;

            foreach (PurchaseOrderItemInfo info2 in info.PurchaseOrderItems)
            {
                str = num.ToString();
                builder.Append("INSERT INTO Hishop_PurchaseOrderItems(PurchaseOrderId, SkuId, ProductId, SKU, Quantity,  CostPrice, ").Append("ItemListPrice, ItemPurchasePrice, ItemDescription, ItemHomeSiteDescription, SKUContent, ThumbnailsUrl, Weight) VALUES( @PurchaseOrderId").Append(",@SkuId").Append(str).Append(",@ProductId").Append(str).Append(",@SKU").Append(str).Append(",@Quantity").Append(str).Append(",@CostPrice").Append(str).Append(",@ItemListPrice").Append(str).Append(",@ItemPurchasePrice").Append(str).Append(",@ItemDescription").Append(str).Append(",@ItemHomeSiteDescription").Append(str).Append(",@SKUContent").Append(str).Append(",@ThumbnailsUrl").Append(str).Append(",@Weight").Append(str).Append(");");
                database.AddInParameter(sqlStringCommand, "SkuId" + str, DbType.String, info2.SkuId);
                database.AddInParameter(sqlStringCommand, "ProductId" + str, DbType.Int32, info2.ProductId);
                database.AddInParameter(sqlStringCommand, "SKU" + str, DbType.String, info2.SKU);
                database.AddInParameter(sqlStringCommand, "Quantity" + str, DbType.Int32, info2.Quantity);
                database.AddInParameter(sqlStringCommand, "CostPrice" + str, DbType.Currency, info2.ItemCostPrice);
                database.AddInParameter(sqlStringCommand, "ItemListPrice" + str, DbType.Currency, info2.ItemListPrice);
                database.AddInParameter(sqlStringCommand, "ItemPurchasePrice" + str, DbType.Currency, info2.ItemPurchasePrice);
                database.AddInParameter(sqlStringCommand, "ItemDescription" + str, DbType.String, info2.ItemDescription);
                database.AddInParameter(sqlStringCommand, "ItemHomeSiteDescription" + str, DbType.String, info2.ItemHomeSiteDescription);
                database.AddInParameter(sqlStringCommand, "SKUContent" + str, DbType.String, info2.SKUContent);
                database.AddInParameter(sqlStringCommand, "ThumbnailsUrl" + str, DbType.String, info2.ThumbnailsUrl);
                database.AddInParameter(sqlStringCommand, "Weight" + str, DbType.Int32, info2.ItemWeight);
                num++;
            }
            foreach (PurchaseOrderGiftInfo info3 in info.PurchaseOrderGifts)
            {
                str = num.ToString();
                builder.Append("INSERT INTO Hishop_PurchaseOrderGifts(PurchaseOrderId, GiftId, GiftName, CostPrice, PurchasePrice, ").Append("ThumbnailsUrl, Quantity) VALUES( @PurchaseOrderId,").Append("@GiftId").Append(str).Append(",@GiftName").Append(str).Append(",@CostPrice").Append(str).Append(",@PurchasePrice").Append(str).Append(",@ThumbnailsUrl").Append(str).Append(",@Quantity").Append(str).Append(");");
                database.AddInParameter(sqlStringCommand, "GiftId" + str, DbType.Int32, info3.GiftId);
                database.AddInParameter(sqlStringCommand, "GiftName" + str, DbType.String, info3.GiftName);
                database.AddInParameter(sqlStringCommand, "Quantity" + str, DbType.Int32, info3.Quantity);
                database.AddInParameter(sqlStringCommand, "CostPrice" + str, DbType.Currency, info3.CostPrice);
                database.AddInParameter(sqlStringCommand, "PurchasePrice" + str, DbType.Currency, info3.PurchasePrice);
                database.AddInParameter(sqlStringCommand, "ThumbnailsUrl" + str, DbType.String, info3.ThumbnailsUrl);
                num++;
            }
            foreach (PurchaseOrderOptionInfo info4 in info.PurchaseOrderOptions)
            {
                str = num.ToString();
                builder.Append("INSERT INTO Hishop_PurchaseOrderOptions (PurchaseOrderId, LookupListId, LookupItemId, ListDescription, ItemDescription, AdjustedPrice, CustomerTitle, CustomerDescription)").Append(" VALUES (@PurchaseOrderId, @LookupListId").Append(str).Append(", @LookupItemId").Append(str).Append(", @ListDescription").Append(str).Append(", @ItemDescription").Append(str).Append(", @AdjustedPrice").Append(str).Append(", @CustomerTitle").Append(str).Append(", @CustomerDescription").Append(str).Append(");");
                database.AddInParameter(sqlStringCommand, "LookupListId" + str, DbType.Int32, info4.LookupListId);
                database.AddInParameter(sqlStringCommand, "LookupItemId" + str, DbType.Int32, info4.LookupItemId);
                database.AddInParameter(sqlStringCommand, "ListDescription" + str, DbType.String, info4.ListDescription);
                database.AddInParameter(sqlStringCommand, "ItemDescription" + str, DbType.String, info4.ItemDescription);
                database.AddInParameter(sqlStringCommand, "AdjustedPrice" + str, DbType.Currency, info4.AdjustedPrice);
                database.AddInParameter(sqlStringCommand, "CustomerTitle" + str, DbType.String, info4.CustomerTitle);
                database.AddInParameter(sqlStringCommand, "CustomerDescription" + str, DbType.String, info4.CustomerDescription);
                num++;
            }
            sqlStringCommand.CommandText = builder.ToString().Remove(builder.Length - 1);
            if (dbTran != null)
            {
                return(database.ExecuteNonQuery(sqlStringCommand, dbTran) > 0);
            }
            return(database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
예제 #20
0
        public StringBuilder GetOrderDetails(string format, string orderitemfomat, PurchaseOrderInfo order)
        {
            StringBuilder builder = new StringBuilder();
            string        str     = string.Empty;

            if (order == null)
            {
                return(builder);
            }
            string        str2     = "false";
            StringBuilder builder2 = new StringBuilder();
            long          num      = 0L;

            foreach (PurchaseOrderItemInfo info in order.PurchaseOrderItems)
            {
                str2 = "true";
                builder2.AppendFormat(orderitemfomat, new object[] { "0", order.OrderId, info.ProductId.ToString(), info.ItemDescription, info.SKU, info.SKUContent, info.Quantity.ToString(), info.ItemListPrice.ToString("F2"), info.ItemPurchasePrice.ToString("F2"), info.ItemCostPrice.ToString("F2") });
                num += info.Quantity;
            }
            Dictionary <string, string> shippingRegion = MessageInfo.GetShippingRegion(order.ShippingRegion);

            builder.AppendFormat(format, new object[] {
                order.OrderId, "0", order.Distributorname, order.DistributorEmail, order.ShipTo, shippingRegion["Province"], shippingRegion["City"].ToString(), shippingRegion["District"], order.Address, order.ZipCode, order.CellPhone, order.TelPhone, order.Remark, order.ManagerMark, order.ManagerRemark, num.ToString(),
                order.OrderTotal.ToString("F2"), order.OrderTotal.ToString("F2"), order.AdjustedFreight.ToString("F2"), order.GetPurchaseProfit().ToString("F2"), order.GetPurchaseTotal().ToString("F2"), order.PayDate.ToString(), order.ShippingDate.ToString(), ((int)order.RefundStatus).ToString(), order.RefundAmount.ToString("F2"), order.RefundRemark, ((int)order.PurchaseStatus).ToString(), str2, builder2
            });
            if (!string.IsNullOrEmpty(order.ShippingRegion))
            {
                str = order.ShippingRegion;
            }
            if (!string.IsNullOrEmpty(order.Address))
            {
                str = str + order.Address;
            }
            if (!string.IsNullOrEmpty(order.ShipTo))
            {
                str = str + "   " + order.ShipTo;
            }
            if (!string.IsNullOrEmpty(order.ZipCode))
            {
                str = str + "   " + order.ZipCode;
            }
            if (!string.IsNullOrEmpty(order.TelPhone))
            {
                str = str + "   " + order.TelPhone;
            }
            if (!string.IsNullOrEmpty(order.CellPhone))
            {
                str = str + "   " + order.CellPhone;
            }
            string str3 = "<ShipAddress>{0}</ShipAddress><ModeName>{1}</ModeName><ShipOrderNumber>{2}</ShipOrderNumber><ExpressCompanyName>{3}</ExpressCompanyName>";

            str3 = string.Format(str3, new object[] { str, order.RealModeName, order.ShipOrderNumber, order.ExpressCompanyName });
            return(builder.Replace("</Status>", "</Status>" + str3));
        }
예제 #21
0
        private void BtnRefund_Click(object sender, EventArgs e)
        {
            PurchaseOrderInfo purchaseOrder = SalesHelper.GetPurchaseOrder(purchaseOrderId);

            if (!purchaseOrder.CheckAction(PurchaseOrderActions.MASTER_REJECT_REFUND))
            {
                ShowMsg("未付款或不在进行中的订单没有退款操作", false);
            }
            else
            {
                int     length = 0;
                decimal result = 0M;
                if (purchaseOrder.PurchaseStatus == OrderStatus.SellerAlreadySent)
                {
                    if (txtRefundTotal.Text.Trim().IndexOf(".") > 0)
                    {
                        length = txtRefundTotal.Text.Trim().Substring(txtRefundTotal.Text.Trim().IndexOf(".") + 1).Length;
                    }
                    if (!(decimal.TryParse(txtRefundTotal.Text.Trim(), out result) && (length <= 2)))
                    {
                        ShowMsg("退款金额只能是数值,且不能超过2位小数", false);
                        return;
                    }
                    if ((result <= 0M) || (result > purchaseOrder.GetPurchaseTotal()))
                    {
                        ShowMsg("退款金额必须大于0,小于等于实收款", false);
                        return;
                    }
                }
                if (txtRefundRemark.Text.Length > 200)
                {
                    ShowMsg("退款说明限制在200个字符以内", false);
                }
                else
                {
                    decimal     num3;
                    Distributor user = Users.GetUser(purchaseOrder.DistributorId) as Distributor;
                    if (purchaseOrder.PurchaseStatus == OrderStatus.SellerAlreadySent)
                    {
                        num3 = result;
                    }
                    else
                    {
                        num3 = decimal.Parse(lblRefundTotal.Money.ToString());
                    }
                    BalanceDetailInfo balanceDetails = new BalanceDetailInfo();
                    balanceDetails.UserId    = purchaseOrder.DistributorId;
                    balanceDetails.UserName  = purchaseOrder.Distributorname;
                    balanceDetails.TradeDate = DateTime.Now;
                    balanceDetails.TradeType = TradeTypes.RefundOrder;
                    balanceDetails.Income    = new decimal?(num3);
                    balanceDetails.Balance   = user.Balance + num3;
                    balanceDetails.Remark    = "采购单退款到预付款";
                    if (DistributorHelper.AddBalance(balanceDetails))
                    {
                        purchaseOrder.RefundAmount = num3;
                        purchaseOrder.RefundRemark = Globals.HtmlEncode(txtRefundRemark.Text.Trim());
                        purchaseOrder.FinishDate   = DateTime.Now;
                        if (purchaseOrder.PurchaseStatus == OrderStatus.BuyerAlreadyPaid)
                        {
                            purchaseOrder.PurchaseStatus = OrderStatus.Closed;
                        }
                        if (purchaseOrder.PurchaseStatus == OrderStatus.SellerAlreadySent)
                        {
                            purchaseOrder.PurchaseStatus = OrderStatus.Finished;
                        }
                        if (SalesHelper.RefundPurchaseOrder(purchaseOrder))
                        {
                            Page.Response.Redirect(Globals.ApplicationPath + string.Format("/Admin/purchaseOrder/RefundPurchaseOrderDetails.aspx?PurchaseOrderId={0}", purchaseOrder.PurchaseOrderId));
                        }
                        else
                        {
                            ShowMsg("退款失败", false);
                        }
                    }
                }
            }
        }
예제 #22
0
        public override bool CreatePurchaseOrder(OrderInfo order, System.Data.Common.DbTransaction dbTran)
        {
            PurchaseOrderInfo purchaseOrderInfo = this.ConvertOrderToPurchaseOrder(order);
            bool result;

            if (purchaseOrderInfo == null)
            {
                result = false;
            }
            else
            {
                System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(" ");
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("INSERT INTO Hishop_PurchaseOrders(PurchaseOrderId, OrderId, Remark, ManagerMark, ManagerRemark, AdjustedDiscount,PurchaseStatus, CloseReason, PurchaseDate, DistributorId, Distributorname,DistributorEmail, DistributorRealName, DistributorQQ, DistributorWangwang, DistributorMSN,ShippingRegion, Address, ZipCode, ShipTo, TelPhone, CellPhone, ShipToDate, ShippingModeId, ModeName,RealShippingModeId, RealModeName, RegionId, Freight, AdjustedFreight, ShipOrderNumber, Weight,ExpressCompanyName,ExpressCompanyAbb,RefundStatus, RefundAmount, RefundRemark, OrderTotal, PurchaseProfit, PurchaseTotal,Tax,InvoiceTitle)VALUES (@PurchaseOrderId, @OrderId, @Remark, @ManagerMark, @ManagerRemark, @AdjustedDiscount,@PurchaseStatus, @CloseReason, @PurchaseDate, @DistributorId, @Distributorname,@DistributorEmail, @DistributorRealName, @DistributorQQ, @DistributorWangwang, @DistributorMSN,@ShippingRegion, @Address, @ZipCode, @ShipTo, @TelPhone, @CellPhone, @ShipToDate, @ShippingModeId, @ModeName,@RealShippingModeId, @RealModeName, @RegionId, @Freight, @AdjustedFreight, @ShipOrderNumber, @PurchaseWeight,@ExpressCompanyName,@ExpressCompanyAbb,@RefundStatus, @RefundAmount, @RefundRemark, @OrderTotal, @PurchaseProfit, @PurchaseTotal,@Tax,@InvoiceTitle);");
                this.database.AddInParameter(sqlStringCommand, "PurchaseOrderId", System.Data.DbType.String, purchaseOrderInfo.PurchaseOrderId);
                this.database.AddInParameter(sqlStringCommand, "OrderId", System.Data.DbType.String, purchaseOrderInfo.OrderId);
                this.database.AddInParameter(sqlStringCommand, "Remark", System.Data.DbType.String, purchaseOrderInfo.Remark);
                if (purchaseOrderInfo.ManagerMark.HasValue)
                {
                    this.database.AddInParameter(sqlStringCommand, "ManagerMark", System.Data.DbType.Int32, (int)purchaseOrderInfo.ManagerMark.Value);
                }
                else
                {
                    this.database.AddInParameter(sqlStringCommand, "ManagerMark", System.Data.DbType.Int32, DBNull.Value);
                }
                this.database.AddInParameter(sqlStringCommand, "ManagerRemark", System.Data.DbType.String, purchaseOrderInfo.ManagerRemark);
                this.database.AddInParameter(sqlStringCommand, "AdjustedDiscount", System.Data.DbType.Currency, purchaseOrderInfo.AdjustedDiscount);
                this.database.AddInParameter(sqlStringCommand, "PurchaseStatus", System.Data.DbType.Int32, (int)purchaseOrderInfo.PurchaseStatus);
                this.database.AddInParameter(sqlStringCommand, "CloseReason", System.Data.DbType.String, purchaseOrderInfo.CloseReason);
                this.database.AddInParameter(sqlStringCommand, "PurchaseDate", System.Data.DbType.DateTime, DateTime.Now);
                this.database.AddInParameter(sqlStringCommand, "DistributorId", System.Data.DbType.Int32, purchaseOrderInfo.DistributorId);
                this.database.AddInParameter(sqlStringCommand, "Distributorname", System.Data.DbType.String, purchaseOrderInfo.Distributorname);
                this.database.AddInParameter(sqlStringCommand, "DistributorEmail", System.Data.DbType.String, purchaseOrderInfo.DistributorEmail);
                this.database.AddInParameter(sqlStringCommand, "DistributorRealName", System.Data.DbType.String, purchaseOrderInfo.DistributorRealName);
                this.database.AddInParameter(sqlStringCommand, "DistributorQQ", System.Data.DbType.String, purchaseOrderInfo.DistributorQQ);
                this.database.AddInParameter(sqlStringCommand, "DistributorWangwang", System.Data.DbType.String, purchaseOrderInfo.DistributorWangwang);
                this.database.AddInParameter(sqlStringCommand, "DistributorMSN", System.Data.DbType.String, purchaseOrderInfo.DistributorMSN);
                this.database.AddInParameter(sqlStringCommand, "ShippingRegion", System.Data.DbType.String, purchaseOrderInfo.ShippingRegion);
                this.database.AddInParameter(sqlStringCommand, "Address", System.Data.DbType.String, purchaseOrderInfo.Address);
                this.database.AddInParameter(sqlStringCommand, "ZipCode", System.Data.DbType.String, purchaseOrderInfo.ZipCode);
                this.database.AddInParameter(sqlStringCommand, "ShipTo", System.Data.DbType.String, purchaseOrderInfo.ShipTo);
                this.database.AddInParameter(sqlStringCommand, "TelPhone", System.Data.DbType.String, purchaseOrderInfo.TelPhone);
                this.database.AddInParameter(sqlStringCommand, "CellPhone", System.Data.DbType.String, purchaseOrderInfo.CellPhone);
                this.database.AddInParameter(sqlStringCommand, "ShipToDate", System.Data.DbType.String, purchaseOrderInfo.ShipToDate);
                this.database.AddInParameter(sqlStringCommand, "ShippingModeId", System.Data.DbType.Int32, purchaseOrderInfo.ShippingModeId);
                this.database.AddInParameter(sqlStringCommand, "ModeName", System.Data.DbType.String, purchaseOrderInfo.ModeName);
                this.database.AddInParameter(sqlStringCommand, "RealShippingModeId", System.Data.DbType.Int32, purchaseOrderInfo.RealShippingModeId);
                this.database.AddInParameter(sqlStringCommand, "RealModeName", System.Data.DbType.String, purchaseOrderInfo.RealModeName);
                this.database.AddInParameter(sqlStringCommand, "RegionId", System.Data.DbType.Int32, purchaseOrderInfo.RegionId);
                this.database.AddInParameter(sqlStringCommand, "Freight", System.Data.DbType.Currency, purchaseOrderInfo.Freight);
                this.database.AddInParameter(sqlStringCommand, "AdjustedFreight", System.Data.DbType.Currency, purchaseOrderInfo.AdjustedFreight);
                this.database.AddInParameter(sqlStringCommand, "ShipOrderNumber", System.Data.DbType.String, purchaseOrderInfo.ShipOrderNumber);
                this.database.AddInParameter(sqlStringCommand, "PurchaseWeight", System.Data.DbType.Int32, (int)purchaseOrderInfo.Weight);
                this.database.AddInParameter(sqlStringCommand, "ExpressCompanyAbb", System.Data.DbType.String, purchaseOrderInfo.ExpressCompanyAbb);
                this.database.AddInParameter(sqlStringCommand, "ExpressCompanyName", System.Data.DbType.String, purchaseOrderInfo.ExpressCompanyName);
                this.database.AddInParameter(sqlStringCommand, "RefundStatus", System.Data.DbType.Int32, (int)purchaseOrderInfo.RefundStatus);
                this.database.AddInParameter(sqlStringCommand, "RefundAmount", System.Data.DbType.Currency, purchaseOrderInfo.RefundAmount);
                this.database.AddInParameter(sqlStringCommand, "RefundRemark", System.Data.DbType.String, purchaseOrderInfo.RefundRemark);
                this.database.AddInParameter(sqlStringCommand, "OrderTotal", System.Data.DbType.Currency, purchaseOrderInfo.OrderTotal);
                this.database.AddInParameter(sqlStringCommand, "PurchaseProfit", System.Data.DbType.Currency, purchaseOrderInfo.GetPurchaseProfit());
                this.database.AddInParameter(sqlStringCommand, "PurchaseTotal", System.Data.DbType.Currency, purchaseOrderInfo.GetPurchaseTotal());
                this.database.AddInParameter(sqlStringCommand, "Tax", System.Data.DbType.Currency, purchaseOrderInfo.Tax);
                this.database.AddInParameter(sqlStringCommand, "InvoiceTitle", System.Data.DbType.String, purchaseOrderInfo.InvoiceTitle);
                int num = 0;
                foreach (PurchaseOrderItemInfo current in purchaseOrderInfo.PurchaseOrderItems)
                {
                    string text = num.ToString();
                    stringBuilder.Append("INSERT INTO Hishop_PurchaseOrderItems(PurchaseOrderId, SkuId, ProductId, SKU, Quantity,  CostPrice, ").Append("ItemListPrice, ItemPurchasePrice, ItemDescription, ItemHomeSiteDescription, SKUContent, ThumbnailsUrl, Weight) VALUES( @PurchaseOrderId").Append(",@SkuId").Append(text).Append(",@ProductId").Append(text).Append(",@SKU").Append(text).Append(",@Quantity").Append(text).Append(",@CostPrice").Append(text).Append(",@ItemListPrice").Append(text).Append(",@ItemPurchasePrice").Append(text).Append(",@ItemDescription").Append(text).Append(",@ItemHomeSiteDescription").Append(text).Append(",@SKUContent").Append(text).Append(",@ThumbnailsUrl").Append(text).Append(",@Weight").Append(text).Append(");");
                    this.database.AddInParameter(sqlStringCommand, "SkuId" + text, System.Data.DbType.String, current.SkuId);
                    this.database.AddInParameter(sqlStringCommand, "ProductId" + text, System.Data.DbType.Int32, current.ProductId);
                    this.database.AddInParameter(sqlStringCommand, "SKU" + text, System.Data.DbType.String, current.SKU);
                    this.database.AddInParameter(sqlStringCommand, "Quantity" + text, System.Data.DbType.Int32, current.Quantity);
                    this.database.AddInParameter(sqlStringCommand, "CostPrice" + text, System.Data.DbType.Currency, current.ItemCostPrice);
                    this.database.AddInParameter(sqlStringCommand, "ItemListPrice" + text, System.Data.DbType.Currency, current.ItemListPrice);
                    this.database.AddInParameter(sqlStringCommand, "ItemPurchasePrice" + text, System.Data.DbType.Currency, current.ItemPurchasePrice);
                    this.database.AddInParameter(sqlStringCommand, "ItemDescription" + text, System.Data.DbType.String, current.ItemDescription);
                    this.database.AddInParameter(sqlStringCommand, "ItemHomeSiteDescription" + text, System.Data.DbType.String, current.ItemHomeSiteDescription);
                    this.database.AddInParameter(sqlStringCommand, "SKUContent" + text, System.Data.DbType.String, current.SKUContent);
                    this.database.AddInParameter(sqlStringCommand, "ThumbnailsUrl" + text, System.Data.DbType.String, current.ThumbnailsUrl);
                    this.database.AddInParameter(sqlStringCommand, "Weight" + text, System.Data.DbType.Int32, current.ItemWeight);
                    num++;
                }
                foreach (PurchaseOrderGiftInfo current2 in purchaseOrderInfo.PurchaseOrderGifts)
                {
                    string text = num.ToString();
                    stringBuilder.Append("INSERT INTO Hishop_PurchaseOrderGifts(PurchaseOrderId, GiftId, GiftName, CostPrice, PurchasePrice, ").Append("ThumbnailsUrl, Quantity) VALUES( @PurchaseOrderId,").Append("@GiftId").Append(text).Append(",@GiftName").Append(text).Append(",@CostPrice").Append(text).Append(",@PurchasePrice").Append(text).Append(",@ThumbnailsUrl").Append(text).Append(",@Quantity").Append(text).Append(");");
                    this.database.AddInParameter(sqlStringCommand, "GiftId" + text, System.Data.DbType.Int32, current2.GiftId);
                    this.database.AddInParameter(sqlStringCommand, "GiftName" + text, System.Data.DbType.String, current2.GiftName);
                    this.database.AddInParameter(sqlStringCommand, "Quantity" + text, System.Data.DbType.Int32, current2.Quantity);
                    this.database.AddInParameter(sqlStringCommand, "CostPrice" + text, System.Data.DbType.Currency, current2.CostPrice);
                    this.database.AddInParameter(sqlStringCommand, "PurchasePrice" + text, System.Data.DbType.Currency, current2.PurchasePrice);
                    this.database.AddInParameter(sqlStringCommand, "ThumbnailsUrl" + text, System.Data.DbType.String, current2.ThumbnailsUrl);
                    num++;
                }
                sqlStringCommand.CommandText = stringBuilder.ToString().Remove(stringBuilder.Length - 1);
                if (dbTran != null)
                {
                    result = (this.database.ExecuteNonQuery(sqlStringCommand, dbTran) > 0);
                }
                else
                {
                    result = (this.database.ExecuteNonQuery(sqlStringCommand) > 0);
                }
            }
            return(result);
        }
예제 #23
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.dlstPurchaseOrders.ItemDataBound += new System.Web.UI.WebControls.DataListItemEventHandler(this.dlstPurchaseOrders_ItemDataBound);
     this.dlstPurchaseOrders.ItemCommand   += new System.Web.UI.WebControls.DataListCommandEventHandler(this.dlstPurchaseOrders_ItemCommand);
     this.btnSearchButton.Click            += new System.EventHandler(this.btnSearchButton_Click);
     this.btnRemark.Click             += new System.EventHandler(this.btnRemark_Click);
     this.btnClosePurchaseOrder.Click += new System.EventHandler(this.btnClosePurchaseOrder_Click);
     this.lkbtnDeleteCheck.Click      += new System.EventHandler(this.lkbtnDeleteCheck_Click);
     this.btnEditOrder.Click          += new System.EventHandler(this.btnEditOrder_Click);
     this.btnOrderGoods.Click         += new System.EventHandler(this.btnOrderGoods_Click);
     this.btnProductGoods.Click       += new System.EventHandler(this.btnProductGoods_Click);
     this.btnAcceptRefund.Click       += new System.EventHandler(this.btnAcceptRefund_Click);
     this.btnRefuseRefund.Click       += new System.EventHandler(this.btnRefuseRefund_Click);
     this.btnAcceptReturn.Click       += new System.EventHandler(this.btnAcceptReturn_Click);
     this.btnRefuseReturn.Click       += new System.EventHandler(this.btnRefuseReturn_Click);
     this.btnAcceptReplace.Click      += new System.EventHandler(this.btnAcceptReplace_Click);
     this.btnRefuseReplace.Click      += new System.EventHandler(this.btnRefuseReplace_Click);
     if (!string.IsNullOrEmpty(base.Request["isCallback"]) && base.Request["isCallback"] == "true")
     {
         if (string.IsNullOrEmpty(base.Request["purchaseOrderId"]))
         {
             base.Response.Write("{\"Status\":\"0\"}");
             base.Response.End();
             return;
         }
         PurchaseOrderInfo         purchaseOrder = SalesHelper.GetPurchaseOrder(base.Request["purchaseOrderId"]);
         System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
         int    num;
         string text;
         if (base.Request["type"] == "refund")
         {
             SalesHelper.GetPurchaseRefundType(base.Request["purchaseOrderId"], out num, out text);
         }
         else
         {
             if (base.Request["type"] == "return")
             {
                 SalesHelper.GetPurchaseRefundTypeFromReturn(base.Request["purchaseOrderId"], out num, out text);
             }
             else
             {
                 num  = 0;
                 text = "";
             }
         }
         string arg;
         if (num == 1)
         {
             arg = "退到预存款";
         }
         else
         {
             arg = "银行转帐";
         }
         stringBuilder.AppendFormat(",\"OrderTotal\":\"{0}\"", Globals.FormatMoney(purchaseOrder.GetPurchaseTotal()));
         if (base.Request["type"] == "replace")
         {
             string purchaseReplaceComments = SalesHelper.GetPurchaseReplaceComments(base.Request["purchaseOrderId"]);
             stringBuilder.AppendFormat(",\"Comments\":\"{0}\"", purchaseReplaceComments.Replace("\r\n", ""));
         }
         else
         {
             stringBuilder.AppendFormat(",\"RefundType\":\"{0}\"", num);
             stringBuilder.AppendFormat(",\"RefundTypeStr\":\"{0}\"", arg);
         }
         stringBuilder.AppendFormat(",\"Remark\":\"{0}\"", text.Replace("\r\n", ""));
         stringBuilder.AppendFormat(",\"Contacts\":\"{0}\"", purchaseOrder.DistributorRealName);
         stringBuilder.AppendFormat(",\"Email\":\"{0}\"", purchaseOrder.DistributorEmail);
         stringBuilder.AppendFormat(",\"Telephone\":\"{0}\"", purchaseOrder.TelPhone);
         stringBuilder.AppendFormat(",\"Address\":\"{0}\"", purchaseOrder.Address);
         stringBuilder.AppendFormat(",\"PostCode\":\"{0}\"", purchaseOrder.ZipCode);
         base.Response.Clear();
         base.Response.ContentType = "application/json";
         base.Response.Write("{\"Status\":\"1\"" + stringBuilder.ToString() + "}");
         base.Response.End();
     }
     if (!this.Page.IsPostBack)
     {
         this.shippingModeDropDownList.DataBind();
         this.ddlIsPrinted.Items.Clear();
         this.ddlIsPrinted.Items.Add(new System.Web.UI.WebControls.ListItem("全部", string.Empty));
         this.ddlIsPrinted.Items.Add(new System.Web.UI.WebControls.ListItem("已打印", "1"));
         this.ddlIsPrinted.Items.Add(new System.Web.UI.WebControls.ListItem("未打印", "0"));
         this.SetPurchaseOrderStatusLink();
         this.BindPurchaseOrders();
     }
     CheckBoxColumn.RegisterClientCheckEvents(this.Page, this.Page.Form.ClientID);
 }
예제 #24
0
        public System.Text.StringBuilder GetOrderDetails(string format, string orderitemfomat, PurchaseOrderInfo order)
        {
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            string text = string.Empty;

            if (order != null)
            {
                string text2 = "false";
                System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                long num = 0L;
                System.Collections.Generic.IList <PurchaseOrderItemInfo> purchaseOrderItems = order.PurchaseOrderItems;
                foreach (PurchaseOrderItemInfo current in purchaseOrderItems)
                {
                    text2 = "true";
                    stringBuilder2.AppendFormat(orderitemfomat, new object[]
                    {
                        "0",
                        order.OrderId,
                        current.ProductId.ToString(),
                        current.ItemDescription,
                        current.SKU,
                        current.SKUContent,
                        current.Quantity.ToString(),
                        current.ItemListPrice.ToString("F2"),
                        current.ItemPurchasePrice.ToString("F2"),
                        current.ItemCostPrice.ToString("F2")
                    });
                    num += (long)current.Quantity;
                }
                System.Collections.Generic.Dictionary <string, string> shippingRegion = MessageInfo.GetShippingRegion(order.ShippingRegion);
                stringBuilder.AppendFormat(format, new object[]
                {
                    order.OrderId,
                    "0",
                    order.Distributorname,
                    order.DistributorEmail,
                    order.ShipTo,
                    shippingRegion["Province"],
                    shippingRegion["City"].ToString(),
                    shippingRegion["District"],
                    order.Address,
                    order.ZipCode,
                    order.CellPhone,
                    order.TelPhone,
                    order.Remark,
                    order.ManagerMark,
                    order.ManagerRemark,
                    num.ToString(),
                    order.OrderTotal.ToString("F2"),
                    order.OrderTotal.ToString("F2"),
                    order.AdjustedFreight.ToString("F2"),
                    order.GetPurchaseProfit().ToString("F2"),
                    order.GetPurchaseTotal().ToString("F2"),
                    order.PayDate.ToString(),
                    order.ShippingDate.ToString(),
                    ((int)order.RefundStatus).ToString(),
                    order.RefundAmount.ToString("F2"),
                    order.RefundRemark,
                    ((int)order.PurchaseStatus).ToString(),
                    text2,
                    stringBuilder2
                });
                if (!string.IsNullOrEmpty(order.ShippingRegion))
                {
                    text = order.ShippingRegion;
                }
                if (!string.IsNullOrEmpty(order.Address))
                {
                    text += order.Address;
                }
                if (!string.IsNullOrEmpty(order.ShipTo))
                {
                    text = text + "   " + order.ShipTo;
                }
                if (!string.IsNullOrEmpty(order.ZipCode))
                {
                    text = text + "   " + order.ZipCode;
                }
                if (!string.IsNullOrEmpty(order.TelPhone))
                {
                    text = text + "   " + order.TelPhone;
                }
                if (!string.IsNullOrEmpty(order.CellPhone))
                {
                    text = text + "   " + order.CellPhone;
                }
                string text3 = "<ShipAddress>{0}</ShipAddress><ModeName>{1}</ModeName><ShipOrderNumber>{2}</ShipOrderNumber><ExpressCompanyName>{3}</ExpressCompanyName>";
                text3 = string.Format(text3, new object[]
                {
                    text,
                    order.RealModeName,
                    order.ShipOrderNumber,
                    order.ExpressCompanyName
                });
                stringBuilder = stringBuilder.Replace("</Status>", "</Status>" + text3);
            }
            return(stringBuilder);
        }
예제 #25
0
        private void WritPurchaseOrderInfo(PurchaseOrderInfo prurchaseOrder, ShippersInfo shipper)
        {
            string[]      strArray = RegionHelper.GetFullRegion(prurchaseOrder.RegionId, ",").Split(new char[] { ',' });
            StringBuilder builder  = new StringBuilder();

            builder.AppendLine("<nodes>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-姓名</name>");
            builder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.ShipTo);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-电话</name>");
            builder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.TelPhone + "_");
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-手机</name>");
            builder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.CellPhone + "_");
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-邮编</name>");
            builder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.ZipCode + "_");
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>收货人-地址</name>");
            builder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.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>", prurchaseOrder.PurchaseOrderId);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-总金额</name>");
            builder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.GetPurchaseTotal() + "_");
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-物品总重量</name>");
            builder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.Weight);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-备注</name>");
            builder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.ManagerRemark);
            builder.AppendLine("</item>");
            string shipperId = "";

            if ((prurchaseOrder.PurchaseOrderItems != null) && (prurchaseOrder.PurchaseOrderItems.Count > 0))
            {
                foreach (PurchaseOrderItemInfo info in prurchaseOrder.PurchaseOrderItems)
                {
                    object obj2 = shipperId;
                    shipperId = string.Concat(new object[] { obj2, "货号 ", info.SKU, " ", info.SKUContent, " \x00d7", info.Quantity, "\n" });
                }
                shipperId = shipperId.Replace(";", "").Replace(";", "").Replace(":", ":");
            }
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-详情</name>");
            builder.AppendFormat("<rename>{0}</rename>", shipperId);
            builder.AppendLine("</item>");
            builder.AppendLine("<item>");
            builder.AppendLine("<name>订单-送货时间</name>");
            builder.AppendFormat("<rename>{0}</rename>", prurchaseOrder.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>", "√");
            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());
        }