public bool WorkerUpdate(int id, string name, string surname, string address, int zip, string phoneNo, string altPhoneNo, string email) { var rdg = new RDGs.RDGtblWorkers(this.session.ConnectionString); try { rdg.Update(new InterfaceAdaptor.Worker() { Active = true, Address = address, AltPhoneNo = altPhoneNo, Email = email, Name = name, PhoneNo = phoneNo, PostNo = this.postNumbers.GetAtPostNumber(zip), Surname = surname, WorkerStatus = null, // TODO add worker status to the program WorkNo = id }); } catch (Exception) { return(false); } return(true); }
private void FildWorkers(bool?active) { this.workers.Clear(); var rgd = new RDGs.RDGtblWorkers(this.session.ConnectionString); foreach (var item in rgd.Get(active)) { this.workers.Add(item); } }
public List <string> ListOfWorkers() { List <string> list = new List <string>(); var rgd = new RDGs.RDGtblWorkers(this.session.ConnectionString); foreach (var item in rgd.Get(true)) { list.Add("#" + item.WorkNo.ToString() + " - " + item.Name + " " + item.Surname); } return(list); }
public bool WorkerAdd(string name, string surname, string address, int zip, string phoneNo, string altPhoneNo, string email) { int workerStatusId = -1; try { var rdgWorkerStatus = new RDGs.RDGtblWorkerStatus(this.session.ConnectionString); workerStatusId = rdgWorkerStatus.NextId; rdgWorkerStatus.Add(new InterfaceAdaptor.WorkerStatus() { Staus = "temp" // TODO add worker status to the program }); } catch (Exception) { return(false); } if (workerStatusId == -1) { return(false); } var rdg = new RDGs.RDGtblWorkers(this.session.ConnectionString); try { rdg.Add(new InterfaceAdaptor.Worker() { Active = true, Address = address, AltPhoneNo = altPhoneNo, Email = email, Name = name, PhoneNo = phoneNo, PostNo = postNumbers.GetAtPostNumber(zip), Surname = surname, WorkerStatus = new InterfaceAdaptor.WorkerStatus() { StautsNo = workerStatusId }, }); } catch (Exception) { return(false); } return(true); }
public bool WorkersRemove(int id) { var rdg = new RDGs.RDGtblWorkers(this.session.ConnectionString); try { rdg.Delete(id); } catch (Exception) { return(false); } this.workers.RemoveAtWorkerId(id); return(true); }