Exemplo n.º 1
0
        private void SaleGiftProcess(PSOperationType opt, string optname, SaleGiftStatus targetStatus)
        {
            List <int?> sysNoList = new List <int?>();

            sysNoList.Add(_saleGiftInfoVM.SysNo);

            _facade.BatchProcessSaleGift(sysNoList, opt, (obj, args) =>
            {
                if (args.Result.FailureRecords.Count == 0)
                {
                    if (opt == PSOperationType.SubmitAudit)
                    {
                        _facade.Load(_saleGiftInfoVM.SysNo, _saleGiftInfoVM, (obj1, args1) =>
                        {
                            _saleGiftInfoVM  = args1.Result;
                            this.DataContext = _saleGiftInfoVM;
                            SetControlByOperation();
                        });
                    }
                    else
                    {
                        _saleGiftInfoVM.Status = targetStatus;
                        SetControlByOperation();
                    }
                    //Window.Alert(string.Format("赠品活动-{0}成功!", optname));
                    Window.Alert(string.Format(ResSaleGiftMaitain.Msg_DealSuccess, optname));
                }
                else
                {
                    string msg = args.Result.FailureRecords.Join("\r\n") + Environment.NewLine;
                    Window.Alert(msg);
                }
            });
        }
Exemplo n.º 2
0
        private void BatchProcess(PSOperationType opt, string optname)
        {
            Window.MessageBox.Show("商家创建的商品为待审核时不能撤回,如有勾选,系统会自动忽略!", MessageBoxType.Information);
            dynamic rows = dgResult.ItemsSource;

            if (rows == null)
            {
                //Window.Alert("请至少勾选一条数据!");
                Window.Alert(ResSaleGiftQuery.Msg_SelcOneMoreRecords);
                return;
            }
            List <int?> sysNoList = new List <int?>();

            foreach (dynamic row in rows)
            {
                if (row.IsChecked && row.RequestSysNo == 0)
                {
                    sysNoList.Add(row.SysNo);
                }
            }
            if (sysNoList.Count == 0)
            {
                // Window.Alert("请至少勾选一条数据!");
                Window.Alert(ResSaleGiftQuery.Msg_SelcOneMoreRecords);
                return;
            }
            _facade.BatchProcessSaleGift(sysNoList, opt, (obj, args) =>
            {
                if (args.Result.FailureRecords.Count == 0)
                {
                    //Window.Alert(string.Format("批量{0}赠品成功!", optname));
                    Window.Alert(string.Format(ResSaleGiftQuery.Msg_BatchDealSuccess, optname));
                }
                else
                {
                    string msg = args.Result.FailureRecords.Join(Environment.NewLine) + Environment.NewLine;
                    if (args.Result.SuccessRecords.Count > 0)
                    {
                        // msg += "其余赠品活动处理成功:" + Environment.NewLine;
                        msg += ResSaleGiftQuery.Msg_DealSuccess + Environment.NewLine;
                        msg += args.Result.SuccessRecords.Join(Environment.NewLine);
                    }
                    Window.Alert(msg);
                }
                ButtonSearch_Click(this.ButtonSearch, new RoutedEventArgs());
            });
        }
Exemplo n.º 3
0
        private void BatchProcess(PSOperationType opt, string optname)
        {
            dynamic rows = dgResult.ItemsSource;

            if (rows == null)
            {
                Window.Alert(ResCouponQuery.Msg_SelcOneMoreRecords);
                return;
            }
            List <int?> sysNoList = new List <int?>();

            foreach (dynamic row in rows)
            {
                if (row.IsChecked)
                {
                    sysNoList.Add(row.SysNo);
                }
            }
            if (sysNoList.Count == 0)
            {
                Window.Alert(ResCouponQuery.Msg_SelcOneMoreRecords);
                return;
            }
            _facade.BatchProcessCoupons(sysNoList, opt, (obj, args) =>
            {
                if (args.Result.FailureRecords.Count == 0)
                {
                    Window.Alert(string.Format(ResCouponQuery.Msg_BatchDealSuccess, optname));
                }
                else
                {
                    string msg = args.Result.FailureRecords.Join(Environment.NewLine) + Environment.NewLine;
                    if (args.Result.SuccessRecords.Count > 0)
                    {
                        msg += ResCouponQuery.Msg_DealSuccess + Environment.NewLine;
                        msg += args.Result.SuccessRecords.Join(Environment.NewLine);
                    }

                    Window.Alert(msg);
                }
                ButtonSearch_Click(this.ButtonSearch, new RoutedEventArgs());
            });
        }
Exemplo n.º 4
0
        private void CouponsProcess(PSOperationType opt, string optname, CouponsStatus targetStatus)
        {
            List <int?> sysNoList = new List <int?>();

            sysNoList.Add(_couponsInfoVM.SysNo);

            _facade.BatchProcessCoupons(sysNoList, opt, (obj, args) =>
            {
                if (args.Result.FailureRecords.Count == 0)
                {
                    _couponsInfoVM.Status = targetStatus;
                    SetControlByOperation();
                    Window.Alert(string.Format(ResCouponMaintain.Msg_DealSuccess, optname));
                }
                else
                {
                    string msg = args.Result.FailureRecords.Join("\r\n") + Environment.NewLine;
                    Window.Alert(msg);
                }
            });
        }
