Beispiel #1
0
 protected override void AttachChildControls()
 {
     this.replaceId = System.Convert.ToInt32(this.Page.Request.QueryString["ReplaceId"]);
     //this.RefundDetails = (Common_OrderManage_OrderItems)this.FindControl("Common_OrderManage_OrderItems");
     this.RefundDetails     = (VshopTemplatedRepeater)this.FindControl("rptOrderProducts");
     this.txtOrderId        = (System.Web.UI.WebControls.Literal) this.FindControl("txtOrderId");
     this.handleStatus      = (System.Web.UI.WebControls.Literal) this.FindControl("handleStatus");
     this.litAddDate        = (FormatedTimeLabel)this.FindControl("litAddDate");
     this.litRemark         = (System.Web.UI.WebControls.Literal) this.FindControl("litRemark");
     this.litAdminRemark    = (System.Web.UI.WebControls.Literal) this.FindControl("litAdminRemark");
     this.litWeight         = (System.Web.UI.WebControls.Literal) this.FindControl("litWeight");
     this.litUsername       = (System.Web.UI.WebControls.Literal) this.FindControl("litUsername");
     this.litShippingRegion = (System.Web.UI.WebControls.Literal) this.FindControl("litShippingRegion");
     this.litZipCode        = (System.Web.UI.WebControls.Literal) this.FindControl("litZipCode");
     this.litEmailAddress   = (System.Web.UI.WebControls.Literal) this.FindControl("litEmailAddress");
     this.litCellPhone      = (System.Web.UI.WebControls.Literal) this.FindControl("litCellPhone");
     this.litTelPhone       = (System.Web.UI.WebControls.Literal) this.FindControl("litTelPhone");
     this.litShipToDate     = (System.Web.UI.WebControls.Literal) this.FindControl("litShipToDate");
     this.litTotalPrice     = (FormatedMoneyLabel)this.FindControl("litTotalPrice");
     if (!this.Page.IsPostBack)
     {
         this.BindOrderReplace(this.replaceId);
         OrderInfo orderInfo = TradeHelper.GetOrderInfo(this.orderId);
         replaceInfo = TradeHelper.GetReplaceInfo(this.replaceId);
         if (orderInfo == null || orderInfo.UserId != HiContext.Current.User.UserId)
         {
             this.Page.Response.Redirect(Globals.ApplicationPath + "/ResourceNotFound.aspx?errorMsg=" + Globals.UrlEncode("该订单不存在或者不属于当前用户的订单"));
             return;
         }
         this.BindOrderItems(orderInfo);
         this.BindRefunds(replaceInfo);
     }
 }
Beispiel #2
0
        public ReplaceInfo GetReplaceInfo(string OrderId, string SkuId = "")
        {
            OrderId = base.GetTrueOrderId(OrderId);
            ReplaceInfo   result        = null;
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("SELECT TOP 1 * FROM Hishop_OrderReplace WHERE OrderId = @OrderId");
            if (!string.IsNullOrEmpty(SkuId))
            {
                stringBuilder.Append(" AND SkuId = @SkuID");
            }
            else
            {
                stringBuilder.Append(" AND (SkuId IS NULL OR SkuId='')");
            }
            stringBuilder.Append(" ORDER BY ReplaceId DESC");
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand(stringBuilder.ToString());

            base.database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, OrderId);
            base.database.AddInParameter(sqlStringCommand, "SkuId", DbType.String, SkuId);
            using (IDataReader objReader = base.database.ExecuteReader(sqlStringCommand))
            {
                result = DataHelper.ReaderToModel <ReplaceInfo>(objReader);
            }
            return(result);
        }
Beispiel #3
0
        protected System.Web.UI.WebControls.Literal litSourceOrder;//关联的订单号

        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(this.Page.Request.QueryString["ReplaceId"]))
            {
                base.GotoResourceNotFound();
                return;
            }
            string key    = "orderdetails-frame";
            string script = string.Format("<script>if(window.parent.frames.length == 0) window.location.href=\"{0}\";</script>", Globals.ApplicationPath + "/admin/default.html");
            ClientScriptManager clientScript = this.Page.ClientScript;

            if (!clientScript.IsClientScriptBlockRegistered(key))
            {
                clientScript.RegisterClientScriptBlock(base.GetType(), key, script);
            }
            int.TryParse(this.Page.Request.QueryString["ReplaceId"], out returnsId);

            this.replaceInfo = OrderHelper.GetReplaceInfo(this.returnsId);
            this.orderId     = replaceInfo.OrderId;
            if (this.replaceInfo == null)
            {
                base.Response.Write("<h3 style=\"color:red;\">退货单不存在,或者已被删除。</h3>");
                base.Response.End();
            }
            else
            {
            }
            if (!this.Page.IsPostBack)
            {
                BindReturnsData();
            }
        }
Beispiel #4
0
        public static List <ReplaceInfo> ReadDataFromFile(string path)
        {
            List <ReplaceInfo> retList = new List <ReplaceInfo>();

            if (!File.Exists(path))
            {
                return(retList);
            }
            try
            {
                using (FileStream fs = new FileStream(path, FileMode.Open))
                {
                    StreamReader sr   = new StreamReader(fs, Encoding.GetEncoding("gb2312"), true);
                    string       line = sr.ReadLine();
                    while (!string.IsNullOrEmpty(line))
                    {
                        string[] arr = line.Split(',');
                        if (arr.Length == 3)
                        {
                            ReplaceInfo info = new ReplaceInfo(arr[0], arr[1], bool.Parse(arr[2]));
                            retList.Add(info);
                        }
                        line = sr.ReadLine();
                    }
                }
            }
            catch (Exception)
            {
            }

            InitialDirectory = path;

            return(retList);
        }
Beispiel #5
0
        public ReplaceInfo GetReplaceInfo(int ReplaceId)
        {
            ReplaceInfo replaceInfo = null;
            //Username,EmailAddress,RealName,ZipCode,CellPhone
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT A.ReplaceId,A.OrderId,A.ApplyForTime,A.RefundMoney,A.Comments,A.HandleStatus,A.HandleTime,A.AdminRemark,A.Operator,A.ReceiveTime,A1.Username,A1.EmailAddress,A1.RealName,A1.ZipCode,A1.CellPhone FROM Ecshop_OrderReplace as A left join Ecshop_Orders as A1 on A.orderId=A1.orderId  where ReplaceId=@ReplaceId;SELECT o.Id,o.AId,o.SkuId,o.ProductId,o.ApplyType,o.Quantity,o.ItemAdjustedPrice,o.ItemDescription,o.ThumbnailsUrl,o.Weight,o.SKUContent,o.PromotionId,o.PromotionName,o.TaxRate,o.TemplateId,o.storeId,o.SupplierId,o.DeductFee,s.SupplierName FROM Ecshop_OrderAppFormItems as o left JOIN Ecshop_Supplier as s ON o.SupplierId=s.SupplierId where o.AId=@ReplaceId and o.ApplyType=2");

            this.database.AddInParameter(sqlStringCommand, "ReplaceId", DbType.Int32, ReplaceId);
            using (IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                replaceInfo = ReaderConvert.ReaderToModel <ReplaceInfo>(dataReader);
                if (replaceInfo != null)
                {
                    replaceInfo.ReplaceLineItem = new List <OrderAppFormItems>();
                }
                dataReader.NextResult();
                OrderAppFormItems appFormItem = null;
                while (1 == 1)
                {
                    appFormItem = ReaderConvert.ReaderToModel <OrderAppFormItems>(dataReader);
                    if (appFormItem != null && replaceInfo.ReplaceLineItem != null)
                    {
                        replaceInfo.ReplaceLineItem.Add(appFormItem);
                    }
                    if (appFormItem == null)
                    {
                        break;
                    }
                }
            }
            return(replaceInfo);
        }
