Ejemplo n.º 1
0
        void UCGiftCardUsageDetail_Loaded(object sender, RoutedEventArgs e)
        {
            Loaded -= new RoutedEventHandler(UCGiftCardUsageDetail_Loaded);
            facade  = new GiftCardFacade(CPApplication.Current.CurrentPage);

            comGiftCardStatus.ItemsSource   = EnumConverter.GetKeyValuePairs <ECCentral.BizEntity.IM.GiftCardStatus>();
            comGiftCardCategory.ItemsSource = EnumConverter.GetKeyValuePairs <ECCentral.BizEntity.IM.GiftCardType>();
            customerInfo = new BizEntity.Customer.CustomerInfo();

            this.btnSave.Visibility = System.Windows.Visibility.Collapsed;
            this.btnVoid.Visibility = System.Windows.Visibility.Collapsed;

            if (VM != null)
            {
                VM.ChannelID         = "1";
                oldEndDate           = VM.EndDate;
                BaseInfo.DataContext = VM;

                customerInfo.BasicInfo.CustomerID    = VM.CustomerID;
                customerInfo.BasicInfo.CustomerSysNo = int.Parse(string.IsNullOrEmpty(VM.CustomerSysNo)?"0":VM.CustomerSysNo);
                facade.GetGiftCardOperateLogByCode(VM.CardCode, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }

                    List <ECCentral.BizEntity.IM.GiftCardOperateLog> logs = args.Result;
                    if (logs != null && logs.Count > 0)
                    {
                        StringBuilder str = new StringBuilder();
                        logs = logs.OrderByDescending(p => p.InDate).ToList();
                        foreach (ECCentral.BizEntity.IM.GiftCardOperateLog log in logs)
                        {
                            str.AppendFormat("{0} {1} by {2} {3}", log.InDate.Value.ToString("yyyy-MM-dd HH:mm"), log.ActionType.ToDescription(), log.InUser, log.Memo);
                            str.AppendLine();
                        }
                        tbLog.Text = str.ToString().TrimEnd();
                    }
                });
                facade.GetGiftCardRedeemLogJoinSOMaster(VM.CardCode, (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    DataGrid.ItemsSource = args.Result;
                });

                if ((VM.Status == GiftCardStatus.Valid || VM.Status == GiftCardStatus.ManualActive) && VM.AvailAmount.HasValue && VM.AvailAmount > 0)
                {
                    this.btnSave.Visibility = System.Windows.Visibility.Visible;
                    //this.btnVoid.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    this.dpEndDate.IsEnabled = false;
                }
            }
        }
Ejemplo n.º 2
0
        public ActionResult AjaxLoadGiftCard(FormCollection form)
        {
            string code     = Request["Code"].Trim();
            string password = Request["Password"];

            var temp = GiftCardFacade.LoadGiftCard(code, password);

            if (temp == null)
            {
                return(Json(new
                {
                    Result = false,
                    Message = "卡号或密码错误,请输入正确的卡号和密码"
                }));
            }
            else
            {
                var newTemp = new
                {
                    Code        = temp.Code,
                    EndDate     = temp.EndDate.Value.ToString("yyyy-MM-dd"),
                    AvailAmount = temp.AvailAmount.ToString("F2"),
                    Status      = temp.BindingCustomerSysNo > 0 ? "已绑定" : "未绑定"
                };
                return(Json(new
                {
                    Result = true,
                    Message = newTemp
                }));
            }
        }
Ejemplo n.º 3
0
        public ActionResult UsedRecord()
        {
            int pageIndex = 0;

            if (!int.TryParse(Request.Params["page"], out pageIndex))
            {
                pageIndex = 1;
            }
            ;

            string code = Request["txtSearch"];

            code = string.IsNullOrEmpty(code) ? code : code.Trim();

            UsedRecordQuery query = new UsedRecordQuery();

            query.PageInfo.PageIndex = pageIndex;
            query.PageInfo.PageSize  = 10;
            query.Code          = code;
            query.CustomerSysNo = this.CurrUser.UserSysNo;

            var result = GiftCardFacade.QueryUsedRecord(query);

            return(View(result));
        }
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);

            this._voucherProductVM = new GiftCardProductVM();
            this._facade           = new GiftCardFacade(this);
            selected = new List <int>();
            this.voucherProduct.ProductSelected += voucherProduct_ProductSelected;

            _facade.GetGiftCardC3SysNo((no) =>
            {
                _c3SysNo = no;
            });
            if (RequestSysNo.HasValue)
            {
                this._voucherProductVM.SysNo = RequestSysNo.Value;

                _facade.GetGiftVoucherProductInfo(RequestSysNo.Value, (ret) =>
                {
                    this._voucherProductVM = ret;
                    foreach (var item in this._voucherProductVM.RelationProducts)
                    {
                        item.IsChecked = false;
                    }
                    SetDataContext();
                });
            }
            else
            {
                //this.voucherProductgd
                SetDataContext();
            }
        }
