Ejemplo n.º 1
0
 public static bool insertPaymentToSupplier(APCEntities APCContext, SupplierInvoice supplierInvoice, decimal paymentAmount, DateTime paymentDate)
 {
     PaymentToSupplier paymentToSupplier = new PaymentToSupplier();
     paymentToSupplier.SupplierInvoice = supplierInvoice;
     paymentToSupplier.PaymentAmount = paymentAmount;
     paymentToSupplier.PaymentDate = paymentDate;
     APCContext.AddToPaymentToSupplier(paymentToSupplier);
     APCContext.SaveChanges();
     return true;
 }
Ejemplo n.º 2
0
 public static PO insertPO(APCEntities APCContext, Supplier supplier, Project project)
 {
     PO po = new PO();
     po.Supplier = supplier;
     po.Project = project;
     po.DateCreated = DateTime.Today;
     po.Invoiced = false;
     APCContext.AddToPO(po);
     APCContext.SaveChanges();
     return po;
 }
Ejemplo n.º 3
0
        public static PaymentFromClient insertPaymentFromClient(APCEntities APCContext, Invoice invoice, decimal paymentAmount, DateTime paymentDate)
        {
            PaymentFromClient paymentFromClient = new PaymentFromClient();
            paymentFromClient.Invoice = invoice;
            paymentFromClient.PaymentAmount = paymentAmount;
            paymentFromClient.PaymentDate = paymentDate;
            APCContext.AddToPaymentFromClient(paymentFromClient);
            APCContext.SaveChanges();

            return paymentFromClient;
        }
Ejemplo n.º 4
0
 public static bool insertSupplier(APCEntities APCContext, string name)
 {
     if (name.Trim() != "")
     {
         Supplier supplier = new Supplier();
         supplier.Name = name;
         APCContext.AddToSupplier(supplier);
         APCContext.SaveChanges();
         return true;
     }
     else
         return false;
 }
Ejemplo n.º 5
0
 public static bool insertClient(APCEntities APCContext, string name)
 {
     if (name.Trim() != "")
     {
         Client client = new Client();
         client.Name = name;
         APCContext.AddToClient(client);
         APCContext.SaveChanges();
         return true;
     }
     else
         return false;
 }
Ejemplo n.º 6
0
 public static bool insertCategory(APCEntities APCContext, string name)
 {
     if (name.Trim() != "")
     {
         Category category = new Category();
         category.Name = name;
         //category.ServiceCharge = serviceCharge;
         APCContext.AddToCategory(category);
         APCContext.SaveChanges();
         return true;
     }
     else
         return false;
 }
Ejemplo n.º 7
0
 public static bool insertWorkers(APCEntities APCContext, string name, decimal salary)
 {
     if (name.Trim() != "")
     {
         Workers workers = new Workers();
         workers.Name = name;
         workers.Salary = salary;
         APCContext.AddToWorkers(workers);
         APCContext.SaveChanges();
         return true;
     }
     else
         return false;
 }
Ejemplo n.º 8
0
 public static bool insertProject(APCEntities APCContext, string name, Client client)
 {
     if (name.Trim() != "")
     {
         Project project = new Project();
         project.Name = name;
         project.Client = client;
         APCContext.AddToProject(project);
         APCContext.SaveChanges();
         return true;
     }
     else
         return false;
 }
Ejemplo n.º 9
0
 public static bool insertPO_Product(APCEntities APCContext, PO po, Category category, string description, int quantity, decimal price, decimal serviceCharge, decimal totalPrice, bool subcon)
 {
     PO_Product po_product = new PO_Product();
     po_product.PO = po;
     po_product.Category = category;
     po_product.Description = description;
     po_product.Quantity = quantity;
     po_product.Price = price;
     po_product.ServiceCharge = serviceCharge;
     po_product.PriceTotal = totalPrice;
     po_product.SubCon = subcon;
     APCContext.AddToPO_Product(po_product);
     APCContext.SaveChanges();
     return true;
 }
Ejemplo n.º 10
0
 public static bool insertInvoice_Product(APCEntities APCContext, Invoice invoice, Category category, string description, int quantity, string unit, decimal price, Kurs kurs, decimal serviceCharge, decimal totalPrice, bool subcon)
 {
     Invoice_Product invoice_product = new Invoice_Product();
     invoice_product.Invoice = invoice;
     invoice_product.Category = category;
     invoice_product.Description = description;
     invoice_product.Quantity = quantity;
     invoice_product.Unit = unit;
     invoice_product.Price = price;
     invoice_product.Kurs = kurs;
     invoice_product.ServiceCharge = serviceCharge;
     invoice_product.PriceTotal = totalPrice;
     invoice_product.SubCon = subcon;
     APCContext.AddToInvoice_Product(invoice_product);
     APCContext.SaveChanges();
     return true;
 }
Ejemplo n.º 11
0
 public static bool insertSupplierInvoice(APCEntities APCContext, string supplierOriNo, decimal paymentDue, DateTime dueDate, PO po)
 {
     if (supplierOriNo.Trim() != "")
     {
         SupplierInvoice supplierInvoice = new SupplierInvoice();
         supplierInvoice.SupplierOriNo = supplierOriNo;
         supplierInvoice.PaymentDue    = paymentDue;
         supplierInvoice.DueDate       = dueDate;
         supplierInvoice.PO            = po;
         supplierInvoice.Paid          = false;
         APCContext.AddToSupplierInvoice(supplierInvoice);
         APCContext.SaveChanges();
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 12
0
 public static bool insertInvoicePO(APCEntities APCContext, Invoice invoice, PO po)
 {
     try
     {
         Invoice_PO invoicePO = new Invoice_PO();
         invoicePO.Invoice = invoice;
         invoicePO.PO = po;
         APCContext.AddToInvoice_PO(invoicePO);
         po.Invoiced = true;
         APCContext.SaveChanges();
         return true;
     }
     catch(Exception e)
     {
         return false;
     }
 }
Ejemplo n.º 13
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            int id = 0;

            int.TryParse(tbId.Text, out id);
            if (id != 0)
            {
                Invoice currentInvoice = BLInvoice.GetInvoiceById(APCContext, id);
                if (currentInvoice != null)
                {
                    decimal paymentDue = 0;
                    if (decimal.TryParse(tbPaymentDue.Text, out paymentDue))
                    {
                        if (calDueDate.Value != null)
                        {
                            //if (ddlPO.SelectedValue != null)
                            //{
                            if (ddlProject.SelectedValue != null)
                            {
                                PO      selectedPO      = BLPO.GetPOById(APCContext, int.Parse(ddlPO.SelectedValue.ToString()));
                                Project selectedProject = BLProject.GetProjectById(APCContext, int.Parse(ddlProject.SelectedValue.ToString()));

                                currentInvoice.TotalDue   = paymentDue;
                                currentInvoice.DueDate    = calDueDate.Value;
                                currentInvoice.ScannedDoc = tbScannedDoc.Text;
                                currentInvoice.Project    = selectedProject;
                                APCContext.SaveChanges();

                                DeleteInvoicePO(currentInvoice);
                                InsertInvoicePO(currentInvoice);

                                deleteInvoice_Product(currentInvoice);
                                insertInvoice_Product(currentInvoice);

                                MessageBox.Show("Invoice Details Successfully Updated");
                                ClearContent();
                            }
                            else
                            {
                                MessageBox.Show("Please select the associated Project");
                            }
                            //}
                            //else
                            //    MessageBox.Show("Please select the associated PO Number");
                        }
                        else
                        {
                            MessageBox.Show("Please specify a correct due date");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please specify correct amount of Payment Due");
                    }
                }
                else
                {
                    MessageBox.Show("Invoice Id not found");
                }
            }
            else
            {
                MessageBox.Show("Invoice Id not found");
            }
        }
 public void Atualizar(TEntity obj)
 {
     db.Entry(obj).State = EntityState.Modified;
     db.SaveChanges();
 }
Ejemplo n.º 15
0
        public static Invoice insertInvoice(APCEntities APCContext, DateTime dateCreated, decimal TotalDue, DateTime dueDate, string scannedDoc, Project project)
        {
            Invoice invoice = new Invoice();
            invoice.DateCreated = dateCreated;
            invoice.TotalDue = TotalDue;
            invoice.DueDate = dueDate;
            invoice.ScannedDoc = scannedDoc;
            invoice.Project = project;
            APCContext.AddToInvoice(invoice);
            APCContext.SaveChanges();

            return invoice;
        }
Ejemplo n.º 16
0
 public static bool insertProject_Workers(APCEntities APCContext, Project project, Workers worker, DateTime startDate, DateTime endDate, decimal totalHours, decimal salary)
 {
     Project_Workers project_workers = new Project_Workers();
     project_workers.Project = project;
     project_workers.Workers = worker;
     project_workers.StartDate = startDate;
     project_workers.EndDate = endDate;
     project_workers.TotalHours = totalHours;
     project_workers.Salary = salary;
     project_workers.TotalSalary = salary * totalHours;
     project_workers.Invoiced = false;
     APCContext.AddToProject_Workers(project_workers);
     APCContext.SaveChanges();
     return true;
 }
Ejemplo n.º 17
0
 public static bool insertSupplierInvoice(APCEntities APCContext, string supplierOriNo, decimal paymentDue, DateTime dueDate, PO po)
 {
     if (supplierOriNo.Trim() != "")
     {
         SupplierInvoice supplierInvoice = new SupplierInvoice();
         supplierInvoice.SupplierOriNo = supplierOriNo;
         supplierInvoice.PaymentDue = paymentDue;
         supplierInvoice.DueDate = dueDate;
         supplierInvoice.PO = po;
         supplierInvoice.Paid = false;
         APCContext.AddToSupplierInvoice(supplierInvoice);
         APCContext.SaveChanges();
         return true;
     }
     else
         return false;
 }