Exemplo n.º 1
0
 private void hlbCheck_Click(object sender, RoutedEventArgs e)
 {
     if (!CheckInputIsPass())
     {
         return;
     }
     _Facade.GetGrossMargin(_ViewModel, (o, arg) =>
     {
         if (arg.FaultsHandle())
         {
             return;
         }
         GrossMarginMsg msg = arg.Result;
         // tblGrossMargin.Text = string.Format("限时抢购毛利(含赠品、优惠券):{0} 限时抢购毛利(不含赠品、优惠券):{1}\r\n限时抢购毛利率(含赠品、优惠券): {2}% 限时抢购毛利率(不含赠品、优惠券): {3}%",
         //msg.GrossMargin, msg.GrossMarginWithOutPointAndGift, msg.GrossMarginRate, msg.GrossMarginRateWithOutPointAndGift);
         spCheckResult.Visibility = Visibility.Visible;
         txtGrossMargin.Text      = msg.GrossMargin.ToString();
         txtGrossMarginWithOutPointAndGift.Text = msg.GrossMarginWithOutPointAndGift.ToString();
         txtGrossMarginRate.Text = msg.GrossMarginRate.ToString();
         txtGrossMarginRateWithOutPointAndGift.Text = msg.GrossMarginRateWithOutPointAndGift.ToString();
         txtGiftSysNo.Text   = msg.GiftSysNo.HasValue ? msg.GiftSysNo.Value.ToString() : "无";
         txtCouponSysNo.Text = msg.CouponSysNo.HasValue ? msg.CouponSysNo.Value.ToString() : "无";
         // tblGrossMargin.Text = string.Format(ResCountdownMaintain.Msg_CountdownGrossProfit, msg.GrossMargin, msg.GrossMarginWithOutPointAndGift, msg.GrossMarginRate, msg.GrossMarginRateWithOutPointAndGift, "\r\n");
     });
 }
Exemplo n.º 2
0
        public virtual GrossMarginMsg GetGrossMargin(CountdownInfo entity)
        {
            GrossMarginMsg msg         = new GrossMarginMsg();
            decimal        GrossMargin = 0;
            decimal        GrossMarginWithOutPointAndGift = 0;
            decimal        GrossMarginRate = 0;
            decimal        GrossMarginRateWithOutPointAndGift = 0;
            var            giftSysNo   = 0;
            var            couponSysNo = 0;

            //获取蛋劵和赠品编号
            if (entity.ProductSysNo.HasValue)
            {
                ObjectFactory <ICountdownQueryDA> .Instance.GetGiftAndCouponSysNo(entity.ProductSysNo.Value, out giftSysNo, out couponSysNo);

                if (giftSysNo != -1)
                {
                    msg.GiftSysNo = giftSysNo;
                }
                if (couponSysNo != -1)
                {
                    msg.CouponSysNo = couponSysNo;
                }
            }
            ObjectFactory <CountdownAppService> .Instance.GetGrossMargin(entity, out GrossMargin, out GrossMarginWithOutPointAndGift, out GrossMarginRate, out GrossMarginRateWithOutPointAndGift);

            msg.GrossMargin = GrossMargin;
            msg.GrossMarginWithOutPointAndGift = GrossMarginWithOutPointAndGift;
            msg.GrossMarginRate = GrossMarginRate;
            msg.GrossMarginRateWithOutPointAndGift = GrossMarginRateWithOutPointAndGift;
            msg.CountDownMargin     = Convert.ToDecimal(AppSettingManager.GetSetting("MKT", "CountDownMargin"));
            msg.CountDownMarginRate = Convert.ToDecimal(AppSettingManager.GetSetting("MKT", "CountDownMarginRate"));
            return(msg);
        }
Exemplo n.º 3
0
        private void ModifyMaintain()
        {
            if (!CheckInputIsPass())
            {
                return;
            }

            if (_ViewModel.SysNo <= 0)
            {
                if (rbIsNeedVerify.IsChecked.Value)//如果勾选提交审核,那么需要更新状态
                {
                    _ViewModel.Status = CountdownStatus.WaitForPrimaryVerify;
                }

                //提示是否确认不提交审核
                if (_ViewModel.Status == CountdownStatus.Ready)
                {
                    _Facade.GetGrossMargin(_ViewModel, (objM, argM) =>
                    {
                        if (argM.FaultsHandle())
                        {
                            return;
                        }
                        GrossMarginMsg msg = argM.Result;

                        _Facade.CheckOptionalAccessoriesInfoMsg(_ViewModel, (objC, argC) =>
                        {
                            if (!argC.FaultsHandle())
                            {
                                //if (Number(smargin) <= Number(margin) || Number(smarginRate) <= Number(marginRate) || _hdCheckOptionalAccessoriesInfo) {
                                if (msg.GrossMargin <= msg.CountDownMargin || msg.GrossMarginRate <= msg.CountDownMarginRate ||
                                    !string.IsNullOrEmpty(argC.Result))
                                {
                                    StringBuilder confirmStr = new StringBuilder();
                                    confirmStr.Append(string.Format(ResCountdownMaintain.Info_GrossMarginError,
                                                                    msg.GrossMarginRate, msg.GrossMargin));

                                    confirmStr.Append("\r\n" + argC.Result + "\r\n");

                                    confirmStr.Append(ResCountdownMaintain.Info_SureNotSubmitAudit);
                                    this.Window.Confirm(confirmStr.ToString(), (obj, args) =>
                                    {
                                        if (args.DialogResult == Newegg.Oversea.Silverlight.Controls.Components.DialogResultType.OK)
                                        {
                                            _Facade.Create(_ViewModel, (o, arg) =>
                                            {
                                                if (!arg.FaultsHandle())
                                                {
                                                    //Window.Alert("创建成功");
                                                    Window.Alert(ResCountdownMaintain.Msg_CreateSuccess);
                                                    Window.Close();
                                                }
                                            });
                                        }
                                    });
                                }
                                else
                                {
                                    _Facade.Create(_ViewModel, (o, arg) =>
                                    {
                                        if (!arg.FaultsHandle())
                                        {
                                            //Window.Alert("创建成功");
                                            Window.Alert(ResCountdownMaintain.Msg_CreateSuccess);
                                            Window.Close();
                                        }
                                    });
                                }
                            }
                        });
                    });
                }
                else
                {
                    _Facade.Create(_ViewModel, (o, arg) =>
                    {
                        if (!arg.FaultsHandle())
                        {
                            //Window.Alert("创建成功");
                            Window.Alert(ResCountdownMaintain.Msg_CreateSuccess);
                            Window.Close();
                        }
                    });
                }
            }
            else
            {
                _Facade.Update(_ViewModel, (o, arg) =>
                {
                    if (!arg.FaultsHandle())
                    {
                        // Window.Alert("更新成功");
                        Window.Alert(ResCountdownMaintain.Msg_UpdateSuccess);
                        Window.Refresh();
                    }
                });
            }
        }