示例#1
0
        public static void Close()
        {
            Mess = string.Empty;

            if (GlobalVar.IsOpen)
            {
                Mess += Properties.Resources.FuncCloseCashbox + Config.NameTicket + Environment.NewLine +
                        Environment.NewLine + Environment.NewLine;

                var otw = RepositoryOpenTicketWindow.GetCurrent();

                RepositoryCloseTicket.Close();
                RepositoryCheck.CloseTicket();
                //PrintService.PrintCloseTicket(closeTicket, Config.NameTicket);

                Mess += Properties.Resources.LabelOperationComplete + Environment.NewLine;

                if (otw != null)
                {
                    otw.DateOpen        = DateTime.Now;
                    otw.IsOpen          = false;
                    otw.IdTicketWindow  = Guid.Empty;
                    otw.IdTicketWindowG = Guid.Empty;
                    RepositoryOpenTicketWindow.Update(otw);
                    Mess += Config.NameTicket + " " + Properties.Resources.LabelCloseEnd.ToLower() + "..." +
                            Environment.NewLine;

                    GlobalVar.IsOpen = false;
                }
                else
                {
                    Mess += Config.NameTicket + " " + Properties.Resources.LabelErrorClosing.ToLower() + "..." +
                            Environment.NewLine;
                }
            }
            else
            {
                Mess += Config.NameTicket + " " + Properties.Resources.LabelAlreadyClosing.ToLower() + "..." +
                        Environment.NewLine;
            }
        }
示例#2
0
        public static bool Open()
        {
            RepositoryGeneral.Set();

            if (!RepositoryGeneral.IsOpen)
            {
                var ticketWindowGeneral = RepositoryCloseTicketG.Create();

                var general = RepositoryGeneral.Generals.FirstOrDefault(g => g.EstablishmentCustomerId == Config.IdEstablishment);

                if (general != null)
                {
                    general.Name   = Config.NameTicket;
                    general.IsOpen = true;
                    general.TicketWindowGeneral = ticketWindowGeneral;
                    general.User = Config.User;
                    general.Date = DateTime.Now;
                    general.EstablishmentCustomerId = Config.IdEstablishment;
                    RepositoryGeneral.Update(general);
                }
                else
                {
                    general = new GeneralType(Guid.NewGuid(), ticketWindowGeneral, true, Config.NameTicket, Config.User, DateTime.Now, Config.IdEstablishment);
                    RepositoryGeneral.Add(general);
                }

                GlobalVar.TicketWindowG = ticketWindowGeneral;

                foreach (var rec in RepositoryOpenTicketWindow.OpenTicketWindows.FindAll(l => l.EstablishmentCustomerId == Config.IdEstablishment))
                {
                    rec.IdTicketWindowG = GlobalVar.TicketWindowG;
                    RepositoryOpenTicketWindow.Update(rec);
                }
                return(true);
            }
            FunctionsService.ShowMessageTime("Уже открыта просто продолжите работать");
            return(false);
        }