Esempio n. 1
0
        public string SaveDepartment(DepartmentModel aDepartmetModel)
        {
            DepartmentGateway aDepartmentGateway = new DepartmentGateway();
            string            message            = "";

            if (aDepartmentGateway.IsDepartmentCodeExist(aDepartmetModel.DepartmentCode))
            {
                message = "Department Code Exists";
            }
            else if (aDepartmentGateway.IsDepartmentNameExist(aDepartmetModel.DepartmentName))
            {
                message = "Department Name Exists";
            }
            else
            {
                int rowAffected = aDepartmentGateway.SaveDepartment(aDepartmetModel);
                if (rowAffected > 0)
                {
                    message = "Department Saved Successfully";
                }
                else
                {
                    message = "Sorry! Department Save Failed !!";
                }
            }
            return(message);
        }
Esempio n. 2
0
        public DepartmentModel GetDepartmentById(int DeptId)
        {
            DepartmentGateway aDepartmentGateway = new DepartmentGateway();
            DepartmentModel   aDepartmentModel   = new DepartmentModel();

            aDepartmentModel = aDepartmentGateway.GetDepartmentById(DeptId);
            return(aDepartmentModel);
        }
Esempio n. 3
0
        public List <DepartmentModel> GetAllDepartments()
        {
            DepartmentGateway      aDepartmentGateway = new DepartmentGateway();
            List <DepartmentModel> departments        = new List <DepartmentModel>();

            departments = aDepartmentGateway.GetAllDepartments();
            return(departments);
        }
Esempio n. 4
0
        public int DeleteDepartment(int departmentId)
        {
            DepartmentGateway aDepartmentGateway = new DepartmentGateway();
            //          string message = "";

            int rowAffected = aDepartmentGateway.DeleteDepartment(departmentId);


            //return message;
            return(rowAffected);
        }
Esempio n. 5
0
        public int UpdateDepartment(DepartmentModel aDepartmetModel)
        {
            DepartmentGateway aDepartmentGateway = new DepartmentGateway();
            //            string message = "";

            /*            if (aDepartmentGateway.IsDepartmentCodeExist(aDepartmetModel.departmentCode)){
             *              return 5;
             *          }
             *
             *          else if (aDepartmentGateway.IsDepartmentNameExist(aDepartmetModel.departmentName)){
             *
             *              return 6;
             *          }
             *          else */
            {
                int rowAffected = aDepartmentGateway.UpdateDepartment(aDepartmetModel);


                //return message;
                return(rowAffected);
            }
        }
Esempio n. 6
0
        public bool IsDepartmentNameExist(string DeptName)
        {
            DepartmentGateway aDepartmentGateway = new DepartmentGateway();

            return(aDepartmentGateway.IsDepartmentNameExist(DeptName));
        }