Beispiel #1
0
        public EmployeeListModel GetEmployee(int id)
        {
            EmployeeListModel       viewModel  = new EmployeeListModel();
            UserPersonalInformation fromDB     = GetEmployeesById(id);
            DepartmentBL            department = new DepartmentBL();
            bool active = false;

            if (fromDB.Active > 0)
            {
                active = true;
            }

            if (fromDB != null)
            {
                viewModel            = new EmployeeListModel();
                viewModel.Active     = active;
                viewModel.Address    = fromDB.Address;
                viewModel.EmployeeId = fromDB.EmployeeId;
                viewModel.FirstName  = fromDB.FirstName;
                viewModel.LastName   = fromDB.LastName;
                viewModel.Position   = fromDB.Position;
                viewModel.BasicPay   = fromDB.BasicPay;
                viewModel.UserPersonalInformationID = fromDB.UserPersonalInformationId;
                if (fromDB.DepartmentId > 0)
                {
                    viewModel.Department = department.GetDepartmentById(fromDB.DepartmentId).DepartmentName;
                }
            }

            return(viewModel);
        }
Beispiel #2
0
        public ActionResult AssignDepartment(AssignDepartmentViewModel viewModel)
        {
            DepartmentBL departmentBL = new DepartmentBL();
            AssignDepartmentViewModel assignDepartmentViewModel = new AssignDepartmentViewModel();

            assignDepartmentViewModel.Departments = new SelectList(departmentBL.GetActiveDepartments(), "DepartmentId", "DepartmentName", 1);
            assignDepartmentViewModel.UserPersonalInformationId = viewModel.UserPersonalInformationId;

            UserPersonalInformation fromDB = employeeBL.GetEmployeesById(viewModel.UserPersonalInformationId);

            if (ModelState.IsValid)
            {
                if (viewModel.DepartmentId > 0)
                {
                    employeeBL.UpdateEmployeeDepartment(viewModel.UserPersonalInformationId, viewModel.DepartmentId);
                }
                else
                {
                    ModelState.AddModelError("", "Error");
                    return(View(assignDepartmentViewModel));
                }
            }
            else
            {
                ModelState.AddModelError("", "Error.");
                return(View(assignDepartmentViewModel));
            }
            return(RedirectToAction("Employees", "Home"));
        }
        public void getDepartmentName()
        {
            ApplicationResult objResult       = new ApplicationResult();
            Controls          objControls     = new Controls();
            DepartmentBL      objDepartmentBl = new DepartmentBL();

            if (ddlOrganisation.SelectedItem.Text == "Trust")
            {
                objResult = objDepartmentBl.Department_Select_By_Trust_School_ForDropDown((Convert.ToInt32(ddlOrgName.SelectedValue)), 0);
                if (objResult != null)
                {
                    objControls.BindDropDown_ListBox(objResult.resultDT, ddlDepartment, "DepartmentNameEng", "DepartmentID");
                    if (objResult.resultDT.Rows.Count > 0)
                    {
                    }
                }
            }
            else
            {
                objResult = objDepartmentBl.Department_Select_By_Trust_School_ForDropDown((Convert.ToInt32(Session[ApplicationSession.TRUSTID])), (Convert.ToInt32(ddlOrgName.SelectedValue)));
                if (objResult != null)
                {
                    objControls.BindDropDown_ListBox(objResult.resultDT, ddlDepartment, "DepartmentNameEng", "DepartmentID");
                    if (objResult.resultDT.Rows.Count > 0)
                    {
                    }
                }
            }
            ddlDepartment.Items.Insert(0, new ListItem("--Select--", ""));
        }
