Beispiel #1
0
        public static void ReturnCheck(CheckTicket check, List <PayProduct> payProducts)
        {
            var returnCheck = new CheckTicket(check.CustomerId,
                                              check.BarCode,
                                              DateTime.Now,                   //check.Date,
                                              0,                              //check.PayBankChecks,
                                              0,                              //check.PayBankCards,
                                              0,                              //check.PayCash,
                                              0,                              //check.PayResto,
                                              0,                              //check.Pay1,
                                              0,                              //check.Pay2,
                                              0,                              //check.Pay3,
                                              0,                              //check.Pay4,
                                              0,                              //check.Pay5,
                                              0,                              //check.Pay6,
                                              0,                              //check.Pay7,
                                              0,                              //check.Pay8,
                                              0,                              //check.Pay9,
                                              0,                              //check.Pay10,
                                              0,                              //check.Pay11,
                                              0,                              //check.Pay12,
                                              0,                              //check.Pay13,
                                              0,                              //check.Pay14,
                                              0,                              //check.Pay15,
                                              0,                              //check.Pay16,
                                              0,                              //check.Pay17,
                                              0,                              //check.Pay18,
                                              0,                              //check.Pay19,
                                              0,                              //check.Pay20,
                                              check.CloseTicketCustomerId,
                                              -payProducts.Sum(p => p.Total), //check.TotalTtc,
                                              0                               //check.Rendu
                                              );

            returnCheck.BarCode       = GetBarCodeCheck();
            returnCheck.ReturnBarCode = check.BarCode;

            foreach (var n in payProducts.Select(p => new PayProduct(
                                                     p.IdCheckTicket,
                                                     p.ProductId,
                                                     p.Name,
                                                     p.Barcode,
                                                     -p.Qty,
                                                     p.Tva,
                                                     -p.PriceHt,
                                                     -p.Total,
                                                     p.ChecksTicketCustomerId,
                                                     p.ChecksTicketCloseTicketCustomerId,
                                                     0,
                                                     0)))
            {
                returnCheck.PayProducts.Add(n);
            }

            var checkelement = CheckTicket.ToCheckXElement(returnCheck);

            Document.GetXElement("checks").Add(checkelement);

            Document.Save(Path);
        }
Beispiel #2
0
        public WReturnProduct(object arg)
        {
            InitializeComponent();
            _check = (CheckTicket)arg;
            foreach (var n in _check.PayProducts.Select(e => new PayProduct(
                                                            e.IdCheckTicket,
                                                            e.ProductId,
                                                            e.Name,
                                                            e.Barcode,
                                                            e.Qty,
                                                            e.Tva,
                                                            e.PriceHt,
                                                            e.Total,
                                                            e.ChecksTicketCustomerId,
                                                            e.ChecksTicketCloseTicketCustomerId,
                                                            0,
                                                            0)))
            {
                //(e.IdCheckTicket, e.ProductId, e.Name, e.Barcode, e.Qty, e.Tva, e.PriceHt, e.Total, e.ChecksTicketCustomerId, 0, 0);
                _products.Add(n);
            }

            GridProducts.ItemsSource = _check.PayProducts;
            CollectionViewSource.GetDefaultView(GridProducts.ItemsSource).Refresh();

            GridReturnedProducts.ItemsSource = _returnedProducts;
            CollectionViewSource.GetDefaultView(GridReturnedProducts.ItemsSource).Refresh();

            BarCodeBox.Focus();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Welcome.WelcomeToAirport();
            string name = Console.ReadLine();
            string firstNames, lastName;

            SplitFullName.SplitName(name, out firstNames, out lastName);

            Console.WriteLine($"{firstNames}, welcome to check-in desk. Please answer for a few questions.");

            Console.WriteLine($"First of all, please input your date of birthday (yyyy,mm,d): ");
            Passport passport = new Passport();

            passport.DateOfBirth = CheckType.GetDateFromConsole();
            CheckDB.CheckDateOfBirth(passport);

            Console.WriteLine($"Are you have a visa, {firstNames}? (yes or no)");
            Visa visa = new Visa();

            visa.Status = CheckVisa.CheckOfVisa();

            Console.WriteLine($"{firstNames}, please input your passport number: ");
            passport.Number = Console.ReadLine();

            Console.WriteLine($"{firstNames}, now please input passport issued (yyyy,mm,d): ");
            passport.Issued = CheckType.GetDateFromConsole();

            Console.WriteLine($"{firstNames}, now please input passport expired (yyyy,mm,d): ");
            passport.Expired = CheckType.GetDateFromConsole();

            CheckPassport.CheckDatesOfPassport(passport);

            Console.WriteLine($"Are you have a online registration, {firstNames}? (yes or no)");
            Ticket ticket = new Ticket();

            ticket.NumberOfTicket = CheckTicket.CheckOnlineRegistration(ticket);

            Console.WriteLine($"\nDo you have any luggage, {firstNames}? (yes or no)");

            Bag bag = new Bag();

            CheckBag.CheckWeightOfBag(bag);

            Console.WriteLine($"{firstNames}, allright! Please go to security check. (any key)");
            Console.ReadKey();

            Console.WriteLine($"{firstNames}, welcome to security check. Open your case for examination, please." +
                              $"\nDo you have anything forbidden in your suitcase: drugs, guns, explosive materials? (yes or no)");
            SecurityEmployee security = new SecurityEmployee();

            security.ForbiddenItem = SecurityCheck.CheckForbiddenItem(security);

            Console.WriteLine($"{firstNames}, welcome to passport control. May I see your passport and ticket, please? (yes or no)");
            Passanger passanger = new Passanger(name, passport, ticket, visa, bag);
            PassportControlEmployee passportControlEmployee = new PassportControlEmployee();

            passportControlEmployee.Passanger = PassportControl.CheckPassanger(passanger);
        }
        private void ButtonClick(object sender, RoutedEventArgs e)
        {
            var check = listDetails.SelectedItem as CheckTicket;

            if (check != null)
            {
                new Class.ClassPrintCheck(new XDocument(CheckTicket.ToCheckXElement(check)), true);
            }
        }
