示例#1
0
        private void FildPrivetOrders(bool?paid)
        {
            this.privetOrders.Clear();

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

            foreach (var item in rdg.Get(paid))
            {
                this.privetOrders.Add(item);
            }
        }
示例#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");
     }
 }
示例#3
0
        public bool PrivetOrdersUpdate(int orderId, int createById, int customerId, string descriptionTask, double hourUse,
                                       double paidHour, int toAcc, DateTime taskDate)
        {
            var rdg = new RDGs.RDGtblPrivetOrders(this.session.ConnectionString);

            var newOrder = new InterfaceAdaptor.PrivetOrder()
            {
                InvoiceNo = orderId,
                CreateBy  = new InterfaceAdaptor.Worker()
                {
                    WorkNo = createById
                },
                CreateDate = DateTime.Now,
                Customer   = new InterfaceAdaptor.PrivetCustomer()
                {
                    PrivateCustomersNo = customerId
                },
                DescriptionTask = descriptionTask,
                HourUse         = hourUse,
                Paid            = false,
                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.privetOrders.Update(rdg.Find(newOrder.InvoiceNo), i);
                    break;
                }
            }

            return(true);
        }
示例#4
0
        public bool PrivetOrdersRemove(int id, out int[] inUseId)
        {
            var rdg = new RDGs.RDGtblPrivetOrders(this.session.ConnectionString);

            inUseId = null;

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

            this.privetOrders.RemoveAtId(id);
            return(true);
        }
示例#5
0
        public List <string> ListOfPrivateCustomersForInvoice()
        {
            var list   = new List <string>();
            var filter = new List <int>();

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

            string temp = string.Empty;

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

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

                    list.Add(temp);

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

            list.Sort();

            return(list);
        }
示例#6
0
        public bool PrivetOrdersAdd(int createById, int customerId, string descriptionTask, double hourUse,
                                    double paidHour, int toAcc, DateTime taskDate)
        {
            var rdg = new RDGs.RDGtblPrivetOrders(this.session.ConnectionString);

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

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

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

            return(true);
        }
示例#7
0
        public DataTable GetCustomersPrivetForInvoices(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.RDGtblPrivetOrders(this.session.ConnectionString);

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

            return(dataTable);
        }
示例#8
0
        public Interface.IprivetCustomer FindPrivateCustomerBaseOrder(int orderId)
        {
            var rdg = new RDGs.RDGtblPrivetOrders(this.session.ConnectionString);

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