public string UpdateUserType(UserTypeEntity usertypeDtl) { string strResponse = string.Empty; short UsTCurrentVersion = 0; try { var usertypeComponent = new UserTypeComponent(); var currentUserTypeDetails = usertypeComponent.GetUserTypeDetailByID(usertypeDtl.UsT_UserTypeID); int usertypeID = currentUserTypeDetails.UsT_UserTypeID; UsTCurrentVersion = Convert.ToInt16(currentUserTypeDetails.UsT_Version); bool UsTCurrentStatus = false; //check for version and active status if (ModelState["UsT_isDeleted"].Value != null) { //UsTCurrentStatus = (usertypeDtl.UsT_ActiveStatus == true) ? true : false; UsTCurrentStatus = usertypeDtl.UsT_isDeleted == true; } if (ModelState.IsValid) { UserSessionInfo _objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo; int _userID = _objSessioninfo.UserId; usertypeDtl.UsT_ModifiedBy = _userID; //while udating increment version by1 usertypeDtl.UsT_Version = ++UsTCurrentVersion; usertypeDtl.UsT_isDeleted = UsTCurrentStatus; var Org = new UserTypeComponent(); int r = Org.UpdateUserTypeDetail(usertypeDtl); if (r == 1) { strResponse = "Employment type updated successfully"; } else if (r == 0) { strResponse = "Employment type already exists"; } else if (r == -1) { strResponse = "Error occured in UpdateUserType"; } else if (r == 2) { strResponse = "Employee Code Already Existed"; } else if (r == 3) { strResponse = "Employee Type Already Existed"; } } } catch (Exception ex) { return(strResponse); } return(strResponse); }
public JsonResult GetUserTypeByID(int catID) { UserTypeEntity UserTypeDetails = null; try { var objDtl = new UserTypeComponent(); UserTypeDetails = objDtl.GetUserTypeDetailByID(catID); } catch (Exception ex) { return(null); } return(Json(UserTypeDetails, JsonRequestBehavior.AllowGet)); }