Exemplo n.º 1
0
        public ActionResult Manage(string SalaryDate)
        {
            try
            {
                ViewBag.SalaryDate = GetSalaryDateList();
                var _salary  = new SalaryViewModel();
                var _idsList = new List <int>();
                _salary.SalaryList = new List <SalaryInfo>();

                _salary.SalaryDate = SalaryDate;

                using (PaySlipRepository Repo = new PaySlipRepository())
                {
                    _idsList = Repo.GetEmployeeIdsListIncludeSelectedDate(_salary.SalaryDate);
                }

                using (SalaryRepository Repo = new SalaryRepository())
                {
                    _salary.SalaryList = Repo.GetSalaryList();
                }

                if (_idsList.Count() > 0)
                {
                    _salary.SalaryList = _salary.SalaryList.Where(t => !_idsList.Contains((int)t.EmployeeInfoId)).ToList();
                }

                return(View(_salary));
            }

            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Salary", "Manage")));
            }
        }
Exemplo n.º 2
0
        // GET: Admin/Salary/Update
        public ActionResult Update(string id = "")
        {
            try
            {
                int temp;

                if (!int.TryParse(id, out temp))
                {
                    return(RedirectToAction("Manage", "Salary"));
                }

                SalaryInfo salary = null;

                using (SalaryRepository Repo = new SalaryRepository())
                {
                    salary = Repo.GetSalaryById(int.Parse(id));
                }

                if (salary == null)
                {
                    return(RedirectToAction("Manage", "Salary"));
                }

                return(View(salary));
            }

            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Salary", "Update")));
            }
        }
Exemplo n.º 3
0
        public ActionResult Update(SalaryInfo salaryInfo)
        {
            try
            {
                using (SalaryRepository Repo = new SalaryRepository())
                {
                    int totalSalary = Convert.ToInt32(salaryInfo.TotalSalary);

                    salaryInfo.IncomTax         = Math.Round(Convert.ToDecimal(TaxCalculator.CalculateTax(totalSalary)), 2);
                    salaryInfo.BasicSalary      = Convert.ToDecimal(totalSalary * 0.65);
                    salaryInfo.MedicalAllowance = Convert.ToDecimal(totalSalary * 0.1);
                    salaryInfo.HouseRent        = Convert.ToDecimal(totalSalary * 0.25);

                    salaryInfo.ModifiedByAccountId = CurrentUser.AccountId;
                    salaryInfo.ModifiedDate        = DateTime.Now;

                    Repo.UpdateSalary(salaryInfo);
                }

                return(RedirectToAction("Update", "Salary", new { id = salaryInfo.Id }));
            }

            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Salary", "Update")));
            }
        }
Exemplo n.º 4
0
        public void GetBenefitDeductionsPositive()
        {
            IEmployeeRepository EmployeeRepos = new EmployeeRepository();

            var AEmployee = EmployeeRepos.GetEmployeeById(1);

            Assert.IsNotNull(AEmployee);

            List <IFamilyMember> FamilyMembers = EmployeeRepos.GetFamilyMembers(AEmployee);

            Assert.IsNotNull(FamilyMembers);

            ISalaryRepository SalaryEmployeeRepos = new SalaryRepository(AEmployee);

            ISalary AEmployeeSalary = SalaryEmployeeRepos.GetSalary();

            Assert.IsNotNull(AEmployeeSalary);

            IBenefitDeductionRepository BenefitDeductionRepos =
                new BenefitDeductionRepository(AEmployee, FamilyMembers, AEmployeeSalary);

            IBenefitDeductionDetail ABenefitDeductionDetail =
                BenefitDeductionRepos.CalculateBenefitDeductionDetail();

            Assert.IsNotNull(ABenefitDeductionDetail);
        }
