Ejemplo n.º 1
0
        public static SalesInvoice GetSaleInvoice(int id)
        {
            string Querry = string.Format(@"select * from SaleInvoice where SaleInvoiceId={0}
select * from SaleInvoiceDetail where SaleInvoiceId ={0}", id);

            DataBase.db  database = new DataBase.db();
            var          x        = database.Read(Querry);
            SalesInvoice s1       = new SalesInvoice()
            {
                SaleInvoiceId = Convert.ToInt32(x.Tables[0].Rows[0][0]),
                Date          = Convert.ToDateTime(x.Tables[0].Rows[0][1]),
                InvoiceTypeId = Convert.ToInt64(x.Tables[0].Rows[0][2]),
                LocationId    = Convert.ToInt64(x.Tables[0].Rows[0][3]),
                PartyId       = Convert.ToInt64(x.Tables[0].Rows[0][4]),
                TotalAmount   = Convert.ToDecimal(x.Tables[0].Rows[0][5])
            };

            s1.SaleInvoiceDetails = new List <SaleInvoiceDetail>();
            foreach (System.Data.DataRow row in x.Tables[1].Rows)
            {
                s1.SaleInvoiceDetails.Add(new SaleInvoiceDetail()
                {
                    SaleInvoiceDetailId = Convert.ToInt64(row[0]),
                    SaleInvoiceId       = Convert.ToInt32(row[1]),
                    ItemId    = Convert.ToInt32(row[2]),
                    Qty       = Convert.ToInt32(row[3]),
                    SalePrice = Convert.ToInt32(row[4]),
                    Total     = Convert.ToDecimal(row[5])
                });
            }
            return(s1);
        }
Ejemplo n.º 2
0
        public static System.Data.DataSet Get()
        {
            var list = new List <SalesInvoice>();

            DataBase.db database = new DataBase.db();
            return(database.Read(@"select SaleInvoice.SaleInvoiceId,SaleInvoice.Date,InvoiceType.InvoiceType,
Location.Name as location, Party.Name as Party, SaleInvoice.TotalAmount
from SaleInvoice inner join InvoiceType on InvoiceType.InvoiceTypeId = SaleInvoice.InvoiceTypeId
inner
join Location on Location.LocationId = SaleInvoice.LocationId
inner
join Party on Party.PartyId = SaleInvoice.PartyId"));
        }