Beispiel #4
0
        public void BindDepartment()
        {
            try
            {
                ApplicationResult objResult       = new ApplicationResult();
                DepartmentBL      objDepartmentbl = new DepartmentBL();

                objResult = objDepartmentbl.Department_Select_By_Trust_School(Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));
                if (objResult.resultDT.Rows.Count > 0)
                {
                    gvDepartment.DataSource = objResult.resultDT;
                    gvDepartment.DataBind();
                    PanelVisibility(1);
                }
                else
                {
                    PanelVisibility(2);
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
Beispiel #5
0
        protected void BindListData()
        {
            DepartmentBL             department = new DepartmentBL();
            SortedList <int, string> temp       = new SortedList <int, string>(department.GetDepartment());

            departmentList.Items.Insert(0, "--Select--");
            foreach (KeyValuePair <int, string> keyValuePair in temp)
            {
                ListItem listItem = new ListItem(keyValuePair.Value, keyValuePair.Key.ToString());
                departmentList.Items.Add(listItem);
            }
        }
 public ActionResult Edit_Dep(Department ob)
 {
     ModelState.Remove("FacultyName_English");
     if (ModelState.IsValid)
     {
         DepartmentBL.Update(ob);
         return(RedirectToAction("Department"));
     }
     else
     {
         return(View());
     }
 }
 public ActionResult Create_Dep(Department sem)
 {
     ModelState.Remove("DepartmentID");
     if (ModelState.IsValid)
     {
         DepartmentBL.Add_Department(sem);
         return(RedirectToAction("Department"));
     }
     else
     {
         return(View());
     }
 }
        protected void GetDepartment()
        {
            List <Departmenttbl> lstDept         = new List <Departmenttbl>();
            Departmenttbl        dpt             = new Departmenttbl();
            DepartmentBL         objDepartmentBL = new DepartmentBL();

            dpt.IsActive = 1;
            lstDept      = objDepartmentBL.GetDeparmentByStatus(dpt).ToList();
            foreach (var cnt in lstDept)
            {
                ListItem li = new ListItem();
                li.Text  = cnt.DepartmentName;
                li.Value = cnt.DepartmentId.ToString();
                DDLDept.Items.Add(li);
            }
        }
Beispiel #9
0
        public void getDepartmentName()
        {
            ApplicationResult objResult       = new ApplicationResult();
            Controls          objControls     = new Controls();
            DepartmentBL      objDepartmentBL = new DepartmentBL();

            objResult = objDepartmentBL.Department_Select_By_Trust_School_ForDropDown(Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));
            if (objResult != null)
            {
                objControls.BindDropDown_ListBox(objResult.resultDT, ddlDepartment, "DepartmentNameENG", "DepartmentID");
                if (objResult.resultDT.Rows.Count > 0)
                {
                }
                ddlDepartment.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select All--", "-1"));
            }
        }
 public object SaveDepartment([FromBody] DepartmentParam PR)
 {
     try
     {
         DepartmentBL OBJSAVE = new DepartmentBL();
         var          result  = OBJSAVE.SaveDepartment(PR);
         return(result);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
 public object GetSingleDesignationInfo([FromBody] DesignationParam OBJGR)
 {
     try
     {
         DepartmentBL obj      = new DepartmentBL();
         var          SingleGR = obj.GetSingleDesignation(OBJGR);
         return(SingleGR);
     }
     catch (Exception ex)
     {
         return(new Error()
         {
             IsError = true, Message = ex.Message
         });
     }
 }
 public object DeleteDesignation([FromBody] DesignationParam MP)
 {
     try
     {
         DepartmentBL obj    = new DepartmentBL();
         var          result = obj.DeleteDesignation(MP);
         return(result);
     }
     catch (Exception e)
     {
         return(new Error()
         {
             IsError = true, Message = e.Message
         });
     }
 }
 public object GetDesignationMaster([FromBody] DesignationParam objid)
 {
     try
     {
         var          status         = objid.Status;
         DepartmentBL obj            = new DepartmentBL();
         var          ERPDesignation = obj.GetDesignationList(status);
         return(ERPDesignation);
     }
     catch (Exception ex)
     {
         return(new Error()
         {
             IsError = true, Message = ex.Message
         });
     }
 }
Beispiel #14
0
        public void BindDepartment()
        {
            ApplicationResult objResult       = new ApplicationResult();
            DepartmentBL      objDepartmentbl = new DepartmentBL();

            objResult = objDepartmentbl.Department_Select_By_Trust_School(Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));
            if (objResult.resultDT.Rows.Count > 0)
            {
                gvDepartment.DataSource = objResult.resultDT;
                gvDepartment.DataBind();
                PanelVisibility(1);
            }
            else
            {
                PanelVisibility(2);
            }
        }
Beispiel #15
0
 protected void gvDepartment_OnRowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         ApplicationResult objResult       = new ApplicationResult();
         DepartmentBL      objDepartmentBL = new DepartmentBL();
         if (e.CommandName.ToString() == "Edit1")
         {
             ViewState["Mode"]         = "Edit";
             ViewState["DepartmentID"] = e.CommandArgument.ToString();
             objResult = objDepartmentBL.Department_Select(Convert.ToInt32(ViewState["DepartmentID"].ToString()));
             if (objResult != null)
             {
                 DataTable dtResult = objResult.resultDT;
                 if (dtResult.Rows.Count > 0)
                 {
                     txtDepartmentNameENG.Text = dtResult.Rows[0][DepartmentBO.DEPARTMENT_DEPARTMENTNAMEENG].ToString();
                     txtDepartmentNameGUJ.Text = dtResult.Rows[0][DepartmentBO.DEPARTMENT_DEPARTMENTNAMEGUJ].ToString();
                     txtDescription.Text       = dtResult.Rows[0][DepartmentBO.DEPARTMENT_DESCRIPTION].ToString();
                     PanelVisibility(2);
                 }
             }
         }
         else if (e.CommandName.ToString() == "Delete1")
         {
             objResult = objDepartmentBL.Department_Delete(Convert.ToInt32(e.CommandArgument.ToString()), Convert.ToInt32(Session[ApplicationSession.USERID]),
                                                           DateTime.UtcNow.AddHours(5.5).ToString());
             if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS)
             {
                 ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record deleted successfully.');</script>");
                 PanelVisibility(1);
                 BindDepartment();
             }
             else
             {
                 ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('You cannot delete this record because it is in used.');</script>");
             }
         }
     }
     catch (Exception ex)
     {
         logger.Error("Error", ex);
         ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
     }
 }
