コード例 #1
0
        static void Main()
        {
            try
            {
                //  GlobalUtil.Initialize(false);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                LoadingForm loadingForm = new Common.LoadingForm();
                loadingForm.TopMost = true;
                loadingForm.Show();
                String DEBUG = ConfigurationManager.AppSettings["DEBUG"];
                if (String.IsNullOrEmpty(DEBUG) || DEBUG.ToLower() != "true")
                {
                    LoginAgileConfiguration loginInfo = null;
                    try
                    {
                        loginInfo = LoginAgileConfiguration.Load(CommonGlobalUtil.AgileConfiguration("Manage.LoginAgileConfiguration")) as LoginAgileConfiguration;
                    }
                    catch (Exception ex)
                    {
                        GlobalUtil.ShowError(ex);
                        CommonGlobalUtil.logger.Log(ex, "Program.Main:", CJBasic.Loggers.ErrorLevel.Standard);
                        return;
                    }
                    if (loginInfo == null)
                    {
                        loginInfo                 = new LoginAgileConfiguration();
                        loginInfo.LoginInfos      = new List <LoginInfo>();
                        loginInfo.BusinessAccount = new BusinessAccount();
                        loginInfo.AutoUpgradeInfo = new AutoUpgradeInfo();
                    }
                    //try
                    //{
                    //    AutoUpgradeInfo config = GlobalUtil.GetAutoUpgradeInfo(loginInfo, 1);
                    //    if (config != null)
                    //    {
                    //        if (VersionHelper.HasNewVersion(config.IP, config.Port))
                    //        {
                    //            string updateExePath = AppDomain.CurrentDomain.BaseDirectory + "AutoUpdater\\易联售自动升级系统.exe";
                    //            System.Diagnostics.Process myProcess = System.Diagnostics.Process.Start(updateExePath, config.IP + " " + config.Port);
                    //            return;
                    //        }
                    //    }
                    //}
                    //catch (Exception ex)
                    //{
                    //    if (ex.Message.Contains("无法连接到远程服务器"))
                    //    {
                    //        GlobalMessageBox.Show("登录超时,请检查您的网络或者本机防火墙设置");
                    //    }
                    //    else if (ex.Message.Contains("操作已被用户取消"))
                    //    {

                    //        GlobalMessageBox.Show("操作已被用户取消");
                    //    }
                    //    else
                    //    {
                    //        GlobalMessageBox.Show("获取版本升级信息时出错:" + ex.Message + " @ " + ex.StackTrace);
                    //    }
                    //    CommonGlobalUtil.logger.Log(ex, "Program.Main", CJBasic.Loggers.ErrorLevel.Standard);
                    //    return;
                    //}
                }
                loadingForm.Close();
                CJPlus.GlobalUtil.SetMaxLengthOfMessage(1024 * 1024 * 10);
                RapidPassiveEngine rapidPassiveEngine = CJPlus.Rapid.RapidEngineFactory.CreatePassiveEngine();
                rapidPassiveEngine.WaitResponseTimeoutInSecs = 30;
                rapidPassiveEngine.SystemToken = SystemToken.Manage;

                LoginForm loginForm = new LoginForm(rapidPassiveEngine);
                if (loginForm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                GlobalUtil.Engine = rapidPassiveEngine;
                MainForm mainForm = new MainForm(null);
                Application.Run(mainForm);
            }
            catch (Exception ee)
            {
                GlobalUtil.ShowError(ee);
            }
        }
コード例 #2
0
ファイル: BalanceForm.cs プロジェクト: jollitycn/JGNet
        private void BaseButton_Submit_Click(object sender, EventArgs e)
        {
            try
            {
                BaseButton_Submit.Enabled = false;
                if (GlobalUtil.EngineUnconnectioned(this))
                {
                    return;
                }

                if (this.member != null && this.m_MoneyStoredCard > this.member.Balance)
                {
                    GlobalMessageBox.Show("卡余额不足!");
                    return;
                }
                decimal moneyIntegration = string.IsNullOrEmpty(this.skinLabel_JFToMoeny.Text) ? 0 : decimal.Parse(this.skinLabel_JFToMoeny.Text);

                if (m_MoneyIntegration != 0)
                {
                    if (moneyIntegration < this.m_MoneyIntegration)
                    {
                        GlobalMessageBox.Show("积分不足!");
                        return;
                    }
                }

                if (this.m_MoneyStoredCard + this.m_MoneyIntegration > this.totalMoneyReceived)
                {
                    GlobalMessageBox.Show("输入的积分返现金额与卡余额之和不能大于应收金额!");
                    return;
                }
                decimal refundAmount = decimal.Parse(this.skinLabel_MoneyChange.Text);
                if (!skinCheckBoxNew.Checked)
                {
                    if (refundAmount < 0)
                    {
                        GlobalMessageBox.Show("付款金额不足!");
                        return;
                    }
                }
                string  id = GlobalCache.ServerProxy.GetRetailOrderID(); //IDHelper.GetID(OrderPrefix.RetailOrder, GlobalCache.GetShop(GlobalCache.CurrentShopID).AutoCode);
                decimal moneyVipCardMain   = this.member == null ? this.m_MoneyStoredCard : this.m_MoneyStoredCard * (1 - (decimal)this.member.DonateCoef);
                decimal moneyVipCardDonate = this.member == null ? 0 : this.m_MoneyStoredCard * (decimal)this.member.DonateCoef;
                this.totalMoneyReceivedActual = this.totalMoneyReceived - this.m_MoneyIntegration - moneyVipCardDonate - this.discountMoney;

                CommonGlobalUtil.WriteLog("应收总金额:" + totalMoneyReceived);
                CommonGlobalUtil.WriteLog("积分:" + m_MoneyIntegration);
                CommonGlobalUtil.WriteLog("vip赠送金额:" + moneyVipCardDonate);
                CommonGlobalUtil.WriteLog("优惠券:" + discountMoney);
                CommonGlobalUtil.WriteLog("满减金额:" + this.mjMoney);
                CommonGlobalUtil.WriteLog("实收总金额:" + totalMoneyReceivedActual);
                if (this.skinCheckBoxNew.Checked)
                {
                    if (this.salesPromotion != null)
                    {
                        this.salesPromotion.ID = String.Empty;
                    }
                    this.discountMoney            = 0;
                    this.totalMoneyReceivedActual = 0;
                    this.totalMoneyReceived       = Convert.ToDecimal(this.skinLabel_TotalMoneySupposed.Text);
                    this.promotionText            = "未付款,不参与任何促销优惠";
                }
                //  String orderId =
                //重新获取订单编号
                //  bool isNotPay = this.skinCheckBoxNew.Checked;

                retailOrder = new RetailOrder()
                {
                    ID                       = id,
                    MemeberID                = this.member == null ? string.Empty : this.member.PhoneNumber,
                    MoneyCash                = this.m_MoneyCash,
                    MoneyCash2               = this.m_MoneyCash - this.moneyChange,
                    MoneyVipCard             = this.m_MoneyStoredCard,
                    MoneyVipCardMain         = moneyVipCardMain,
                    MoneyVipCardDonate       = moneyVipCardDonate,
                    MoneyBankCard            = this.m_MoneyBankCard,
                    MoneyWeiXin              = this.m_MoneyWeiXin,
                    MoneyAlipay              = this.m_MoneyAlipay,
                    MoneyOther               = this.m_MoneyElse,
                    MoneyIntegration         = this.m_MoneyIntegration,
                    SmallMoneyRemoved        = this.m_SmallMoneyRemoved,
                    TotalPrice               = this.totalOriginalAmount,
                    MoneyDiscounted          = this.moneyDiscounted,
                    TotalMoneyReceived       = this.totalMoneyReceived,
                    TotalMoneyReceivedActual = this.totalMoneyReceivedActual,
                    ShopID                   = shopID,
                    Remarks                  = this.rtfRichTextBox_Remarks.Text,
                    TotalCount               = this.totalCount,
                    CreateTime               = createTime,

                    EntryTime        = DateTime.Now,
                    EntryUserID      = CommonGlobalCache.CurrentUserID,
                    MoneyChange      = this.moneyChange,
                    SalesPromotionID = this.salesPromotion == null ? String.Empty : this.salesPromotion.ID,
                    GuideID          = this.guideID,
                    TotalCost        = this.totalCost,
                    //已经满减了
                    Benefit               = this.totalMoneyReceivedActual - this.totalCost,
                    PromotionText         = this.promotionText,
                    IsRefundOrder         = false,
                    OperateGuideID        = this.guideID,
                    MoneyDeductedByTicket = this.discountMoney,
                    IsNotPay              = this.skinCheckBoxNew.Checked,
                    GiftTicket            = this.giftTicketList,
                };


                List <RetailDetail> retailDetailListWithoutBuyout = retailDetailList.FindAll(t => !t.IsBuyout);
                List <RetailDetail> retailDetailListBuyout        = retailDetailList.FindAll(t => t.IsBuyout);

                if (skinCheckBoxNew.Checked)

                {
                    foreach (RetailDetail detail in retailDetailListWithoutBuyout)
                    {
                        List <CostumeItem> resultList = CommonGlobalCache.ServerProxy.GetCostumeStoreList(
                            new CostumeStoreListPara()
                        {
                            CostumeID       = detail.CostumeID,
                            ShopID          = shopID,
                            IsOnlyShowValid = true,
                            IsAccurateQuery = true,
                        });
                        decimal      saleprice  = 0;
                        CostumeStore reslutList = new CostumeStore();
                        if (resultList != null && resultList.Count > 0)
                        {
                            List <CostumeStore> lStore = resultList[0].CostumeStoreList;
                            reslutList = lStore.Find(t => t.ColorName == detail.ColorName);
                            if (reslutList.SalePrice < reslutList.Price)
                            {
                                saleprice = reslutList.Price;
                            }
                            else
                            {
                                saleprice = reslutList.SalePrice;
                            }
                            //saleprice = resultList[0].CostumeStoreList[].Price;
                        }
                        detail.Price    = saleprice;
                        detail.Discount = saleprice / reslutList.Price * 100;

                        detail.SumMoney = detail.Price * detail.BuyCount;
                    }
                }
                RetailCostume retailCostume = new RetailCostume()
                {
                    RetailDetailList = this.retailDetailList,
                    RetailOrder      = retailOrder
                };

                foreach (var item in retailDetailList)
                {
                    item.RetailOrderID = id;
                    CostumeSalePriceConfiguration costumeSalePrice = new CostumeSalePriceConfiguration();
                    costumeSalePrice.price = item.SinglePrice;
                    //  item.SalePrice = item.SinglePrice;
                    costumeSalePrice.Save(CommonGlobalUtil.AgileConfiguration("Pos//SalePrice//" + GlobalCache.CurrentShopID + "//" + item.CostumeID));
                }



                InteractResult result = GlobalCache.ServerProxy.RetailCostume(retailCostume);

                switch (result.ExeResult)
                {
                case ExeResult.Success:
                    GlobalMessageBox.Show("结算成功!");
                    this.DialogResult = DialogResult.OK;
                    if (skinCheckBoxPrint.Checked)
                    {
                        OrderPrintUtil printHelper = new OrderPrintUtil();
                        int            times       = CommonGlobalUtil.ConvertToInt32(GlobalCache.GetParameter(ParameterConfigKey.PrintCount).ParaValue);
                        DataGridView   dgv         = deepCopyDataGridView();
                        printHelper.Print(retailCostume, times, dgv);
                    }

                    break;

                case ExeResult.Error:
                    GlobalMessageBox.Show(result.Msg);
                    break;

                default:
                    break;
                }
            }
            catch (Exception ee)
            {
                GlobalUtil.ShowError(ee);
            }
            finally
            {
                BaseButton_Submit.Enabled = true;
                GlobalUtil.UnLockPage(this);
            }
        }
コード例 #3
0
 public static String GetConfigPath()
 {
     return(CommonGlobalUtil.AgileConfiguration(OPTION_CONFIGURATION_PATH));
 }