Ejemplo n.º 1
0
 public List <ClientType> GetNewClientTypeList()
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         currClientTypes = ent.ClientTypes.ToList();
         return(currClientTypes);
     }
 }
Ejemplo n.º 2
0
 public void AddTrainingGroup(TrainingGroup tg)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         ent.TrainingGroups.Add(tg);
         ent.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public List <DayTimeSet> GetNewDayTimeSetList()
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         currDayTimeSet = ent.DayTimeSets.ToList();
     }
     return(currDayTimeSet);
 }
Ejemplo n.º 4
0
 public void AddEmployee(Employee emp)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         ent.Employees.Add(emp);
         ent.SaveChanges();
     }
 }
Ejemplo n.º 5
0
 public void AddClient(Client client)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         ent.Clients.Add(client);
         ent.SaveChanges();
     }
 }
Ejemplo n.º 6
0
 public void AddAbonement(Abonement abonement)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         ent.Abonements.Add(abonement);
         ent.SaveChanges();
     }
 }
Ejemplo n.º 7
0
 //trash
 public void SaveCalendarTimeRows(DataGridView dgv, DateTime currDate)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         bool isColumnNotEmpty = false;
         for (int i = 0; i < dgv.RowCount; i++)
         {
             isColumnNotEmpty = false;
             for (int j = 1; j < dgv.ColumnCount; j++)
             {
                 if ((dgv[j, i] as DataGridViewComboBoxCell).Value != null)
                 {
                     isColumnNotEmpty = true;
                     break;
                 }
             }
             if (isColumnNotEmpty)
             {
                 CalendarTimeRow      ctr = new CalendarTimeRow();
                 List <TrainingGroup> tgs;
                 tgs = GetTrainingGroupByName(dgv[1, i].Value as string);
                 if (tgs.Count != 0)
                 {
                     ctr.Lane1 = tgs[0].Id;
                 }
                 tgs = GetTrainingGroupByName(dgv[2, i].Value as string);
                 if (tgs.Count != 0)
                 {
                     ctr.Lane2 = tgs[0].Id;
                 }
                 tgs = GetTrainingGroupByName(dgv[3, i].Value as string);
                 if (tgs.Count != 0)
                 {
                     ctr.Lane3 = tgs[0].Id;
                 }
                 tgs = GetTrainingGroupByName(dgv[4, i].Value as string);
                 if (tgs.Count != 0)
                 {
                     ctr.Lane4 = tgs[0].Id;
                 }
                 tgs = GetTrainingGroupByName(dgv[5, i].Value as string);
                 if (tgs.Count != 0)
                 {
                     ctr.Lane5 = tgs[0].Id;
                 }
                 tgs = GetTrainingGroupByName(dgv[6, i].Value as string);
                 if (tgs.Count != 0)
                 {
                     ctr.Lane6 = tgs[0].Id;
                 }
                 ctr.TimeId = DayTimeSetIndexToId(i);
                 ctr.Date   = currDate;
                 ent.CalendarTimeRows.Add(ctr);
                 ent.SaveChanges();
             }
         }
     }
 }
Ejemplo n.º 8
0
 public void DeleteTrainingGroupById(int id)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         TrainingGroup tg = ent.TrainingGroups.Where(t => t.Id == id).FirstOrDefault();
         ent.TrainingGroups.Remove(tg);
         ent.SaveChanges();
     }
 }
Ejemplo n.º 9
0
 public void DeleteEmployeeById(int id)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         Employee emp = ent.Employees.Where(e => e.Id == id).FirstOrDefault();
         ent.Employees.Remove(emp);
         ent.SaveChanges();
     }
 }
Ejemplo n.º 10
0
 public List <EmployeesPosition> GetNewEmployeePositionList()
 {
     currEmployeePositions = new List <EmployeesPosition>();
     using (poolDBEntities ent = new poolDBEntities())
     {
         currEmployeePositions = ent.EmployeesPositions.ToList();
     }
     return(currEmployeePositions);
 }
Ejemplo n.º 11
0
 public List <Employee> GetNewEmployeeList()
 {
     GetNewEmployeePositionList();
     currEmployeeList = new List <Employee>();
     using (poolDBEntities ent = new poolDBEntities())
     {
         currEmployeeList = ent.Employees.ToList();
     }
     return(currEmployeeList);
 }
