Esempio n. 1
0
        public static bool AddEmployeesBLL(Employee emp, Employee_Security empsec, string desig, string grade)
        {
            bool isEmployeeAdded     = false;
            bool isEmployeeValidated = false;

            try
            {
                isEmployeeValidated = ValidateEmployeeBLL(emp, empsec, desig, grade);
                if (isEmployeeValidated)
                {
                    isEmployeeAdded = EmployeeOperations.AddEmployeesDAL(emp, empsec, desig, grade);
                    return(isEmployeeAdded);
                }
                else
                {
                    throw new PayrollException("Error");
                }
            }
            catch (PayrollException)
            {
                throw;
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Esempio n. 2
0
        public static string LoginCheckBLL(int id, string pwd)
        {
            string username = null;
            bool   isLoginValid;

            try
            {
                isLoginValid = ValidLoginBLL(id, pwd);
                if (isLoginValid)
                {
                    username = EmployeeOperations.LoginCheckDAL(id, pwd);
                    return(username);
                }
                else
                {
                    throw new PayrollException("Error");
                }
            }
            catch (PayrollException)
            {
                throw;
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Esempio n. 3
0
        // GET: Employee
        public ActionResult Index()
        {
            EmployeeOperations employeeOperations = new EmployeeOperations();
            var employees = employeeOperations.GetEmployeeData();

            return(View(employees));
        }
Esempio n. 4
0
        private void btnEmployee_Click(object sender, EventArgs e)
        {
            var employeeForm       = new FormEmployee();
            var employeeRepository = new DataAccessEmployee();
            var employeePresenter  = new EmployeeOperations(employeeForm, employeeRepository);

            employeeForm.Show();
        }
        public async Task GenericEmployeeFindWithIncludesTask()
        {
            var employee = await EmployeeOperations.GenericRepositoryFindWithIncludesAsync(3);

            Assert.IsFalse(employee.CountryIdentifierNavigation == null);
            Assert.IsFalse(employee.ContactTypeIdentifierNavigation == null);
            Assert.IsFalse(employee.Orders == null);
            Assert.IsFalse(employee.ReportsToNavigation == null);
        }
Esempio n. 6
0
        public void Setup()
        {
            AutofacConfig.RegisterTypes();
            var stratisEndPoint = new StratisEndPointAdhocService();
            var rsaEngine       = new EncryptDecrypt();

            _moocMicroCredentialProvider = new MoocMicroCredentialProvider(stratisEndPoint, rsaEngine);
            _employeeOperations          = new EmployeeOperations(stratisEndPoint, rsaEngine, _moocMicroCredentialProvider);
            _employerOperations          = new EmployerOperations(stratisEndPoint, rsaEngine, _moocMicroCredentialProvider);
        }
        /* Render */

        public ActionResult Index()
        {
            Account account = base.GetLoginAccount(false);

            if (account == null || !EmployeeOperations.CanRender(account))
            {
                return(base.ToLoginPage());
            }
            return(View());
        }
 /// <summary>
 /// Provides ability to update current employee in the data grid
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ButtonCurrent_OnClick(object sender, RoutedEventArgs e)
 {
     if (Question("Update current employee?"))
     {
         var employee = EmployeeGrid.SelectedItem as Employees;
         if (!EmployeeOperations.Update(employee))
         {
             MessageBox.Show("Update failed");
         }
     }
 }
Esempio n. 9
0
        public void DetectChangesEmployee()
        {
            var results = EmployeeOperations.GetChanges();

            string[] propertyNames = { "City", "CountryIdentifier" };

            var changedResults = results
                                 .Select(item => item.Item1).ToArray();

            Assert.IsTrue(propertyNames.SequenceEqual(changedResults));
        }
 public int AddEmployee_BLL(Employee pobj, Users users)
 {
     try
     {
         EmployeeOperations pd = new EmployeeOperations();
         return(pd.AddEmployee_DAL(pobj, users));
     }
     catch (TaxiExceptions)
     {
         throw;
     }
 }
 public bool UpdateEmployee_BLL(Employee pobj)
 {
     try
     {
         EmployeeOperations pd = new EmployeeOperations();
         return(pd.UpdateEmployee_DAL(pobj));
     }
     catch (TaxiExceptions)
     {
         throw;
     }
 }
 public bool DeleteEmployee_BLL(int employeeID)
 {
     try
     {
         EmployeeOperations pd = new EmployeeOperations();
         return(pd.DeleteEmployee_DAL(employeeID));
     }
     catch (TaxiExceptions)
     {
         throw;
     }
 }
 public Employee SearchEmployee_BLL(int employeeID)
 {
     try
     {
         EmployeeOperations pd = new EmployeeOperations();
         return(pd.SearchEmployee_DAL(employeeID));
     }
     catch (TaxiExceptions)
     {
         throw;
     }
 }
 public DataTable DisplayEmployee_BLL()
 {
     try
     {
         EmployeeOperations pd = new EmployeeOperations();
         return(pd.DisplayEmployee_DAL());
     }
     catch (TaxiExceptions)
     {
         throw;
     }
 }
Esempio n. 15
0
        public async Task GenericEmployeesFindTask()
        {
            var employee = await EmployeeOperations.GenericRepositoryFindAsync(new[]
            {
                "CountryIdentifierNavigation",
                "ContactTypeIdentifierNavigation"
            });

            Assert.IsTrue(
                employee.ContactTypeIdentifierNavigation != null &&
                employee.CountryIdentifierNavigation != null);
        }
Esempio n. 16
0
        public void DetectChangesEmployee1()
        {
            // var not used so it's apparent what is being returned
            List <(string PropertyName, object OriginalValue, object CurrentValue)> results =
                EmployeeOperations.GetChanges1();

            string[] propertyNames = { "City", "CountryIdentifier" };

            var changedResults = results
                                 .Select(item => item.PropertyName).ToArray();

            Assert.IsTrue(propertyNames.SequenceEqual(changedResults));
        }
Esempio n. 17
0
 public ActionResult ReadEmployee(int id)
 {
     using (var context = new DataContext())
     {
         try
         {
             Account account = base.GetLoginAccount();
             Account dbm     = EmployeeOperations.TryRead(account, context, id);
             return(Json(new UIEmployee_CRU(dbm)));
         }
         catch (Exception e)
         {
             base.HandleException("ReadEmployee", e);
             return(null);
         }
     }
 }
Esempio n. 18
0
        public ActionResult ListEmployees(int draw, int start, int length, int authz, int active)
        {
            using (var context = new DataContext())
            {
                try
                {
                    Account account            = base.GetLoginAccount();
                    IQueryable <Account> query = EmployeeOperations.TryList(account, context);

                    // Handle filtering
                    query = query.Where(a => a.active == active);
                    if (authz != Account.AUTHZ_ANY)
                    {
                        query = query.Where(a => a.authz == authz);
                    }

                    // Possibly apply filter
                    var searchstring = Request["search[value]"];
                    if (!String.IsNullOrWhiteSpace(searchstring))
                    {
                        query = query.Where(a =>
                                            a.firstname.Contains(searchstring) ||
                                            a.lastname.Contains(searchstring));
                    }
                    int recordsFiltered = query.Count();

                    // Execute query
                    IList <Account> dbms         = query.OrderBy(a => a.firstname).ThenBy(a => a.lastname).Skip(start).Take(length).ToList();
                    int             recordsTotal = context.Accounts.Count();

                    // Compose view models
                    IList <UIEmployee_List> uims = new List <UIEmployee_List>();
                    foreach (Account dbm in dbms)
                    {
                        uims.Add(new UIEmployee_List(dbm));
                    }
                    return(Json(new { draw = draw, recordsTotal = recordsTotal, recordsFiltered = recordsFiltered, data = uims }));
                }
                catch (Exception e)
                {
                    base.HandleException("ListEmployees", e);
                    return(null);
                }
            }
        }
Esempio n. 19
0
        public int AddEmployee_BLL(Employee newEmp)
        {
            int rowsAffected = 0;
            EmployeeOperations operationObj;
            try
            {
                if (validateEmp(newEmp))
                {
                    operationObj = new EmployeeOperations();
                    rowsAffected = operationObj.AddEmployee(newEmp);
                }
            }
            catch (EmployeeException ex) { throw ex; }
            catch (SqlException se) { throw se; }
            catch (Exception ex) { throw ex; }
            return rowsAffected;

        }
Esempio n. 20
0
        public static bool AddLeavesBLL(Leave_Details leave)
        {
            bool isLeaveAdded = false;

            try
            {
                isLeaveAdded = EmployeeOperations.AddLeavesDAL(leave);
                return(isLeaveAdded);
            }
            catch (PayrollException)
            {
                throw;
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Esempio n. 21
0
        public static DataTable SearchEmpById(int id)
        {
            DataTable eList = new DataTable();

            try
            {
                eList = EmployeeOperations.SearchEmpById(id);
                return(eList);
            }
            catch (PayrollException)
            {
                throw;
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Esempio n. 22
0
        public static List <string> LoginSecurityBLL(int id)
        {
            List <string> qa = new List <string>();

            try
            {
                qa = EmployeeOperations.LoginSecurityDAL(id);
                return(qa);
            }
            catch (PayrollException)
            {
                throw;
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Esempio n. 23
0
        public static int GetLeaveBalanceBLL(int empid)
        {
            try
            {
                int balance;

                balance = EmployeeOperations.GetLeaveBalanceDAL(empid);

                return(balance);
            }
            catch (PayrollException)
            {
                throw;
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Esempio n. 24
0
        public static bool UpdateDetailsBLL(int empid, string fname, string lname, string address)
        {
            try
            {
                bool isUpdated = false;

                isUpdated = EmployeeOperations.UpdateDetailsDAL(empid, fname, lname, address);

                return(isUpdated);
            }
            catch (PayrollException)
            {
                throw;
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Esempio n. 25
0
        public static bool UpdateEmployeedetailsDAL(int empid, string fname, string lname, string desig, string grade)
        {
            try
            {
                bool isUpdated = false;

                isUpdated = EmployeeOperations.UpdateEmployeedetailsDAL(empid, fname, lname, desig, grade);

                return(isUpdated);
            }
            catch (PayrollException)
            {
                throw;
            }
            catch (System.Exception)
            {
                throw;
            }
        }
Esempio n. 26
0
        public DataTable LoadDeparment_BLL()
        {
            DataTable dtDept;
            try
            {
                empOperation = new EmployeeOperations();
                dtDept = empOperation.LoadDeparment();
            }
            catch (SqlException se)
            {

                throw se;
            }
            catch (Exception ex)
            {

                throw ex;
            }
            return dtDept;
        }
Esempio n. 27
0
        public ActionResult DeleteEmployee(int id)
        {
            AjaxStatus status = new AjaxStatus();

            using (var context = new DataContext())
            {
                try
                {
                    Account account = base.GetLoginAccount();
                    EmployeeOperations.TryDelete(account, context, id);
                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    base.HandleException("DeleteEmployee", e);
                    status.SetError(e.Message);
                }
            }
            return(Json(status));
        }
Esempio n. 28
0
        public DataTable GetEmployee_BLL()
        {
            DataTable dtEmp;
            try
            {
                empOperation = new EmployeeOperations();
                dtEmp = empOperation.GetEmployee();
            }
            catch (SqlException se)
            {

                throw se;
            }
            catch (Exception ex)
            {

                throw ex;
            }
            return dtEmp;
        }
Esempio n. 29
0
        public CandidateController(UnitOfWork unitOfWork)
        {
            _roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(new ApplicationDbContext()));
            _unitOfWork  = unitOfWork;
            _unitOfWork.UniSADbContext = new UniSA.DataAccess.UniSADbContext();
            var stratisEndPoint             = new StratisEndPointAdhocService();
            var moocMicroCredentialProvider = new MoocMicroCredentialProvider(new StratisEndPointAdhocService(), new EncryptDecrypt());

            var        employeeProvider = new EmployeeOperations(stratisEndPoint, new EncryptDecrypt(), moocMicroCredentialProvider);
            HttpClient client           = new HttpClient();

            client.BaseAddress = new Uri(ConfigurationManager.AppSettings["StratisBlockChainBaseUrl"]);
            var stratisApiRequests = new UniSA.Services.StratisBlockChainServices.StratisApi.StratisApiFullfilRequestComponent(client);;

            moocMicroCredentialProvider.StratisApiFullfilRequestComponent = stratisApiRequests;
            _repositoryEndPointService = new RepositoryEndPointServices(_unitOfWork, moocMicroCredentialProvider);
            _repositoryEndPointService.EmployeeOperations         = employeeProvider;
            moocMicroCredentialProvider.RepositoryEndPointService = _repositoryEndPointService;
            employeeProvider.RepositoryEndPointService            = _repositoryEndPointService;
            employeeProvider.StratisApiFullfilRequestComponent    = stratisApiRequests;
        }
Esempio n. 30
0
        public ActionResult CreateEmployee(UIEmployee_CRU uim)
        {
            AjaxStatus status = new AjaxStatus();

            using (var context = new DataContext())
            {
                try
                {
                    Account account = base.GetLoginAccount();
                    Account model   = uim.CreateModel();
                    EmployeeOperations.TryCreate(account, context, model);
                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    base.HandleException("CreateEmployee", e);
                    status.SetError(e.Message);
                }
            }
            return(Json(status));
        }