private List <ClassCheck.localTypesPay> getTypePay(ClassSync.ClassCloseTicket.CloseTicket e)
            {
                List <ClassCheck.localTypesPay> typePay = new List <ClassCheck.localTypesPay>();
                string st = "";

                if (e.PayCash > 0)
                {
                    st = "Cash";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.PayCash);
                    typePay.Add(ltp);
                }



                if (e.PayBankCards > 0)
                {
                    st = "BankCards";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.PayBankCards);
                    typePay.Add(ltp);
                }

                if (e.PayBankChecks > 0)
                {
                    st = "BankChecks";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.PayBankChecks);
                    typePay.Add(ltp);
                }

                if (e.PayResto > 0)
                {
                    st = "Resto";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.PayResto);
                    typePay.Add(ltp);
                }

                if (e.Pay1 > 0)
                {
                    ClassSync.TypesPayDB tp = new ClassSync.TypesPayDB();
                    st = "1";
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay1);
                    typePay.Add(ltp);
                }
                if (e.Pay2 > 0)
                {
                    st = "2";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay2);
                    typePay.Add(ltp);
                }
                if (e.Pay3 > 0)
                {
                    st = "3";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay3);
                    typePay.Add(ltp);
                }
                if (e.Pay4 > 0)
                {
                    st = "4";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay4);
                    typePay.Add(ltp);
                }
                if (e.Pay5 > 0)
                {
                    st = "5";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay5);
                    typePay.Add(ltp);
                }
                if (e.Pay6 > 0)
                {
                    st = "6";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay6);
                    typePay.Add(ltp);
                }
                if (e.Pay7 > 0)
                {
                    st = "7";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay7);
                    typePay.Add(ltp);
                }
                if (e.Pay8 > 0)
                {
                    st = "8";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay8);
                    typePay.Add(ltp);
                }

                if (e.Pay9 > 0)
                {
                    st = "9";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay9);
                    typePay.Add(ltp);
                }
                if (e.Pay10 > 0)
                {
                    st = "10";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay10);
                    typePay.Add(ltp);
                }
                if (e.Pay11 > 0)
                {
                    st = "11";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay11);
                    typePay.Add(ltp);
                }
                if (e.Pay12 > 0)
                {
                    st = "12";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay12);
                    typePay.Add(ltp);
                }
                if (e.Pay13 > 0)
                {
                    st = "13";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay13);
                    typePay.Add(ltp);
                }
                if (e.Pay14 > 0)
                {
                    st = "14";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay14);
                    typePay.Add(ltp);
                }
                if (e.Pay15 > 0)
                {
                    st = "15";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay15);
                    typePay.Add(ltp);
                }
                if (e.Pay16 > 0)
                {
                    st = "16";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay16);
                    typePay.Add(ltp);
                }
                if (e.Pay17 > 0)
                {
                    st = "17";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay17);
                    typePay.Add(ltp);
                }
                if (e.Pay18 > 0)
                {
                    st = "18";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay18);
                    typePay.Add(ltp);
                }
                if (e.Pay19 > 0)
                {
                    st = "19";
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay19);
                    typePay.Add(ltp);
                }
                if (e.Pay20 > 0)
                {
                    st = "20";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay20);
                    typePay.Add(ltp);
                }
                return(typePay);
            }
            private List <ClassCheck.localTypesPay> getTypePay(ClassSync.ClassCloseTicket.CloseTicketG e)
            {
                List <ClassCheck.localTypesPay> typePay = new List <ClassCheck.localTypesPay>();
                string st = "";

                if (e.PayCash > 0)
                {
                    st = "Cash";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.PayCash ?? 0.0m);
                    typePay.Add(ltp);
                }



                if (e.PayBankCards > 0)
                {
                    st = "BankCards";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.PayBankCards ?? 0.0m);
                    typePay.Add(ltp);
                }

                if (e.PayBankChecks > 0)
                {
                    st = "BankChecks";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.PayBankChecks ?? 0.0m);
                    typePay.Add(ltp);
                }

                if (e.PayResto > 0)
                {
                    st = "Resto";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.PayResto ?? 0.0m);
                    typePay.Add(ltp);
                }

                if (e.Pay1 > 0)
                {
                    ClassSync.TypesPayDB tp = new ClassSync.TypesPayDB();
                    st = "1";
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay1 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay2 > 0)
                {
                    st = "2";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay2 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay3 > 0)
                {
                    st = "3";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay3 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay4 > 0)
                {
                    st = "4";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay4 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay5 > 0)
                {
                    st = "5";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay5 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay6 > 0)
                {
                    st = "6";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay6 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay7 > 0)
                {
                    st = "7";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay7 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay8 > 0)
                {
                    st = "8";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay8 ?? 0.0m);
                    typePay.Add(ltp);
                }

                if (e.Pay9 > 0)
                {
                    st = "9";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay9 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay10 > 0)
                {
                    st = "10";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay10 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay11 > 0)
                {
                    st = "11";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay11 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay12 > 0)
                {
                    st = "12";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay12 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay13 > 0)
                {
                    st = "13";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay13 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay14 > 0)
                {
                    st = "14";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay14 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay15 > 0)
                {
                    st = "15";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay15 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay16 > 0)
                {
                    st = "16";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay16 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay17 > 0)
                {
                    st = "17";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay17 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay18 > 0)
                {
                    st = "18";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay18 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay19 > 0)
                {
                    st = "19";
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay19 ?? 0.0m);
                    typePay.Add(ltp);
                }
                if (e.Pay20 > 0)
                {
                    st = "20";
                    ClassSync.TypesPayDB     tp  = new ClassSync.TypesPayDB();
                    ClassSync.TypesPayDB     t   = ClassSync.TypesPayDB.t.Find(l => l.NameCourt == st);
                    ClassCheck.localTypesPay ltp = new ClassCheck.localTypesPay(t, e.Pay20 ?? 0.0m);
                    typePay.Add(ltp);
                }
                return(typePay);
            }