private static void GetDistributorBillByOrderId()
 {
     try
     {
         string searchDistributorID;
         Console.WriteLine("Enter Distributor ID to Search:");
         searchDistributorID = Console.ReadLine();
         DistributorPaymentDetails searchDistributor = DistributorPaymentDetailsBL.SearchDistributorBL(searchDistributorID);
         if (searchDistributor != null)
         {
             Console.WriteLine("******************************************************************************");
             Console.WriteLine("DistributorID\t\tDistributor Name\t\tPhoneNumber");
             Console.WriteLine("******************************************************************************");
             Console.WriteLine("{0}\t\t{1}\t\t{2}", searchDistributor.DisId, searchDistributor.DisName, searchDistributor.DistributorContactNumber);
             Console.WriteLine("******************************************************************************");
         }
         else
         {
             Console.WriteLine("No Distributor Payment Details Available");
         }
     }
     catch (InventoryException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
 private static void DecrementDistributorPaymentDetails()
 {
     try
     {
         string updateDistributorID;
         Console.WriteLine("Enter DistributorID to Update Details:");
         updateDistributorID = Console.ReadLine();
         DistributorPaymentDetails updatedDisPDDetails = DistributorPaymentDetailsBL.SearchDistributorBL(updateDistributorID);
         if (updatedDisPDDetails != null)
         {
             Console.WriteLine("Update Distributor Name :");
             updatedDisPDDetails. = Console.ReadLine();
             Console.WriteLine("Update PhoneNumber :");
             updatedDisPDDetails. = Console.ReadLine();
             bool distributorUpdated = DistributorPaymentDetailsBL.DecrementPaymentDetailsBL(updatedDisPDDetails);
             if (distributorUpdated)
             {
                 Console.WriteLine("Distributor Details Updated");
             }
             else
             {
                 Console.WriteLine("Distributor Details not Updated ");
             }
         }
         else
         {
             Console.WriteLine("No Distributor Details Available");
         }
     }
     catch (InventoryException ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
        private static void AddDistributorPaymentDetails()
        {
            try
            {
                DistributorPaymentDetails distributorPDDetails = new DistributorPaymentDetails();
                Console.WriteLine("Enter Distributor ID :");
                distributorPDDetails.DistributorID = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Enter Distributor Name :");
                distributorPDDetails.DistributorName = Console.ReadLine();
                Console.WriteLine("Enter PhoneNumber :");
                distributorPDDetails.DistributorContactNumber = Console.ReadLine();
                Console.WriteLine("Enter Email ID :");
                distributorPDDetails.DistributorEmail = Console.ReadLine();

                bool distributorAdded = DistributorPaymentDetailsBL.AddDistributorPaymentDetailsBL(distributorPDDetails);
                if (distributorAdded)
                {
                    Console.WriteLine("Distributor Payment Details Added");
                }
                else
                {
                    Console.WriteLine("Distributor Payment Details not Added");
                }
            }
            catch (InventoryException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #4
0
        //To add Distributor Payment Details
        public bool AddDistributorPaymentDAL(DistributorPaymentDetails newPayment)
        {
            bool distributorPaymentAdded;

            try
            {
                disPDList.Add(newPayment);
                distributorPaymentAdded = true;
            }
            catch (SystemException ex)
            {
                throw new InventoryException(ex.Message);
            }
            return(distributorPaymentAdded);
        }
Beispiel #5
0
        //Validating & Searching Distributor by using Distributor ID as parameter
        public static DistributorPaymentDetails SearchDistributorBL(string searchDistributorID)
        {
            DistributorPaymentDetails searchDistributor = null;

            try
            {
                DistributorPaymentDetailsDAL distributorDAL = new DistributorPaymentDetailsDAL();
                searchDistributor = distributorDAL.SearchDistributorPDDAL(searchDistributorID);
            }
            catch (InventoryException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(searchDistributor);
        }
Beispiel #6
0
        //Searching Distributor by Distributor ID
        public DistributorPaymentDetails SearchDistributorPDDAL(string searchDistributorID)
        {
            DistributorPaymentDetails searchDistributor = null;

            try
            {
                foreach (DistributorPaymentDetails item in disPDList)
                {
                    if (item.DisId == searchDistributorID)
                    {
                        searchDistributor = item;
                    }
                }
            }
            catch (SystemException ex)
            {
                throw new InventoryException(ex.Message);
            }
            return(searchDistributor);
        }
Beispiel #7
0
        private static bool ValidateDisPayment(DistributorPaymentDetails disPD)
        {
            StringBuilder sb           = new StringBuilder();
            bool          validPayment = true;

            if (disPD.DisTransactionID <= 0)
            {
                validPayment = false;
                sb.Append(Environment.NewLine + "Invalid Distributor ID");
            }
            if (disPD.DisId == string.Empty)
            {
                validPayment = false;
                sb.Append(Environment.NewLine + "Distributor Name Required");
            }

            if (validPayment == false)
            {
                throw new InventoryException(sb.ToString());
            }
            return(validPayment);
        }
Beispiel #8
0
        //To increment the
        public bool IncrementPaymentDetailsDAL(DistributorPaymentDetails updatePaymentDetails)
        {
            bool detailsUpdated = false;

            try
            {
                for (int i = 0; i < disPDList.Count; i++)
                {
                    if (disPDList[i].DisId == updatePaymentDetails.DisId)
                    {
                        updatePaymentDetails.DisTotalPrice    += disPDList[i].DisTotalPrice;
                        updatePaymentDetails.DisTotalQuantity += disPDList[i].DisTotalQuantity;
                        detailsUpdated = true;
                    }
                }
            }
            catch (SystemException ex)
            {
                throw new InventoryException(ex.Message);
            }
            return(detailsUpdated);
        }
Beispiel #9
0
        public static bool AddDistributorPaymentDetailsBL(DistributorPaymentDetails newPayment)
        {
            bool distributorPaymentAdded = false;

            try
            {
                if (ValidateDisPayment(newPayment))
                {
                    DistributorPaymentDetailsDAL distributorDAL = new DistributorPaymentDetailsDAL();
                    distributorPaymentAdded = distributorDAL.AddDistributorPaymentDAL(newPayment);
                }
            }
            catch (InventoryException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(distributorPaymentAdded);
        }
Beispiel #10
0
        public static bool DecrementPaymentDetailsBL(DistributorPaymentDetails updatepaymentDetails)
        {
            bool detailsUpdated = false;

            try
            {
                if (ValidateDisPayment(updatepaymentDetails))
                {
                    DistributorPaymentDetailsDAL supPDDAL = new DistributorPaymentDetailsDAL();
                    detailsUpdated = supPDDAL.DecrementPaymentDetailsDAL(updatepaymentDetails);
                }
            }
            catch (InventoryException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(detailsUpdated);
        }