public List <ClientType> GetNewClientTypeList() { using (poolDBEntities ent = new poolDBEntities()) { currClientTypes = ent.ClientTypes.ToList(); return(currClientTypes); } }
public void AddTrainingGroup(TrainingGroup tg) { using (poolDBEntities ent = new poolDBEntities()) { ent.TrainingGroups.Add(tg); ent.SaveChanges(); } }
public List <DayTimeSet> GetNewDayTimeSetList() { using (poolDBEntities ent = new poolDBEntities()) { currDayTimeSet = ent.DayTimeSets.ToList(); } return(currDayTimeSet); }
public void AddEmployee(Employee emp) { using (poolDBEntities ent = new poolDBEntities()) { ent.Employees.Add(emp); ent.SaveChanges(); } }
public void AddClient(Client client) { using (poolDBEntities ent = new poolDBEntities()) { ent.Clients.Add(client); ent.SaveChanges(); } }
public void AddAbonement(Abonement abonement) { using (poolDBEntities ent = new poolDBEntities()) { ent.Abonements.Add(abonement); ent.SaveChanges(); } }
//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(); } } } }
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(); } }
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(); } }
public List <EmployeesPosition> GetNewEmployeePositionList() { currEmployeePositions = new List <EmployeesPosition>(); using (poolDBEntities ent = new poolDBEntities()) { currEmployeePositions = ent.EmployeesPositions.ToList(); } return(currEmployeePositions); }
public List <Employee> GetNewEmployeeList() { GetNewEmployeePositionList(); currEmployeeList = new List <Employee>(); using (poolDBEntities ent = new poolDBEntities()) { currEmployeeList = ent.Employees.ToList(); } return(currEmployeeList); }
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); } }
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(); } }
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); }
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(); } }
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); }
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(); } }
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); }
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); }
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(); } }
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(); } }
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); }
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); }
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); }
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); }
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(); } }
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(); } }
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(); } }
public void SetTimeRowsOnDay(DateTime date) { using (poolDBEntities ent = new poolDBEntities()) { } }