//打印
        private void printTool_Click(object sender, EventArgs e)
        {
            try
            {
                dgv_show();

                var dc = new BathDBDataContext(LogIn.connectionString);
                string companyName = dc.Options.FirstOrDefault().companyName;
                List<string> printColumns = new List<string>();
                foreach (DataGridViewColumn dgvCol in dgv.Columns)
                {
                    printColumns.Add(dgvCol.HeaderText);
                }

                dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

                if (ptTimeList.SelectedIndex == 0)
                {
                    CashPrintTime cpt = new CashPrintTime();
                    cpt.macAdd = macAdd;
                    cpt.time = GeneralClass.Now;
                    dc.CashPrintTime.InsertOnSubmit(cpt);
                    dc.SubmitChanges();
                }

                PrintReceipt.Print_DataGridView(dgv, lastTime.ToString("yyyy-MM-dd HH:mm:ss"), thisTime.ToString("yyyy-MM-dd HH:mm:ss"), companyName);
                BathClass.set_dgv_fit(dgv);
            }
            catch
            {
                BathClass.printErrorMsg("打印出错,请重新打印!");
            }
        }
Exemple #2
0
        //打印
        private void printTool_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgv.Rows.Count == 0)
                {
                    dgv_show();
                }

                var           dc           = new BathDBDataContext(LogIn.connectionString);
                string        companyName  = dc.Options.FirstOrDefault().companyName;
                List <string> printColumns = new List <string>();
                foreach (DataGridViewColumn dgvCol in dgv.Columns)
                {
                    printColumns.Add(dgvCol.HeaderText);
                }

                dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;


                PrintReceipt.Print_DataGridView("技师对账单汇总", dgv, lastTime.ToString("yyyy-MM-dd HH:mm:ss"), thisTime.ToString("yyyy-MM-dd HH:mm:ss"), companyName);
            }
            catch
            {
                BathClass.printErrorMsg("打印出错,请重新打印!");
            }
        }
Exemple #3
0
        //打印
        private void printTool_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgv.Rows.Count == 0)
                {
                    dgv_show();
                }

                var           dc           = new BathDBDataContext(LogIn.connectionString);
                string        companyName  = LogIn.options.companyName;
                List <string> printColumns = new List <string>();
                foreach (DataGridViewColumn dgvCol in dgv.Columns)
                {
                    printColumns.Add(dgvCol.HeaderText);
                }

                dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

                string now = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                PrintReceipt.Print_DataGridView("客房押金表", dgv, now, now, companyName);
                //BathClass.set_dgv_fit(dgv);
                dgv.Rows.Clear();
            }
            catch
            {
                BathClass.printErrorMsg("打印出错,请重新打印!");
            }
        }
