예제 #1
0
        public bool PiadInvoice(char type, int id)
        {
            if (type == 'C')
            {
                try
                {
                    var rdg = new RDGs.RDGtblInvoiceCompany(this.session.ConnectionString);

                    rdg.UpdateActive(id, false);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else if (type == 'P')
            {
                try
                {
                    var rdg = new RDGs.RDGtblInvoicePrivet(this.session.ConnectionString);
                    rdg.UpdateActive(id, false);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            else
            {
                throw new ArgumentException();
            }

            return(true);
        }
예제 #2
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);
        }
예제 #3
0
        public bool DelelteInvoice(char type, int id)
        {
            if (type == 'C')
            {
                var rdg = new RDGs.RDGtblInvoiceCompany(this.session.ConnectionString);

                try
                {
                    rdg.Delete(id);
                }
                catch (Exception)
                {
                    return(false);
                }

                return(true);
            }
            else if (type == 'P')
            {
                var rdg = new RDGs.RDGtblInvoicePrivet(this.session.ConnectionString);

                try
                {
                    rdg.Delete(id);
                }
                catch (Exception)
                {
                    return(false);
                }

                return(true);
            }
            else
            {
                throw new ArgumentException("Type");
            }
        }
예제 #4
0
        public DataTable GetInvoice()
        {
            var dataTable = new DataTable();

            dataTable.Columns.Add("Faktura nr", typeof(string));
            dataTable.Columns.Add("Kunde", typeof(string));
            dataTable.Columns.Add("Ordrenr 1", typeof(string));
            dataTable.Columns.Add("Ordrenr 2", typeof(string));
            dataTable.Columns.Add("Ordrenr 3", typeof(string));
            dataTable.Columns.Add("Ordrenr 4", typeof(string));
            dataTable.Columns.Add("Ordrenr 5", typeof(string));
            dataTable.Columns.Add("Ordrenr 6", typeof(string));
            dataTable.Columns.Add("Ordrenr 7", typeof(string));
            dataTable.Columns.Add("Ordrenr 8", typeof(string));
            dataTable.Columns.Add("Ordrenr 9", typeof(string));
            dataTable.Columns.Add("Ordrenr 10", typeof(string));
            dataTable.Columns.Add("Ordrenr 11", typeof(string));
            dataTable.Columns.Add("Ordrenr 12", typeof(string));
            dataTable.Columns.Add("Ordrenr 13", typeof(string));
            dataTable.Columns.Add("Ordrenr 14", typeof(string));
            dataTable.Columns.Add("Ordrenr 15", typeof(string));
            dataTable.Columns.Add("Ordrenr 16", typeof(string));
            dataTable.Columns.Add("Ordrenr 17", typeof(string));
            dataTable.Columns.Add("Ordrenr 18", typeof(string));
            dataTable.Columns.Add("Ordernr 19", typeof(string));
            dataTable.Columns.Add("Ordrenr 20", typeof(string));

            var rdgCustomersC  = new RDGs.RDGtblCompanyCustomers(this.session.ConnectionString);
            var invoiceCompany = new RDGs.RDGtblInvoiceCompany(this.session.ConnectionString).Get(true);

            foreach (var item in invoiceCompany)
            {
                var customers = rdgCustomersC.Find((int)item.Order[0]);

                dataTable.Rows.Add(
                    "C-" + item.Id,
                    "#" + customers.CompanyCustomersNo + ": " + customers.Name,
                    item.Order[0].ToString(),
                    item.Order[1].ToString(),
                    item.Order[2].ToString(),
                    item.Order[3].ToString(),
                    item.Order[4].ToString(),
                    item.Order[5].ToString(),
                    item.Order[6].ToString(),
                    item.Order[7].ToString(),
                    item.Order[8].ToString(),
                    item.Order[9].ToString(),
                    item.Order[10].ToString(),
                    item.Order[11].ToString(),
                    item.Order[12].ToString(),
                    item.Order[13].ToString(),
                    item.Order[14].ToString(),
                    item.Order[15].ToString(),
                    item.Order[16].ToString(),
                    item.Order[17].ToString(),
                    item.Order[18].ToString(),
                    item.Order[19].ToString());
            }

            var rdgCustomersP = new RDGs.RDGtblPrivateCustomers(this.session.ConnectionString);
            var invoicePrivet = new RDGs.RDGtblInvoicePrivet(this.session.ConnectionString).Get(true);

            foreach (var item in invoicePrivet)
            {
                var customers = rdgCustomersP.Find((int)item.Order[0]);

                dataTable.Rows.Add(
                    "P-" + item.Id,
                    "#" + customers.PrivateCustomersNo + ": " + customers.Name + " " + customers.Surname,
                    item.Order[0].ToString(),
                    item.Order[1].ToString(),
                    item.Order[2].ToString(),
                    item.Order[3].ToString(),
                    item.Order[4].ToString(),
                    item.Order[5].ToString(),
                    item.Order[6].ToString(),
                    item.Order[7].ToString(),
                    item.Order[8].ToString(),
                    item.Order[9].ToString(),
                    item.Order[10].ToString(),
                    item.Order[11].ToString(),
                    item.Order[12].ToString(),
                    item.Order[13].ToString(),
                    item.Order[14].ToString(),
                    item.Order[15].ToString(),
                    item.Order[16].ToString(),
                    item.Order[17].ToString(),
                    item.Order[18].ToString(),
                    item.Order[19].ToString());
            }

            return(dataTable);
        }