public JsonResult CreateRequest(LeaveViewModel objViewModel) { try { cEmpLeave objempleave = cEmpLeave.Create(); string LeavetypeID = objViewModel.SelectedLeaveType[0].ToString(); objempleave.objLeaveType.iObjectID = Convert.ToInt32(LeavetypeID); objempleave.dtFromDate = objViewModel.objEmployeeLeave.FromDate; objempleave.dtToDate = objViewModel.objEmployeeLeave.ToDate; objempleave.sReason = objViewModel.objEmployeeLeave.Reason; objempleave.sLeaveStatus = "2"; objempleave.objEmpLogin.iObjectID = Convert.ToInt32(HttpContext.User.Identity.Name); int manageID = cEmpLogin.Get_ID(Convert.ToInt32(HttpContext.User.Identity.Name)).objManageGroup.iObjectID; cManageGroup objmanage = cManageGroup.Get_ID(manageID); objempleave.iReportingHead = objmanage.iReportingHead; objempleave.bIsActive = true; objempleave.Save(); int IreportHead = objmanage.iReportingHead;; string reporterEmail = cEmpLogin.Get_ID(IreportHead).sEmailID; List <cEmpPersonalDetails> aobOer = cEmpPersonalDetails.Find(" objEmpLogin = "******" " + aobOer[0].sLastName; List <cEmpPersonalDetails> aobre = cEmpPersonalDetails.Find(" objEmpLogin = "******" " + aobre[0].sLastName; MailLeaveRequest(ReprtingHead, ReprtingFrom, reporterEmail); return(Json("1")); } catch (Exception ex) { throw ex; } }
public ActionResult Add(string ID) { try { EmployeeViewModel objEmpViewMod = new EmployeeViewModel(); if (ID != null) { int val = Convert.ToInt32(ID); cEmpLogin objEmpLogin = cEmpLogin.Get_ID(val); List <cEmpPersonalDetails> aobPerso = cEmpPersonalDetails.Find(" objEmpLogin = "******" objEmpLogin = "******"dd/MM/yyyy"); ViewBag.TitleName = objEmpLogin.objTitle.iObjectID; ViewBag.iLocation = objEmpLogin.objLocation.iObjectID; cManageGroup objmanage = cManageGroup.Get_ID(objEmpLogin.objManageGroup.iObjectID); ViewBag.iReportingHead = objmanage.iReportingHead; ViewBag.DepID = cFunctionalGroup.Get_ID(objmanage.objFunctionalGroup.iObjectID).objFunctionalDepartment; ViewBag.RollAccessID = objEmpLogin.objRoleAccess.iObjectID; ViewBag.DepTypeID = objmanage.objFunctionalGroup.iObjectID; ViewBag.DesgID = objEmpLogin.objDesignation.iObjectID; objEmpViewMod.DesignationList = getDesignationList(); objEmpViewMod.ReportList = getReportHeadList(); objEmpViewMod.TitleList = getTitleList(); objEmpViewMod.LocationList = getLocation(); objEmpViewMod.DepartmentList = getDepartmentList(); objEmpViewMod.RollAccessList = getRollAccessList(); objEmpViewMod.DepartTypeList = getDepartmentType(); objEmpViewMod.EmpList = GetEmployeeList(); ViewBag.Update = objEmpViewMod; return(View(objEmpViewMod)); } else { objEmpViewMod.DesignationList = getDesignationList(); objEmpViewMod.ReportList = getReportHeadList(); objEmpViewMod.TitleList = getTitleList(); objEmpViewMod.LocationList = getLocation(); objEmpViewMod.DepartmentList = getDepartmentList(); objEmpViewMod.RollAccessList = getRollAccessList(); objEmpViewMod.DepartTypeList = getDepartmentType(); objEmpViewMod.EmpList = GetEmployeeList(); return(View(objEmpViewMod)); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Creates a cManageGroup object. It will be saved in permanent storage only /// on calling Save() /// </summary> /// <returns>cManageGroup object</returns> public static cManageGroup Create() { cManageGroup oObj = new cManageGroup(); SecurityCheck((int)enManageGroup_Action.Create); // Create an object in memory, will be saved to storage on calling Save() oObj.m_bCreating = true; oObj.m_bInvalid = false; return(oObj); }
/// <summary> /// Ensures that an object with the specified name exists, while creating other properties are set to their default values /// </summary> /// <param name="i_sName">Name</param> /// <returns>cManageGroup object</returns> public static cManageGroup CreateIfRequiredAndGet(string i_sName) { cManageGroup oObj = cManageGroup.Get_Name(i_sName); if (oObj == null) { oObj = cManageGroup.Create(); oObj.sName = i_sName; oObj.Save(); } return(oObj); }
/// <summary> /// Finds and return cManageGroup objects matching the specified criteria /// </summary> /// <param name="i_oFilter">Filter criteria (WHERE clause)</param> /// <returns>cManageGroup objects</returns> public static List <cManageGroup> Find(cFilter i_oFilter) { DataTable dt = Find_DataTable(i_oFilter, null); List <cManageGroup> l = new List <cManageGroup>(); cManageGroup oObj; for (int i = 0; i < dt.Rows.Count; i++) { oObj = new cManageGroup(); oObj.m_iID = Convert.ToInt32(dt.Rows[i]["iID"]); oObj.m_sName = dt.Rows[i]["sName"].ToString(); oObj.m_dtCreatedOn = Convert.ToDateTime(dt.Rows[i]["dtCreatedOn"]); oObj.m_dtLastUpdatedOn = Convert.ToDateTime(dt.Rows[i]["dtLastUpdatedOn"]); oObj.m_objFunctionalGroup.iObjectID = Convert.ToInt32(dt.Rows[i]["objFunctionalGroup"].ToString()); oObj.m_iReportingHead = Convert.ToInt32(dt.Rows[i]["iReportingHead"]); oObj.m_bIsActive = Convert.ToBoolean(dt.Rows[i]["bIsActive"]); oObj.m_bInvalid = false; l.Add(oObj); } return(l); }
public ActionResult CreateRequest() { try { LeaveViewModel objLeaveViewModel = new LeaveViewModel(); int LoginID = Convert.ToInt32(HttpContext.User.Identity.Name); int manageID = cEmpLogin.Get_ID(LoginID).objManageGroup.iObjectID; cManageGroup objmanage = cManageGroup.Get_ID(manageID); int ReportHeadID = objmanage.iReportingHead; List <cEmpPersonalDetails> objPersona = cEmpPersonalDetails.Find(" objEmpLogin = "******"EmployeeCode"].ToString(); objLeaveViewModel.EmployeeDepartment = dt.Rows[0]["DepartmentType"].ToString(); objLeaveViewModel.EmployeeDesignation = dt.Rows[0]["Designation"].ToString(); objLeaveViewModel.EmployeeName = dt.Rows[0]["Firstname"].ToString(); if (objPersona.Count > 0) { objLeaveViewModel.EmployeeReportingHead = objPersona[0].sFirstName + " " + objPersona[0].sLastName; } else { objLeaveViewModel.EmployeeReportingHead = ""; } } cEmpLogin objEmpLogin = cEmpLogin.Get_ID(LoginID); objLeaveViewModel.LeaveTypeList = getLeaveTypeList(); return(View(objLeaveViewModel)); } catch (Exception ex) { throw ex; } }
public JsonResult Add(EmployeeViewModel emp, string hdnEmployeeID) { try { EmployeeViewModel objEmpViewMod = new EmployeeViewModel(); if (emp.SelectedRollAccess[0] == "" || emp.SelectedReportHead[0] == "" || emp.SelectedLocation[0] == "" || emp.SelectedDepartmentType[0] == "" || emp.SelectedDesignation[0] == "" || emp.SelectedRollAccess[0] == "" || emp.SelectedReportHead[0] == "") { return(Json("1"));//Some Dropdown are not selected } else { //if (ModelState.IsValid) //{ if (hdnEmployeeID != null && hdnEmployeeID != "") { string strTitle = "0"; if (emp.SelectedTitle[0] == "") { strTitle = "0"; } else { strTitle = emp.SelectedTitle[0]; } int ID = Convert.ToInt32(hdnEmployeeID); cEmpLogin objEmpLogin = cEmpLogin.Get_ID(ID); objEmpLogin.sEmailID = emp.EmployeeEmailIdUpdate; List <cManageGroup> objManag = cManageGroup.Find(" objFunctionalGroup = " + emp.DepTypeID + " and iReportingHead = " + Convert.ToInt32(emp.SelectedReportHead[0])); if (objManag.Count > 0) { objEmpLogin.objManageGroup.iObjectID = objManag[0].iID; } else { cManageGroup aobjManag = cManageGroup.Create(); aobjManag.objFunctionalGroup.iObjectID = Convert.ToInt32(emp.SelectedDepartmentType[0]); aobjManag.iReportingHead = Convert.ToInt32(emp.SelectedReportHead[0]); aobjManag.Save(); objEmpLogin.objManageGroup.iObjectID = aobjManag.iID; } objEmpLogin.objRoleAccess.iObjectID = Convert.ToInt32(emp.SelectedRollAccess[0]); objEmpLogin.objTitle.iObjectID = Convert.ToInt32(emp.SelectedTitle[0]); objEmpLogin.objLocation.iObjectID = Convert.ToInt32(emp.SelectedLocation[0]); objEmpLogin.objDesignation.iObjectID = Convert.ToInt32(emp.SelectedDesignation[0]); objEmpLogin.sFirstTime = "1"; objEmpLogin.bIsActive = true; objEmpLogin.sPassword = emp.Password; objEmpLogin.Save(); List <cEmpPersonalDetails> aobjEmployeePersonalDetails = cEmpPersonalDetails.Find(" objEmpLogin = "******""; } else { aobjEmployeePersonalDetails[0].sMiddleName = aobjEmployeePersonalDetails[0].sMiddleName; } //aobjEmployeePersonalDetails[0].sMiddleName = emp.EmpPersonal.MiddleName; aobjEmployeePersonalDetails[0].sLastName = emp.EmpPersonal.LastName; aobjEmployeePersonalDetails[0].sPersoanlEmailID = emp.PersonalEmailUpdate; aobjEmployeePersonalDetails[0].objEmpLogin.iObjectID = objEmpLogin.iID; aobjEmployeePersonalDetails[0].Save(); List <cEmployee> aobjEmp = cEmployee.Find(" objEmpLogin = "******" iID = " + aobjEmp[0].objEmpDesigDepartmentType.iObjectID); //aobjDesigDepart[0].objDepartmentType.iObjectID = Convert.ToInt32(emp.SelectedDepartmentType[0]); //aobjDesigDepart[0].objDesignation.iObjectID = Convert.ToInt32(emp.SelectedDesignation[0]); //aobjDesigDepart[0].Save(); MailCreateEmployee(objEmpLogin.sEmailID, objEmpLogin.sPassword, "Update"); return(Json("2"));//Update } else { string strTitle = "0"; if (emp.SelectedTitle[0] == "") { strTitle = "0"; } else { strTitle = emp.SelectedTitle[0]; } cEmpLogin objEmpLogin = cEmpLogin.Create(); objEmpLogin.sEmailID = emp.EmployeeEmailId; objEmpLogin.objRoleAccess.iObjectID = Convert.ToInt32(emp.SelectedRollAccess[0]); objEmpLogin.sFirstTime = "1"; objEmpLogin.bIsActive = true; objEmpLogin.sPassword = emp.Password; objEmpLogin.objDesignation.iObjectID = Convert.ToInt32(emp.SelectedDesignation[0]); objEmpLogin.objLocation.iObjectID = Convert.ToInt32(emp.SelectedLocation[0]); objEmpLogin.objTitle.iObjectID = Convert.ToInt32(emp.SelectedTitle[0]); List <cManageGroup> objManag = cManageGroup.Find(" objFunctionalGroup = " + emp.DepTypeID + " and iReportingHead = " + Convert.ToInt32(emp.SelectedReportHead[0])); if (objManag.Count > 0) { objEmpLogin.objManageGroup.iObjectID = objManag[0].iID; } else { cManageGroup aobjManag = cManageGroup.Create(); aobjManag.objFunctionalGroup.iObjectID = Convert.ToInt32(emp.SelectedDepartmentType[0]); aobjManag.iReportingHead = Convert.ToInt32(emp.SelectedReportHead[0]); aobjManag.Save(); objEmpLogin.objManageGroup.iObjectID = aobjManag.iID; } objEmpLogin.Save(); cEmpPersonalDetails objEmployeePersonalDetails = cEmpPersonalDetails.Create(); objEmployeePersonalDetails.sFirstName = emp.EmpPersonal.FirstName; if (emp.EmpPersonal.MiddleName == null) { objEmployeePersonalDetails.sMiddleName = ""; } else { objEmployeePersonalDetails.sMiddleName = emp.EmpPersonal.MiddleName; } objEmployeePersonalDetails.sLastName = emp.EmpPersonal.LastName; objEmployeePersonalDetails.sPersoanlEmailID = emp.PersonalEmail; objEmployeePersonalDetails.objEmpLogin.iObjectID = objEmpLogin.iID; objEmployeePersonalDetails.bIsActive = true; objEmployeePersonalDetails.Save(); cEmployee objEmp = cEmployee.Create(); objEmp.objEmpLogin.iObjectID = objEmpLogin.iID; objEmp.dtDOJ = Convert.ToDateTime(emp.Employee.DOJ); objEmp.Save(); MailCreateEmployee(objEmpLogin.sEmailID, objEmpLogin.sPassword, "Create"); return(Json("3"));//Create } } } catch (Exception ex) { throw ex; } }