Exemplo n.º 5
0
        public MainPresenter(IMainView mainView, string nameOrConnectionString)
        {
            view       = mainView;
            repository = new SalaryRepository(nameOrConnectionString);

            view.ShowEmployeesClick += View_ShowEmployeesClick;
        }
        private const string dateTimeFormat = "d.MM.yyyy";   // Use this format.

        public FormSalaries()
        {
            InitializeComponent();

            salRepo = new SalaryRepository();   //contains data
            empRepo = new EmployerRepository(); //contains data FK

            RefreshGui();
        }
Exemplo n.º 7
0
        public ActionResult SalaryDetail(int?id)
        {
            SalaryViewModel model = new SalaryViewModel();

            if (id.HasValue)
            {
                model = new SalaryRepository().GetByID((int)id);
            }
            return(PartialView("_Salary", model));
        }
Exemplo n.º 8
0
        public JsonResult Salary(int?draw, int?start, int?length, List <Dictionary <string, string> > order, List <Dictionary <string, string> > columns)
        {
            var search = Request["search[value]"];
            var dir    = order[0]["dir"].ToLower();
            var column = columns[int.Parse(order[0]["column"])]["data"];

            var dataTableData = new SalaryRepository().GetPage(search, draw, start, length, dir, column);

            return(Json(dataTableData, JsonRequestBehavior.AllowGet));
        }
        public FormReports()
        {
            InitializeComponent();
            dpmRepo          = new DepartmentRepository();
            empRepo          = new EmployerRepository();
            salRepo          = new SalaryRepository();
            people           = new List <HumanItem>();
            salariesPerMonth = new Dictionary <DateTime, List <double> >();

            RefreshGui();
        }
 public PublicAccountWaterApplication(UnitOfWorkFactory factory,
     PersonalAccountRepository personalAccountRepository,
     categoryRepository categoryRepository,
     PublicAccountWaterRepository publicAccountWaterRepository,
     SalaryRepository salaryRepository)
     : base(factory)
 {
     this._personalAccountRepository = personalAccountRepository;
     this._categoryRepository = categoryRepository;
     this._publicAccountWaterRepository = publicAccountWaterRepository;
     this._salaryRepository = salaryRepository;
 }
        public FormSalariesEdit(EmployerRepository repositoryOfEmployee)
        {
            InitializeComponent();

            salRepo      = new SalaryRepository();
            ss           = new SoloSalary();
            this.empRepo = repositoryOfEmployee;
            monthCalendarUntil.SetDate(DateTime.Today.AddYears(1)); //add default end date
            comboBoxEmp.DataSource    = empRepo.getComboBoxSource();
            comboBoxEmp.DisplayMember = "Name3";                    //changing by event
            comboBoxEmp.ValueMember   = "ID";
            comboBoxEmp.SelectedIndex = -1;                         //not implicitely touch other users
        }
        public ActionResult <SalaryDto> Get(int employeeId)
        {
            IEmployeeRepository EmployeeRepos = new EmployeeRepository();

            IEmployee         AEmployee           = EmployeeRepos.GetEmployeeById(employeeId);
            ISalaryRepository SalaryEmployeeRepos = new SalaryRepository(AEmployee);

            ISalary AEmployeeSalary = SalaryEmployeeRepos.GetSalary();

            var ASalaryDto = Util.Converters.SalaryConverter.Convert(AEmployeeSalary);

            return(ASalaryDto);
        }
Exemplo n.º 13
0
        public void GetEmployeeSalaryPositive()
        {
            IEmployeeRepository EmployeeRepos = new EmployeeRepository();

            IEmployee AEmployee = EmployeeRepos.GetEmployeeById(1);

            Assert.IsNotNull(AEmployee);

            ISalaryRepository SalaryEmployeeRepos = new SalaryRepository(AEmployee);

            ISalary AEmployeeSalary = SalaryEmployeeRepos.GetSalary();

            Assert.IsNotNull(AEmployeeSalary);
        }