Ejemplo n.º 12
0
        public List <CalendarTimeRow> GetNewCalendarTimeRowsByDate(DateTime currDate)
        {
            using (poolDBEntities ent = new poolDBEntities())
            {
                currCalendarTimeRows = ent.CalendarTimeRows
                                       .Where(c => System.Data.Entity.DbFunctions.TruncateTime(c.Date) == currDate.Date).ToList();

                //currCalendarTimeRows = trans.ToList();
                return(currCalendarTimeRows);
            }
        }
Ejemplo n.º 13
0
 public void DeleteAbonementById(int id)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         Abonement abonEnt = ent.Abonements
                             .Where(a => a.Id == id)
                             .FirstOrDefault();
         ent.Abonements.Remove(abonEnt);
         ent.SaveChanges();
     }
 }
Ejemplo n.º 14
0
 public List <Client> GetNewClientList()
 {
     currClientsList = new List <Client>();
     using (poolDBEntities ent = new poolDBEntities())
     {
         var trans = from C in ent.Clients
                     select C;
         currClientsList = trans.ToList();
     }
     return(currClientsList);
 }
Ejemplo n.º 15
0
 public void DeleteClientById(int id)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         Client cl = ent.Clients
                     .Where(c => c.Id == id)
                     .FirstOrDefault();
         ent.Clients.Remove(cl);
         ent.SaveChanges();
     }
 }
Ejemplo n.º 16
0
 public List <VisitType> GetNewVisitTypeList()
 {
     currVisitTypes = new List <VisitType>();
     using (poolDBEntities ent = new poolDBEntities())
     {
         var trans = from V in ent.VisitTypes
                     select V;
         currVisitTypes = trans.ToList();
     }
     return(currVisitTypes);
 }
Ejemplo n.º 17
0
 public void EditTrainingGroup(TrainingGroup tg)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         TrainingGroup dbtg = ent.TrainingGroups.Where(t => t.Id == tg.Id).FirstOrDefault();
         dbtg.GroupName = tg.GroupName;
         dbtg.CoachId   = tg.CoachId;
         dbtg.Color     = tg.Color;
         ent.SaveChanges();
     }
 }
Ejemplo n.º 18
0
 public List <TrainingGroup> GetNewTrainingGroupList()
 {
     currTrainingGroups = new List <TrainingGroup>();
     using (poolDBEntities ent = new poolDBEntities())
     {
         var trans = from T in ent.TrainingGroups
                     select T;
         currTrainingGroups = trans.ToList();
     }
     return(currTrainingGroups);
 }
Ejemplo n.º 19
0
 public List <ServiceType> GetNewServiceTypeList()
 {
     currServiceTypes = new List <ServiceType>();
     using (poolDBEntities ent = new poolDBEntities())
     {
         var trans = from S in ent.ServiceTypes
                     select S;
         currServiceTypes = trans.ToList();
     }
     return(currServiceTypes);
 }
Ejemplo n.º 20
0
 public void CheckVisitWithDate(int abonementId, DateTime date)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         VisitDate vd = new VisitDate();
         vd.AbonementId = abonementId;
         vd.Date        = date.Date;
         vd.ClientId    = GetClientByAbonementId(abonementId)[0].Id;
         ent.VisitDates.Add(vd);
         ent.SaveChanges();
     }
 }
Ejemplo n.º 21
0
 public void EditEmployee(Employee emp)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
         Employee dbEmp = ent.Employees.Where(e => e.Id == emp.Id).FirstOrDefault();
         dbEmp.Name       = emp.Name;
         dbEmp.Phone      = emp.Phone;
         dbEmp.PositionId = emp.PositionId;
         dbEmp.Secondname = emp.Secondname;
         dbEmp.Surname    = emp.Surname;
         ent.SaveChanges();
     }
 }
Ejemplo n.º 22
0
        public List <Abonement> GetNewClientAbonementsList(int id)
        {
            int ClientId = GetClientById(id).Id;

            using (poolDBEntities ent = new poolDBEntities())
            {
                var trans = from A in ent.Abonements
                            where A.ClientId == ClientId
                            select A;
                currClientAbonements = trans.ToList();
            }
            return(currClientAbonements);
        }
Ejemplo n.º 23
0
        public List <Client> GetClientByAbonementId(int id)
        {
            List <Client> c = new List <Client>();

            using (poolDBEntities ent = new poolDBEntities())
            {
                Abonement abon = ent
                                 .Abonements.Where(a => a.Id == id)
                                 .FirstOrDefault();
                c.Add(abon.Client);
            }
            return(c);
        }