Beispiel #6
0
        public int AddReplaceInfo(ReplaceInfo replaceInfo, DbTransaction dbTran)
        {
            StringBuilder stringBuilder = new StringBuilder();

            //换货表中没有关于物流相关的字段 ldy
            //stringBuilder.Append(" insert into Ecshop_OrderReplace(OrderId,ApplyForTime,Comments,HandleStatus,LogisticsCompany,LogisticsId) values(@OrderId,@ApplyForTime,@Comments,0,@LogisticsCompany,@LogisticsId);SELECT @@identity ");
            stringBuilder.Append(" insert into Ecshop_OrderReplace(OrderId,ApplyForTime,Comments,HandleStatus) values(@OrderId,@ApplyForTime,@Comments,0);SELECT @@identity");
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand(stringBuilder.ToString());

            this.database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, replaceInfo.OrderId);
            this.database.AddInParameter(sqlStringCommand, "ApplyForTime", DbType.DateTime, DateTime.Now);
            this.database.AddInParameter(sqlStringCommand, "Comments", DbType.String, replaceInfo.Comments);
            //this.database.AddInParameter(sqlStringCommand, "LogisticsCompany", DbType.String, replaceInfo.LogisticsCompany);
            //this.database.AddInParameter(sqlStringCommand, "LogisticsId", DbType.String, replaceInfo.LogisticsId);
            int    returnsId;
            object obj;

            if (dbTran != null)
            {
                obj = this.database.ExecuteScalar(sqlStringCommand, dbTran);
            }
            else
            {
                obj = this.database.ExecuteScalar(sqlStringCommand);
            }
            if (obj != DBNull.Value)
            {
                returnsId = Convert.ToInt32(obj);
            }
            else
            {
                returnsId = 0;
            }
            return(returnsId);
        }
        private void listReplace_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
            {
                return;
            }
            ReplaceInfo   replaceInfo  = (ReplaceInfo)e.Item.DataItem;
            int           replaceId    = replaceInfo.ReplaceId;
            ReplaceStatus handleStatus = replaceInfo.HandleStatus;
            string        orderId      = replaceInfo.OrderId;
            string        skuId        = replaceInfo.SkuId;
            HtmlAnchor    htmlAnchor   = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
            Label         label        = (Label)e.Item.FindControl("Logistics");
            HyperLink     hyperLink    = (HyperLink)e.Item.FindControl("hlinkOrderDetails");

            if (hyperLink != null && (replaceInfo.HandleStatus == ReplaceStatus.MerchantsAgreed || replaceInfo.HandleStatus == ReplaceStatus.UserDelivery || replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery))
            {
                hyperLink.Text = "处理";
                hyperLink.Attributes.CssStyle.Add("color", "red");
            }
            if (handleStatus != ReplaceStatus.Replaced && handleStatus != ReplaceStatus.MerchantsDelivery && handleStatus != ReplaceStatus.UserDelivery)
            {
                return;
            }
            label.Attributes.Add("action", "replace");
            label.Attributes.Add("ReplaceId", replaceId.ToString());
            label.Visible = true;
        }
        private void btnGetAndSendGoods_Click(object sender, EventArgs e)
        {
            int         replaceId   = this.Page.Request["replaceId"].ToInt(0);
            ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(replaceId);

            if (replaceInfo == null)
            {
                this.ShowMsg("错误的换货信息", false);
            }
            else
            {
                string arg = "自己门店";
                if (this.UserStoreId == 0)
                {
                    arg = "平台";
                }
                if (replaceInfo.StoreId != this.UserStoreId)
                {
                    this.ShowMsg(string.Format("只能由发货的店铺或者平台处理", arg), false);
                }
                else
                {
                    string             text  = "";
                    string             text2 = "";
                    ExpressCompanyInfo expressCompanyInfo = ExpressHelper.FindNode(this.expressDropDownList.SelectedValue);
                    if (expressCompanyInfo != null)
                    {
                        text  = expressCompanyInfo.Kuaidi100Code;
                        text2 = expressCompanyInfo.Name;
                        string text3 = this.txtShipOrderNumber.Text;
                        if (string.IsNullOrEmpty(text3) || text3.Length > 20)
                        {
                            this.ShowMsg("请输入运单编号,长度在1-20位之间", false);
                        }
                        else if (TradeHelper.ReplaceShopSendGoods(replaceId, text, text2, text3, replaceInfo.OrderId, replaceInfo.SkuId))
                        {
                            if (text.ToUpper() == "HTKY")
                            {
                                ExpressHelper.GetDataByKuaidi100(text, text3);
                            }
                            OrderInfo  orderInfo = OrderHelper.GetOrderInfo(replaceInfo.OrderId);
                            MemberInfo user      = Users.GetUser(orderInfo.UserId);
                            replaceInfo.HandleStatus = ReplaceStatus.MerchantsDelivery;
                            Messenger.AfterSaleDeal(user, orderInfo, null, replaceInfo);
                            this.ShowMsg("换货发货成功!", true, HttpContext.Current.Request.Url.ToString());
                        }
                        else
                        {
                            this.ShowMsg("换货发货失败,原因未知", false);
                        }
                    }
                    else
                    {
                        this.ShowMsg("请选择快递公司", false);
                    }
                }
            }
        }
Beispiel #9
0
 public void GetReplaceInfo(HttpContext context)
 {
     if (!this.CheckUserRole())
     {
         this.ShowMessage_New(context, "请先登录会员!", true);
     }
     else
     {
         int num = 0;
         if (context.Request["ReplaceId"] != null)
         {
             int.TryParse(context.Request["ReplaceId"], out num);
         }
         string text = "";
         text = context.Request["orderId"];
         string      skuId       = context.Request["skuId"];
         ReplaceInfo replaceInfo = null;
         if (num > 0)
         {
             replaceInfo = TradeHelper.GetReplaceInfo(num);
         }
         if (replaceInfo == null && !string.IsNullOrEmpty(text))
         {
             replaceInfo = TradeHelper.GetReplaceInfo(text, skuId);
         }
         if (replaceInfo == null)
         {
             this.ShowMessage_New(context, "参数不正确", true);
         }
         else
         {
             string s = JsonConvert.SerializeObject(new
             {
                 Result = new
                 {
                     success = "true",
                     Replace = new
                     {
                         replaceInfo.ReplaceId,
                         replaceInfo.OrderId,
                         replaceInfo.SkuId,
                         replaceInfo.ExpressCompanyAbb,
                         replaceInfo.ExpressCompanyName,
                         replaceInfo.AdminCellPhone,
                         replaceInfo.AdminRemark,
                         replaceInfo.AdminShipAddress,
                         replaceInfo.AdminShipTo,
                         replaceInfo.ShipOrderNumber,
                         replaceInfo.UserRemark
                     }
                 }
             });
             context.Response.Write(s);
             context.Response.End();
         }
     }
 }
Beispiel #10
0
        /// <summary>
        /// 领取操作,把处理人改为当前用户,状态改为处理中,领取时间为当前时间
        /// </summary>
        /// <param name="refundInfo"></param>
        /// <returns></returns>
        public bool UpdateOrderReplaceInfo(ReplaceInfo replaceInfo)
        {
            DbCommand sqlStringCommand = this.database.GetSqlStringCommand("update Ecshop_OrderReplace set HandleStatus = @HandleStatus,Operator=@Operator,ReceiveTime=@ReceiveTime where ReplaceId=@ReplaceId and HandleStatus = 0");

            this.database.AddInParameter(sqlStringCommand, "ReplaceId", DbType.Int32, replaceInfo.ReplaceId);
            this.database.AddInParameter(sqlStringCommand, "HandleStatus", DbType.Int32, replaceInfo.HandleStatus);
            this.database.AddInParameter(sqlStringCommand, "Operator", DbType.String, replaceInfo.Operator);
            this.database.AddInParameter(sqlStringCommand, "ReceiveTime", DbType.DateTime, replaceInfo.ReceiveTime);
            return(this.database.ExecuteNonQuery(sqlStringCommand) > 0);
        }
Beispiel #11
0
        public bool CreateReturn(ReplaceInfo replaceInfo)//创建退换单
        {
            bool result;

            if (replaceInfo == null)
            {
                result = false;
            }
            else
            {
                Database database = DatabaseFactory.CreateDatabase();
                using (System.Data.Common.DbConnection dbConnection = database.CreateConnection())
                {
                    dbConnection.Open();
                    System.Data.Common.DbTransaction dbTransaction = dbConnection.BeginTransaction();
                    try
                    {
                        if (!UpdateOrderStatusBeApplyForReplacement(replaceInfo.OrderId, dbTransaction))
                        {
                            dbTransaction.Rollback();
                            result = false;
                            return(result);
                        }
                        replaceInfo.ReplaceId = AddReplaceInfo(replaceInfo, dbTransaction);
                        if (replaceInfo.ReplaceId <= 0)
                        {
                            dbTransaction.Rollback();
                            result = false;
                            return(result);
                        }
                        if (replaceInfo.ReplaceLineItem.Count > 0)
                        {
                            if (!AddReplaceItem(replaceInfo, dbTransaction))
                            {
                                dbTransaction.Rollback();
                                result = false;
                                return(result);
                            }
                        }
                        dbTransaction.Commit();
                        result = true;
                    }
                    catch
                    {
                        dbTransaction.Rollback();
                        result = false;
                    }
                    finally
                    {
                        dbConnection.Close();
                    }
                }
            }
            return(result);
        }
        private void JudgeOrderStatus(OrderInfo order)
        {
            this.lkbtnConfirmOrder.Visible = (order.OrderStatus == OrderStatus.SellerAlreadySent && order.ItemStatus == OrderItemStatus.Nomarl);
            if (order.PreSaleId > 0)
            {
                if (order.OrderStatus == OrderStatus.WaitBuyerPay && order.ItemStatus == OrderItemStatus.Nomarl && !order.DepositDate.HasValue)
                {
                    this.lkbtnCloseOrder.Visible = true;
                }
                else
                {
                    this.lkbtnCloseOrder.Visible = false;
                }
            }
            else
            {
                this.lkbtnCloseOrder.Visible = (order.OrderStatus == OrderStatus.WaitBuyerPay && order.ItemStatus == OrderItemStatus.Nomarl);
            }
            RefundInfo   refundInfo     = TradeHelper.GetRefundInfo(order.OrderId);
            ReturnInfo   returnInfo     = TradeHelper.GetReturnInfo(order.OrderId, "");
            ReplaceInfo  replaceInfo    = TradeHelper.GetReplaceInfo(order.OrderId, "");
            DateTime     finishDate     = order.FinishDate;
            OrderStatus  orderStatus    = order.OrderStatus;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings();
            HtmlAnchor   htmlAnchor     = this.lkbtnApplyForRefund;
            int          visible;

            if (order.GetTotal(false) > decimal.Zero && !TradeHelper.OrderHasRefundOrReturning(order))
            {
                if ((refundInfo == null || refundInfo.HandleStatus == RefundStatus.Refused) && returnInfo == null && replaceInfo == null)
                {
                    visible = ((order.OrderStatus == OrderStatus.BuyerAlreadyPaid && order.ItemStatus == OrderItemStatus.Nomarl) ? 1 : 0);
                    goto IL_0136;
                }
                visible = 0;
            }
            else
            {
                visible = 0;
            }
            goto IL_0136;
IL_0136:
            htmlAnchor.Visible = ((byte)visible != 0);
            this.lkbtnApplyForRefund.Attributes.Add("orderId", this.orderId);
            if (!masterSettings.OpenMultStore && masterSettings.IsOpenPickeupInStore && order.SupplierId == 0 && order.ShippingModeId == -2)
            {
                this.litGetGoodsRemark.Text = masterSettings.PickeupInStoreRemark;
            }
            else
            {
                this.divPickUpRemark.Visible = false;
            }
        }
Beispiel #13
0
        public bool AddReplaceItem(ReplaceInfo replaceInfo, DbTransaction dbTran)
        {
            bool result;

            if (replaceInfo.ReplaceId == 0)
            {
                result = false;
                return(result);
            }
            if (replaceInfo.ReplaceLineItem == null || replaceInfo.ReplaceLineItem.Count == 0)
            {
                result = false;
            }
            else
            {
                DbCommand     sqlStringCommand = this.database.GetSqlStringCommand(" ");
                StringBuilder stringBuilder    = new StringBuilder();
                int           num = 0;
                foreach (OrderAppFormItems lineItem in replaceInfo.ReplaceLineItem)
                {
                    stringBuilder.Append(" INSERT INTO Ecshop_OrderAppFormItems ([AId],[SkuId],[ProductId],[Quantity],[ItemAdjustedPrice],[ItemDescription],[ThumbnailsUrl],[Weight],[SKUContent],[PromotionId],[PromotionName],[TaxRate],[TemplateId],[storeId],[SupplierId],[ApplyType])  VALUES(").Append("@AId").Append(num).Append(",@SkuId").Append(num).Append(", @ProductId").Append(num).Append(", @Quantity").Append(num).Append(", @ItemAdjustedPrice").Append(num).Append(", @ItemDescription").Append(num).Append(",@ThumbnailsUrl").Append(num).Append(",@Weight").Append(num).Append(", @SKUContent").Append(num).Append(",@PromotionId").Append(num).Append(", @PromotionName").Append(num).Append(",@TaxRate").Append(num).Append(", @TemplateId").Append(num).Append(", @storeId").Append(num).Append(", @SupplierId").Append(num).Append(", @ApplyType").Append(num).Append(")");
                    this.database.AddInParameter(sqlStringCommand, "AId" + num, DbType.Int32, replaceInfo.ReplaceId);
                    this.database.AddInParameter(sqlStringCommand, "SkuId" + num, DbType.String, lineItem.SkuId);
                    this.database.AddInParameter(sqlStringCommand, "ProductId" + num, DbType.Int32, lineItem.ProductId);
                    this.database.AddInParameter(sqlStringCommand, "Quantity" + num, DbType.Int32, lineItem.Quantity);
                    this.database.AddInParameter(sqlStringCommand, "ItemAdjustedPrice" + num, DbType.String, lineItem.ItemAdjustedPrice);
                    this.database.AddInParameter(sqlStringCommand, "ItemDescription" + num, DbType.String, lineItem.ItemDescription);
                    this.database.AddInParameter(sqlStringCommand, "ThumbnailsUrl" + num, DbType.String, lineItem.ThumbnailsUrl);
                    this.database.AddInParameter(sqlStringCommand, "Weight" + num, DbType.Decimal, lineItem.ItemWeight);
                    this.database.AddInParameter(sqlStringCommand, "SKUContent" + num, DbType.String, lineItem.SKUContent);
                    this.database.AddInParameter(sqlStringCommand, "PromotionId" + num, DbType.Int32, lineItem.PromotionId);
                    this.database.AddInParameter(sqlStringCommand, "PromotionName" + num, DbType.String, lineItem.PromotionName);
                    this.database.AddInParameter(sqlStringCommand, "TaxRate" + num, DbType.Decimal, lineItem.TaxRate);
                    this.database.AddInParameter(sqlStringCommand, "TemplateId" + num, DbType.Int32, lineItem.TemplateId);
                    this.database.AddInParameter(sqlStringCommand, "storeId" + num, DbType.Int32, lineItem.storeId);
                    this.database.AddInParameter(sqlStringCommand, "SupplierId" + num, DbType.Int32, lineItem.SupplierId);
                    this.database.AddInParameter(sqlStringCommand, "ApplyType" + num, DbType.Int32, lineItem.ApplyType);
                    num++;
                }
                sqlStringCommand.CommandText = stringBuilder.ToString();
                if (dbTran != null)
                {
                    result = this.database.ExecuteNonQuery(sqlStringCommand, dbTran) > 0;
                }
                else
                {
                    result = this.database.ExecuteNonQuery(sqlStringCommand) > 0;
                }
            }
            return(result);
        }
Beispiel #14
0
        private void btnAcceptReplace_Click(object sender, EventArgs e)
        {
            string      text           = Globals.StripAllTags(this.txtAdminRemark.Text);
            string      text2          = Globals.StripAllTags(this.txtAdminShipAddress.Text);
            string      adminShipTo    = Globals.StripAllTags(this.txtAdminShipTo.Text);
            string      adminCellPhone = Globals.StripAllTags(this.txtAdminCellPhone.Text);
            int         replaceId      = this.Page.Request["replaceId"].ToInt(0);
            ReplaceInfo replaceInfo    = TradeHelper.GetReplaceInfo(replaceId);

            if (replaceInfo == null)
            {
                this.ShowMsg("换货信息错误!", false);
            }
            else if (this.UserStoreId != replaceInfo.StoreId && replaceInfo.StoreId >= 0)
            {
                this.ShowMsg("换货只能由发货的店铺或者平台进行处理!", false);
            }
            else
            {
                OrderInfo orderInfo = TradeHelper.GetOrderInfo(replaceInfo.OrderId);
                if (orderInfo == null)
                {
                    this.ShowMsg("绑定的订单信息不存在!", false);
                }
                else if (replaceInfo.HandleStatus != 0)
                {
                    this.ShowMsg("错误的售后状态", false);
                }
                else
                {
                    if (string.IsNullOrEmpty(text))
                    {
                        text = replaceInfo.AdminRemark;
                    }
                    if (string.IsNullOrEmpty(text2))
                    {
                        this.ShowMsg("请输入平台收货地址,告之用户发货的地址和联系方式", false);
                    }
                    else if (OrderHelper.AgreedReplace(replaceInfo.ReplaceId, replaceInfo.OrderId, replaceInfo.SkuId, text, text2, adminShipTo, adminCellPhone, false))
                    {
                        this.ShowMsg("成功的确认了订单换货", true, HttpContext.Current.Request.Url.ToString());
                    }
                    else
                    {
                        this.ShowMsg("订单或者订单项状态错误!", false);
                    }
                }
            }
        }
Beispiel #15
0
		public ReplaceControl(ReplaceInfo replaceInfo, Configurator configurator, Dispatcher dispatcher)
		{
			Configurator = configurator;
			Dispatcher = dispatcher;

			InitializeComponent();

			replaceInfo = replaceInfo ?? new ReplaceInfo();

			PatternComboBox.Text = replaceInfo.Pattern;
			ReplacementComboBox.Text = replaceInfo.Replacement;
			CaseSensitiveCheckBox.Checked = replaceInfo.CaseSensitive;
			WholeWordCheckbox.Checked = replaceInfo.WholeWord;
			RegexCheckBox.Checked = replaceInfo.UseRegex;
		}
 private void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         LineItemInfo lineItemInfo = e.Item.DataItem as LineItemInfo;
         HtmlAnchor   htmlAnchor   = e.Item.FindControl("hylinkProductName") as HtmlAnchor;
         Literal      literal      = e.Item.FindControl("ltlSKUContent") as Literal;
         Literal      literal2     = e.Item.FindControl("ltlPrice") as Literal;
         Literal      literal3     = e.Item.FindControl("ltlProductCount") as Literal;
         HtmlAnchor   htmlAnchor2  = e.Item.FindControl("hyDetailLink") as HtmlAnchor;
         Label        label        = e.Item.FindControl("litSendCount") as Label;
         string       hRef         = lineItemInfo.IsValid ? ("ServiceMemberOrderDetails.aspx?OrderId=" + lineItemInfo.OrderId.ToNullString()) : ("MemberOrderDetails.aspx?OrderId=" + lineItemInfo.OrderId.ToNullString());
         htmlAnchor.InnerText = lineItemInfo.ItemDescription.ToNullString();
         htmlAnchor.HRef      = hRef;
         literal.Text         = lineItemInfo.SKUContent.ToNullString();
         literal2.Text        = lineItemInfo.ItemAdjustedPrice.ToDecimal(0).F2ToString("f2");
         literal3.Text        = lineItemInfo.Quantity.ToNullString();
         if (lineItemInfo.ShipmentQuantity > lineItemInfo.Quantity)
         {
             label.Text = "赠" + (lineItemInfo.ShipmentQuantity - lineItemInfo.Quantity).ToString();
         }
         htmlAnchor2.HRef = hRef;
         Literal literal4 = (Literal)e.Item.FindControl("litStatus");
         if (literal4 != null)
         {
             LineItemStatus status      = lineItemInfo.Status;
             string         text        = "";
             ReturnInfo     returnInfo  = TradeHelper.GetReturnInfo(lineItemInfo.OrderId, lineItemInfo.SkuId);
             ReplaceInfo    replaceInfo = TradeHelper.GetReplaceInfo(lineItemInfo.OrderId, lineItemInfo.SkuId);
             if (status == LineItemStatus.Normal)
             {
                 text = "";
             }
             else if (returnInfo != null)
             {
                 if (returnInfo.HandleStatus != ReturnStatus.Refused)
                 {
                     text = ((returnInfo.AfterSaleType != AfterSaleTypes.OnlyRefund) ? EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 1) : EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 3));
                 }
             }
             else if (replaceInfo != null && replaceInfo.HandleStatus != ReplaceStatus.Refused)
             {
                 text = EnumDescription.GetEnumDescription((Enum)(object)replaceInfo.HandleStatus, 1);
             }
             literal4.Text = text;
         }
     }
 }
Beispiel #17
0
        public bool ApplyForReplace(ReplaceInfo replace)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("UPDATE Hishop_OrderItems SET Status = @ItemStatus WHERE OrderId = @OrderId AND SkuId = @SkuId;");
            stringBuilder.Append("DELETE FROM Hishop_OrderReplace WHERE OrderId = @OrderId AND SkuId = @SkuId;");
            DbCommand sqlStringCommand = base.database.GetSqlStringCommand(stringBuilder.ToString());

            base.database.AddInParameter(sqlStringCommand, "OrderId", DbType.String, replace.OrderId);
            base.database.AddInParameter(sqlStringCommand, "ItemStatus", DbType.Int32, 30);
            base.database.AddInParameter(sqlStringCommand, "SkuId", DbType.String, replace.SkuId);
            if (base.database.ExecuteNonQuery(sqlStringCommand) > 0)
            {
                return(this.Add(replace, null) > 0);
            }
            return(false);
        }