Exemplo n.º 14
0
 public UnitOfWork(SalaryAppContext context)
 {
     _context      = context;
     Banks         = new BankRepository(_context);
     Cities        = new CityRepository(_context);
     Countries     = new CountryRepository(_context);
     Companies     = new CompanyRepository(_context);
     Genders       = new GenderRepository(_context);
     Employees     = new EmployeeRepository(_context);
     Workplaces    = new WorkplaceRepository(_context);
     Salaries      = new SalaryRepository(_context);
     SalaryDetails = new SalaryDitailsRepository(_context);
     Attendances   = new AttendanceRepository(_context);
 }
Exemplo n.º 15
0
        public void GivenSalaryDetails_AbleToUpdateSalarayDetails()
        {
            SalaryRepository  salary      = new SalaryRepository();
            SalaryUpdateModel updateModel = new SalaryUpdateModel()
            {
                SalaryId       = 2,
                Month          = "Jan",
                EmployeeSalary = 120,
                EmployeeId     = 1
            };

            int EmpSalary = salary.UpdateSalary(updateModel);

            Assert.AreEqual(updateModel.EmployeeSalary, EmpSalary);
        }
Exemplo n.º 16
0
        public JsonResult SaveSalary(SalaryViewModel model)
        {
            ResponseData result = new Models.ResponseData();

            if (model.SaID != 0)
            {
                result = new SalaryRepository().UpdateByEntity(model);
            }
            else
            {
                result = new SalaryRepository().AddByEntity(model);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 17
0
        public TestFixture()
        {
            ISalaryRepository   salary_repository    = new SalaryRepository();
            IEmployeeRepository employees_repository = new EmployeeRepository();

            using (var uow = new NHUnitOfWork()) {
                var e  = Employee.Create(Person.Create("juan", "santos", "puruntong", "", Gender.MALE, Date.Now), Date.Now);
                var s  = Salary.Create(e, MonetaryValue.of("php", 10000));
                var d  = Deduction.Create(s, 3, MonetaryValue.of("php", 5000));
                var da = Deduction.CreateAmortized(s, 12, MonetaryValue.of("php", 200), mode: DeductionMode.CONTINIOUS);
                var db = Deduction.CreateAmortized(s, 12, MonetaryValue.of("php", 300), mode: DeductionMode.CONTINIOUS);
                var dc = Deduction.CreateAmortized(s, 12, MonetaryValue.of("php", 400), mode: DeductionMode.CONTINIOUS);

                var e2  = Employee.Create(Person.Create("juan", "cruz", "dela cruz", "", Gender.MALE, Date.Now), Date.Now);
                var s2  = Salary.Create(e2, MonetaryValue.of("php", 15000));
                var d2  = Deduction.Create(s2, 3, MonetaryValue.of("php", 3000));
                var d2a = Deduction.CreateAmortized(s2, 12, MonetaryValue.of("php", 200), mode: DeductionMode.CONTINIOUS);
                var d2b = Deduction.CreateAmortized(s2, 12, MonetaryValue.of("php", 300), mode: DeductionMode.CONTINIOUS);
                var d2c = Deduction.CreateAmortized(s2, 12, MonetaryValue.of("php", 400), mode: DeductionMode.CONTINIOUS);

                var e3  = Employee.Create(Person.Create("ann", "santos", "cruz", "", Gender.FEMALE, Date.Now), Date.Now);
                var s3  = Salary.Create(e3, MonetaryValue.of("php", 13000));
                var d3  = Deduction.Create(s3, 2, MonetaryValue.of("php", 2000));
                var d3a = Deduction.CreateAmortized(s3, 12, MonetaryValue.of("php", 200), mode: DeductionMode.CONTINIOUS);
                var d3b = Deduction.CreateAmortized(s3, 12, MonetaryValue.of("php", 300), mode: DeductionMode.CONTINIOUS);
                var d3c = Deduction.CreateAmortized(s3, 12, MonetaryValue.of("php", 400), mode: DeductionMode.CONTINIOUS);

                var e4  = Employee.Create(Person.Create("audrey", "yin", "yang", "", Gender.FEMALE, Date.Now), Date.Now);
                var s4  = Salary.Create(e4, MonetaryValue.of("php", 14000));
                var d4  = Deduction.Create(s4, 2, MonetaryValue.of("php", 5000));
                var d4a = Deduction.CreateAmortized(s4, 12, MonetaryValue.of("php", 200), mode: DeductionMode.CONTINIOUS);
                var d4b = Deduction.CreateAmortized(s4, 12, MonetaryValue.of("php", 300), mode: DeductionMode.CONTINIOUS);
                var d4c = Deduction.CreateAmortized(s4, 12, MonetaryValue.of("php", 400), mode: DeductionMode.CONTINIOUS);

                employees_repository.Save(e);
                employees_repository.Save(e2);
                employees_repository.Save(e3);
                employees_repository.Save(e4);
                salary_repository.Save(s);
                salary_repository.Save(s2);
                salary_repository.Save(s3);
                salary_repository.Save(s4);
                uow.Commit();
            }
        }
        public FormSalariesEdit(SalaryRepository salariesRepo, EmployerRepository employeesRepo, int v)
        {
            InitializeComponent();
            this.salRepo          = salariesRepo;
            this.empRepo          = employeesRepo;
            this.SelectedSalIndex = v;
            ss = new SoloSalary();
            ss = salRepo.SelectById(SelectedSalIndex);

            labelID.Text = String.Format("ID of salary record: {0}", SelectedSalIndex);

            comboBoxEmp.DataSource    = empRepo.getComboBoxSource();
            comboBoxEmp.DisplayMember = "Name3";                         //changing to full name by event
            comboBoxEmp.ValueMember   = "ID";
            comboBoxEmp.SelectedValue = empRepo.SelectById(ss.IDemp).ID; //select ID where sal.IDemp = emp.IDemp

            numericUpDownAm.Value = (decimal)ss.Amount;
            monthCalendarFrom.SetDate(ss.validFrom);
            monthCalendarUntil.SetDate(ss.validUntil);
        }
Exemplo n.º 19
0
 public MainRepository(AppContext context)
 {
     _context = context;
     Calls = new CallRepository(_context);
     Users = new UserRepository(_context);
     Locations = new LocationRepository(_context);
     Groups = new GroupRepository(_context);
     Operations = new OperationRepository(_context);
     Roles = new RoleRepository(_context);
     Debits = new DebitRepository(_context);
     PenaltyTypes = new PenaltyTypeRepository(_context);
     Employees = new EmployeeRepository(_context);
     Extras = new ExtraRepository(_context);
     PayRolls = new PayRollRepository(_context);
     Salaries = new SalaryRepository(_context);
     DebitTypes = new DebitTypeRepository(_context);
     Penalties = new PenaltyRepository(_context);
     DebitPayments = new DebitPaymentRepository(_context);
     Administrators = new AdministratorRepository(_context);
     Savings = new SavingRepository(_context);
     Vacations = new VacationRepository(_context);
     RoleOperations = new RoleOperationRepository(_context);
 }
Exemplo n.º 20
0
        public ActionResult <BenefitDeductionDetailDto> Get(int employeeId)
        {
            IEmployeeRepository EmployeeRepos = new EmployeeRepository();

            var AEmployee = EmployeeRepos.GetEmployeeById(employeeId);

            List <IFamilyMember> FamilyMembers = EmployeeRepos.GetFamilyMembers(AEmployee);

            ISalaryRepository SalaryEmployeeRepos = new SalaryRepository(AEmployee);

            ISalary AEmployeeSalary = SalaryEmployeeRepos.GetSalary();

            IBenefitDeductionRepository BenefitDeductionRepos =
                new BenefitDeductionRepository(AEmployee, FamilyMembers, AEmployeeSalary);

            IBenefitDeductionDetail ABenefitDeductionDetail =
                BenefitDeductionRepos.CalculateBenefitDeductionDetail();


            var ABenefitDeductionDetailDto = Util.Converters.
                                             BenefitDeductionDetailConverter.Convert(ABenefitDeductionDetail);

            return(ABenefitDeductionDetailDto);
        }
 public SalaryBusiness(IUnitOfWork _unitOfWork)
 {
     unitOfWork       = _unitOfWork;
     salaryRepository = new SalaryRepository(unitOfWork);
 }
        public void RefreshGui()
        {
            salRepo = new SalaryRepository(); //contains data
            salRepo.GetAll();


            if (empRepo != null && salRepo != null)
            {
                List <SoloSalary> salaries = salRepo.GetAll().ToList();
                var employees = empRepo.GetAll();

                int selectedRowComfortGui; //for user comfort
                try
                {
                    selectedRowComfortGui = salDataGridView.CurrentCell.RowIndex;
                }
                catch
                {
                    selectedRowComfortGui = 0;
                }

                salDataGridView.ClearSelection(); //cleaning previos search
                salDataGridView.Columns.Clear();  //cleaning previous content
                salDataGridView.Rows.Clear();     //cleaning previous content

                //columns headers
                DataGridViewColumn d1 = new DataGridViewTextBoxColumn();
                d1.HeaderText = "ID";
                d1.Visible    = false;
                d1.SortMode   = DataGridViewColumnSortMode.Automatic;
                DataGridViewColumn d2 = new DataGridViewTextBoxColumn();
                d2.HeaderText = "Employee";
                d2.SortMode   = DataGridViewColumnSortMode.Automatic;
                DataGridViewColumn d3 = new DataGridViewTextBoxColumn();
                d3.HeaderText = "Amount €";
                d3.SortMode   = DataGridViewColumnSortMode.Automatic;
                DataGridViewColumn d4 = new DataGridViewTextBoxColumn();
                d4.HeaderText = "Earn from";
                d4.SortMode   = DataGridViewColumnSortMode.Automatic;
                DataGridViewColumn d5 = new DataGridViewTextBoxColumn();
                d5.HeaderText = "Earn to";
                d5.SortMode   = DataGridViewColumnSortMode.Automatic;
                salDataGridView.Columns.AddRange(d1, d2, d3, d4, d5);

                foreach (SoloSalary sal in salaries)
                {
                    var row = new DataGridViewRow();
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = sal.IDsal
                    });
                    SoloEmployer se = empRepo.GetByID(sal.IDemp);
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = se.Name1 + " " + se.Name2 + " " + se.Name3
                    });
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = sal.Amount
                    });
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = sal.validFrom.ToString(dateTimeFormat)
                    });
                    row.Cells.Add(new DataGridViewTextBoxCell {
                        Value = sal.validUntil.ToString(dateTimeFormat)
                    });
                    salDataGridView.Rows.Add(row); //finalize row
                }

                salDataGridView.Rows[selectedRowComfortGui].Selected = true;
            }
        }