Exemplo n.º 5
0
        //----------------批量处理---------------------------
        public void BatchProcessSaleGift(List <int?> sysNoList, PSOperationType operation, EventHandler <RestClientEventArgs <BatchResultRsp> > callback)
        {
            string relativeUrl = "/MKTService/SaleGift/{0}";

            switch (operation)
            {
            case PSOperationType.AuditApprove:
                relativeUrl = string.Format(relativeUrl, "AuditApprove");
                break;

            case PSOperationType.AuditRefuse:
                relativeUrl = string.Format(relativeUrl, "AuditRefuse");
                break;

            case PSOperationType.CancelAudit:
                relativeUrl = string.Format(relativeUrl, "CancelAudit");
                break;

            case PSOperationType.Stop:
                relativeUrl = string.Format(relativeUrl, "ManualStop");
                break;

            case PSOperationType.SubmitAudit:
                relativeUrl = string.Format(relativeUrl, "SubmitAudit");
                break;

            case PSOperationType.Void:
                relativeUrl = string.Format(relativeUrl, "Void");
                break;
            }
            restClient.Query <BatchResultRsp>(relativeUrl, sysNoList, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                callback(obj, args);
            });
        }
Exemplo n.º 6
0
        /// <summary>
        /// 检查当前状态的下当前操作是否符合业务逻辑。同时也通过out参数返回操作后的状态
        /// </summary>
        /// <param name="operation">操作类型</param>
        /// <param name="curStatus">当前状态</param>
        /// <param name="resultStatus">操作后的状态</param>
        /// <returns>当前状态下本操作是否正确</returns>
        private static bool CheckAndOperateStatus(PSOperationType operation, int?sysNo, SaleGiftStatus?curStatus,
                                                  out SaleGiftStatus resultStatus, out string errorDescription)
        {
            resultStatus     = curStatus.HasValue ? curStatus.Value : SaleGiftStatus.Origin;
            errorDescription = null;
            bool checkPassResult = true;

            switch (operation)
            {
            case PSOperationType.Edit:
                if (curStatus != SaleGiftStatus.Origin)
                {
                    checkPassResult  = false;
                    errorDescription = string.Format("活动[{0}]编辑失败:只有初始状态可以进行编辑!本活动当前状态:{1}!", sysNo, curStatus.Value.GetDescription());
                }
                break;

            case PSOperationType.SubmitAudit:
                if (curStatus != SaleGiftStatus.Origin)
                {
                    checkPassResult  = false;
                    errorDescription = string.Format("活动[{0}]提交审核失败:只有初始状态可以提交审核!本活动当前状态:{1}!", sysNo, curStatus.Value.GetDescription());

                    break;
                }
                resultStatus = SaleGiftStatus.WaitingAudit;
                break;

            case PSOperationType.CancelAudit:
                if (curStatus != SaleGiftStatus.WaitingAudit && curStatus != SaleGiftStatus.Ready)
                {
                    checkPassResult  = false;
                    errorDescription = string.Format("活动[{0}]撤回失败:只有待审核状态和就绪状态可以取消审核!本活动当前状态:{1}!", sysNo, curStatus.Value.GetDescription());

                    break;
                }
                resultStatus = SaleGiftStatus.Origin;
                break;

            case PSOperationType.AuditApprove:
                if (curStatus != SaleGiftStatus.WaitingAudit)
                {
                    checkPassResult  = false;
                    errorDescription = string.Format("活动[{0}]审核通过失败:只有待审核状态可以审核通过!本活动当前状态:{1}!", sysNo, curStatus.Value.GetDescription());

                    break;
                }
                resultStatus = SaleGiftStatus.Ready;
                break;

            case PSOperationType.AuditRefuse:
                if (curStatus != SaleGiftStatus.WaitingAudit)
                {
                    checkPassResult  = false;
                    errorDescription = string.Format("活动[{0}]审核拒绝失败:只有待审核状态可以进行审核拒绝!本活动当前状态:{1}!", sysNo, curStatus.Value.GetDescription());

                    break;
                }
                resultStatus = SaleGiftStatus.Void;
                break;

            case PSOperationType.Stop:
                if (curStatus != SaleGiftStatus.Run)
                {
                    checkPassResult  = false;
                    errorDescription = string.Format("活动[{0}]提前终止失败:只有运行状态可以进行提前终止!本活动当前状态:{1}!", sysNo, curStatus.Value.GetDescription());

                    break;
                }
                resultStatus = SaleGiftStatus.Stoped;
                break;

            case PSOperationType.Void:
                //if (curStatus != SaleGiftStatus.Init && curStatus != SaleGiftStatus.WaitingAudit && curStatus != SaleGiftStatus.Ready)
                //{
                if (curStatus != SaleGiftStatus.Origin)
                {
                    checkPassResult  = false;
                    errorDescription = string.Format("活动[{0}]作废失败:只有初始、待审核、就绪状态可以进行作废!本活动当前状态:{1}!", sysNo, curStatus.Value.GetDescription());

                    break;
                }
                resultStatus = SaleGiftStatus.Void;
                break;
            }

            return(checkPassResult);
        }