Beispiel #1
0
 public Invoice(DTO_Invoice inv)
 {
     InvoiceID     = inv.InvoiceID;
     ClaimID       = inv.ClaimID;
     InvoiceTypeID = inv.InvoiceTypeID;
     VendorID      = inv.VendorID;
     InvoiceAmount = inv.InvoiceAmount;
     InvoiceDate   = inv.InvoiceDate;
     Paid          = inv.Paid;
 }
        public async Task AddInvoice(DTO_Invoice token)
        {
            try
            {
                var response = await client.PostAsJsonAsync(string.Format(@"{0}{1}", URL, "AddInvoice"),
                                                            token);

                response.EnsureSuccessStatusCode();
                Invoice = await response.Content.ReadAsAsync <DTO_Invoice>();
            }
            catch (Exception e)
            {
                Console.Write(e.StackTrace);
            }
        }
Beispiel #3
0
        public List <DTO_Invoice> GetInvoiceDAO(string sql)
        {
            List <DTO_Invoice> list = new List <DTO_Invoice>();
            SqlCommand         cmd  = new SqlCommand(sql, dp.cnn);
            SqlDataReader      dr;
            int MaHoaDon;
            int MaMonNuoc;
            int MaBan;

            dp.Connect();
            //SqlConnection cnn = dp.getConnect();
            //cnn.Open();
            try
            {
                dr = cmd.ExecuteReader();
                //SqlDataReader dr = dp.ExecuteReader(sql);
                while (dr.Read())
                {
                    MaHoaDon  = dr.GetInt32(0);
                    MaMonNuoc = dr.GetInt32(1);
                    MaBan     = dr.GetInt32(2);
                    DTO_Invoice prod = new DTO_Invoice(MaHoaDon, MaMonNuoc, MaBan);
                    list.Add(prod);
                }
                return(list);
            }
            catch (SqlException ex)
            {
                return(null);

                throw ex;
            }
            finally
            {
                dp.DisConnect();
            }
        }