Beispiel #5
0
        private static CheckTicket GetCheck(string barcode)
        {
            RepositoryCheck.GetDucument();

            var foundedCheckElement = RepositoryCheck.Document.GetXElements("checks", "check")
                                      .FirstOrDefault(c => c.GetXAttributeValue("barcodeCheck") == barcode);

            // Если в текущем чеке нет ищем в прошлом
            if (foundedCheckElement == null)
            {
                var dir = new DirectoryInfo(Path.Combine(Config.AppPath, "Data"));
                foreach (var yearDir in dir.GetDirectories().Where(d => IsDigitalName(d.Name)).OrderByDescending(p => p.CreationTime))
                {
                    foreach (var monthDir in yearDir.GetDirectories().OrderByDescending(p => p.CreationTime))
                    {
                        foreach (var file in monthDir.GetFiles().OrderByDescending(p => p.CreationTime))
                        {
                            var document = XDocument.Load(file.FullName);

                            foundedCheckElement = document.GetXElements("checks", "check")
                                                  .FirstOrDefault(c => c.GetXAttributeValue("barcodeCheck") == barcode);

                            if (foundedCheckElement != null)
                            {
                                break;
                            }
                        }

                        if (foundedCheckElement != null)
                        {
                            break;
                        }
                    }

                    if (foundedCheckElement != null)
                    {
                        break;
                    }
                }
            }

            return(foundedCheckElement != null
                ? CheckTicket.FromCheckXElement(foundedCheckElement, Guid.NewGuid(), Guid.NewGuid())
                : null);
        }
Beispiel #6
0
        public static XElement SetPaysAttributesBase(XElement checkElement, CheckTicket check)
        {
            foreach (var type in RepositoryTypePay.TypePays)
            {
                decimal val = 0;

                switch (type.NameCourt)
                {
                case "BankChecks":
                    val = check.PayBankChecks;
                    break;

                case "BankCards":
                    val = check.PayBankCards;
                    break;

                case "Cash":
                    val = check.PayCash;
                    break;

                case "Resto":
                    val = check.PayResto;
                    break;

                case "1":
                    val = check.Pay1;
                    break;

                case "2":
                    val = check.Pay2;
                    break;

                case "3":
                    val = check.Pay3;
                    break;

                case "4":
                    val = check.Pay4;
                    break;

                case "5":
                    val = check.Pay5;
                    break;

                case "6":
                    val = check.Pay6;
                    break;

                case "7":
                    val = check.Pay7;
                    break;

                case "8":
                    val = check.Pay8;
                    break;

                case "9":
                    val = check.Pay9;
                    break;

                case "10":
                    val = check.Pay10;
                    break;

                case "11":
                    val = check.Pay11;
                    break;

                case "12":
                    val = check.Pay12;
                    break;

                case "13":
                    val = check.Pay13;
                    break;

                case "14":
                    val = check.Pay14;
                    break;

                case "15":
                    val = check.Pay15;
                    break;

                case "16":
                    val = check.Pay16;
                    break;

                case "17":
                    val = check.Pay17;
                    break;

                case "18":
                    val = check.Pay18;
                    break;

                case "19":
                    val = check.Pay19;
                    break;

                case "20":
                    val = check.Pay20;
                    break;
                }

                if (val != 0)
                {
                    checkElement.Add(new XAttribute(type.NameCourt.Trim(), val));
                }
            }
            return(checkElement);
        }