Ejemplo n.º 5
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            base.OnPageLoad(sender, e);

            _filter   = new GiftCardProductFilter();
            _filterVM = new GiftCardProductFilterVM();

            _facade       = new GiftCardFacade(this);
            selectedSysNo = new List <int>();

            this.filtergd.DataContext = _filterVM;
        }
        void UCGiftCardProductMaintain_Loaded(object sender, RoutedEventArgs e)
        {
            Loaded                     -= new RoutedEventHandler(UCGiftCardProductMaintain_Loaded);
            facade                      = new GiftCardFacade(CPApplication.Current.CurrentPage);
            giftCardProductVM           = giftCardProductVM ?? new GiftCardProductVM();
            this.LayoutRoot.DataContext = giftCardProductVM;

            voucherProduct.ProductSelected += voucherProduct_ProductSelected;

            facade.GetGiftCardC3SysNo((no) =>
            {
                C3SysNo = no;
            });
        }
Ejemplo n.º 7
0
        public override void OnPageLoad(object sender, EventArgs e)
        {
            facade                        = new GiftCardFacade(this);
            filter                        = new ECCentral.QueryFilter.IM.GiftCardFilter();
            model                         = new GiftCardVM();
            model.CompanyCode             = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.CompanyCode;
            model.ChannelID               = "1";
            comGiftCardStatus.ItemsSource =
                EnumConverter.GetKeyValuePairs <ECCentral.BizEntity.IM.GiftCardStatus>(EnumConverter.EnumAppendItemType.All).Where(status => status.Key != GiftCardStatus.Void && status.Key != GiftCardStatus.Used);

            //comGiftCardCategory.ItemsSource = EnumConverter.GetKeyValuePairs<ECCentral.BizEntity.IM.GiftCardType>(EnumConverter.EnumAppendItemType.All);
            SeachBuilder.DataContext = model;

            base.OnPageLoad(sender, e);
        }
