Ejemplo n.º 1
0
        private void FildCompanyOrders(bool?paid)
        {
            this.companyOrders.Clear();

            var rdg = new RDGs.RGDtblCompanyOrders(this.session.ConnectionString);

            foreach (var item in rdg.Get(paid))
            {
                this.companyOrders.Add(item);
            }
        }
Ejemplo n.º 2
0
 public string FindOrdersInfo(char type, int id)
 {
     if (type == 'C')
     {
         var rdg = new RDGs.RGDtblCompanyOrders(this.session.ConnectionString);
         return(rdg.Find(id).DescriptionTask);
     }
     else if (type == 'P')
     {
         var rdg = new RDGs.RDGtblPrivetOrders(this.session.ConnectionString);
         return(rdg.Find(id).DescriptionTask);
     }
     else
     {
         throw new ArgumentException("Type");
     }
 }
Ejemplo n.º 3
0
        public bool CompanyOrdersUpdate(int orderId, int createById, int customerId, string descriptionTask, double hourUse,
                                        double paidHour, int toAcc, DateTime taskDate)
        {
            var rdg = new RDGs.RGDtblCompanyOrders(this.session.ConnectionString);

            var newOrder = new InterfaceAdaptor.CompanyOrder()
            {
                CreateBy = new InterfaceAdaptor.Worker()
                {
                    WorkNo = createById
                },
                Customer = new InterfaceAdaptor.CompanyCustomer()
                {
                    CompanyCustomersNo = customerId
                },
                DescriptionTask = descriptionTask,
                HoutsUse        = hourUse,
                InvoiceNo       = orderId,
                PaidHour        = paidHour,
                PaidToAcc       = toAcc,
                TaskDate        = taskDate,
            };

            try
            {
                rdg.Update(newOrder);
            }
            catch (Exception)
            {
                return(false);
            }

            for (int i = 0; i < this.privetOrders.Count; i++)
            {
                if (this.privetOrders.GetAt(i).InvoiceNo == orderId)
                {
                    this.companyOrders.Update(rdg.Find(newOrder.InvoiceNo), i);
                    break;
                }
            }

            return(true);
        }
Ejemplo n.º 4
0
        public bool CompanyOrdersRemove(int id, out int[] inUseId)
        {
            var rdg = new RDGs.RGDtblCompanyOrders(this.session.ConnectionString);

            inUseId = null;

            try
            {
                rdg.Delete(id);
            }
            catch (Exception)
            {
                var invoicePrivet = new RDGs.RDGtblInvoiceCompany(this.session.ConnectionString);
                inUseId = invoicePrivet.OrdersInUse(id);
                return(false);
            }

            this.companyOrders.RemoveAtId(id);
            return(true);
        }
Ejemplo n.º 5
0
        public List <string> ListOfCompanyCustomersForInvoice()
        {
            var list   = new List <string>();
            var filter = new List <int>();

            var rdg = new RDGs.RGDtblCompanyOrders(this.session.ConnectionString);

            string temp = string.Empty;

            foreach (var item in rdg.Get(false))
            {
                if (!filter.Contains(item.Customer.CompanyCustomersNo))
                {
                    temp = "#";
                    if (item.Customer.CompanyCustomersNo < 10)
                    {
                        temp += "00" + item.Customer.CompanyCustomersNo;
                    }
                    else if (item.Customer.CompanyCustomersNo < 100)
                    {
                        temp += "0" + item.Customer.CompanyCustomersNo;
                    }
                    else
                    {
                        temp += item.Customer.CompanyCustomersNo;
                    }

                    temp += " - " + item.Customer.Name;

                    list.Add(temp);

                    filter.Add(item.Customer.CompanyCustomersNo);
                }
            }

            list.Sort();

            return(list);
        }
Ejemplo n.º 6
0
        public bool CompanyOrdersAdd(int createById, int customerId, string descriptionTask, double hourUse,
                                     double paidHour, int toAcc, DateTime taskDate)
        {
            var rdg = new RDGs.RGDtblCompanyOrders(this.session.ConnectionString);

            var newOrder = new InterfaceAdaptor.CompanyOrder()
            {
                CreateBy = new InterfaceAdaptor.Worker()
                {
                    WorkNo = createById
                },
                CreateDate = DateTime.Now,
                Customer   = new InterfaceAdaptor.CompanyCustomer()
                {
                    CompanyCustomersNo = customerId
                },
                DescriptionTask = descriptionTask,
                HoutsUse        = hourUse,
                Paid            = false,
                PaidHour        = paidHour,
                PaidToAcc       = toAcc,
                TaskDate        = taskDate
            };

            try
            {
                rdg.Add(newOrder);
            }
            catch (Exception)
            {
                return(false);
            }

            this.companyOrders.Add(rdg.Find(rdg.NextId - 1));

            return(true);
        }
Ejemplo n.º 7
0
        public DataTable GetCompanyCustomerstForInvoices(int id)
        {
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("Ordrenr", typeof(int));
            dataTable.Columns.Add("Opgave", typeof(string));
            dataTable.Columns.Add("Dato", typeof(DateTime));
            dataTable.Columns.Add("Timer brugt", typeof(double));
            dataTable.Columns.Add("Timeløn", typeof(double));

            var rdg = new RDGs.RGDtblCompanyOrders(this.session.ConnectionString);

            foreach (var item in rdg.GetBaseCustomer(id, false))
            {
                dataTable.Rows.Add(
                    item.InvoiceNo,
                    item.DescriptionTask,
                    item.CreateDate,
                    item.HoutsUse,
                    item.PaidHour);
            }

            return(dataTable);
        }
Ejemplo n.º 8
0
        public Interface.IcompanyCustomer FindCompanyCustomerBaseOrder(int orderId)
        {
            var rdg = new RDGs.RGDtblCompanyOrders(this.session.ConnectionString);

            return(rdg.Find(orderId).Customer);
        }