Beispiel #18
0
        /// <summary>
        /// 换货单领取操作
        /// </summary>
        /// <param name="context"></param>
        public void OrderReplaceReceive(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";

            string        ReplaceId     = context.Request["ReplaceId"];
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("{");

            if (string.IsNullOrEmpty(ReplaceId))
            {
                stringBuilder.Append("\"Status\":\"-1\"");
                stringBuilder.Append("}");
                context.Response.Write(stringBuilder.ToString());
                return;
            }
            IUser user = HiContext.Current.User as SiteManager;

            ReplaceInfo replaceInfo = new ReplaceInfo();

            replaceInfo.ReplaceId    = int.Parse(ReplaceId);
            replaceInfo.ReceiveTime  = DateTime.Now;
            replaceInfo.HandleStatus = 3;//处理中
            if (user != null)
            {
                replaceInfo.Operator = user.Username;
            }


            bool flag = TradeHelper.UpdateOrderReplaceInfo(replaceInfo);

            if (flag)
            {
                stringBuilder.Append("\"Status\":\"OK\"");
                stringBuilder.Append("}");
            }
            else
            {
                stringBuilder.Append("\"Status\":\"-1\"");
                stringBuilder.Append("}");
            }

            context.Response.Write(stringBuilder.ToString());
        }
Beispiel #19
0
        private List <ReplaceInfo> GetReplaceInfo()
        {
            List <ReplaceInfo> replaceInfos = new List <ReplaceInfo>();

            for (int i = 0; i < this.dataGrid.RowCount; i++)
            {
                string oldStr = this.dataGrid.Rows[i].Cells[0].FormattedValue.ToString();
                string newStr = this.dataGrid.Rows[i].Cells[1].FormattedValue.ToString();
                bool   ifReg  = (bool)this.dataGrid.Rows[i].Cells[2].FormattedValue;

                if (oldStr != newStr)
                {
                    ReplaceInfo info = new ReplaceInfo(oldStr, newStr, ifReg);
                    replaceInfos.Add(info);
                }
            }

            return(replaceInfos);
        }
Beispiel #20
0
        private void FinishReplace()
        {
            int num = 0;

            if (HttpContext.Current.Request.QueryString["replaceId"] != null)
            {
                int.TryParse(HttpContext.Current.Request.QueryString["replaceId"], out num);
            }
            ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(num);

            if (replaceInfo == null)
            {
                this.ShowMessage("错误的换货信息", false, "", 1);
            }
            else
            {
                OrderInfo orderInfo = TradeHelper.GetOrderInfo(replaceInfo.OrderId);
                if (orderInfo == null)
                {
                    this.ShowMessage("错误的订单信息", false, "", 1);
                }
                else if (orderInfo.LineItems.ContainsKey(replaceInfo.SkuId))
                {
                    if (orderInfo.LineItems[replaceInfo.SkuId].Status != LineItemStatus.MerchantsDeliveryForRepalce)
                    {
                        this.ShowMessage("商品换货状态不正确", false, "", 1);
                    }
                    else if (TradeHelper.FinishReplace(replaceInfo.ReplaceId, replaceInfo.AdminRemark, replaceInfo.OrderId, replaceInfo.SkuId))
                    {
                        this.ShowMessage("确认收货完成换货成功", true, this.returnUrl, 2);
                    }
                    else
                    {
                        this.ShowMessage("确认收货完成换货失败", false, "", 1);
                    }
                }
                else
                {
                    this.ShowMessage("订单中不包含商品信息", false, "", 1);
                }
            }
        }
Beispiel #21
0
        public DateTime?GetHandleTime(ReplaceInfo model)
        {
            DateTime?result = null;

            switch (model.HandleStatus)
            {
            case ReplaceStatus.MerchantsAgreed:
                return(model.AgreedOrRefusedTime);

            case ReplaceStatus.UserDelivery:
                return(model.UserSendGoodsTime);

            case ReplaceStatus.MerchantsDelivery:
                return(model.MerchantsConfirmGoodsTime);

            case ReplaceStatus.Replaced:
                return(model.UserConfirmGoodsTime);

            default:
                return(result);
            }
        }
Beispiel #22
0
        private void btnRefuseReplace_Click(object sender, EventArgs e)
        {
            int         replaceId   = this.Page.Request["replaceId"].ToInt(0);
            ReplaceInfo replaceInfo = TradeHelper.GetReplaceInfo(replaceId);

            if (replaceInfo == null)
            {
                this.ShowMsg("换货信息错误!", false);
            }
            else
            {
                string text = Globals.StripAllTags(this.txtAdminRemark.Text);
                if (string.IsNullOrEmpty(text))
                {
                    this.ShowMsg("请填写换货拒绝原因。", false);
                }
                else
                {
                    OrderHelper.CheckReplace(replaceInfo.OrderId, text, false, replaceInfo.SkuId, "", "", "", false);
                    this.ShowMsg("成功的拒绝了订单换货", true, HttpContext.Current.Request.Url.ToString());
                }
            }
        }
Beispiel #23
0
        /// <summary>
        /// Gets the template and replaces the string
        /// </summary>
        /// <param name="beginDelimitator">The delimiter that begins the replacement string in the template. Defaults to "{".</param>
        /// <param name="endDelimitator">The delimiter that ends the replacement string in the template. Defaults to "}".</param>
        /// <returns></returns>
        public string GetTemplate(string beginDelimitator, string endDeliminator)
        {
            StringBuilder sb = new StringBuilder(TemplateContent);

            foreach (string key in _replaceValues.Keys)
            {
                sb.Replace(beginDelimitator + key + endDeliminator, _replaceValues[key]);
            }
            foreach (string key in _replaceInfoValues.Keys)
            {
                ReplaceInfo repl = _replaceInfoValues[key];
                if (repl.OutputFunction != null)
                {
                    StringBuilder sb2 = new StringBuilder();
                    for (int i = 0; i < repl.Values.Length; i++)
                    {
                        sb2.Append(repl.OutputFunction(key, repl.Values[i], i));
                    }
                    sb.Replace(beginDelimitator + key + endDeliminator, sb2.ToString());
                }
            }
            return(sb.ToString());
        }
 private void BindRefunds(ReplaceInfo replaceInfo)
 {
     this.RefundDetails.DataSource = replaceInfo.ReplaceLineItem;
     this.RefundDetails.DataBind();
 }