Beispiel #16
0
        //Edit Employee :
        public ActionResult Edit(EmployeesData employeesData)
        {
            if (Session["fullName"] != null)
            {
                DepartmentBL  departmentBL = new DepartmentBL();
                EmployeesData departments  = new EmployeesData();
                departments.Departments = departmentBL.GetDepartmentsInComboBox();

                employeesData             = employeeBL.GetEmployeeData(employeesData.ID);
                employeesData.Departments = departments.Departments;

                return(View("Edit", employeesData));
            }
            else
            {
                return(Redirect("/LogIn/"));
            }
        }
        // Checks for role and adds to Session variable
        public static bool Authenticate(int empId)
        {
            EmployeeVM emp = EmployeeBL.GetEmp(empId);

            if (emp == null)
            {
                return(false);
            }
            else
            {
                HttpContext.Current.Session["empId"]   = empId;
                HttpContext.Current.Session["empName"] = emp.EmpName;
                if (emp.Role == "Employee")
                {
                    DepartmentVM dep = DepartmentBL.GetDept(empId);
                    if (dep.DelegateApproverId == empId)
                    {
                        if (DateTime.Now > dep.DelegateFromDate && DateTime.Now < dep.DelegateToDate)
                        {
                            HttpContext.Current.Session["role"] = "Delegate";
                        }
                        else
                        {
                            HttpContext.Current.Session["role"] = "Employee";
                            Controllers.DepartmentCtrl.RemoveDelegate(dep.DeptCode);
                        }
                    }
                    else if (dep.DeptRepId == empId)
                    {
                        HttpContext.Current.Session["role"] = "Representative";
                    }
                    else
                    {
                        HttpContext.Current.Session["role"] = "Employee";
                    }
                }
                else
                {
                    HttpContext.Current.Session["role"] = emp.Role;
                }

                return(true);
            }
        }