Exemplo n.º 23
0
 public SalaryApplication(UnitOfWorkFactory factory,
     SalaryRepository salaryRepository)
     : base(factory)
 {
     this._salaryRepository = salaryRepository;
 }
Exemplo n.º 24
0
        public JsonResult DeleteSalary(int id)
        {
            var result = new SalaryRepository().RemoveByID(id);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 25
0
 public SalaryService(SalaryRepository repository)
 {
     _salaryRepository = repository;
 }
Exemplo n.º 26
0
        public JsonResult SalaryByStep(int level, decimal step)
        {
            var result = new SalaryRepository().GetSalary(level, step);

            return(Json(new { Salary = result }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 27
0
        public ActionResult CreateSalariesHistory(string employeesIdList = "", string SalaryDate = "")
        {
            try
            {
                string previousMonth = DateTime.Now.AddMonths(-1).ToString("MMMM - yyyy");
                string currentMonth  = DateTime.Now.ToString("MMMM - yyyy");
                string nextMonth     = DateTime.Now.AddMonths(1).ToString("MMMM - yyyy");

                if (string.IsNullOrEmpty(employeesIdList) || string.IsNullOrEmpty(SalaryDate))
                {
                    TempData["Msg"] = AlertMessageProvider.FailureMessage("Something went wrong! please try again later.");

                    return(View());
                }

                DateTime dt;

                if (!DateTime.TryParse(SalaryDate, out dt))
                {
                    TempData["Msg"] = AlertMessageProvider.FailureMessage("Invalid date, please select valid date.");

                    return(View());
                }

                if (dt.ToString("MMMM - yyyy") != previousMonth && dt.ToString("MMMM - yyyy") != currentMonth && dt.ToString("MMMM - yyyy") != nextMonth)
                {
                    TempData["Msg"] = AlertMessageProvider.FailureMessage("Salary cannot be created other than previous, current and next month.");

                    return(View());
                }

                var  _empIdsList  = employeesIdList.Split(',').Select(int.Parse).ToList();
                var  _paySlipInfo = new PaySlipInfo();
                bool isSucceed    = false;

                _paySlipInfo.CreatedDate        = DateTime.Now;
                _paySlipInfo.SalaryDate         = dt;
                _paySlipInfo.NumberOfDaysWorked = DateTime.DaysInMonth(dt.Year, dt.Month);
                _paySlipInfo.CreatedByAccountId = CurrentUser.AccountId;

                using (var transaction = new System.Transactions.TransactionScope())
                {
                    using (SalaryRepository SalaryRepo = new SalaryRepository())
                    {
                        using (PaySlipRepository PaySlipRepo = new PaySlipRepository())
                        {
                            foreach (var empId in _empIdsList)
                            {
                                SalaryInfo salary = null;
                                salary = SalaryRepo.GetSalaryByEmployeeId(empId);

                                if (salary != null)
                                {
                                    if (PaySlipRepo.IsPayslipCreated((int)salary.EmployeeInfoId, SalaryDate) == true)
                                    {
                                        TempData["Msg"] = AlertMessageProvider.FailureMessage("Selected employee(s) salary of selected month has already created.");

                                        return(RedirectToAction("Manage", "Salary"));
                                    }

                                    if (salary.TotalSalary > 0)
                                    {
                                        _paySlipInfo.TotalSalary      = salary.TotalSalary;
                                        _paySlipInfo.BasicSalary      = salary.BasicSalary;
                                        _paySlipInfo.HouseRent        = salary.HouseRent;
                                        _paySlipInfo.MedicalAllowance = salary.MedicalAllowance;
                                        _paySlipInfo.IncomTax         = salary.IncomTax;
                                        _paySlipInfo.LoanDeduction    = salary.LoanDeduction;
                                        _paySlipInfo.OtherDeductions  = salary.OtherDeductions;
                                        _paySlipInfo.EmployeeInfoId   = (int)salary.EmployeeInfoId;

                                        PaySlipRepo.SavePayslip(_paySlipInfo);

                                        salary.LoanDeduction   = 0;
                                        salary.OtherDeductions = 0;

                                        SalaryRepo.UpdateSalary(salary);
                                        isSucceed = true;
                                    }
                                }
                            }
                        }
                    }

                    transaction.Complete();
                }

                if (isSucceed == true)
                {
                    TempData["Msg"] = AlertMessageProvider.SuccessMessage("Salaries created successfully.");
                }
                else
                {
                    TempData["Msg"] = AlertMessageProvider.FailureMessage("Selected employee(s) salary amount is zero.");
                }

                return(RedirectToAction("Manage", "Salary"));
            }

            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Salary", "CreateSalariesHistory")));
            }
        }
Exemplo n.º 28
0
        public ActionResult Create(AccountInfo accountInfo)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var _employeeInfo = new Model.EmployeeInfo();
                    _employeeInfo.CreatedByAccountId = CurrentUser.AccountId;
                    _employeeInfo.CreatedDate        = DateTime.Now;

                    int employeeInfoId;
                    int accountId;

                    string saltValue = RandomPassword.Generate(18, 20);
                    string password  = RijndaelCrypt.EncryptPassword(RandomPassword.Generate(), saltValue);

                    accountInfo.CompanyEmail     = accountInfo.CompanyEmail.ToLower();
                    accountInfo.PasswordHash     = password;
                    accountInfo.Salt             = saltValue;
                    accountInfo.LastLoginDate    = DateTime.Now;
                    accountInfo.LastLoginIp      = "";
                    accountInfo.IsActive         = true;
                    accountInfo.IsFirstTimeLogin = true;

                    using (var transaction = new System.Transactions.TransactionScope())
                    {
                        using (AccountRepository Repo = new AccountRepository())
                        {
                            if (Repo.IsEmailExist(accountInfo.CompanyEmail) == true)
                            {
                                TempData["Msg"] = AlertMessageProvider.FailureMessage("Email already exist.");

                                return(View());
                            }

                            int roleId = Repo.GetRoleIdByName("Anonymous");
                            accountInfo.RoleId = roleId;

                            accountId = Repo.CreateAccount(accountInfo);
                        }

                        using (AccountCheckListRepository Repo = new AccountCheckListRepository())
                        {
                            var _accountCheckList = new AccountCheckListInfo(accountId);

                            Repo.SaveAccountCheckList(_accountCheckList);
                        }

                        using (EmployeeRepository Repo = new EmployeeRepository())
                        {
                            _employeeInfo.AccountId = accountId;

                            employeeInfoId = Repo.SaveEmployeeInfo(_employeeInfo);
                        }

                        using (LeaveAllowedRepository Repo = new LeaveAllowedRepository())
                        {
                            LeaveAllowedInfo _leaveAllowed = new LeaveAllowedInfo(0, 0, employeeInfoId, CurrentUser.AccountId);

                            Repo.SaveLeaveAllowed(_leaveAllowed);
                        }

                        using (SalaryRepository Repo = new SalaryRepository())
                        {
                            var _salaryInfo = new SalaryInfo(CurrentUser.AccountId, employeeInfoId);

                            Repo.SaveSalary(_salaryInfo);
                        }

                        using (FamilyMemberRepository Repo = new FamilyMemberRepository())
                        {
                            var _familyMember = new FamilyMemberInfo
                            {
                                Name           = "Self",
                                Relation       = "Selef",
                                EmployeeInfoId = employeeInfoId
                            };

                            Repo.SaveFamilyMember(_familyMember);
                        }

                        transaction.Complete();
                    }

                    List <string> To = new List <string>()
                    {
                        accountInfo.CompanyEmail
                    };
                    string Subject  = "LPS Online Account Information";
                    var    LoginUrl = Url.Action("Login", "Auth", new { Area = "" }, protocol: Request.Url.Scheme);

                    string Body = "Dear Employee, <br/><br/>" +
                                  "Your account has been created.<br/>" +
                                  "Please ensure to save the username and password written below:<br/><br/>" +
                                  "Username: &nbsp; <b>" + accountInfo.CompanyEmail + "</b><br/>" +
                                  "Password: &nbsp; <b>" + RijndaelCrypt.DecryptPassword(accountInfo.PasswordHash, accountInfo.Salt) + "</b><br/><br/>" +
                                  "<a href='" + LoginUrl + "' target='_blank'>" + LoginUrl + "</a><br/>" +
                                  "You can login to your account to use LPS online services.<br/><br/>" +
                                  "Thanks,<br/>" +
                                  "<b>Logic Powered Solutions</b>";

                    bool result = EmailSender.Send(Subject, Body, To);

                    if (result)
                    {
                        TempData["Msg"] = AlertMessageProvider.SuccessMessage("Account created, email has been sent to employee successfully.");
                    }
                    else
                    {
                        TempData["Msg"] = AlertMessageProvider.FailureMessage("Something went wrong! email not sent, please try again later.");
                    }

                    return(RedirectToAction("Manage", "Account"));
                }

                return(View());
            }

            catch (Exception ex)
            {
                return(View("Error", new HandleErrorInfo(ex, "Account", "Create")));
            }
        }