Esempio n. 1
0
        public void Fill()
        {
            DataTable dataTable = Category_DAL.GetDataTable();
            Category  category  = new Category();
            DataRow   dataRow;

            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                dataRow = dataTable.Rows[i];

                category = new Category(dataRow);

                this.Add(category);
            }
        }
        public Guid InsertUpdateRecord(Category objCategory)
        {
            Guid objReturn = new Guid();

            try
            {
                using (Category_DAL objDAL = new Category_DAL())
                {
                    objReturn = objDAL.InsertUpdateRecord(objCategory);
                }
            }
            catch (Exception ex)
            {
                log.Error("InsertUpdateRecord Error: ", ex);
            }
            return(objReturn);
        }
        public Category Validate(string email, string password)
        {
            Category objReturn = null;

            try
            {
                using (Category_DAL objDAL = new Category_DAL())
                {
                    objReturn = objDAL.Validate(email, password);
                }
            }
            catch (Exception ex)
            {
                log.Error("Validate Error: ", ex);
            }
            return(objReturn);
        }
        public Category GetRecordById(Guid iId)
        {
            Category objReturn = null;

            try
            {
                using (Category_DAL objDAL = new Category_DAL())
                {
                    objReturn = objDAL.GetRecordById(iId);
                }
            }
            catch (Exception ex)
            {
                log.Error("GetRecordById Error: ", ex);
            }
            return(objReturn);
        }
        public CategoryPage GetRecordPage(int iPageNo, int iPageSize)
        {
            CategoryPage objReturn = new CategoryPage();

            try
            {
                using (Category_DAL objDAL = new Category_DAL())
                {
                    objReturn = objDAL.GetRecordPage(iPageNo, iPageSize);
                }
            }
            catch (Exception ex)
            {
                log.Error("GetRecordPage Error: ", ex);
            }
            return(objReturn);
        }
        public List <Category> GetAllRecord()
        {
            List <Category> objReturn = null;

            try
            {
                using (Category_DAL objDAL = new Category_DAL())
                {
                    objReturn = objDAL.GetAllRecord();
                }
            }
            catch (Exception ex)
            {
                log.Error("GetAllRecord Error: ", ex);
            }
            return(objReturn);
        }
        public bool DeleteRecord(int iId)
        {
            bool objReturn = false;

            try
            {
                using (Category_DAL objDAL = new Category_DAL())
                {
                    objReturn = objDAL.DeleteRecord(iId);
                }
            }
            catch (Exception ex)
            {
                log.Error("DeleteRecord Error: ", ex);
            }
            return(objReturn);
        }
Esempio n. 8
0
        //Dispaly All Category
        public static DataTable DisplayCategory_BL()
        {
            DataTable Cat = null;

            try
            {
                Cat = Category_DAL.DisplayAllCategories();
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (HRMSException ex)
            {
                throw ex;
            }
            return(Cat);
        }
Esempio n. 9
0
        //Search Category By Id
        public static DataTable SearchCategoryById_BL(int Catid)
        {
            DataTable Cat = null;

            try
            {
                Cat = Category_DAL.SearchCategoryById(Catid);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (HRMSException ex)
            {
                throw ex;
            }
            return(Cat);
        }
Esempio n. 10
0
        //Delete Category
        public static int DeleteCategory_BL(int Catid)
        {
            int rowsAffected = 0;

            try
            {
                rowsAffected = Category_DAL.DeleteCategory(Catid);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (HRMSException ex)
            {
                throw ex;
            }
            return(rowsAffected);
        }
Esempio n. 11
0
        //Get Autogenerated ID
        public static int GetAutogeneratedCategoryID_BL()
        {
            int Catid = 0;

            try
            {
                Catid = Category_DAL.GetAutoGeneratedCategoryId();
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (HRMSException ex)
            {
                throw ex;
            }
            return(Catid);
        }
Esempio n. 12
0
        //Calling Update Category
        public static int UpdateCategory_BL(Category newCat)
        {
            int rowsAffected = 0;

            try
            {
                if (ValidatCategory(newCat))
                {
                    rowsAffected = Category_DAL.UpdateCategory(newCat);
                }
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (HRMSException ex)
            {
                throw ex;
            }
            return(rowsAffected);
        }