Пример #1
0
        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);
        }
Пример #2
0
        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);
            }
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }