private static void DecrementSupplierPaymentDetails()
 {
     try
     {
         string updateSupplierID;
         Console.WriteLine("Enter SupplierID to Update Details:");
         updateSupplierID = Console.ReadLine();
         SupplierPaymentDetails updatedSupPDDetails = SupplierPaymentDetailsBL.SearchSupplierBL(updateSupplierID);
         if (updatedSupPDDetails != null)
         {
             Console.WriteLine("Update Distributor Name :");
             updatedSupPDDetails. = Console.ReadLine();
             Console.WriteLine("Update PhoneNumber :");
             updatedSupPDDetails. = Console.ReadLine();
             bool SupplierUpdated = SupplierPaymentDetailsBL.DecrementPaymentDetailsBL(updatedSupPDDetails);
             if (SupplierUpdated)
             {
                 Console.WriteLine("Supplier Payment Details Updated");
             }
             else
             {
                 Console.WriteLine("Supplier Payment Details not Updated ");
             }
         }
         else
         {
             Console.WriteLine("No Supplier Payment Details Available");
         }
     }
     catch (InventoryException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
        private static void AddSupplierPaymentDetails()
        {
            try
            {
                SupplierPaymentDetails supplierPDDetails = new SupplierPaymentDetails();
                Console.WriteLine("Enter Distributor ID :");
                supplierPDDetails.DistributorID = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Enter Distributor Name :");
                supplierPDDetails.DistributorName = Console.ReadLine();
                Console.WriteLine("Enter PhoneNumber :");
                supplierPDDetails.DistributorContactNumber = Console.ReadLine();
                Console.WriteLine("Enter Email ID :");
                supplierPDDetails.DistributorEmail = Console.ReadLine();

                bool supplierAdded = SupplierPaymentDetailsBL.AddSupplierPaymentDetailsBL(supplierPDDetails);
                if (supplierAdded)
                {
                    Console.WriteLine("Supplier Payment Details Added");
                }
                else
                {
                    Console.WriteLine("Supplier Payment Details not Added");
                }
            }
            catch (InventoryException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
 private static void GetSupplierBillByOrderId()
 {
     try
     {
         string searchSupplierID;
         Console.WriteLine("Enter Supplier ID to Search:");
         searchSupplierID = Console.ReadLine();
         SupplierPaymentDetails searchSupplier = SupplierPaymentDetailsBL.SearchSupplierBL(searchSupplierID);
         if (searchSupplier != null)
         {
             Console.WriteLine("******************************************************************************");
             Console.WriteLine("DistributorID\t\tDistributor Name\t\tPhoneNumber");
             Console.WriteLine("******************************************************************************");
             Console.WriteLine("{0}\t\t{1}\t\t{2}", searchSupplier.DisId, searchSupplier.DisName, searchSupplier.DistributorContactNumber);
             Console.WriteLine("******************************************************************************");
         }
         else
         {
             Console.WriteLine("No Supplier Payment Details Available");
         }
     }
     catch (InventoryException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
        public static bool DecrementPaymentDetailsBL(SupplierPaymentDetails updatepaymentDetails)
        {
            bool detailsUpdated = false;

            try
            {
                if (ValidateSupPayment(updatepaymentDetails))
                {
                    SupplierPaymentDetailsDAL supPDDAL = new SupplierPaymentDetailsDAL();
                    detailsUpdated = supPDDAL.DecrementPaymentDetailsDAL(updatepaymentDetails);
                }
            }
            catch (InventoryException)
            {
                throw;
            }

            /*
             * catch (Exception ex)
             * {
             *  throw ex;
             * }
             */

            return(detailsUpdated);
        }
Exemplo n.º 5
0
        //To add Supplier Payment Details
        public bool AddSupplierPaymentDAL(SupplierPaymentDetails newSupplier)
        {
            bool supplierPaymentAdded;

            try
            {
                supPDList.Add(newSupplier);
                supplierPaymentAdded = true;
            }
            catch (SystemException ex)
            {
                throw new InventoryException(ex.Message);
            }
            return(supplierPaymentAdded);
        }
Exemplo n.º 6
0
        /*public static List<SupplierPaymentDetails> GetAllPaymentDetailsBL()
         * {
         *  List<SupplierPaymentDetails> supplierList;
         *  try
         *  {
         *      SupplierPaymentDetailsDAL supplierDAL = new SupplierPaymentDetailsDAL();
         *      supplierList = supplierDAL.GetPaymentDetailsDAL();
         *  }
         *  catch (InventoryException ex)
         *  {
         *      throw ex;
         *  }
         *  catch (Exception ex)
         *  {
         *      throw ex;
         *  }
         *  return supplierList;
         * }*/

        //Validating & Searching Supplier by using Supplier ID as parameter
        public static SupplierPaymentDetails SearchSupplierBL(string searchSupplierID)
        {
            SupplierPaymentDetails searchSupplier = null;

            try
            {
                SupplierPaymentDetailsDAL distributorDAL = new SupplierPaymentDetailsDAL();
                searchSupplier = distributorDAL.SearchSupplierPDDAL(searchSupplierID);
            }
            catch (InventoryException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(searchSupplier);
        }
        //Searching Supplier by Supplier ID
        public SupplierPaymentDetails SearchSupplierPDDAL(string searchSupplierID)
        {
            SupplierPaymentDetails searchSupplier = null;

            try
            {
                foreach (SupplierPaymentDetails item in supPDList)
                {
                    if (item.SupId == searchSupplierID)
                    {
                        searchSupplier = item;
                    }
                }
            }
            catch (SystemException ex)
            {
                throw new InventoryException(ex.Message);
            }
            return(searchSupplier);
        }
Exemplo n.º 8
0
        public bool DecrementPaymentDetailsDAL(SupplierPaymentDetails updatePaymentDetails)
        {
            bool detailsUpdated = false;

            try
            {
                for (int i = 0; i < supPDList.Count; i++)
                {
                    if (supPDList[i].SupId == updatePaymentDetails.SupId)
                    {
                        updatePaymentDetails.SupTotalPrice    -= supPDList[i].SupTotalPrice;
                        updatePaymentDetails.SupTotalQuantity -= supPDList[i].SupTotalQuantity;
                        detailsUpdated = true;
                    }
                }
            }
            catch (SystemException ex)
            {
                throw new InventoryException(ex.Message);
            }
            return(detailsUpdated);
        }
Exemplo n.º 9
0
        private static bool ValidateSupPayment(SupplierPaymentDetails supPD)
        {
            StringBuilder sb           = new StringBuilder();
            bool          validPayment = true;

            if (supPD.SupTransactionID <= 0)
            {
                validPayment = false;
                sb.Append(Environment.NewLine + "Invalid Supplier ID");
            }
            if (supPD.SupId == string.Empty)
            {
                validPayment = false;
                sb.Append(Environment.NewLine + "Supplier Name Required");
            }

            if (validPayment == false)
            {
                throw new InventoryException(sb.ToString());
            }
            return(validPayment);
        }
Exemplo n.º 10
0
        public static bool AddSupplierPaymentDetailsBL(SupplierPaymentDetails newPayment)
        {
            bool supplierPaymentAdded = false;

            try
            {
                if (ValidateSupPayment(newPayment))
                {
                    SupplierPaymentDetailsDAL supplierDAL = new SupplierPaymentDetailsDAL();
                    supplierPaymentAdded = supplierDAL.AddSupplierPaymentDAL(newPayment);
                }
            }
            catch (InventoryException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(supplierPaymentAdded);
        }