示例#1
0
        public static JMS_Entities SearchSalesMan(int SalesManCode)
        {
            JMS_Entities SalesManSearched = null;

            try
            {
                //Searching Customer
                SalesManSearched = JMS_DAL.SearchSalesMan(SalesManCode);

                //If searched Customer is null raise exception
                if (SalesManSearched == null)
                {
                    throw new JMS_Exceptions("SalesMan Info does not exist!");
                }
            }
            catch (JMS_Exceptions p)
            {
                throw;
            }
            catch (SystemException e)
            {
                Console.WriteLine(e.Message);
            }

            return(SalesManSearched);
        }
示例#2
0
        public static bool DeleteSalesMan(int SalesManCode)
        {
            bool         SalesManDeleted     = true;
            JMS_Entities salesmanToBeDeleted = null;

            try
            {
                //Search customer in the records
                salesmanToBeDeleted = JMS_DAL.SearchSalesMan(SalesManCode);

                //If Guest is not null delete customer otherwise raise exception
                if (salesmanToBeDeleted != null)
                {
                    SalesManDeleted = JMS_DAL.DeleteSalesMan(salesmanToBeDeleted);
                }
                else
                {
                    SalesManDeleted = false;
                    throw new JMS_Exceptions("SalesMan Info does not exists to delete");
                }
            }
            catch (JMS_Exceptions p)
            {
                throw;
            }
            catch (SystemException e)
            {
                Console.WriteLine(e.Message);
            }

            return(SalesManDeleted);
        }
示例#3
0
        public static bool AddSalesMan(JMS_Entities newSalesMan)
        {
            bool SalesManAdded = false;

            try
            {
                if (ValidateSalesMan(newSalesMan))
                {
                    SalesManAdded = JMS_DAL.AddSalesMan(newSalesMan);
                }
            }
            catch (JMS_Exceptions)
            {
                throw;
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
            return(SalesManAdded);
        }
示例#4
0
        public static bool UpdateSalesMan(JMS_Entities SalesManToBeUpdated)
        {
            bool SalesManUpdated = true;

            try
            {
                //Searching customer, if found update or raise exception
                if (JMS_DAL.SearchSalesMan(SalesManToBeUpdated.SalesManCode) != null)
                {
                    //validating customer, if valid update o.w. raise exception
                    if (ValidateSalesMan(SalesManToBeUpdated))
                    {
                        SalesManUpdated = JMS_DAL.UpdateSalesMan(SalesManToBeUpdated);
                    }
                    else
                    {
                        SalesManUpdated = false;
                        throw new JMS_Exceptions("SalesMan Info is not updated because it is not valid!");
                    }
                }
                else
                {
                    SalesManUpdated = false;
                    throw new JMS_Exceptions("SalesMan id not exists for update!");
                }
            }
            catch (JMS_Exceptions e)
            {
                throw;
            }
            catch (SystemException e)
            {
                Console.WriteLine(e.Message);
            }

            return(SalesManUpdated);
        }
示例#5
0
        public static List <JMS_Entities> DisplayFromFile()
        {
            List <JMS_Entities> SMS = JMS_DAL.DisplaySalesManFromFile();

            return(SMS);
        }
示例#6
0
 public static void SerializeData()
 {
     JMS_DAL.SerializeData();
 }
示例#7
0
 public static List <JMS_Entities> ReturnSalesManInformation1()
 {
     return(JMS_DAL.ReturnSalesManInformation());
 }