public ActionResult Index() { if (AuthConfig.GetSession("CurrentUser") != null) { ViewData["title"] = AuthConfig.CurrentCompanyInfo.CSCompanyDesc; HREmployeesInfo EmployeeInfo = GMCWebApp.GetEmployeeByUserName(Convert.ToString(AuthConfig.GetSession("CurrentUser"))); if (EmployeeInfo == null) { EmployeeInfo = new HREmployeesInfo(); } ViewData["EmployeeInfo"] = EmployeeInfo; ViewData["lstBranchs"] = Helpers.HtmlControls.GetDropDownListObjects("BRBranchs", "BRBranchID", "BRBranchName", EmployeeInfo.FK_BRBranchID); ViewData["lstPositions"] = Helpers.HtmlControls.GetDropDownListObjects("HRPositions", "HRPositionID", "HRPositionName", EmployeeInfo.FK_HRPositionID); ViewData["lstSections"] = Helpers.HtmlControls.GetDropDownListObjects("HRSections", "HRSectionID", "HRSectionName", EmployeeInfo.FK_HRSectionID); ViewData["lstAreas"] = Helpers.HtmlControls.GetDropDownListObjects("HRAreas", "HRAreaID", "HRAreaName", EmployeeInfo.FK_HRAreaID); HomeModels home = new HomeModels(); foreach (KeyValuePair <string, double> item in home.GetTonPhepTheoNhanVien(EmployeeInfo)) { ViewData[item.Key] = item.Value; } if (AuthConfig.GetSession("TongNgayPhep") == null) { AuthConfig.SetSession("TongNgayPhep", ViewData["ConLai"]); } //DevExpress.Web.Localization.ASPxGridViewLocalizer.Active = return(View()); } else { return(RedirectToAction("Login", "Account")); } }
public ActionResult RegisterOffWork(string oEmplOffWork) { string[] arr = oEmplOffWork.Split('&'); HREmployeeOffWorksInfo objEmplOffWork = new HREmployeeOffWorksInfo(); HREmployeeOffWorksController EmployeeOffWorkCtrl = new HREmployeeOffWorksController(); arr.ToList().ForEach(x => { string[] arrItem = x.Split('='); GMCDbUtil.SetPropertyValue(objEmplOffWork, arrItem.FirstOrDefault(), Convert.ChangeType(arrItem.LastOrDefault(), GMCDbUtil.GetCSharpVariableType("HREmployeeOffWorks", arrItem.FirstOrDefault()))); }); int iLeaveTypeID = new HREmployeeLeaveTypesController().GetObjectIDByNo("PN"); if (objEmplOffWork.FK_HREmployeeLeaveTypeID == iLeaveTypeID && objEmplOffWork.HREmployeeOffWorkRegDays > Convert.ToDouble(AuthConfig.GetSession("TongNgayPhep"))) { return(Content("Số ngày nghỉ phép vượt quá tổng số ngày nghỉ phép còn lại! Kiểm tra lại")); } HREmployeesInfo objEmpl = ExpertERP.Controller.EmployeeCtrl.GetObjectByID(objEmplOffWork.FK_HREmployeeID) as HREmployeesInfo; if (objEmpl == null) { objEmpl = GMCWebApp.GetEmployeeByUserName(Convert.ToString(AuthConfig.GetSession("CurrentUser"))); } if (objEmpl != null) { DataSet ds = SqlDatabaseHelper.RunStoredProcedure("spl_GetAllDataEmployeeOffWorkByEmployeeIDAndDate", objEmpl.HREmployeeID, objEmplOffWork.HREmployeeOffWorkFromDate.Value, objEmplOffWork.HREmployeeOffWorkToDate.Value); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { return(Content(string.Format("Bạn đã đăng ký phép trong thời gian {0} - {1}! Vui lòng kiểm tra lại!", objEmplOffWork.HREmployeeOffWorkFromDate.Value.ToShortDateString(), objEmplOffWork.HREmployeeOffWorkToDate.Value.ToShortDateString()))); } if (objEmplOffWork.FK_HREmployeeID == 0) { objEmplOffWork.FK_HREmployeeID = objEmpl.HREmployeeID; } objEmplOffWork.AACreatedUser = Convert.ToString(AuthConfig.GetSession("CurrentUser")); objEmplOffWork.ApprovalStatusCombo = "New"; objEmplOffWork.HREmployeeOffWorkTypeCombo = "Permision"; EmployeeOffWorkCtrl.SaveObject(objEmplOffWork); return(Content("OK")); } else { return(Content("User hiện chưa cấu hình nhân viên! Không thể đăng ký!")); } }
public ActionResult ShowSubScreenRegisterOffWork(string sType) { HomeModels home = new HomeModels(); ViewData["type"] = sType; DataTable dtSource = ADConfigValueUtility.InitConfigValueTable("EmployeeOffWorkShiftType"); ViewData["ModalTitle"] = "Thông tin đăng ký nghỉ phép"; ViewData["lstEmployeeLeaveType"] = home.GetEmployeeLeaveTypes(); ViewData["objEmployeeOffWork"] = new HREmployeeOffWorksInfo(); ViewData["lstShiftTypeCombo"] = Helpers.HtmlControls.GetDropDownListObjects(dtSource, "Value", "Text"); HREmployeesInfo objCurrent = GMCWebApp.GetEmployeeByUserName(Convert.ToString(AuthConfig.GetSession("CurrentUser"))); if (objCurrent != null) { dtSource = new HREmployeesController().GetDataTableByDataSet(new HREmployeesController().GetAllDataByForeignColumn("FK_HREmployeeManagerID", objCurrent.HREmployeeID)); if (dtSource == null) { dtSource = new DataTable(); } DataRow dr = dtSource.NewRow(); if (dtSource.Columns.Contains("HREmployeeID")) { dr.SetField("HREmployeeID", objCurrent.HREmployeeID); } if (dtSource.Columns.Contains("HREmployeeFullName")) { dr.SetField("HREmployeeFullName", objCurrent.HREmployeeFullName); } dtSource.Rows.InsertAt(dr, 0); } ViewData["EmployeeID"] = objCurrent.HREmployeeID; ViewData["lstEmployee"] = Helpers.HtmlControls.GetDropDownListObjects(dtSource, "HREmployeeID", "HREmployeeFullName"); foreach (KeyValuePair <string, double> item in home.GetTonPhepTheoNhanVien(objCurrent)) { ViewData[item.Key] = item.Value; } return(PartialView("ShowSubScreenRegisterOffWork")); }
public ActionResult GridViewPartialView(int iFieldID, string sType, string sDocType, string sStatus) { // DXCOMMENT: Pass a data model for GridView in the PartialView method's second parameter HomeModels home = new HomeModels(); Dictionary <STFieldsInfo, List <BusinessObject> > dic = home.GetFieldInfo(iFieldID); ViewData["sType"] = sType; ViewData["control"] = dic; string sApproval = Request.Url.Query.Split('=').LastOrDefault(); string sApprovalStatus = (sApproval == "Register") ? "New" : ((sApproval == "Submit" ? "Approving" : "Approved")); sStatus = (sApproval == "Cancel") ? "Cancel" : "Alive"; HREmployeesInfo objEmployee = GMCWebApp.GetEmployeeByUserName(Convert.ToString(AuthConfig.GetSession("CurrentUser"))); int iEmployeeID = 0; if (objEmployee != null) { iEmployeeID = objEmployee.HREmployeeID; } ViewData["data"] = home.GetEmployeeOffWorkByApprovalStatus(iEmployeeID, sApprovalStatus, sStatus); return(PartialView("GridViewAjaxPartialView", null)); }