Beispiel #18
0
        public ActionResult Employees()
        {
            EmployeeListPayrollPeriodViewModel employeeListPayrollPeriod = new EmployeeListPayrollPeriodViewModel();

            List <EmployeeListModel>       employeeListModels = new List <EmployeeListModel>();
            EmployeeListModel              employee           = new EmployeeListModel();
            DepartmentBL                   department         = new DepartmentBL();
            List <UserPersonalInformation> listFromDB         = employeeBL.GetAllEmployees();


            PayrollPeriodBL      payrollPeriodBL = new PayrollPeriodBL();
            List <PayrollPeriod> payrollPeriods  = new List <PayrollPeriod>();

            payrollPeriods = payrollPeriodBL.GetPayrollPeriods();

            foreach (UserPersonalInformation item in listFromDB)
            {
                employee            = new EmployeeListModel();
                employee.Active     = Convert.ToBoolean(item.Active);
                employee.Address    = item.Address;
                employee.EmployeeId = item.EmployeeId;
                employee.FirstName  = item.FirstName;
                employee.LastName   = item.LastName;
                employee.UserPersonalInformationID = item.UserPersonalInformationId;
                employee.Position = item.Position;
                employee.BasicPay = item.BasicPay;
                employee.Name     = item.FirstName + " " + employee.LastName;
                if (item.DepartmentId > 0)
                {
                    employee.Department = department.GetDepartmentById(item.DepartmentId).DepartmentName;
                }
                employeeListModels.Add(employee);
            }
            employeeListPayrollPeriod.EmployeeList   = employeeListModels;
            employeeListPayrollPeriod.PayrollPeriods = new SelectList(payrollPeriods, "PayrollPeriodId", "PayPeriodFrom", 2);
            return(View(employeeListPayrollPeriod));
        }
Beispiel #19
0
        public ActionResult AssignDepartment(int id)
        {
            DepartmentBL departmentBL = new DepartmentBL();
            AssignDepartmentViewModel assignDepartmentViewModel = new AssignDepartmentViewModel();

            assignDepartmentViewModel.Departments = new SelectList(departmentBL.GetActiveDepartments(), "DepartmentId", "DepartmentName", 1);
            assignDepartmentViewModel.UserPersonalInformationId = id;

            UserPersonalInformation fromDB = employeeBL.GetEmployeesById(id);

            if (fromDB != null)
            {
                if (fromDB.DepartmentId > 0)
                {
                    assignDepartmentViewModel.SelectedDepartment = departmentBL.GetDepartmentById(fromDB.DepartmentId).DepartmentName;
                }
                else
                {
                    assignDepartmentViewModel.SelectedDepartment = "None Selected";
                }
            }

            return(View(assignDepartmentViewModel));
        }