Ejemplo n.º 24
0
        public List <Client> GetClientsByGroupId(int id)
        {
            List <Client> curr = new List <Client>();

            using (poolDBEntities ent = new poolDBEntities())
            {
                curr = ent.Clients.Where(c => (
                                             c.Abonements.Where(a =>
                                                                a.TrainingGroupId == id)
                                             .ToList().Count > 0))
                       .ToList();
            }
            return(curr);
        }
Ejemplo n.º 25
0
        public List <Employee> GetNewEmployeeListByPositionId(params int[] ids)
        {
            List <Employee> empList = new List <Employee>();

            using (poolDBEntities ent = new poolDBEntities())
            {
                int currPosId = 1;
                for (int i = 0; i < ids.Length; i++)
                {
                    currPosId = ids[i];
                    List <Employee> emps = ent.Employees.Where(e => e.PositionId == currPosId).ToList();
                    empList.AddRange(emps);
                }
            }
            return(empList);
        }
Ejemplo n.º 26
0
        public void EditClient(Client client)
        {
            using (poolDBEntities ent = new poolDBEntities())
            {
                Client clientEnt = ent.Clients
                                   .Where(c => c.Id == client.Id)
                                   .FirstOrDefault();
                //abonEnt = abonement;
                clientEnt.Name       = client.Name;
                clientEnt.Secondname = client.Secondname;
                clientEnt.Surname    = client.Surname;
                clientEnt.Phone      = client.Phone;
                clientEnt.Gender     = client.Gender;

                ent.SaveChanges();
            }
        }
Ejemplo n.º 27
0
        public void EditAbonement(Abonement abonement)
        {
            using (poolDBEntities ent = new poolDBEntities())
            {
                Abonement abonEnt = ent.Abonements
                                    .Where(a => a.Id == abonement.Id)
                                    .FirstOrDefault();
                //abonEnt = abonement;
                abonEnt.VisitTypeId     = abonement.VisitTypeId;
                abonEnt.ServiceTypeId   = abonement.ServiceTypeId;
                abonEnt.TrainingGroupId = abonement.TrainingGroupId;
                abonEnt.VisitCount      = abonement.VisitCount;
                abonEnt.ClientId        = abonement.ClientId;
                abonEnt.DateEnd         = abonement.DateEnd;

                ent.SaveChanges();
            }
        }
Ejemplo n.º 28
0
        public void SaveCalendarDataGridViewCmbCellChanges(DateTime currDate, DataGridViewComboBoxCell cmbCell)
        {
            int rowInd       = cmbCell.RowIndex;
            int dayTimeSetId = DayTimeSetIndexToId(rowInd);

            using (poolDBEntities ent = new poolDBEntities())
            {
                List <CalendarTimeRow> currDateCtrs = ent.CalendarTimeRows.Where(c => System.Data.Entity.DbFunctions.TruncateTime(c.Date) == currDate.Date).ToList();
                CalendarTimeRow        ctr          = currDateCtrs?.Find(c => c.TimeId == dayTimeSetId);
                if (ctr == null)
                {
                    if (cmbCell.Value == null)
                    {
                        return;
                    }
                    CalendarTimeRow newCtr = new CalendarTimeRow();
                    newCtr.TimeId = dayTimeSetId;
                    newCtr.Date   = currDate;
                    SetCalendarTimeRowLane(ref newCtr, cmbCell.ColumnIndex, GetTrainingGroupIdByName(cmbCell.Value as string));
                    ent.CalendarTimeRows.Add(newCtr);
                    //ent.Entry(newCtr).State = System.Data.Entity.EntityState.Added;
                }
                else
                {
                    SetCalendarTimeRowLane(ref ctr, cmbCell.ColumnIndex, GetTrainingGroupIdByName(cmbCell.Value as string));
                    if (ctr.Lane1 == null &&
                        ctr.Lane2 == null &&
                        ctr.Lane3 == null &&
                        ctr.Lane4 == null &&
                        ctr.Lane5 == null &&
                        ctr.Lane6 == null)
                    {
                        ent.CalendarTimeRows.Remove(ctr);
                    }
                    //ent.Entry(ctr).State = System.Data.Entity.EntityState.Modified;
                }
                ent.SaveChanges();
            }
        }
Ejemplo n.º 29
0
 public void SetTimeRowsOnDay(DateTime date)
 {
     using (poolDBEntities ent = new poolDBEntities())
     {
     }
 }