Beispiel #1
0
    // method to update invoice items 
    public void updateItem(Guid _invoiceID, string _item, double _cost, Guid _itemID)
    {
        try
        {
            // respective datacontext object
            InvoiceItemDataContext objItemDC = new InvoiceItemDataContext();
            // get row to update
            var upItem = objItemDC.brdhc_InvoiceItems.Single(i => i.ItemId == _itemID);
            //updating values
            upItem.ItemName = _item;
            upItem.ItemCost = _cost;

            //updating table
            objItemDC.SubmitChanges();

            //updating total
            InvoicesDataContext objInvDC = new InvoicesDataContext();
            //get invoice row
            var inv = objInvDC.brdhc_Invoices.Single(i => i.InvoiceID == _invoiceID);
            //calculating total
            double total = getTotal(_invoiceID);

            //update total
            inv.TotalAmt = total;

            objInvDC.SubmitChanges();

        }
        catch (Exception e)
        {
            clsCommon.saveError(e);
        }
    }
Beispiel #2
0
    //method to insert invoice
    public void insertInvoice(Guid _pID, DateTime _createdOn, string _createdBy, string _reason, string _status, DateTime _dueOn, Double _total)
    {
        InvoicesDataContext objInvoiceDC = new InvoicesDataContext();
        try
        {
            Guid invoiceID = Guid.NewGuid();
            Console.Write(invoiceID);
            brdhc_Invoice objInv = new brdhc_Invoice();
            objInv.InvoiceID = invoiceID;
            objInv.PatientID = _pID;
            objInv.CreatedOn = _createdOn;
            objInv.CreatedBy = _createdBy;
            objInv.Reason = _reason;
            objInv.Status = _status;
            objInv.DueOn = _dueOn;
            objInv.TotalAmt = _total;

            objInvoiceDC.brdhc_Invoices.InsertOnSubmit(objInv);
            objInvoiceDC.SubmitChanges();

        }
        catch (Exception e)
        {
            clsCommon.saveError(e);
        }
    }
Beispiel #3
0
  //method to update transaction if completed
    public void updateTransaction(Guid invID, string txID, DateTime txDate)
    {
        InvoicesDataContext objInvoiceDC = new InvoicesDataContext();

        try
        {
            var inv = objInvoiceDC.brdhc_Invoices.Single(x => x.InvoiceID == invID);
            inv.TransactionID = txID;
            inv.PaidOn = txDate;
            inv.Status = "Paid";
            objInvoiceDC.SubmitChanges();
        }
        catch (Exception ex)
        {
            clsCommon.saveError(ex);
        }
    }
Beispiel #4
0
 //method to update invoice, only due date allowed
 public void updateDueDate(Guid invID, DateTime dueOn)
 {
     InvoicesDataContext objInvoiceDC = new InvoicesDataContext();
     try
     {
         var inv = objInvoiceDC.brdhc_Invoices.Single(x => x.InvoiceID == invID);
         inv.DueOn = dueOn;
         objInvoiceDC.SubmitChanges();
     }
     catch (Exception e)
     {
         clsCommon.saveError(e);
     }
 }
Beispiel #5
0
 //method to get all invoices by ID
 public IQueryable<brdhc_Invoice> getInvoicesById(Guid id)
 {
     InvoicesDataContext objInvoiceDC = new InvoicesDataContext();
     var invoice = from x in objInvoiceDC.brdhc_Invoices where x.InvoiceID == id orderby x.InvoiceID select x;
     return invoice;
 }
Beispiel #6
0
 //method to get all invoices by doctor logged in and invoice status
 public List<sp_getInvoiceByDocStatusResult> getInvoicebyDocStatus(string docUsername, string status)
 {
     InvoicesDataContext objInvoiceDC = new InvoicesDataContext();
     return objInvoiceDC.sp_getInvoiceByDocStatus(docUsername, status).ToList();
 }
Beispiel #7
0
 //method to get all invoices by doctor logged in
 public List<sp_getInvoiceByDocNameResult> getInvoicesbyDocUname(string docUsername)
 {
     InvoicesDataContext objInvoiceDC = new InvoicesDataContext();
     return objInvoiceDC.sp_getInvoiceByDocName(docUsername).ToList();
 }
Beispiel #8
0
 //method to get all invoices by patient Id and status
 public IQueryable<brdhc_Invoice> getInvoicesByPatientIDandStatus(Guid pID, string status)
 {
     InvoicesDataContext objInvoiceDC = new InvoicesDataContext();
     var allInvoices = from x in objInvoiceDC.brdhc_Invoices where x.PatientID == pID && x.Status == status orderby x.CreatedOn select x;
     return allInvoices;
 }
Beispiel #9
0
 //method to get all invoices
  public IQueryable<brdhc_Invoice> getInvoices()
  {
      InvoicesDataContext objInvoiceDC = new InvoicesDataContext();
      var allInvoices = from x in objInvoiceDC.brdhc_Invoices orderby x.CreatedOn select x;
      return allInvoices;
  }
Beispiel #10
0
    //method to delete invoice
    public void deleteInvoice(Guid invID)
    { 
        
       try
        {
           // delete all invoice items with this invID
            // respective datacontext object
            InvoiceItemDataContext objItemDC = new InvoiceItemDataContext();

            //get rows to delete
            var delItem = from i in objItemDC.brdhc_InvoiceItems where (i.InvoiceID == invID) select i;

            // delete from table
            objItemDC.brdhc_InvoiceItems.DeleteAllOnSubmit(delItem);
            //commit delete
            objItemDC.SubmitChanges();

           // delete invoice
           InvoicesDataContext objInvDC = new InvoicesDataContext();

           //get row to delete
           var delInv = from i in objInvDC.brdhc_Invoices where (i.InvoiceID == invID) select i;

           //delete from table
           objInvDC.brdhc_Invoices.DeleteAllOnSubmit(delInv);
           //commit delete
           objInvDC.SubmitChanges();
            
        }
        catch (Exception e)
        {
            clsCommon.saveError(e);
            
        }
    }
Beispiel #11
0
    //method to delete invoice item

    public void deleteItem(Guid _itemID, Guid _invoiceID)
    {
        try
        {
            // respective datacontext object
            InvoiceItemDataContext objItemDC = new InvoiceItemDataContext();

            //get row to delete
            var delItem = from i in objItemDC.brdhc_InvoiceItems where (i.ItemId == _itemID) select i;

            // delete from table
            objItemDC.brdhc_InvoiceItems.DeleteAllOnSubmit(delItem);
            //commit delete
            objItemDC.SubmitChanges();

            //updating total
            InvoicesDataContext objInvDC = new InvoicesDataContext();
            //get invoice row
            var inv = objInvDC.brdhc_Invoices.Single(i => i.InvoiceID == _invoiceID);
            //calculating total
            double total = getTotal(_invoiceID);

            //update total
            inv.TotalAmt = total;

            objInvDC.SubmitChanges();
        }
        catch (Exception e)
        {
            clsCommon.saveError(e);
            
        }
    }