Beispiel #20
0
        public ActionResult Payroll(FormCollection collection)
        {
            var payPeriodId = collection.GetValue("PayrollPeriodId").AttemptedValue;

            if (ModelState.IsValid)
            {
                if (payPeriodId.ToString().Length > 0)
                {
                    List <EmployeeListModel>                employeeListModels                = new List <EmployeeListModel>();
                    EmployeeListModel                       employee                          = new EmployeeListModel();
                    DepartmentBL                            department                        = new DepartmentBL();
                    List <UserPersonalInformation>          listFromDB                        = employeeBL.GetAllEmployees();
                    AssingedEmployeeIncomeBL                assingedEmployeeIncomeBL          = new AssingedEmployeeIncomeBL();
                    List <AssignedEmployeeIncomesViewModel> assignEmployeeIncomeViewModelList = new List <AssignedEmployeeIncomesViewModel>();
                    AssignedEmployeeIncomesViewModel        assignEmployeeIncomeViewModel     = new AssignedEmployeeIncomesViewModel();
                    List <Income>                           incomeDBList                      = new List <Income>();
                    Income   incomeDB = new Income();
                    IncomeBL incomeBL = new IncomeBL();

                    PayrollPeriodBL payrollPeriodBL = new PayrollPeriodBL();
                    PayrollPeriod   payrollPeriodDB = new PayrollPeriod();

                    List <Deduction> deductionDBList = new List <Deduction>();
                    Deduction        deductionDB     = new Deduction();
                    DeductionBL      deductionBL     = new DeductionBL();

                    List <PayrollTransactionIncome> payrollTransactionIncomes  = new List <PayrollTransactionIncome>();
                    PayrollTransactionIncome        payrollTransactionIncome   = new PayrollTransactionIncome();
                    PayrollTransactionIncomeBL      payrollTransactionIncomeBL = new PayrollTransactionIncomeBL();

                    PayrollTransactionDeduction   payrollTransactionDeduction   = new PayrollTransactionDeduction();
                    PayrollTransactionDeductionBL payrollTransactionDeductionBL = new PayrollTransactionDeductionBL();

                    List <PayrollTransactionDeductionViewModels> payrollTransactionDeductionViewModels = new List <PayrollTransactionDeductionViewModels>();
                    PayrollTransactionDeductionViewModels        payrollTransactionDeductionViewModel  = new PayrollTransactionDeductionViewModels();

                    List <PayrollTransactionIncomeViewModels> payrollTransactionIncomeViewModels = new List <PayrollTransactionIncomeViewModels>();
                    PayrollTransactionIncomeViewModels        payrollTransactionIncomeViewModel  = new PayrollTransactionIncomeViewModels();

                    foreach (UserPersonalInformation item in listFromDB)
                    {
                        employee            = new EmployeeListModel();
                        employee.Active     = Convert.ToBoolean(item.Active);
                        employee.Address    = item.Address;
                        employee.EmployeeId = item.EmployeeId;
                        employee.FirstName  = item.FirstName;
                        employee.LastName   = item.LastName;
                        employee.UserPersonalInformationID = item.UserPersonalInformationId;
                        employee.Position = item.Position;
                        employee.BasicPay = item.BasicPay;
                        employee.Name     = item.FirstName + " " + employee.LastName;


                        #region incomes
                        incomeDBList = incomeBL.GetActiveIncomes();
                        if (incomeDBList != null)
                        {
                            foreach (var dbIncome in incomeDBList)
                            {
                                payrollTransactionIncome = new PayrollTransactionIncome();
                                payrollTransactionIncome = payrollTransactionIncomeBL.GetPayrollTransactionIncome(item.UserPersonalInformationId, Convert.ToInt32(payPeriodId), dbIncome.IncomeId);

                                if (payrollTransactionIncome != null)
                                {
                                    payrollTransactionIncomeViewModel = new PayrollTransactionIncomeViewModels();
                                    payrollTransactionIncomeViewModel.PayrollTransactionIncomeId = payrollTransactionIncome.PayrollTransactionIncomeId;
                                    payrollTransactionIncomeViewModel.UserPersonalInformationid  = item.UserPersonalInformationId;
                                    payrollTransactionIncomeViewModel.PayrollPeriodId            = Convert.ToInt32(payPeriodId);


                                    incomeDB = incomeBL.GetIncomesById(Convert.ToInt32(payrollTransactionIncome.IncomeId));
                                    payrollTransactionIncomeViewModel.IncomeId           = Convert.ToInt32(payrollTransactionIncome.IncomeId);
                                    payrollTransactionIncomeViewModel.CustomIncomeAmount = payrollTransactionIncome.CustomIncomeAmount > 0 ? Convert.ToDecimal(payrollTransactionIncome.CustomIncomeAmount) : 0.0M;
                                    //payrollTransactionIncomeViewModel.DefaultIncomeAmount = dbIncome.IncomeAmount > 0 ? Convert.ToDecimal(dbIncome.IncomeAmount) : 0.0M;
                                    payrollTransactionIncomeViewModel.DefaultIncomeName = incomeDB.IncomeName;

                                    payrollTransactionIncomeViewModels.Add(payrollTransactionIncomeViewModel);
                                }
                                else
                                {
                                    PayrollTransactionIncomeViewModels insertView = new PayrollTransactionIncomeViewModels();
                                    insertView.CustomIncomeAmount         = 0.0M;
                                    insertView.PayrollTransactionIncomeId = 0;
                                    insertView.UserPersonalInformationid  = item.UserPersonalInformationId;

                                    incomeDB                      = incomeBL.GetIncomesById(Convert.ToInt32(dbIncome.IncomeId));
                                    insertView.IncomeId           = Convert.ToInt32(dbIncome.IncomeId);
                                    insertView.CustomIncomeAmount = 0.0M;
                                    //insertView.DefaultIncomeAmount = dbIncome.IncomeAmount > 0 ? Convert.ToDecimal(dbIncome.IncomeAmount) : 0.0M;
                                    insertView.DefaultIncomeName = incomeDB.IncomeName;
                                    insertView.PayrollPeriodId   = Convert.ToInt32(payPeriodId);

                                    payrollTransactionIncome = new PayrollTransactionIncome();
                                    payrollTransactionIncome = payrollTransactionIncomeBL.InsertPayrollTransactionIncomes(insertView);
                                    insertView = new PayrollTransactionIncomeViewModels();
                                    insertView.PayrollTransactionIncomeId = payrollTransactionIncome.PayrollTransactionIncomeId;
                                    insertView.UserPersonalInformationid  = item.UserPersonalInformationId;
                                    insertView.PayrollPeriodId            = Convert.ToInt32(payPeriodId);
                                    insertView.IncomeId           = Convert.ToInt32(payrollTransactionIncome.IncomeId);
                                    insertView.CustomIncomeAmount = payrollTransactionIncome.CustomIncomeAmount > 0 ? Convert.ToDecimal(payrollTransactionIncome.CustomIncomeAmount) : 0.0M;
                                    //insertView.DefaultIncomeAmount = dbIncome.IncomeAmount > 0 ? Convert.ToDecimal(dbIncome.IncomeAmount) : 0.0M;
                                    insertView.DefaultIncomeName = incomeDB.IncomeName;
                                    payrollTransactionIncomeViewModels.Add(insertView);
                                }
                            }
                        }
                        #endregion

                        #region deductions
                        deductionDBList = deductionBL.GetActiveDeductions();
                        if (deductionDBList != null)
                        {
                            foreach (var dbDeduction in deductionDBList)
                            {
                                payrollTransactionDeduction = new PayrollTransactionDeduction();
                                payrollTransactionDeduction = payrollTransactionDeductionBL.GetPayrollTransactionDeduction(item.UserPersonalInformationId, Convert.ToInt32(payPeriodId), dbDeduction.DeductionId);

                                if (payrollTransactionDeduction != null)
                                {
                                    payrollTransactionDeductionViewModel = new PayrollTransactionDeductionViewModels();
                                    payrollTransactionDeductionViewModel.PayrollTransactionDeductionId = payrollTransactionDeduction.PayrollTransactionDeductionId;
                                    payrollTransactionDeductionViewModel.UserPersonalInformationid     = item.UserPersonalInformationId;
                                    payrollTransactionDeductionViewModel.PayrollPeriodId = Convert.ToInt32(payPeriodId);


                                    deductionDB = deductionBL.GetDeductionById(Convert.ToInt32(payrollTransactionDeduction.DeductionId));
                                    payrollTransactionDeductionViewModel.DeductionId           = Convert.ToInt32(payrollTransactionDeduction.DeductionId);
                                    payrollTransactionDeductionViewModel.CustomDeductionAmount = payrollTransactionDeduction.CustomDeductionAmount > 0 ? Convert.ToDecimal(payrollTransactionDeduction.CustomDeductionAmount) : 0.0M;
                                    //payrollTransactionIncomeViewModel.DefaultIncomeAmount = dbIncome.IncomeAmount > 0 ? Convert.ToDecimal(dbIncome.IncomeAmount) : 0.0M;
                                    payrollTransactionDeductionViewModel.DefaultDeductionName = deductionDB.DeductionName;

                                    payrollTransactionDeductionViewModels.Add(payrollTransactionDeductionViewModel);
                                }
                                else
                                {
                                    PayrollTransactionDeductionViewModels deductionView = new PayrollTransactionDeductionViewModels();
                                    deductionView.CustomDeductionAmount         = 0.0M;
                                    deductionView.PayrollTransactionDeductionId = 0;
                                    deductionView.UserPersonalInformationid     = item.UserPersonalInformationId;

                                    deductionDB = deductionBL.GetDeductionById(Convert.ToInt32(dbDeduction.DeductionId));
                                    deductionView.DeductionId           = Convert.ToInt32(dbDeduction.DeductionId);
                                    deductionView.CustomDeductionAmount = 0.0M;
                                    //insertView.DefaultIncomeAmount = dbIncome.IncomeAmount > 0 ? Convert.ToDecimal(dbIncome.IncomeAmount) : 0.0M;
                                    deductionView.DefaultDeductionName = incomeDB.IncomeName;
                                    deductionView.PayrollPeriodId      = Convert.ToInt32(payPeriodId);

                                    payrollTransactionDeduction = new PayrollTransactionDeduction();
                                    payrollTransactionDeduction = payrollTransactionDeductionBL.InsertPayrollTransactionDeductions(deductionView);
                                    deductionView = new PayrollTransactionDeductionViewModels();
                                    deductionView.PayrollTransactionDeductionId = payrollTransactionDeduction.PayrollTransactionDeductionId;
                                    deductionView.UserPersonalInformationid     = item.UserPersonalInformationId;
                                    deductionView.PayrollPeriodId       = Convert.ToInt32(payPeriodId);
                                    deductionView.DeductionId           = Convert.ToInt32(payrollTransactionDeduction.DeductionId);
                                    deductionView.CustomDeductionAmount = payrollTransactionDeduction.CustomDeductionAmount > 0 ? Convert.ToDecimal(payrollTransactionDeduction.CustomDeductionAmount) : 0.0M;
                                    //insertView.DefaultIncomeAmount = dbIncome.IncomeAmount > 0 ? Convert.ToDecimal(dbIncome.IncomeAmount) : 0.0M;
                                    deductionView.DefaultDeductionName = incomeDB.IncomeName;
                                    payrollTransactionDeductionViewModels.Add(deductionView);
                                }
                            }
                        }
                        #endregion

                        employee.Incomes = payrollTransactionIncomeViewModels;
                        payrollTransactionIncomeViewModels = new List <PayrollTransactionIncomeViewModels>();
                        employee.Deductions = payrollTransactionDeductionViewModels;
                        payrollTransactionDeductionViewModels = new List <PayrollTransactionDeductionViewModels>();

                        if (item.DepartmentId > 0)
                        {
                            employee.Department = department.GetDepartmentById(item.DepartmentId).DepartmentName;
                        }


                        #region EmployeeDetailsPayrollViewModel
                        EmployeeDetailsPayrollViewModel employeeDetailsPayrollViewModel = new EmployeeDetailsPayrollViewModel();
                        employeeDetailsPayrollViewModel.BasicPay   = employee.BasicPay > 0 ? Convert.ToDecimal(employee.BasicPay) : 0.0M;
                        employeeDetailsPayrollViewModel.Department = employee.Department;
                        employeeDetailsPayrollViewModel.EmployeeId = employee.EmployeeId;
                        employeeDetailsPayrollViewModel.Name       = employee.Name;

                        #endregion

                        #region EmployeePayPeriodDetailsPayrollViewModel
                        payrollPeriodDB = payrollPeriodBL.GetPayrollPeriodById(Convert.ToInt32(payPeriodId));
                        EmployeePayPeriodDetailsPayrollViewModel employeePayPeriodDetailsPayrollViewModel = new EmployeePayPeriodDetailsPayrollViewModel();
                        employeePayPeriodDetailsPayrollViewModel.CurrentPeriodWorkDays  = payrollPeriodDB.WorkDays > 0 ? Convert.ToDecimal(payrollPeriodDB.WorkDays) : 0.0M;
                        employeePayPeriodDetailsPayrollViewModel.CurrentPeriodWorkHours = payrollPeriodDB.WorkHours > 0 ? Convert.ToDecimal(payrollPeriodDB.WorkHours) : 0.0M;;
                        employeePayPeriodDetailsPayrollViewModel.Month         = payrollPeriodDB.Month;
                        employeePayPeriodDetailsPayrollViewModel.PayPeriodFrom = payrollPeriodDB.PayPeriodFrom;
                        employeePayPeriodDetailsPayrollViewModel.PayPeriodTo   = payrollPeriodDB.PayPeriodTo;
                        employeePayPeriodDetailsPayrollViewModel.PayPeriodId   = Convert.ToInt32(payPeriodId);
                        #endregion


                        employee.EmployeeDetailsPayrollViewModel          = employeeDetailsPayrollViewModel;
                        employee.EmployeePayPeriodDetailsPayrollViewModel = employeePayPeriodDetailsPayrollViewModel;
                        employeeListModels.Add(employee);
                    }

                    return(View(employeeListModels));
                }
                else
                {
                    ModelState.AddModelError("", "Choose a pay period.");
                    return(RedirectToAction("Employees", "Home"));
                }
            }
            else
            {
                ModelState.AddModelError("", "Choose a pay period.");
                return(RedirectToAction("Employees", "Home"));
            }
        }
 public static DepartmentVM GetDept(int empId)
 {
     return(DepartmentBL.GetDept(empId));
 }