Beispiel #25
0
        private DataGridViewModel <Dictionary <string, object> > GetDataList(OrderQuery query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();

            if (query != null)
            {
                DbQueryResult orders = OrderHelper.GetOrders(query);
                dataGridViewModel.rows  = DataHelper.DataTableToDictionary(orders.Data);
                dataGridViewModel.total = orders.TotalRecords;
                string[] orderIds = (from d in dataGridViewModel.rows
                                     select d["OrderId"].ToString()).ToArray();
                List <RefundInfo> refundInfos = TradeHelper.GetRefundInfos(orderIds);
                foreach (Dictionary <string, object> row in dataGridViewModel.rows)
                {
                    OrderInfo order = TradeHelper.GetOrderInfo(row["OrderId"].ToString());
                    row.Add("OrderStatusText", OrderHelper.GetOrderStatusText(order.OrderStatus, order.ShippingModeId, order.IsConfirm, order.Gateway, 0, order.PreSaleId, order.DepositDate, false, order.ItemStatus, OrderType.NormalOrder));
                    row.Add("CanConfirmOrder", order.CanConfirmOrder());
                    row.Add("canCheckTake", order.CanConfirmTakeCode());
                    row.Add("canCloseOrder", this.CanClose(order, base.CurrentSiteSetting.OpenMultStore));
                    row.Add("canOfflineReceipt", OrderHelper.CanConfirmOfflineReceipt(order, false));
                    row.Add("CanEditPrice", this.CanEditPrice(order));
                    row.Add("InvoiceTypeText", string.IsNullOrEmpty(order.InvoiceTitle) ? "" : EnumDescription.GetEnumDescription((Enum)(object)order.InvoiceType, 0));
                    bool flag = order.CanSendGoods(base.CurrentSiteSetting.OpenMultStore);
                    if (base.CurrentSiteSetting.OpenMultStore && order.StoreId != 0)
                    {
                        flag = false;
                    }
                    row.Add("canSendGoods", flag);
                    row.Add("canFinishTrade", order.OrderStatus == OrderStatus.SellerAlreadySent && order.ItemStatus == OrderItemStatus.Nomarl);
                    bool flag2 = false;
                    if (base.CurrentSiteSetting.OpenMultStore && order.CountDownBuyId == 0 && order.BundlingId == 0 && order.ItemStatus == OrderItemStatus.Nomarl && (order.OrderStatus == OrderStatus.BuyerAlreadyPaid || (order.OrderStatus == OrderStatus.WaitBuyerPay && order.Gateway == "hishop.plugins.payment.podrequest")))
                    {
                        if (order.StoreId == -1)
                        {
                            flag2 = (order.LineItems.Count > 0);
                        }
                        else if (order.StoreId > 0)
                        {
                            flag2 = !order.IsConfirm;
                        }
                        else if (order.StoreId == 0)
                        {
                            flag2 = (order.ShippingModeId != -2 && order.LineItems.Count > 0);
                        }
                    }
                    row.Add("CanAllotStore", flag2);
                    RefundInfo refundInfo = refundInfos.FirstOrDefault((RefundInfo d) => d.OrderId == order.OrderId);
                    if (refundInfo != null)
                    {
                        row.Add("IsCheckRefund", order.OrderStatus == OrderStatus.ApplyForRefund && !order.IsStoreCollect);
                        row.Add("RefundId", refundInfo.RefundId);
                    }
                    bool   flag3  = false;
                    string value  = string.Empty;
                    string value2 = string.Empty;
                    if (order.ItemStatus != 0 || order.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        if (refundInfo != null && order.OrderStatus == OrderStatus.ApplyForRefund)
                        {
                            flag3  = true;
                            value2 = "订单已申请退款";
                            value  = "/Admin/sales/RefundApplyDetail?RefundId=" + refundInfo.RefundId;
                        }
                        else
                        {
                            int            num            = 0;
                            AfterSaleTypes afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                            int            num2           = 0;
                            foreach (LineItemInfo value4 in order.LineItems.Values)
                            {
                                if (value4.ReturnInfo != null || value4.ReplaceInfo != null)
                                {
                                    ReturnInfo  returnInfo  = value4.ReturnInfo;
                                    ReplaceInfo replaceInfo = value4.ReplaceInfo;
                                    if (num == 0 || (returnInfo != null && returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) || (replaceInfo != null && (replaceInfo.HandleStatus != ReplaceStatus.Refused || replaceInfo.HandleStatus != ReplaceStatus.Replaced)))
                                    {
                                        if (value4.ReturnInfo != null)
                                        {
                                            afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                                            num2           = value4.ReturnInfo.ReturnId;
                                        }
                                        else
                                        {
                                            afterSaleTypes = AfterSaleTypes.Replace;
                                            num2           = value4.ReplaceInfo.ReplaceId;
                                        }
                                    }
                                    num++;
                                }
                            }
                            if (order.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                            {
                                value2 = "订单中有商品正在退货/换货中";
                            }
                            else if (order.ReturnedCount > 0)
                            {
                                value2 = "订单中有商品已退货完成";
                            }
                            else if (order.ItemStatus == OrderItemStatus.HasReplace)
                            {
                                value2 = "订单中有商品正在进行换货操作";
                            }
                            else if (order.ItemStatus == OrderItemStatus.HasReturn)
                            {
                                value2 = "订单中有商品正在进行退货操作";
                            }
                            if (num > 0)
                            {
                                flag3 = true;
                                value = ((afterSaleTypes != AfterSaleTypes.ReturnAndRefund) ? ("ReplaceApplyDetail?ReplaceId=" + num2) : ("ReturnApplyDetail?ReturnId=" + num2));
                            }
                        }
                    }
                    row.Add("IsShowRefundIcon", flag3);
                    row.Add("RefundOperUrl", value);
                    row.Add("RefundTips", value2);
                    bool flag4 = false;
                    if (order.FightGroupId > 0)
                    {
                        FightGroupInfo fightGroup = VShopHelper.GetFightGroup(order.FightGroupId);
                        if (fightGroup != null)
                        {
                            row.Add("FightGroupActivityId", fightGroup.FightGroupActivityId);
                            if (fightGroup.Status == FightGroupStatus.FightGroupIn && order.OrderStatus != OrderStatus.WaitBuyerPay && order.OrderStatus != OrderStatus.Closed)
                            {
                                flag4 = true;
                            }
                        }
                    }
                    row.Add("FightGrouping", flag4);
                    if (order.StoreId > 0)
                    {
                        row.Add("StoreName", this.GetStoreName(order.StoreId));
                    }
                    if (order.LineItems.Count <= 0)
                    {
                        if (order.UserAwardRecordsId > 0)
                        {
                            row.Add("IsAwardOrder", true);
                        }
                        else
                        {
                            row.Add("IsGiftOrder", true);
                        }
                    }
                    if (order.PreSaleId > 0 && order.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                    {
                        ProductPreSaleInfo productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(order.PreSaleId);
                        if (productPreSaleInfo != null)
                        {
                            string   value3 = "";
                            DateTime dateTime;
                            if (productPreSaleInfo.DeliveryDate.HasValue)
                            {
                                dateTime = productPreSaleInfo.DeliveryDate.Value;
                                value3   = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                            }
                            else
                            {
                                DateTime payDate = order.PayDate;
                                if (order.PayDate != DateTime.MinValue)
                                {
                                    dateTime = order.PayDate;
                                    dateTime = dateTime.AddDays((double)productPreSaleInfo.DeliveryDays);
                                    value3   = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                                }
                            }
                            row.Add("SendGoodsTips", value3);
                        }
                    }
                }
            }
            return(dataGridViewModel);
        }
Beispiel #26
0
        private void dlstOrders_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                string       a = "";
                if (!(DataBinder.Eval(e.Item.DataItem, "Gateway") is DBNull))
                {
                    a = (string)DataBinder.Eval(e.Item.DataItem, "Gateway");
                }
                string          text             = DataBinder.Eval(e.Item.DataItem, "OrderId").ToString();
                OrderInfo       orderInfo        = TradeHelper.GetOrderInfo(text);
                OrderStatus     orderStatus      = (OrderStatus)DataBinder.Eval(e.Item.DataItem, "OrderStatus");
                int             num              = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
                ImageLinkButton imageLinkButton  = (ImageLinkButton)e.Item.FindControl("lkbtnPayOrder");
                Literal         literal          = (Literal)e.Item.FindControl("litCloseOrder");
                HyperLink       hyperLink        = (HyperLink)e.Item.FindControl("lkbtnEditPrice");
                int             num2             = (int)((DataBinder.Eval(e.Item.DataItem, "GroupBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "GroupBuyId"));
                int             num3             = (int)((DataBinder.Eval(e.Item.DataItem, "CountDownBuyId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "CountDownBuyId"));
                int             num4             = (int)((DataBinder.Eval(e.Item.DataItem, "BundlingId") is DBNull) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "BundlingId"));
                int             num5             = DataBinder.Eval(e.Item.DataItem, "ShippingModeId").ToInt(0);
                ImageLinkButton imageLinkButton2 = (ImageLinkButton)e.Item.FindControl("lkbtnConfirmOrder");
                Literal         literal2         = (Literal)e.Item.FindControl("litDivideStore");
                Literal         literal3         = (Literal)e.Item.FindControl("isGiftOrder");
                LinkButton      linkButton       = (LinkButton)e.Item.FindControl("lbtnFightGroup");
                Image           image            = (Image)e.Item.FindControl("imgError");
                HtmlAnchor      htmlAnchor       = (HtmlAnchor)e.Item.FindControl("lkbtnCheckRefund");
                HtmlInputHidden htmlInputHidden  = (HtmlInputHidden)e.Item.FindControl("hidFightGroup");
                HtmlAnchor      htmlAnchor2      = (HtmlAnchor)e.Item.FindControl("aftersaleImg");
                image.Visible = orderInfo.IsError;
                if (orderInfo.IsError)
                {
                    image.Attributes.Add("title", orderInfo.ErrorMessage);
                    image.ImageUrl = "\\Admin\\images\\orderError.png";
                }
                ProductPreSaleInfo productPreSaleInfo = null;
                if (orderInfo.PreSaleId > 0)
                {
                    Literal            literal4           = (Literal)e.Item.FindControl("litPreSale");
                    Literal            literal5           = (Literal)e.Item.FindControl("litSendGoods");
                    FormatedMoneyLabel formatedMoneyLabel = (FormatedMoneyLabel)e.Item.FindControl("lblOrderTotals");
                    e.Item.FindControl("lblAmount").Visible = true;
                    productPreSaleInfo = ProductPreSaleHelper.GetProductPreSaleInfo(orderInfo.PreSaleId);
                    literal4.Text      = "<font>定金:" + orderInfo.Deposit.F2ToString("f2") + "</font>";
                    Literal literal6 = literal4;
                    literal6.Text            = literal6.Text + "<font>尾款:" + orderInfo.FinalPayment.F2ToString("f2") + "</font>";
                    literal4.Visible         = true;
                    formatedMoneyLabel.Money = orderInfo.Deposit + orderInfo.FinalPayment;
                    formatedMoneyLabel.Text  = (orderInfo.Deposit + orderInfo.FinalPayment).ToString();
                    if (orderInfo.OrderStatus == OrderStatus.BuyerAlreadyPaid)
                    {
                        literal5.Visible = true;
                        DateTime dateTime;
                        if (productPreSaleInfo.DeliveryDate.HasValue)
                        {
                            Literal literal7 = literal5;
                            dateTime      = productPreSaleInfo.DeliveryDate.Value;
                            literal7.Text = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                        }
                        else
                        {
                            DateTime payDate = orderInfo.PayDate;
                            if (orderInfo.PayDate != DateTime.MinValue)
                            {
                                Literal literal8 = literal5;
                                dateTime      = orderInfo.PayDate;
                                dateTime      = dateTime.AddDays((double)productPreSaleInfo.DeliveryDays);
                                literal8.Text = "<span>预计发货时间:" + dateTime.ToString("yyyy-MM-dd") + "</span>";
                            }
                        }
                    }
                }
                RefundInfo refundInfo = TradeHelper.GetRefundInfo(orderInfo.OrderId);
                if (orderInfo.ItemStatus != 0 || orderInfo.OrderStatus == OrderStatus.ApplyForRefund)
                {
                    if (orderInfo.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        if (refundInfo != null)
                        {
                            htmlAnchor2.Visible = true;
                            htmlAnchor2.Title   = "订单已申请退款";
                            htmlAnchor2.HRef    = "/Admin/sales/RefundApplyDetail?RefundId=" + refundInfo.RefundId;
                        }
                    }
                    else
                    {
                        int            num6           = 0;
                        AfterSaleTypes afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                        int            num7           = 0;
                        foreach (LineItemInfo value in orderInfo.LineItems.Values)
                        {
                            if (value.ReturnInfo != null || value.ReplaceInfo != null)
                            {
                                ReturnInfo  returnInfo  = value.ReturnInfo;
                                ReplaceInfo replaceInfo = value.ReplaceInfo;
                                if (num6 == 0 || (returnInfo != null && returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) || (replaceInfo != null && (replaceInfo.HandleStatus != ReplaceStatus.Refused || replaceInfo.HandleStatus != ReplaceStatus.Replaced)))
                                {
                                    if (value.ReturnInfo != null)
                                    {
                                        afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                                        num7           = value.ReturnInfo.ReturnId;
                                    }
                                    else
                                    {
                                        afterSaleTypes = AfterSaleTypes.Replace;
                                        num7           = value.ReplaceInfo.ReplaceId;
                                    }
                                }
                                num6++;
                            }
                        }
                        if (orderInfo.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                        {
                            htmlAnchor2.Title = "订单中有商品正在退货/换货中";
                        }
                        else if (orderInfo.ReturnedCount > 0)
                        {
                            htmlAnchor2.Title = "订单中有商品已退货完成";
                        }
                        else if (orderInfo.ItemStatus == OrderItemStatus.HasReplace)
                        {
                            htmlAnchor2.Title = "订单中有商品正在进行换货操作";
                        }
                        else if (orderInfo.ItemStatus == OrderItemStatus.HasReturn)
                        {
                            htmlAnchor2.Title = "订单中有商品正在进行退货操作";
                        }
                        if (num6 > 0)
                        {
                            htmlAnchor2.Visible = true;
                            if (afterSaleTypes == AfterSaleTypes.ReturnAndRefund)
                            {
                                htmlAnchor2.HRef = "ReturnApplyDetail?ReturnId=" + num7;
                            }
                            else
                            {
                                htmlAnchor2.HRef = "ReplaceApplyDetail?ReplaceId=" + num7;
                            }
                        }
                    }
                }
                if (orderInfo.FightGroupId > 0)
                {
                    FightGroupInfo fightGroup = VShopHelper.GetFightGroup(orderInfo.FightGroupId);
                    if (fightGroup != null)
                    {
                        linkButton.PostBackUrl = "/Admin/promotion/FightGroupDetails.aspx?fightGroupActivityId=" + fightGroup.FightGroupActivityId;
                        if (fightGroup.Status == FightGroupStatus.FightGroupIn && orderInfo.OrderStatus != OrderStatus.WaitBuyerPay && orderInfo.OrderStatus != OrderStatus.Closed)
                        {
                            htmlInputHidden.Value = "1";
                        }
                        else
                        {
                            htmlInputHidden.Value = "0";
                        }
                    }
                }
                else
                {
                    linkButton.Visible = false;
                }
                OrderStatusLabel orderStatusLabel = (OrderStatusLabel)e.Item.FindControl("lblOrderStatus");
                if (orderStatusLabel != null)
                {
                    orderStatusLabel.OrderItemStatus = orderInfo.ItemStatus;
                    if (orderInfo.PreSaleId > 0)
                    {
                        orderStatusLabel.PreSaleId   = orderInfo.PreSaleId;
                        orderStatusLabel.DepositDate = orderInfo.DepositDate;
                    }
                }
                HtmlAnchor htmlAnchor3 = (HtmlAnchor)e.Item.FindControl("lkbtnToDetail");
                int        num8        = (int)((DataBinder.Eval(e.Item.DataItem, "StoreId") == DBNull.Value) ? ((object)0) : DataBinder.Eval(e.Item.DataItem, "StoreId"));
                bool       flag        = (bool)((DataBinder.Eval(e.Item.DataItem, "IsStoreCollect") == DBNull.Value) ? ((object)false) : DataBinder.Eval(e.Item.DataItem, "IsStoreCollect"));
                bool       flag2       = false;
                if (refundInfo != null)
                {
                    htmlAnchor.HRef = "/Admin/sales/RefundApplyDetail?RefundId=" + refundInfo.RefundId.ToString();
                    flag2           = true;
                }
                if (orderInfo.LineItems.Count <= 0)
                {
                    literal3.Text = "(礼)";
                }
                Literal literal9 = (Literal)e.Item.FindControl("group");
                if (literal9 != null)
                {
                    if (num2 > 0)
                    {
                        literal9.Text = "(团)";
                    }
                    if (num3 > 0)
                    {
                        literal9.Text = "(抢)";
                    }
                    if (orderInfo.PreSaleId > 0)
                    {
                        literal9.Text = "(预)";
                    }
                }
                if (orderStatus == OrderStatus.WaitBuyerPay)
                {
                    if (orderInfo.PreSaleId > 0)
                    {
                        if (!orderInfo.DepositDate.HasValue)
                        {
                            hyperLink.NavigateUrl = "javascript:DialogFrame('/Admin/sales/EditOrder.aspx?OrderId=" + text + "','修改订单价格',null,null,function(e){location.reload();})";
                            hyperLink.Visible     = true;
                            literal.Visible       = true;
                            if (a != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                            {
                                imageLinkButton.Visible = true;
                            }
                        }
                        else if (productPreSaleInfo.PaymentStartDate <= DateTime.Now && productPreSaleInfo.PaymentEndDate >= DateTime.Now && a != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0)
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                    else
                    {
                        hyperLink.NavigateUrl = "javascript:DialogFrame('/Admin/sales/EditOrder.aspx?OrderId=" + text + "','修改订单价格',null,null,function(e){location.reload();})";
                        hyperLink.Visible     = true;
                        if (a != "hishop.plugins.payment.podrequest" && num != -2 && orderInfo.FightGroupId == 0 && (orderInfo.ParentOrderId == "0" || orderInfo.ParentOrderId == "-1"))
                        {
                            imageLinkButton.Visible = true;
                        }
                    }
                }
                if (a == "hishop.plugins.payment.podrequest")
                {
                    int num9;
                    switch (orderStatus)
                    {
                    case OrderStatus.SellerAlreadySent:
                        num9 = ((orderInfo.ParentOrderId == "0" || orderInfo.ParentOrderId == "-1") ? 1 : 0);
                        break;

                    default:
                        num9 = 0;
                        break;

                    case OrderStatus.WaitBuyerPay:
                        num9 = 1;
                        break;
                    }
                    if (num9 != 0)
                    {
                        literal.Visible = true;
                    }
                }
                if (orderStatus == OrderStatus.SellerAlreadySent && orderInfo.StoreId > 0 && masterSettings.OpenMultStore)
                {
                    literal.Visible = false;
                }
                if (orderStatus == OrderStatus.ApplyForRefund && !orderInfo.IsStoreCollect)
                {
                    htmlAnchor.Visible = true;
                }
                imageLinkButton2.Visible = (orderStatus == OrderStatus.SellerAlreadySent && orderInfo.ItemStatus == OrderItemStatus.Nomarl);
                if (masterSettings.OpenMultStore && num == -2 && orderStatus == OrderStatus.WaitBuyerPay)
                {
                    literal.Visible   = !orderInfo.IsConfirm;
                    hyperLink.Visible = true;
                    if (a != "hishop.plugins.payment.podrequest" && orderInfo.PaymentTypeId != -3 && orderInfo.FightGroupId == 0)
                    {
                        imageLinkButton.Visible = true;
                    }
                }
            }
        }
Beispiel #27
0
        private bool __repeat(DefinedPlaceholder beginPlaceholder, DefinedPlaceholder endPlaceholder, ReplaceInfo[] replaceInfos,
		                      string parameters)
        {
            string beginPlaceholderString = Placeholder.ToString(beginPlaceholder);
            string endPlaceholderString = Placeholder.ToString(endPlaceholder);
            string text = _text.ToString();
            int beginIndex = text.IndexOf(beginPlaceholderString);
            int endIndex = text.IndexOf(endPlaceholderString);

            if (parameters != null)
                beginPlaceholderString += "(" + parameters + ")";

            // something to do?
            if (beginIndex == -1 && endIndex == -1)
                return false;

            if (beginIndex != -1 && endIndex == -1)
                throw new CodeGeneratorException(ErrorCode.RepeaterBeginWithoutEnd, beginPlaceholderString);

            if (endIndex != -1 && beginIndex == -1)
                throw new CodeGeneratorException(ErrorCode.RepeaterEndWithoutStart, endPlaceholderString);

            // yes!
            string repeatTemplate = GetRepeatTemplate(text, beginPlaceholderString, endPlaceholderString);
            string repeatResults = string.Empty;

            foreach (ReplaceInfo replaceInfo in replaceInfos)
            {
                if (replaceInfo.replaceInfos == null)
                    continue;

                string includeResult = repeatTemplate;

                for (int i = 0; i < replaceInfo.replaceInfos.Length - 1; i += 2)
                    includeResult = includeResult.Replace(replaceInfo.replaceInfos[i], replaceInfo.replaceInfos[i + 1]);

                repeatResults += includeResult;
            }

            // replace
            text = text.Remove(beginIndex, endIndex-beginIndex+endPlaceholderString.Length);
            text = text.Insert(beginIndex, repeatResults);

            _text = new StringBuilder(text);

            return true;
        }
Beispiel #28
0
 public void Include(DefinedPlaceholder placeholder, ReplaceInfo[] replaceInfos)
 {
     while (__include(placeholder, replaceInfos));
 }
        protected void orderItems_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                LineItemStatus lineItemStatus = (LineItemStatus)DataBinder.Eval(e.Item.DataItem, "Status");
                string         text           = DataBinder.Eval(e.Item.DataItem, "SkuId").ToString();
                OrderStatus    orderStatus    = this.order.OrderStatus;
                DateTime       finishDate     = this.order.FinishDate;
                string         gateway        = this.order.Gateway;
                LineItemInfo   lineItemInfo   = this.order.LineItems[text];
                HtmlAnchor     htmlAnchor     = (HtmlAnchor)e.Item.FindControl("lkbtnAfterSalesApply");
                Label          label          = (Label)e.Item.FindControl("Logistics");
                HtmlAnchor     htmlAnchor2    = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
                htmlAnchor.Attributes.Add("OrderId", this.order.OrderId);
                htmlAnchor.Attributes.Add("SkuId", text);
                htmlAnchor.Attributes.Add("GateWay", gateway);
                ReplaceInfo replaceInfo = lineItemInfo.ReplaceInfo;
                ReturnInfo  returnInfo  = lineItemInfo.ReturnInfo;
                string      text2       = (string)DataBinder.Eval(e.Item.DataItem, "StatusText");
                if (lineItemStatus == LineItemStatus.Normal)
                {
                    text2 = "";
                }
                else if (returnInfo != null)
                {
                    text2 = ((returnInfo.AfterSaleType != AfterSaleTypes.OnlyRefund) ? EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 1) : EnumDescription.GetEnumDescription((Enum)(object)returnInfo.HandleStatus, 3));
                }
                else if (replaceInfo != null)
                {
                    text2 = EnumDescription.GetEnumDescription((Enum)(object)replaceInfo.HandleStatus, 1);
                }
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                HtmlAnchor   htmlAnchor3    = htmlAnchor;
                int          visible;
                switch (orderStatus)
                {
                case OrderStatus.Finished:
                    visible = ((!this.order.IsServiceOver) ? 1 : 0);
                    break;

                default:
                    visible = 0;
                    break;

                case OrderStatus.SellerAlreadySent:
                    visible = 1;
                    break;
                }
                htmlAnchor3.Visible = ((byte)visible != 0);
                if (htmlAnchor.Visible)
                {
                    htmlAnchor.Visible = (this.order.LineItems.Count >= 1 && (returnInfo == null || returnInfo.HandleStatus == ReturnStatus.Refused) && (replaceInfo == null || replaceInfo.HandleStatus == ReplaceStatus.Refused));
                }
                Literal literal = (Literal)e.Item.FindControl("litStatusText");
                if (literal != null && lineItemStatus != 0)
                {
                    if (returnInfo != null && (lineItemStatus == LineItemStatus.DeliveryForReturn || lineItemStatus == LineItemStatus.GetGoodsForReturn || lineItemStatus == LineItemStatus.MerchantsAgreedForReturn || lineItemStatus == LineItemStatus.ReturnApplied || lineItemStatus == LineItemStatus.Returned || lineItemStatus == LineItemStatus.ReturnsRefused))
                    {
                        literal.Text = "<a href=\"/User/UserReturnsApplyDetails?ReturnsId=" + returnInfo.ReturnId + "\">" + text2 + "</a>";
                    }
                    else if (replaceInfo != null)
                    {
                        literal.Text = "<a href=\"/User/UserReplaceApplyDetails?ReplaceId=" + replaceInfo.ReplaceId + "\">" + text2 + "</a>";
                    }
                }
                int num;
                if (replaceInfo != null && (replaceInfo.HandleStatus == ReplaceStatus.Replaced || replaceInfo.HandleStatus == ReplaceStatus.UserDelivery || replaceInfo.HandleStatus == ReplaceStatus.MerchantsDelivery))
                {
                    label.Attributes.Add("action", "replace");
                    AttributeCollection attributes = label.Attributes;
                    num = replaceInfo.ReplaceId;
                    attributes.Add("ReplaceId", num.ToString());
                    label.Visible = true;
                }
                if (returnInfo != null && returnInfo.AfterSaleType == AfterSaleTypes.ReturnAndRefund && (returnInfo.HandleStatus == ReturnStatus.Deliverying || returnInfo.HandleStatus == ReturnStatus.Returned || returnInfo.HandleStatus == ReturnStatus.GetGoods))
                {
                    label.Attributes.Add("action", "return");
                    AttributeCollection attributes2 = label.Attributes;
                    num = returnInfo.ReturnId;
                    attributes2.Add("returnId", num.ToString());
                    label.Visible = true;
                }
            }
        }
        private void UpgradeDB()
        {
            #region 升级
            #region 变量
            List <ReplaceInfo> replaceList  = new List <ReplaceInfo>();
            string             filePath     = string.Empty;
            string             dbConnection = string.Empty;
            string             dbFile       = "DBFile/";
            bool isExist = false;//文件是否存在
            #endregion

            try
            {
                #region 执行过程

                #region 验证数据库连接是否成功
                //验证数据库连接是否成功
                bool isConnection = CheckDBConnection(out dbConnection);
                if (!isConnection)
                {
                    MessageBox.Show("数据库无法连接,请检查数据库配置");
                    return;
                }
                #endregion

                #region 第一步:添加表
                SetRadioButton(first);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddTable.sql";
                isExist  = CheckFileIsExist(filePath, "表脚本不存在");
                if (!isExist)
                {
                    return;
                }
                #region 替换信息
                replaceList = new List <ReplaceInfo>();
                ReplaceInfo replace = new ReplaceInfo();
                replace.OldValue = "iCMSDB";
                replace.NewValue = txtDBName.Text.Trim();
                replaceList.Add(replace);
                #endregion
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第二步:添加字段
                SetRadioButton(second);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddField.sql";
                isExist  = CheckFileIsExist(filePath, "字段脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第三步:添加函数
                SetRadioButton(third);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddFunction.sql";
                isExist  = CheckFileIsExist(filePath, "函数脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第四步:升级数据
                SetRadioButton(fourth);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "Data.sql";
                isExist  = CheckFileIsExist(filePath, "数据脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第五步:添加模块
                SetRadioButton(fifth);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddModule.sql";
                isExist  = CheckFileIsExist(filePath, "模块脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第六步:添加角色
                SetRadioButton(sixth);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddRole.sql";
                isExist  = CheckFileIsExist(filePath, "角色脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第七步:添加视图
                SetRadioButton(seventh);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddView.sql";
                isExist  = CheckFileIsExist(filePath, "视图脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第八步:添加存储过程
                SetRadioButton(eighth);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddProcedure.sql";
                isExist  = CheckFileIsExist(filePath, "存储过程脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第九步:添加触发器
                SetRadioButton(ninth);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddTrigger.sql";
                isExist  = CheckFileIsExist(filePath, "触发器脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第十步:添加角色和模板关联
                SetRadioButton(ten);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddUserRole.sql";
                isExist  = CheckFileIsExist(filePath, "添加角色和模板关联脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第十一步:添加用户和WS关联
                SetRadioButton(eleven);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddUserDeviceWS.sql";
                isExist  = CheckFileIsExist(filePath, "添加用户和WS关联脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第十二步:添加形貌图报警阈值数据
                SetRadioButton(twelve);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddAlarmThreshoud.sql";
                isExist  = CheckFileIsExist(filePath, "添加形貌图报警阈值数据脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第十三步:添加集团和机组
                SetRadioButton(thirteen);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddMonitorTree.sql";
                isExist  = CheckFileIsExist(filePath, "添加集团和机组脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #region 第十四步:添加系统参数数据
                SetRadioButton(fourteen);
                //脚本地址
                filePath = AppDomain.CurrentDomain.BaseDirectory + dbFile + "AddConfig.sql";
                isExist  = CheckFileIsExist(filePath, "添加系统参数数据脚本不存在");
                if (!isExist)
                {
                    return;
                }
                //执行脚本
                SqlFile(dbConnection, filePath, replaceList);
                #endregion

                #endregion

                this.BeginInvoke(new MethodInvoker(delegate()
                {
                    btnSubmit.Enabled = true;
                }));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex);
            }
            finally
            {
                this.BeginInvoke(new MethodInvoker(delegate()
                {
                    btnSubmit.Enabled = true;
                }));
                MessageBox.Show("数据库升级执行完成");
            }
            #endregion
        }
Beispiel #31
0
        private DataGridViewModel <Dictionary <string, object> > GetOrderList(OrderQuery query)
        {
            DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >();
            DbQueryResult orders = OrderHelper.GetOrders(query);

            dataGridViewModel.rows  = DataHelper.DataTableToDictionary(orders.Data);
            dataGridViewModel.total = orders.TotalRecords;
            string[] orderIds = (from d in dataGridViewModel.rows
                                 select d["OrderId"].ToString()).ToArray();
            List <RefundInfo> refundInfos = TradeHelper.GetRefundInfos(orderIds);

            foreach (Dictionary <string, object> row in dataGridViewModel.rows)
            {
                OrderInfo order = TradeHelper.GetOrderInfo(row["OrderId"].ToString());
                row.Add("OrderStatusText", OrderHelper.GetOrderStatusText(order.OrderStatus, order.ShippingModeId, order.IsConfirm, order.Gateway, 0, order.PreSaleId, order.DepositDate, false, order.ItemStatus, OrderType.NormalOrder));
                row.Add("CanConfirmOrder", order.CanConfirmOrder());
                row.Add("canCheckTake", order.CanConfirmTakeCode());
                row.Add("canCloseOrder", order.CanClose(base.CurrentSiteSetting.OpenMultStore, true));
                row.Add("canOfflineReceipt", OrderHelper.CanConfirmOfflineReceipt(order, true));
                row.Add("canSendGoods", order.CanSendGoods(base.CurrentSiteSetting.OpenMultStore));
                row.Add("canFinishTrade", order.OrderStatus == OrderStatus.SellerAlreadySent && order.ItemStatus == OrderItemStatus.Nomarl);
                row.Add("SupplierOrderTotals", order.OrderCostPrice + order.Freight);
                if (order.IsStoreCollect)
                {
                    row.Add("isShowCheckRefund", order.OrderStatus == OrderStatus.ApplyForRefund && order.StoreId == base.CurrentManager.StoreId);
                }
                row.Add("InvoiceTypeText", string.IsNullOrEmpty(order.InvoiceTitle) ? "" : EnumDescription.GetEnumDescription((Enum)(object)order.InvoiceType, 0));
                bool flag = false;
                if (order.FightGroupId > 0)
                {
                    FightGroupInfo fightGroup = VShopHelper.GetFightGroup(order.FightGroupId);
                    if (fightGroup != null)
                    {
                        row.Add("FightGroupActivityId", fightGroup.FightGroupActivityId);
                        if (fightGroup.Status == FightGroupStatus.FightGroupIn && order.OrderStatus != OrderStatus.WaitBuyerPay && order.OrderStatus != OrderStatus.Closed)
                        {
                            flag = true;
                        }
                    }
                }
                row.Add("FightGrouping", flag);
                row.Add("isGiftOrder", order.LineItems.Count <= 0);
                row["IsError"]      = order.IsError;
                row["ErrorMessage"] = order.ErrorMessage;
                RefundInfo refundInfo = refundInfos.FirstOrDefault((RefundInfo d) => d.OrderId == order.OrderId);
                if (refundInfo != null)
                {
                    row.Add("RefundId", refundInfo.RefundId);
                }
                int            num      = 0;
                int            num2     = 0;
                bool           flag2    = false;
                string         value    = "订单中有商品正在进行退货/退款";
                AfterSaleTypes?nullable = null;
                if (order.ItemStatus != 0 || order.OrderStatus == OrderStatus.ApplyForRefund)
                {
                    if (order.OrderStatus == OrderStatus.ApplyForRefund)
                    {
                        RefundInfo refundInfo2 = TradeHelper.GetRefundInfo(order.OrderId);
                        if (refundInfo2 != null)
                        {
                            flag2 = true;
                            value = "订单已申请退款";
                        }
                    }
                    else
                    {
                        int            num3           = 0;
                        AfterSaleTypes afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                        int            num4           = 0;
                        foreach (LineItemInfo value2 in order.LineItems.Values)
                        {
                            if (value2.ReturnInfo != null || value2.ReplaceInfo != null)
                            {
                                ReturnInfo  returnInfo  = value2.ReturnInfo;
                                ReplaceInfo replaceInfo = value2.ReplaceInfo;
                                if (num3 == 0 || (returnInfo != null && returnInfo.HandleStatus != ReturnStatus.Refused && returnInfo.HandleStatus != ReturnStatus.Returned) || (replaceInfo != null && (replaceInfo.HandleStatus != ReplaceStatus.Refused || replaceInfo.HandleStatus != ReplaceStatus.Replaced)))
                                {
                                    if (value2.ReturnInfo != null)
                                    {
                                        afterSaleTypes = AfterSaleTypes.ReturnAndRefund;
                                        num4           = value2.ReturnInfo.ReturnId;
                                    }
                                    else
                                    {
                                        afterSaleTypes = AfterSaleTypes.Replace;
                                        num4           = value2.ReplaceInfo.ReplaceId;
                                    }
                                }
                                num3++;
                            }
                        }
                        if (order.ItemStatus == OrderItemStatus.HasReturnOrReplace)
                        {
                            value = "订单中有商品正在退货/换货中";
                        }
                        else if (order.ItemStatus == OrderItemStatus.HasReplace)
                        {
                            value = "订单中有商品正在进行换货";
                        }
                        else if (order.ItemStatus == OrderItemStatus.HasReturn)
                        {
                            value = "订单中有商品在进行退货/退款操作";
                        }
                        else if (order.ReturnedCount > 0)
                        {
                            value = "订单中有商品已退货完成";
                        }
                        if (num3 > 0)
                        {
                            flag2    = true;
                            nullable = afterSaleTypes;
                            if (afterSaleTypes == AfterSaleTypes.ReturnAndRefund)
                            {
                                num = num4;
                            }
                            else
                            {
                                num2 = num4;
                            }
                        }
                    }
                }
                row.Add("ReturnId", num);
                row.Add("ReplaceId", num2);
                row.Add("AfterSaleType", nullable);
                row.Add("isShowRefund", flag2);
                row.Add("RefundStatus", value);
            }
            return(dataGridViewModel);
        }
Beispiel #32
0
        public void Repeat(DefinedPlaceholder beginPlaceholder, DefinedPlaceholder endPlaceholder, ReplaceInfo[] replaceInfos,
		                   string parameters)
        {
            while (__repeat(beginPlaceholder, endPlaceholder, replaceInfos, parameters)) ;
        }
Beispiel #33
0
 public void Repeat(DefinedPlaceholder beginPlaceholder, DefinedPlaceholder endPlaceholder, ReplaceInfo[] replaceInfos)
 {
     while (__repeat(beginPlaceholder, endPlaceholder, replaceInfos, null));
 }
Beispiel #34
0
        protected void listProduct_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                LineItemStatus lineItemStatus = (LineItemStatus)DataBinder.Eval(e.Item.DataItem, "Status");
                string         text           = (string)DataBinder.Eval(e.Item.DataItem, "StatusText");
                string         orderId        = (string)DataBinder.Eval(e.Item.DataItem, "OrderId");
                OrderInfo      orderInfo      = TradeHelper.GetOrderInfo(orderId);
                string         text2          = DataBinder.Eval(e.Item.DataItem, "SkuId").ToString();
                LineItemInfo   lineItemInfo   = orderInfo.LineItems[text2];
                if (lineItemStatus == LineItemStatus.Normal)
                {
                    text = TradeHelper.GetOrderItemSatusText(lineItemInfo.Status);
                }
                OrderStatus orderStatus = orderInfo.OrderStatus;
                DateTime    finishDate  = orderInfo.FinishDate;
                string      gateway     = orderInfo.Gateway;
                HtmlAnchor  htmlAnchor  = (HtmlAnchor)e.Item.FindControl("lkbtnAfterSalesApply");
                Label       label       = (Label)e.Item.FindControl("ItemLogistics");
                HtmlAnchor  htmlAnchor2 = (HtmlAnchor)e.Item.FindControl("lkbtnViewMessage");
                htmlAnchor.Attributes.Add("OrderId", orderInfo.OrderId);
                htmlAnchor.Attributes.Add("SkuId", text2);
                htmlAnchor.Attributes.Add("GateWay", gateway);
                ReplaceInfo replaceInfo = lineItemInfo.ReplaceInfo;
                ReturnInfo  returnInfo  = lineItemInfo.ReturnInfo;
                Literal     literal     = (Literal)e.Item.FindControl("litStatusText");
                if (literal != null && (replaceInfo != null || returnInfo != null))
                {
                    if (returnInfo != null)
                    {
                        if (returnInfo.AfterSaleType == AfterSaleTypes.OnlyRefund)
                        {
                            literal.Text = "<a href=\"UserReturnsApplyDetails?ReturnsId=" + returnInfo.ReturnId + "\" class=\"aslink\">" + EnumDescription.GetEnumDescription((Enum)(object)lineItemStatus, 3) + "</a>";
                        }
                        else
                        {
                            literal.Text = "<a href=\"UserReturnsApplyDetails?ReturnsId=" + returnInfo.ReturnId + "\" class=\"aslink\">" + EnumDescription.GetEnumDescription((Enum)(object)lineItemStatus, 2) + "</a>";
                        }
                    }
                    else
                    {
                        literal.Text = "<a href=\"UserReplaceApplyDetails?ReplaceId=" + replaceInfo.ReplaceId + "\" class=\"aslink\">" + EnumDescription.GetEnumDescription((Enum)(object)lineItemStatus, 2) + "</a>";
                    }
                }
                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                HtmlAnchor   htmlAnchor3    = htmlAnchor;
                int          visible;
                if (orderInfo.OrderType != OrderType.ServiceOrder)
                {
                    switch (orderStatus)
                    {
                    case OrderStatus.Finished:
                        visible = ((!orderInfo.IsServiceOver) ? 1 : 0);
                        break;

                    default:
                        visible = 0;
                        break;

                    case OrderStatus.SellerAlreadySent:
                        visible = 1;
                        break;
                    }
                }
                else
                {
                    visible = 0;
                }
                htmlAnchor3.Visible = ((byte)visible != 0);
                if (htmlAnchor.Visible)
                {
                    htmlAnchor.Visible = ((returnInfo == null || returnInfo.HandleStatus == ReturnStatus.Refused) && (replaceInfo == null || replaceInfo.HandleStatus == ReplaceStatus.Refused || replaceInfo.HandleStatus == ReplaceStatus.Replaced));
                }
            }
        }
Beispiel #35
0
        private bool __include(DefinedPlaceholder placeholder, ReplaceInfo[] replaceInfos)
        {
            string placeholderString = Placeholder.ToString(placeholder);
            string text = _text.ToString();
            int startIndex = text.IndexOf(placeholderString);

            // something to do?
            if (startIndex == -1)
                return false;

            // yes!
            int length = placeholderString.Length;
            int endIndex = startIndex + length;

            // get include placeholder + filename $NAME$(filename)
            if (text[endIndex] != '(')
                throw new CodeGeneratorException(ErrorCode.InvalidIncludeTemplateFormatOpeningBracket, placeholderString);

            do
            {
                if (endIndex+1 == text.Length)
                    throw new CodeGeneratorException(ErrorCode.InvalidIncludeTemplateFormatClosingBracket, placeholderString);

                endIndex++;
                length++;

                if (text[endIndex] == ')')
                {
                    endIndex++;
                    length++;

                    break;
                }
            }
            while (true);

            // get template from include
            string includePlaceholderPlusFilename = text.Substring(startIndex, length);
            string includeTemplate = GetIncludeTemplate(placeholderString, includePlaceholderPlusFilename);

            // replace
            string includeResults = string.Empty;

            foreach (ReplaceInfo replaceInfo in replaceInfos)
            {
                if (replaceInfo.replaceInfos == null)
                    continue;

                string includeResult = includeTemplate;

                for (int i=0; i<replaceInfo.replaceInfos.Length-1; i+=2)
                    includeResult = includeResult.Replace(replaceInfo.replaceInfos[i], replaceInfo.replaceInfos[i+1]);

                includeResults += includeResult;
            }

            text = text.Replace(includePlaceholderPlusFilename, includeResults);
            _text = new StringBuilder(text);

            return true;
        }