Ejemplo n.º 8
0
        public ActionResult LookPassword()
        {
            string Code = Request["Code"].ToString();

            LoginUser suer = UserMgr.ReadUserInfo();
            //CustomerInfo customerInfo = CustomerFacade.GetCustomerInfo(suer.UserSysNo);

            string password = GiftCardFacade.LookPassword(Code, suer.UserSysNo);

            if (password != null)
            {
                return(Json(password, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("未能获取礼品卡密码", JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 9
0
        public ActionResult AjaxModifyGiftCardPwd(FormCollection form)
        {
            string code        = Request["Code"].Trim();
            string password    = Request["Password"];
            string newPassword = Request["NewPassword"];

            var temp = GiftCardFacade.LoadGiftCard(code, password);

            if (temp == null)
            {
                return(Json(new
                {
                    Result = false,
                    Message = "卡号或密码错误,请输入正确的卡号和密码"
                }));
            }
            else if (temp.EndDate < DateTime.Now)
            {
                return(Json(new
                {
                    Result = false,
                    Message = "礼品卡已过期,不能修改密码"
                }));
            }
            else if ((temp.BindingCustomerSysNo > 0 && temp.BindingCustomerSysNo != CurrUser.UserSysNo) || (temp.BindingCustomerSysNo == 0 && temp.CustomerSysNo != CurrUser.UserSysNo))
            {
                return(Json(new
                {
                    Result = false,
                    Message = "礼品卡未绑定或不属于此帐号,不能修改密码"
                }));
            }
            else
            {
                GiftCardFacade.ModifyGiftCardPwd(code, newPassword);
                return(Json(new
                {
                    Result = true,
                    Message = "礼品卡密码修改成功"
                }));
            }
        }
        public override void OnPageLoad(object sender, EventArgs e)
        {
            facade            = new GiftCardFacade(this);
            filter            = new ECCentral.QueryFilter.IM.GiftCardFabricationFilter();
            model             = new GiftCardFabricationVM();
            model.CompanyCode = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.CompanyCode;
            model.ChannelID   = "1";

            CodeNamePairHelper.GetList("IM", "GiftCardFabricationStatus", CodeNamePairAppendItemType.All, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                comStatus.ItemsSource = args.Result;
            });
            SeachBuilder.DataContext = model;
            btnNew.DataContext       = model;
            base.OnPageLoad(sender, e);
        }
Ejemplo n.º 11
0
        public ActionResult AjaxBindGiftCard(FormCollection form)
        {
            string code     = Request["Code"].Trim();
            string password = Request["Password"];

            var temp = GiftCardFacade.LoadGiftCard(code, password);

            if (temp == null)
            {
                return(Json(new
                {
                    Result = false,
                    Message = "卡号或密码错误,请输入正确的卡号和密码"
                }));
            }
            else if (temp.BindingCustomerSysNo > 0)
            {
                return(Json(new
                {
                    Result = false,
                    Message = "礼品卡已经被绑定,不能重复绑定"
                }));
            }
            else if (temp.EndDate < DateTime.Now)
            {
                return(Json(new
                {
                    Result = false,
                    Message = "礼品卡已过期,不能绑定"
                }));
            }
            else
            {
                GiftCardFacade.BindGiftCard(code, this.CurrUser.UserSysNo);
                return(Json(new
                {
                    Result = true,
                    Message = "礼品卡绑定成功"
                }));
            }
        }
        void UCGiftCardFabricationMaintain_Loaded(object sender, RoutedEventArgs e)
        {
            Loaded -= new RoutedEventHandler(UCGiftCardFabricationMaintain_Loaded);
            facade  = new GiftCardFacade(CPApplication.Current.CurrentPage);
            BtnStack.DataContext = new GiftCardFabricationVM();

            if (VM != null)
            {
                ECCentral.Portal.Basic.Utilities.CodeNamePairHelper.GetList("IM", "GiftCardFabricationStatus", (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    comStatus.ItemsSource = args.Result;
                    VM.ChannelID          = "1";
                    if (args.Result != null)
                    {
                        VM.Status = args.Result.SingleOrDefault(a => a.Name == VM.Status).Code;
                    }


                    if (string.IsNullOrEmpty(VM.POSysNo))
                    {
                        hlPOSysNo.Visibility = System.Windows.Visibility.Collapsed;
                    }


                    //if (VM.POStatus != ECCentral.BizEntity.PO.PurchaseOrderStatus.Abandoned)
                    if (VM.Status != "-1" && VM.Status != "-2")
                    {
                        if (VM.POStatus == PurchaseOrderStatus.WaitingInStock || VM.Status == "1")
                        {
                            btnExport.Visibility = Visibility.Visible;
                        }
                        else if (VM.Status == "0" && VM.POStatus == null)
                        {
                            btnSave.Visibility     = Visibility.Visible;
                            btnCreatePO.Visibility = Visibility.Visible;
                            btnVoid.Visibility     = Visibility.Visible;
                        }
                        ;
                    }

                    // if (VM.POStatus == PurchaseOrderStatus.InStocked)//测试用
                    //    btnExport.IsEnabled = true;

                    BaseInfo.DataContext = VM;
                });
            }
            else
            {
                ECCentral.Portal.Basic.Utilities.CodeNamePairHelper.GetList("IM", "GiftCardFabricationStatus", (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    comStatus.ItemsSource = args.Result;
                });
                hlPOSysNo.Visibility = System.Windows.Visibility.Collapsed;

                VM                   = new GiftCardFabricationVM();
                VM.ChannelID         = "1";
                VM.Status            = "0";
                VM.SysNo             = 0;
                BaseInfo.DataContext = VM;
                tbTotal.Text         = string.Format(total, 0, 0, 0);

                btnSave.Visibility = Visibility.Visible;
                //btnCreatePO.IsEnabled = false;
                //btnVoid.IsEnabled = false;
                //btnExport.IsEnabled = false;
            }

            facade.GetGiftCardFabricationItem(VM.SysNo.Value, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }

                rsp = args.Result;

                gridVM = new List <GiftCardFabricationItemVM>();
                if (rsp.GiftCardFabricationList != null)
                {
                    foreach (GiftCardFabrication gift in rsp.GiftCardFabricationList)
                    {
                        GiftCardFabricationItemVM item = new GiftCardFabricationItemVM();
                        item.SysNo        = gift.SysNo.Value;
                        item.Quantity     = gift.Quantity;
                        item.ProductName  = gift.Product.ProductBasicInfo.ShortDescription.Content;
                        item.CurrentPrice = gift.Product.ProductPriceInfo.CurrentPrice;
                        item.ProductID    = gift.Product.ProductID;
                        item.ProductSysNo = gift.Product.SysNo;
                        item.PMUserSysNo  = gift.PMUserSysNo;
                        gridVM.Add(item);
                    }
                    DataGrid.ItemsSource = gridVM;
                    if (gridVM[0].SysNo.Value == 0)
                    {
                        DataGrid.Columns[0].Visibility = System.Windows.Visibility.Collapsed;
                    }
                    if (rsp.GiftCardFabricationList != null)
                    {
                        tbTotal.Text = string.Format(total, rsp.GiftCardFabricationList.Count, rsp.TotalPrice, rsp.TotalCount);
                    }
                    else
                    {
                        tbTotal.Text = string.Format(total, 0, 0, 0);
                    }
                }
                else
                {
                    CPApplication.Current.CurrentPage.Context.Window.Alert(ResGiftCardInfo.Information_CheckTheCardGiftProduct, MessageType.Information);
                }
            });
        }