Beispiel #22
0
 public Manager_DocMngmnt()
 {
     InitializeComponent();
     BL    = new DoctorBL();
     DepBL = new DepartmentBL();
 }
        //---------------------------------------------------------------
        //Department Table

        public ActionResult Department()
        {
            return(View(DepartmentBL.GetAll()));
        }
        public static List <DepartmentVM> GetAllDept()
        {
            List <DepartmentVM> departments = DepartmentBL.GetAllDept();

            return(departments.Where(x => x.DeptName != "Store Department").ToList());
        }
 public static bool RemoveDelegate(string deptCode)
 {
     return(DepartmentBL.removeDelegate(deptCode));
 }
        public ViewResult Edit_Dep(int id)
        {
            var ob = DepartmentBL.GetById(id);

            return(View(ob));
        }
Beispiel #27
0
 public Manager_DptMngmnt()
 {
     InitializeComponent();
     BL = new DepartmentBL();
 }
 public static bool SetRep(string deptCode, int empId)
 {
     return(DepartmentBL.setRep(deptCode, empId));
 }
Beispiel #29
0
        protected void btnSaveClass_OnClick(object sender, EventArgs e)
        {
            try
            {
                DepartmentBO      objDepartmentBO = new DepartmentBO();
                DepartmentBL      objDepartmentBL = new DepartmentBL();
                ApplicationResult objResult       = new ApplicationResult();
                DataTable         dtResult        = new DataTable();
                int intDepartmentID = 0;

                objDepartmentBO.TrustMID           = Convert.ToInt32(Session[ApplicationSession.TRUSTID]);
                objDepartmentBO.SchoolMID          = Convert.ToInt32(Session[ApplicationSession.SCHOOLID]);
                objDepartmentBO.DepartmentNameENG  = txtDepartmentNameENG.Text.Trim();
                objDepartmentBO.DepartmentNameGUJ  = txtDepartmentNameGUJ.Text.Trim();
                objDepartmentBO.Description        = txtDescription.Text.Trim();
                objDepartmentBO.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);
                objDepartmentBO.LastModifiedDate   = DateTime.UtcNow.AddHours(5.5).ToString();

                //Code For Validate Department Name
                if (ViewState["Mode"].ToString() == "Save")
                {
                    intDepartmentID = -1;
                }
                else if (ViewState["Mode"].ToString() == "Edit")
                {
                    intDepartmentID = Convert.ToInt32(ViewState["DepartmentID"].ToString());
                }
                objResult = objDepartmentBL.Department_ValidateName(Convert.ToInt32(Session[ApplicationSession.TRUSTID]), Convert.ToInt32(Session[ApplicationSession.SCHOOLID]), intDepartmentID, objDepartmentBO.DepartmentNameENG);
                if (objResult != null)
                {
                    dtResult = objResult.resultDT;
                    if (dtResult.Rows.Count > 0)
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Department name already exist.');</script>");
                    }
                    else
                    {
                        if (ViewState["Mode"].ToString() == "Save")
                        {
                            objDepartmentBO.CreatedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);
                            objDepartmentBO.CreatedDate   = DateTime.UtcNow.AddHours(5.5).ToString();
                            objResult = objDepartmentBL.Department_Insert(objDepartmentBO);
                            if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS)
                            {
                                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record saved successfully.');</script>");
                            }
                        }
                        else if (ViewState["Mode"].ToString() == "Edit")
                        {
                            objDepartmentBO.DepartmentID = Convert.ToInt32(ViewState["DepartmentID"].ToString());
                            objResult = objDepartmentBL.Department_Update(objDepartmentBO);
                            if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS)
                            {
                                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record updated successfully.');</script>");
                            }
                        }
                        ClearAll();
                        BindDepartment();
                        PanelVisibility(1);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
 public static bool SetDelegate(string deptCode, DateTime fromDate, DateTime toDate, int empId)
 {
     return(DepartmentBL.setDelegate(deptCode, fromDate, toDate, empId));
 }