public JsonResult ChangePassword(ChangePassword objChangePass) { if (objChangePass.hdnEmail != null) { string email = EncryptDecrypt.Decrypt(objChangePass.hdnEmail); List <cEmpLogin> aobjLoginEmp = cEmpLogin.Find(" sEmailID = " + email); if (aobjLoginEmp.Count > 0) { aobjLoginEmp[0].sPassword = objChangePass.NewPassword; aobjLoginEmp[0].Save(); return(Json("1")); } else { return(Json("3")); } } else { if (objChangePass.CurrentPassword != null && objChangePass.CurrentPassword != "") { int loginID = Convert.ToInt32(HttpContext.User.Identity.Name); cEmpLogin objLoginEmp = cEmpLogin.Get_ID(loginID); objLoginEmp.sPassword = objChangePass.NewPassword; objLoginEmp.Save(); return(Json("2")); } else { return(Json("3")); } } }
/// <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>cEmpLogin object</returns> public static cEmpLogin CreateIfRequiredAndGet(string i_sName) { cEmpLogin oObj = cEmpLogin.Get_Name(i_sName); if (oObj == null) { oObj = cEmpLogin.Create(); oObj.sName = i_sName; oObj.Save(); } return(oObj); }
public JsonResult personaldeatil(EmployeePersonalDetails objEmpPersonal) { try { int LoginID = Convert.ToInt32(HttpContext.User.Identity.Name); cEmpLogin objEmpLogin = cEmpLogin.Get_ID(LoginID); List <cEmpPersonalDetails> aobjEmployeePersonalDetails = cEmpPersonalDetails.Find(" objEmpLogin = "******"2"; objEmpLogin.Save(); } List <cEmpEmergencyContact> aobjEmpEmergency = cEmpEmergencyContact.Find(" objEmpLogin = "******"2"; return(Json(aobjEmployeePersonalDetails[0])); } catch (Exception ex) { throw ex; } }
//public JsonResult Edit(string ID) //{ // try // { // JsonResult result = new JsonResult(); // result.Data = objEmpViewMod; // result.JsonRequestBehavior = JsonRequestBehavior.AllowGet; // return result; // } // catch (Exception) // { // throw; // } //} public JsonResult Delete(string ID) { try { int loginID = Convert.ToInt32(HttpContext.User.Identity.Name); int id = Convert.ToInt32(ID); cEmpLogin objEmp = cEmpLogin.Get_ID(id); objEmp.bIsActive = false; objEmp.Save(); //List<cEmpPersonalDetails> objPersonal = cEmpPersonalDetails.Find(" objEmpLogin = "******" objEmpLogin = "******" objEmpLogin = "******"2"); //} ////Profile Detail Delete //List<cEmpPersonalDetails> objPersonal = cEmpPersonalDetails.Find(" objEmpLogin = "******" objEmpLogin = "******" objEmpLogin = "******" objEmpLogin = "******" objEmpLogin = "******" objEmpLogin = "******" objEmpLogin = "******" objEmpLogin = "******" objEmpLogin = "******" objEmpLogin = "******" objTimesheet = " + aobjTimeSheet[0].iID); // if (aobjTimeActivity.Count>0) // { // foreach (var itemAct in aobjTimeActivity) // { // List<cTimeSheetActivityDes> aobjTimeAcDes = cTimeSheetActivityDes.Find(" objTimeSheetActivity = " + itemAct.iID); // if (aobjTimeAcDes.Count > 0) // { // foreach (var itemDes in aobjTimeAcDes) // { // cTimeSheetActivityDes.Delete(itemDes.iID); // } // } // cTimeSheetActivity.Delete(itemAct.iID); // } // } // cTimesheet.Delete(aobjTimeSheet[0].iID); //} ////Update reporting Head:- //List<cEmpLogin> aobEmpLog = cEmpLogin.Find(" objEmpLogin = "******" iReportingHead = " + id); //if (aobEmpReport.Count > 0) //{ // foreach (var itemEmpRe in aobEmpReport) // { // itemEmpRe.iReportingHead = 1; // itemEmpRe.Save(); // } //} //cEmpLogin.Delete(id); return(Json("1")); } 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; } }