Exemple #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var reportData = new ReportDataSource();
            var dsReceipt  = new PrintReceipt();

            dsReceipt.BeginInit();
            reportData.Name        = "dsReceipt";
            reportData.Value       = dsReceipt.up_PrintReceipt;
            Receipt.ProcessingMode = ProcessingMode.Local;
            Receipt.LocalReport.DataSources.Clear();
            Receipt.LocalReport.DataSources.Add(reportData);
            Receipt.LocalReport.ReportEmbeddedResource = "StudioAdvanced.rptReceipt.rdlc";
            Receipt.LocalReport.ReportPath             = @".../.../Reports/rptReceipt.rdlc";
            var printReceiptTableAdapter = new up_PrintReceiptTableAdapter {
                ClearBeforeFill = true
            };

            if (Data.Instance.Connection.State == ConnectionState.Open)
            {
                Data.Instance.Connection.Close();
            }
            printReceiptTableAdapter.Fill(dsReceipt.up_PrintReceipt);
            dsReceipt.EndInit();
            Receipt.RefreshReport();
            txtEmail.Text = Data.Instance.GetFamilyEmail(FamilyID);
        }
        public JsonResult GetPrintReportData(string BookingID)
        {
            List <PrintReceipt> objListPrintReceipt = new List <PrintReceipt>();
            PrintReceipt        objPrintReceipt;

            string    xmlData   = "<ebooking><actionname>printreceipt</actionname><roid>" + BookingID + "</roid></ebooking>";
            ReportDAL objReport = new ReportDAL();

            try
            {
                DataTable objdt = objReport.GetPrintReceiptData(xmlData).Tables[0];
                if (objdt.Rows.Count > 0)
                {
                    foreach (DataRow dr in objdt.Rows)
                    {
                        objPrintReceipt = new PrintReceipt();
                        objPrintReceipt.OrderReceiptNo  = Convert.ToString(dr["OrderReceiptNo"]);
                        objPrintReceipt.ClientName      = Convert.ToString(dr["ClientName"]);
                        objPrintReceipt.Address         = Convert.ToString(dr["Address"]);
                        objPrintReceipt.City            = Convert.ToString(dr["City"]);
                        objPrintReceipt.Phone           = Convert.ToString(dr["Phone"]);
                        objPrintReceipt.Zip             = Convert.ToString(dr["Zip"]);
                        objPrintReceipt.BookedBy        = Convert.ToString(dr["BookedBy"]);
                        objPrintReceipt.BookedBy        = Convert.ToString(dr["BookedBy"]);
                        objPrintReceipt.REVISION_NUMBER = Convert.ToString(dr["REVISION_NUMBER"]);
                        objPrintReceipt.IsClassified    = Convert.ToString(dr["isClassified"]);
                        objPrintReceipt.VATNumber       = Convert.ToString(dr["VATNumber"]);
                        objPrintReceipt.Premia          = Convert.ToString(dr["Premia"]);
                        objPrintReceipt.Size            = Convert.ToString(dr["Size"]);
                        objPrintReceipt.Publication     = Convert.ToString(dr["Publication"]);
                        objPrintReceipt.AdTypeName      = Convert.ToString(dr["AdTypeName"]);
                        objPrintReceipt.Pubdate         = Convert.ToString(dr["Pubdate"]);
                        objPrintReceipt.Cost            = Convert.ToString(dr["Cost"]);
                        objPrintReceipt.VatAmount       = Convert.ToString(dr["VatAmount"]);
                        objPrintReceipt.Total           = Convert.ToString(dr["Total"]);
                        objPrintReceipt.Date            = Convert.ToString(dr["Date"]);
                        objPrintReceipt.AgencyName      = Convert.ToString(dr["AgencyName"]);
                        objPrintReceipt.AgencyCode      = Convert.ToString(dr["AgencyCode"]);
                        objPrintReceipt.Category1       = Convert.ToString(dr["Category1"]);
                        objPrintReceipt.Category2       = Convert.ToString(dr["Category2"]);
                        objPrintReceipt.Material        = Convert.ToString(dr["Material"]);
                        objListPrintReceipt.Add(objPrintReceipt);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(Json(objListPrintReceipt));
        }
        private async Task UploadSamplePrintResponseFile()
        {
            var samplePrintResponse = new PrintReceipt()
            {
                Batch = new BatchData()
                {
                    BatchNumber           = 1,
                    BatchDate             = DateTime.Parse("2020-01-31T13:30:00.0000000Z"),
                    PostalContactCount    = 22,
                    TotalCertificateCount = 48,
                    ProcessedDate         = DateTime.Parse("2020-02-03T15:30:00.0000000Z")
                }
            };

            var filename = "PrintBatchResponse-001-3101201330.json";
            var path     = $"{_printResponseDirectory}/Samples/{filename}";

            await _blobFileTransferClient.UploadFile(JsonConvert.SerializeObject(samplePrintResponse), path);
        }
Exemple #7
0
        static void Main(string[] args)
        {
            //Create tax rate based on the user input
            ChargeRate chargeRate = CreatechargeRate();

            if (chargeRate != null)
            {
                try
                {
                    IList <IProduct> listOfProducts = AddProductsBasedOnUserInput(chargeRate);

                    PrintReceipt.PrintReceiptWithCalculatedTax(listOfProducts, chargeRate);
                }

                catch (Exception)
                {
                    Console.WriteLine("--- WARNING --- Something went wrong!!!\n");

                    //TODO: Error handling for: product line input.
                }
            }

            Console.ReadKey();
        }
Exemple #8
0
        public void Execute()
        {
            OrderManager     manager   = OrderManagerFactory.Create();
            Order            order     = new Order();
            DateTime         orderDate = new DateTime().Date;
            Calculations     calculate = new Calculations();
            PrintReceipt     print     = new PrintReceipt();
            AddOrderResponse response  = new AddOrderResponse();


            while (true)
            {
                Console.Clear();
                Console.WriteLine("Add an order");
                Console.WriteLine(TextHelper.ConsoleBar);
                Console.WriteLine("Please enter the following information....");
                Console.WriteLine();

                while (true)
                {
                    Console.WriteLine("Date of Order: ");
                    if (DateTime.TryParse(Console.ReadLine(), out orderDate))
                    {
                        order.Date = orderDate;
                        break;
                    }

                    Console.WriteLine("That was not a valid date. Press any key to continue...");
                    Console.ReadKey();
                }

                while (true)
                {
                    Console.Clear();
                    Console.WriteLine("Customer Name: ");
                    string customerName = Console.ReadLine();

                    order.CustomerName = customerName;

                    if (String.IsNullOrWhiteSpace(order.CustomerName))
                    {
                        Console.WriteLine("You did not enter anything! Press any key to continue...");
                        Console.ReadKey();
                    }

                    else
                    {
                        break;
                    }
                }

                List <Taxes> taxes = new List <Taxes>();
                taxes = ReadFromTaxesFile.ReadTaxes(FilePaths.TaxesFilePath);
                Console.Clear();
                Console.WriteLine("We service the states of...");
                foreach (var tax in taxes)
                {
                    Console.WriteLine(tax.StateAbbreviation + " ");
                }
                Console.WriteLine("\nPlease enter your state (use abbreviation): ");
                order.State = Console.ReadLine().ToUpper();

                List <Product> products = new List <Product>();
                products = ReadFromProductsFile.ReadProducts(FilePaths.ProductsFilePath);
                Console.Clear();
                Console.WriteLine("Products currently in stock:");
                foreach (var product in products)
                {
                    Console.WriteLine(product.ProductType + " ");
                }

                Console.WriteLine("\nPlease enter your product selection:");
                order.ProductType = Console.ReadLine();

                while (true)
                {
                    Console.Clear();
                    Console.WriteLine("Enter the area of the floor (sq ft). Minimun order is 100: ");
                    decimal area;
                    if (decimal.TryParse(Console.ReadLine(), out area))
                    {
                        order.Area = area;
                        break;
                    }
                    else
                    {
                        Console.WriteLine("That was not a valid entry! Press any key to continue...");
                        Console.ReadKey();
                        continue;
                    }
                }

                response = manager.AddOrder(order.Date, order.CustomerName, order.State, order.ProductType, order.Area);
                if (!response.success)
                {
                    Console.WriteLine("There was an error with your order...");
                    Console.WriteLine(response.message);
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                }
                else
                {
                    break;
                }
            }

            order = calculate.MakeCalculations(order, order.Date, order.CustomerName, order.State, order.ProductType, order.Area);
            while (true)
            {
                print.Print(order);
                Console.WriteLine("Are you sure you want to place this order (Y/N)? ");
                string userResponse = Console.ReadLine().ToUpper();
                switch (userResponse)
                {
                case "Y":
                    AddOrderFile addOrder = new AddOrderFile();
                    addOrder.AddOrderToFile(response.Orders, order, order.Date);
                    Console.WriteLine("Order has been saved! Press any key to continue...");
                    Console.ReadKey();
                    break;

                case "N":
                    Console.WriteLine("Order has been canceled. Press any key to continue...");
                    Console.ReadKey();
                    break;

                default:
                    Console.WriteLine("That was not a valid choice. Press any key to try again...");
                    Console.ReadKey();
                    continue;
                }
                break;
            }
        }
Exemple #9
0
        private void InvoicePrinting(
            Customer customer,
            string invoiceNumber,
            DateTime invoiceDate,
            float discountPercentage,
            float depositAmount,
            float paidAmount,
            float returnAmount,
            bool isDeposit)
        {
            bool issueReceipt;
            var issueReceiptStr = AppContext.IssueReceipt;
            bool.TryParse(issueReceiptStr, out issueReceipt);
            if(!issueReceipt)
                return;

            var receiptTemplate = AppContext.ReceiptTemplate;
            if (string.IsNullOrEmpty(receiptTemplate))
                receiptTemplate = Resources.ConstReceiptTemplate1;

            if (receiptTemplate.Equals(Resources.ConstReceiptTemplate1))
            {
                //Print
                double amountSold = paidAmount - returnAmount;
                //amountSold = amountSold/(1 - discountPercentage/100);

                var printReceipt = new PrintReceipt
                {
                    InvoiceNumber = invoiceNumber,
                    Cashier = AppContext.User.LogInName,
                    PrintDate = DateTime.Now.ToString("dd/MM/yyyy HH:mm", AppContext.CultureInfo),
                    Counter = AppContext.Counter.CounterName,
                    CustomerInfo =
                        ((string.IsNullOrEmpty(customer.CustomerName)
                              ? string.Empty
                              : customer.CustomerName) +
                         (string.IsNullOrEmpty(customer.PhoneNumber)
                              ? string.Empty
                              : " | " + customer.PhoneNumber)),
                    AmountSold =
                        amountSold.ToString("N", AppContext.CultureInfo),
                    AmountPaid =
                        (paidAmount).ToString("N",
                                                           AppContext.
                                                               CultureInfo),
                    AmountReturn = returnAmount.ToString("N", AppContext.CultureInfo),
                    Discount = (discountPercentage + " %"),
                    //AmountSubTotal =
                    //    ((saleOrder.AmountSoldInt * 100) / (100 - discountPercentage)).ToString("N",
                    //                                                                        AppContext
                    //                                                                            .
                    //                                                                            CultureInfo),
                    AmountSubTotal =
                        (((paidAmount - returnAmount) * 100) / (100 - discountPercentage)).ToString("N",
                                                                                            AppContext
                                                                                                .
                                                                                                CultureInfo),
                    BindingListObj = _saleItemBindingList
                };

                printReceipt.InializeReceiptPrinting();
                //var fileName = Resources.ConstReceiptExcelFile;
                //printReceipt.PrintReceiptHandler(
                //    Application.StartupPath + @"\" + fileName,
                //    string.Empty);
            }
            else
            {
                var fileName = isDeposit ? Resources.ConstDepositExcelFile : Resources.ConstSaleExcelFile;

                //Print
                var printInvoice = new PrintInvoice();
                printInvoice.ExcelInvoicePrintingHandler(
                    AppContext.Counter.ReceiptPrinter,
                    Application.StartupPath + @"\" + fileName,
                    string.Empty,
                    customer.CustomerName,
                    customer.Address,
                    invoiceNumber,
                    invoiceDate,
                    discountPercentage,
                    depositAmount,
                    paidAmount,
                    _saleItemBindingList,
                    isDeposit);
            }
        }
Exemple #10
0
        public IEnumerable <PrintReceipt> Post(BookingDetail objbookingDetail)
        {
            Dictionary <string, object> OrderDetails        = new Dictionary <string, object>();
            List <PrintReceipt>         objListPrintReceipt = new List <PrintReceipt>();
            PrintReceipt objPrintReceipt;

            try
            {
                HomeDAL objHomeDAL = new HomeDAL();
                string  strXml     = string.Empty;
                strXml += "<ebooking><actionname>printreceipt</actionname><receiptid>" + objbookingDetail.ReceiptID + "</receiptid></ebooking>";
                DataTable objdt = objHomeDAL.eBookingActions(strXml).Tables[0];

                if (objdt.Rows.Count > 0)
                {
                    //objOpenOder.IsValid = Convert.ToInt16(objdt.Rows[0]["ErrorFlag"]);
                    //if (objOpenOder.IsValid == 1)
                    //{
                    //    objOpenOder.ErrorMessage = Convert.ToString(objdt.Rows[0]["ErrorMessage"]);
                    //    objOpenOder.IsValid = Convert.ToInt16(objdt.Rows[0]["ErrorFlag"]);
                    //    objListOpenOrder.Add(objOpenOder);
                    //    OrderDetails.Add("OpenOrder", objListOpenOrder);
                    //}
                    //else
                    //{
                    foreach (DataRow dr in objdt.Rows)
                    {
                        objPrintReceipt = new PrintReceipt();
                        objPrintReceipt.OrderReceiptNo  = Convert.ToString(dr["OrderReceiptNo"]);
                        objPrintReceipt.ClientName      = Convert.ToString(dr["ClientName"]);
                        objPrintReceipt.Address         = Convert.ToString(dr["Address"]);
                        objPrintReceipt.City            = Convert.ToString(dr["City"]);
                        objPrintReceipt.Phone           = Convert.ToString(dr["Phone"]);
                        objPrintReceipt.Zip             = Convert.ToString(dr["Zip"]);
                        objPrintReceipt.BookedBy        = Convert.ToString(dr["BookedBy"]);
                        objPrintReceipt.BookedBy        = Convert.ToString(dr["BookedBy"]);
                        objPrintReceipt.REVISION_NUMBER = Convert.ToString(dr["REVISION_NUMBER"]);
                        objPrintReceipt.IsClassified    = Convert.ToString(dr["isClassified"]);
                        objPrintReceipt.VATNumber       = Convert.ToString(dr["VATNumber"]);
                        objPrintReceipt.Premia          = Convert.ToString(dr["Premia"]);
                        objPrintReceipt.Size            = Convert.ToString(dr["Size"]);
                        objPrintReceipt.Publication     = Convert.ToString(dr["Publication"]);
                        objPrintReceipt.AdTypeName      = Convert.ToString(dr["AdTypeName"]);
                        objPrintReceipt.Pubdate         = Convert.ToString(dr["Pubdate"]);
                        objPrintReceipt.Cost            = Convert.ToString(dr["Cost"]);
                        objPrintReceipt.VatAmount       = Convert.ToString(dr["VatAmount"]);
                        objPrintReceipt.Total           = Convert.ToString(dr["Total"]);
                        objPrintReceipt.Date            = Convert.ToString(dr["Date"]);
                        objPrintReceipt.AgencyName      = Convert.ToString(dr["AgencyName"]);
                        objPrintReceipt.AgencyCode      = Convert.ToString(dr["AgencyCode"]);
                        objPrintReceipt.Category1       = Convert.ToString(dr["Category1"]);
                        objPrintReceipt.Category2       = Convert.ToString(dr["Category2"]);
                        objPrintReceipt.Material        = Convert.ToString(dr["Material"]);
                        objListPrintReceipt.Add(objPrintReceipt);
                    }
                }
            }
            catch (Exception ex)
            {
                Utility.ReportError("PrintReceiptController::Post:", ex);
            }
            return(objListPrintReceipt);
        }
Exemple #11
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            ReadCmdSendTypeFromOptionsTxt();

            EagleAPI.LogWrite("");//时间间隔

            //时间调校
            Thread thGetServerTime = new Thread(new ThreadStart(Options.gbOption.isDifferCompareTimeWithServerThan12));

            thGetServerTime.Start();
            //提示新订单ToolStripMenuItem.Checked = EagleAPI2.initNewOrder();

            EagleAPI.LogWrite("");//时间间隔

            try
            {
                GlobalVar.mainMenu = this.MainMenu;
                //this.Text = Properties.Resources.MainFormTitle;//commentted by king

                //EagleAPI.GetPrintConfig();
                //EagleAPI.GetOptions();

                {
                    //这里控制可用菜单
                    int iConflict = 0;
                    if (md.b_001)
                    {
                        iConflict++;
                    }
                    if (md.b_006)
                    {
                        iConflict++;
                    }
                    if (md.b_007)
                    {
                        iConflict++;
                    }
                    if (md.b_009)
                    {
                        iConflict++;
                    }
                    Model.md.SetBoolVars();

                    if (GlobalVar.serverAddr == GlobalVar.ServerAddr.ZhenZhouJiChang)
                    {
                        BookTicket.bIbe = false;
                    }
                    //BookTicket.bIbe = Model.md.b_00E;//IBE


                    this.Visible = Model.md.b_004;
                    #region 终端功能控制


                    if (Model.md.b_004)
                    {                                                        //若有黑屏
                        this.tsb_WebBrowser.Enabled        = !md.b_00H;
                        this.style3.Enabled                = Model.md.b_F12; //S3按钮
                        this.mi_style3.Enabled             = Model.md.b_F12;
                        this.pICCToolStripMenuItem.Visible = Model.md.b_001;
                        this.miPrint.Visible               = Model.md.b_002;
                        this.miPrintReceipt.Visible        = Model.md.b_003;
                        //this.miPrintInsurance.Visible = Model.md.b_005;
                        this.Book.Enabled = Model.md.b_006;                   //简版

                        this.toolStripButton_ClearQ.Enabled = Model.md.b_QQQ; //自动清Q
                        this.永安保险ToolStripMenuItem.Visible  = Model.md.b_007;
                        this.新华保险ToolStripMenuItem.Visible  = Model.md.b_009;

                        this.交通意外伤害保险单ToolStripMenuItem.Visible = Model.md.b_B01;//华安
                        if (!Model.md.b_B01)
                        {
                            this.华安ToolStripMenuItem.Visible = false;
                        }

                        this.航空旅客人身意外伤害保险单ToolStripMenuItem.Visible = Model.md.b_B02;//人寿
                        if (!Model.md.b_B02)
                        {
                            this.人寿ToolStripMenuItem.Visible = false;
                        }

                        this.出行无忧ToolStripMenuItem.Visible = Model.md.b_B04;         //都帮航意险

                        this.航翼网航空意外伤害保险单ToolStripMenuItem.Visible = Model.md.b_B03; //都邦出行无忧
                        this.出行乐ToolStripMenuItem.Visible          = Model.md.b_B05; //都帮出行乐

                        if (!(Model.md.b_B03 || Model.md.b_B04 || Model.md.b_B05))
                        {
                            this.都邦ToolStripMenuItem.Visible = false;
                        }

                        this.SunShineToolStripMenuItem.Visible = Model.md.b_B07;//一路阳光

                        if (!(Model.md.b_B07))
                        {
                            this.阳光ToolStripMenuItem.Visible = false;
                        }

                        this.航翼网会员保险卡ToolStripMenuItem.Visible = Model.md.b_B08;//航翼网会员保险卡
                        if (!(Model.md.b_B08))
                        {
                            this.航翼网ToolStripMenuItem.Visible = false;
                        }

                        this.新华人寿ToolStripMenuItem.Visible  = Model.md.b_B09; //易格网会员保险卡
                        this.安邦商行通ToolStripMenuItem.Visible = Model.md.b_B0B; //安邦商行通

                        this.pICCToolStripMenuItem.Visible = Model.md.b_B0D;  //易格PICC
                        if (!(Model.md.b_B09 || Model.md.b_B0B || Model.md.b_B0D))
                        {
                            this.易格网ToolStripMenuItem.Visible = false;
                        }

                        this.周游列国.Visible = Model.md.b_B06;//周游列国
                        //if (!(Model.md.b_B06))
                        this.平安ToolStripMenuItem.Visible = false;

                        this.航空意外险ToolStripMenuItem.Visible = Model.md.b_B0A;//太平洋意外险
                        if (!(Model.md.b_B0A))
                        {
                            this.太平洋ToolStripMenuItem.Visible = false;
                        }

                        if (EagleAPI.GetCmdName("etdz", GlobalVar.loginLC.VisuableCommand) == "" || EagleAPI.GetCmdName("etdz", GlobalVar.loginLC.VisuableCommand) == null)
                        {
                            toolStripButton2.Enabled = false;
                        }

                        if (!GlobalVar.bPekGuangShunUser)
                        {
                            toolStripButton1.Visible = toolStripSeparator16.Visible = false;
                        }

                        this.cTICToolStripMenuItem.Visible = Model.md.b_0CTI;//呼叫中心
                    }
                    //else if (iConflict > 1)
                    //{//冲突,没有黑屏下,不能同时为保险及简版用户

                    //    MessageBox.Show("模块分配冲突,请与管理员联系!");
                    //    Application.Exit();
                    //}
                    else if (Model.md.b_006)
                    {//没黑屏,仅为简版用户
                        BookTicket bt = new BookTicket();
                        bt.Show();
                        BookTicket.bIbe = !Model.md.b_00F;
                        MessageBox.Show("您的帐户余额为:¥" + GlobalVar.f_CurMoney);
                    }

                    else if (Model.md.b_001)
                    {//没黑屏,仅为PICC保险打印
                        PrintHyx.PrintPICC2 pp = new ePlus.PrintHyx.PrintPICC2();
                        pp.Show();
                    }
                    else if (Model.md.b_007)
                    {//没黑屏,仅为永安保险打印
                        PrintHyx.Yongan ya = new ePlus.PrintHyx.Yongan();
                        ya.Show();
                    }
                    else if (Model.md.b_009)
                    {//新华保险
                        PrintHyx.NewChina nc = new ePlus.PrintHyx.NewChina();
                        nc.Show();
                    }
                    else if (Model.md.b_B01)
                    {//华安保险
                        PrintHyx.SinoSafe ss = new ePlus.PrintHyx.SinoSafe();
                        ss.Show();
                    }
                    else if (Model.md.b_B02)
                    {//人寿航意险
                        PrintHyx.ChinaLife cl = new ePlus.PrintHyx.ChinaLife();
                        cl.Show();
                    }
                    else if (Model.md.b_B03)
                    {//都帮航意险
                        PrintHyx.DuBang01 db1 = new ePlus.PrintHyx.DuBang01();
                        db1.Show();
                    }
                    else if (Model.md.b_B04)
                    {//都帮出行无忧
                        PrintHyx.DuBang02 db2 = new ePlus.PrintHyx.DuBang02();
                        db2.Show();
                    }
                    else if (Model.md.b_B05)
                    {//都帮出行乐
                        PrintHyx.DuBang02 db3 = new ePlus.PrintHyx.DuBang02();
                        db3.Dubang03();
                        db3.Show();
                    }
                    else if (Model.md.b_B06)
                    {
                        PrintHyx.PingAn01 pa = new ePlus.PrintHyx.PingAn01();
                        pa.Show();
                    }
                    else if (Model.md.b_B07)
                    {
                        PrintHyx.Sunshine ins = new ePlus.PrintHyx.Sunshine();
                        ins.Show();
                    }
                    else if (Model.md.b_B08)
                    {
                        PrintHyx.Hangyiwang ins = new ePlus.PrintHyx.Hangyiwang();
                        ins.Show();
                    }
                    else if (Model.md.b_B09)
                    {
                        PrintHyx.bxLogin bx = new ePlus.PrintHyx.bxLogin();
                        if (bx.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }

                        PrintHyx.EagleIns ins = new ePlus.PrintHyx.EagleIns();
                        ins.Text = ins.lb公司名称.Text = "新华人寿保险股份有限公司意外伤害保险承保告知单";
                        ins.Show();
                    }
                    else if (Model.md.b_B0A)
                    {
                        PrintHyx.Pacific ins = new ePlus.PrintHyx.Pacific();
                        ins.Show();
                    }
                    else if (Model.md.b_B0B)
                    {
                        PrintHyx.EagleAnbang ea = new ePlus.PrintHyx.EagleAnbang();
                        ea.Show();
                    }
                    else if (Model.md.b_003)//只显示行程单打印
                    {
                        PrintReceipt pr = new PrintReceipt();

                        pr.Show();
                    }
                    else
                    {//无模块使用
                     //MessageBox.Show("您无权使用该系统,请让您的管理员打开必要权限");
                     //Application.Exit();
                    }

                    #endregion

                    this.ttsddbBookModel.Text = this.简易模式ToolStripMenuItem.Text;
                    GlobalVar.commandSendtype = GlobalVar.CommandSendType.Fast;
                    //
                    //this.ttsddbBookModel.Text = this.普通模式ToolStripMenuItem.Text;
                    //GlobalVar.commandSendtype = GlobalVar.CommandSendType.A;
                }

#if receipt
                this.Visible = false;
                PrintReceipt pr = new PrintReceipt();
                pr.Text = "ClawSoft - 行程单打印";
                pr.Icon = new Icon(Application.StartupPath + "\\claw.ico");
                pr.Show();
#endif
                if (Options.GlobalVar.QueryType == XMLConfig.QueryType.Eterm)
                {
                    #region//配置选择按钮增加ip
                    {
                        string[]      ipls    = GlobalVar.loginLC.IPsString.Split('~');
                        List <string> lsip    = new List <string>();
                        List <string> addedIP = new List <string>();
                        for (int i = 0; i < ipls.Length; i++)
                        {
                            string[] cfgs = EagleAPI.GetConfigNumberByIP(ipls[i]).Split('~');//相同IP不同配置也能得到
                            if (addedIP.Contains(ipls[i]))
                            {
                                continue;
                            }
                            addedIP.Add(ipls[i]);
                            for (int j = 0; j < cfgs.Length; j++)
                            {
                                lsip.Add(cfgs[j]);
                            }
                        }
                        //对cfg排序
                        lsip.Sort();
                        mi_CONFIG.DropDownItems.Add("全部配置");
                        for (int i = 0; i < lsip.Count; i++)
                        {
                            //mi_CONFIG.DropDownItems.Add(EagleAPI.GetConfigNumberByIP(ipls[i]));
                            if (md.b_00I || lsip[i].ToLower().IndexOf("tao") >= 0 || GlobalVar.serverAddr == GlobalVar.ServerAddr.ZhenZhouJiChang || GlobalVar.serverAddr == GlobalVar.ServerAddr.KunMing)
                            {
                                mi_CONFIG.DropDownItems.Add(lsip[i]);
                            }
                        }



                        int theLastOne = lsip.Count - 1;
                        if (lsip.Count > 0)
                        {
                            //应指定当前所连接服务器的可用cfg的最后一个,而不是未排序的ip的最后一个


                            for (int i = lsip.Count - 1; i > 0; i--)
                            {
                                XmlDocument xd = new XmlDocument();
                                xd.LoadXml(GlobalVar.loginXml);
                                XmlNode xn = xd.SelectSingleNode("eg").SelectSingleNode("IPS");
                                for (int j = 0; j < xn.ChildNodes.Count; j++)
                                {
                                    if (lsip[i].Trim() == xn.ChildNodes[j].SelectSingleNode("PeiZhi").InnerText.Trim())
                                    {
                                        theLastOne = i;

                                        break;
                                    }
                                }
                            }
                            try
                            {
#if 全部配置
                                ((ToolStripMenuItem)(mi_CONFIG.DropDownItems[theLastOne + 1])).Checked = true;//启动时为最后一个,对黑屏用户有效

                                mi_CONFIG.Text = mi_CONFIG.DropDownItems[theLastOne + 1].Text;
                                GlobalVar.officeNumberCurrent = mi_CONFIG.Text;
#else
                                //bool bSpecifyDefaultConfig = false;
                                //for (int i = 0; i < mi_CONFIG.DropDownItems.Count; i++)
                                //{

                                //}
                                mi_CONFIG.Text = "全部配置";
                                ((ToolStripMenuItem)(mi_CONFIG.DropDownItems[0])).Checked = true;
#endif
                            }
                            catch
                            {
                                ((ToolStripMenuItem)(mi_CONFIG.DropDownItems[theLastOne])).Checked = true;
                                mi_CONFIG.Text = mi_CONFIG.DropDownItems[theLastOne].Text;
                                GlobalVar.officeNumberCurrent = mi_CONFIG.Text;
                            }
                        }
                        mi_CONFIG.DropDownItems.Add("-");
                        GlobalAPI.NotGlobal ng      = new ePlus.GlobalAPI.NotGlobal();
                        List <string>       ipgroup = ng.GetConfigGroupsBy(lsip);
                        for (int iip = 0; iip < ipgroup.Count; iip++)
                        {
                            //#if RWY
                            //                        break;
                            //#endif
                            mi_CONFIG.DropDownItems.Add(ipgroup[iip]);
                        }
                    }
                    #endregion

                    //Thread th = new Thread(new ThreadStart(connect));
                    //th.Start();
                    connect_1();
                }

#if !RWY
                this.Text = GlobalVar.exeTitle + "(服务器位置:" + GlobalVar.loginLC.SrvName + ")";
#endif
                //if (GlobalVar.loginLC.SrvName.IndexOf("外围") >= 0) BookTicket.bIbe = true;
                //timerNotice1();
            }
            catch (Exception ex1)
            {
                EagleAPI.LogWrite(ex1.Message);//时间间隔
            }
            initStatusBar();
            //SetNkgMode();

            instance = this;
            SetIA10();
            ShowIA();                           //added by king
            EagleAPI.LogWrite("init finished"); //时间间隔
        }
Exemple #12
0
        public void Execute()
        {
            OrderManager        manager = OrderManagerFactory.Create();
            Order               order   = new Order();
            bool                orderExists;
            EditOrderInFile     editInFile     = new EditOrderInFile();
            DateTime            orderDate      = new DateTime().Date;
            Calculations        caluclate      = new Calculations();
            PrintReceipt        print          = new PrintReceipt();
            OrderLookupResponse lookupResponse = new OrderLookupResponse();
            EditOrderResponse   editResponse   = new EditOrderResponse();
            EditOrderRule       editRules      = new EditOrderRule();
            List <Order>        Orders         = new List <Order>();
            bool                exception      = false;



            while (true)
            {
                while (true)
                {
                    Console.Clear();
                    Console.WriteLine("Edit an order");
                    Console.WriteLine(TextHelper.ConsoleBar);
                    Console.WriteLine("Please enter the following information....");
                    Console.WriteLine();

                    Console.WriteLine("Date of order: ");
                    if (DateTime.TryParse(Console.ReadLine(), out orderDate))
                    {
                        order.Date = orderDate;
                        break;
                    }
                    else
                    {
                        Console.WriteLine("You did not enter a valid date format. Press any key to continue...");
                        Console.ReadKey();

                        Console.Clear();
                    }
                }



                try
                {
                    lookupResponse = manager.LookupOrder(order.Date);
                    if (lookupResponse != null)
                    {
                        Orders = lookupResponse.Orders;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("You cannot proceed. Please contact IT.");
                    Console.WriteLine(ex.Message);
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                    exception = true;
                    break;
                }

                if (lookupResponse.success)
                {
                    break;
                }
                else
                {
                    Console.WriteLine("An error occurred.");
                    Console.WriteLine(lookupResponse.message);
                    continue;
                }
            }

            if (exception == false)
            {
                while (true)
                {
                    Console.Clear();
                    ConsoleIO.DisplayOrderDetails(lookupResponse.Orders);
                    int orderNumber;

                    Console.WriteLine("Order number: ");
                    if (int.TryParse(Console.ReadLine(), out orderNumber))
                    {
                        order.OrderNumber = orderNumber;
                    }
                    else
                    {
                        Console.WriteLine("You did not enter a number. Press any key to continue...");
                        Console.ReadKey();
                    }


                    string filePath = FilePath.GetFilePath(order.Date);
                    Orders      = ReadOrdersFromFile.ReadOrders(filePath);
                    orderExists = editInFile.CheckOrderNumberExists(Orders, order.OrderNumber);
                    if (!orderExists)
                    {
                        Console.WriteLine("That order number does not exist for the date you entered. Press any key to continue...");
                        Console.ReadKey();
                        continue;
                    }
                    else
                    {
                        Order singleOrder = Orders.Where(ord => ord.OrderNumber == order.OrderNumber).Single();
                        order = singleOrder;
                    }
                    order        = editInFile.GetNewOrderInfoFromUser(order);
                    order        = caluclate.EditCalculations(order, order.Date, order.CustomerName, order.State, order.ProductType, order.Area);
                    editResponse = editRules.EditRules(order.Date, order.CustomerName, order.State, order.ProductType, order.Area, editResponse);

                    if (!editResponse.success)
                    {
                        Console.WriteLine("An error occurred: ");
                        Console.WriteLine(editResponse.message);
                        Console.WriteLine("Press any key to continue...");
                        Console.ReadKey();
                    }
                    else
                    {
                        break;
                    }
                }



                while (true)
                {
                    print.Print(order);

                    Console.WriteLine("Is the updated order correct (Y/N)?");
                    string userInput = Console.ReadLine().ToUpper();
                    switch (userInput)
                    {
                    case "Y":
                        EditOrderFile editOrder = new EditOrderFile();
                        editOrder.EditOrderToFile(Orders, order.Date);
                        Console.WriteLine("Edit has been saved! Press any key to continue...");
                        Console.ReadKey();
                        break;

                    case "N":
                        Console.WriteLine("Edit has been canceled. Press any key to continue...");
                        Console.ReadKey();
                        break;

                    default:
                        Console.WriteLine("That was not a valid entry! Press any key to continue...");
                        Console.ReadKey();
                        continue;
                    }
                    break;
                }
            }
        }
Exemple #13
0
        public void Execute()
        {
            OrderManager        manager        = OrderManagerFactory.Create();
            DateTime            orderDate      = new DateTime().Date;
            Order               order          = new Order();
            List <Order>        Orders         = new List <Order>();
            OrderLookupResponse lookupResponse = new OrderLookupResponse();
            bool            orderExists;
            EditOrderInFile editInFile = new EditOrderInFile();
            PrintReceipt    print      = new PrintReceipt();
            EditOrderFile   editFile   = new EditOrderFile();


            Console.Clear();
            Console.WriteLine("Edit an order");
            Console.WriteLine(TextHelper.ConsoleBar);
            Console.WriteLine("Please enter the following information....");
            Console.WriteLine();

            while (true)
            {
                Console.WriteLine("Date of order: ");
                if (DateTime.TryParse(Console.ReadLine(), out orderDate))
                {
                    order.Date = orderDate;
                    break;
                }
                Console.WriteLine("You did not enter a valid date format. Press any key to continue...");
                Console.ReadKey();
            }

            while (true)
            {
                lookupResponse = manager.LookupOrder(order.Date);
                if (lookupResponse != null)
                {
                    Orders = lookupResponse.Orders;
                }

                if (lookupResponse.success)
                {
                    break;
                }
                else
                {
                    Console.WriteLine("An error occurred.");
                    Console.WriteLine(lookupResponse.message);
                    continue;
                }
            }
            while (true)
            {
                Console.Clear();
                ConsoleIO.DisplayOrderDetails(lookupResponse.Orders);
                int orderNumber;
                Console.WriteLine("Order number: ");
                if (int.TryParse(Console.ReadLine(), out orderNumber))
                {
                    order.OrderNumber = orderNumber;
                }
                else
                {
                    Console.WriteLine("You did not enter a number. Press any key to continue...");
                    Console.ReadKey();
                }


                string filePath = FilePath.GetFilePath(order.Date);
                Orders      = ReadOrdersFromFile.ReadOrders(filePath);
                orderExists = editInFile.CheckOrderNumberExists(Orders, order.OrderNumber);
                if (!orderExists)
                {
                    Console.WriteLine("That order number does not exist for the date you entered. Press any key to continue...");
                    Console.ReadKey();
                    continue;
                }
                else
                {
                    Order singleOrder = Orders.Where(ord => ord.OrderNumber == order.OrderNumber).Single();
                    order = singleOrder;
                }

                while (true)
                {
                    print.Print(order);
                    Console.WriteLine("Are you sure you want to delete this order? (Y/N)?");
                    string userInput = Console.ReadLine().ToUpper();
                    switch (userInput)
                    {
                    case "Y":
                        RemoveOrderFile remove = new RemoveOrderFile();
                        remove.RemoveOrderFromList(Orders, order, order.Date);
                        editFile.EditOrderToFile(Orders, order.Date);
                        Console.WriteLine("Remove has been saved! Press any key to continue...");
                        Console.ReadKey();
                        break;

                    case "N":
                        Console.WriteLine("Remove has been canceled. Press any key to continue...");
                        Console.ReadKey();
                        break;

                    default:
                        Console.WriteLine("That was not a valid entry! Press any key to continue...");
                        Console.ReadKey();
                        continue;
                    }
                    break;
                }
                break;
            }
        }