Пример #1
0
        public Invoice GetInvoiceDetails(int invoiceID)
        {
            Invoice invoice = null;

            SqlParameter[] paramaters = new SqlParameter[]
            {
                new SqlParameter("@InvoiceID", invoiceID)
            };

            using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand("sp_GetInvoiceDetails", CommandType.StoredProcedure, paramaters))
            {
                if (table.Rows.Count >= 1)
                {
                    DataRow row = table.Rows[0];
                    invoice = new Invoice();

                    invoice.BookingID = Convert.ToInt32(row["BookingID"]);
                    invoice.Rooms = row["Rooms"].ToString();
                    invoice.Rates = row["Rates"].ToString();
                }
            }
            return invoice;
        }
        public int Saveinvoice(InvoiceModel model)
        {
            try
               {
               using (_context= new HSSNInventoryEntities() )
               {
                   var data = new Invoice()
                   {
                       InvoiceId = model.InvoiceId,
                       InvoiceNumber = model.InvoiceNumber,
                       InvoiceDate = model.InvoiceDate,
                       GateEntryNo = model.GateEntryNo,
                       GateEntryDate = model.GateEntryDate,
                       VechileNumber = model.VechileNumber,
                       DistributorId = model.DistributorId,
                       Remarks = model.Remarks,
                       DateOfEntry = model.DateOfEntry,
                       CreatedBy = model.CreatedBy,
                       CreatedDate = model.CreatedDate,
                       ModifiedBy = model.ModifiedBy,
                       ModifiedDate = model.ModifiedDate,
                       TotalAmount = model.TotalAmount,
                   };
                   _context.Entry(data).State=EntityState.Added;
                   _context.SaveChanges();
                   return data.InvoiceId;

               }
               }
               catch (Exception)
               {

               throw;
               }
        }