public ActionResult AddRatingScales(AddRatingScale model) { try { bool success = false; string result = null; string[] role = Roles.GetRolesForUser(Membership.GetUser().UserName); CommonMethodsDAL Commondal = new CommonMethodsDAL(); string UserRole = Commondal.GetMaxRoleForUser(role); ConfigurationDAL configDAL = new ConfigurationDAL(); success = configDAL.SaveRatingScales(model, UserRole); if (model.IsAddnew) { result = "addnew"; return(Json(new { resultMesssage = result, status = success }, JsonRequestBehavior.AllowGet)); } else { if (success) { result = "Saved"; } else { result = "Error"; } return(Json(new { resultMesssage = result, status = success }, JsonRequestBehavior.AllowGet)); } } catch { throw; } }
public ActionResult AddRatingScales(int?RatingID) { try { AddRatingScale addNewRating = new AddRatingScale(); string[] role = Roles.GetRolesForUser(Membership.GetUser().UserName); addNewRating.SearchedUserDetails = new SearchedUserDetails(); CommonMethodsDAL Commondal = new CommonMethodsDAL(); addNewRating.SearchedUserDetails.UserRole = Commondal.GetMaxRoleForUser(role); EmployeeDAL dal = new EmployeeDAL(); int employeeID = dal.GetEmployeeID(Membership.GetUser().UserName); addNewRating.SearchedUserDetails.EmployeeId = employeeID; PersonalDetailsDAL personalDAL = new PersonalDetailsDAL(); addNewRating.SearchedUserDetails.EmployeeCode = personalDAL.getEmployeeCode(employeeID); ConfigurationDAL configDAL = new ConfigurationDAL(); if (RatingID != null) { tbl_PA_Rating_Master ratingScale = configDAL.getRatingScaleDetails(RatingID); addNewRating.Percentage = ratingScale.Percentage; addNewRating.Rating = ratingScale.Rating; addNewRating.RatingID = ratingScale.RatingID; addNewRating.Description = ratingScale.Description; addNewRating.AdjustmentFactor = ratingScale.AdjustmentFactor; addNewRating.SetAsMinimumLimit = ratingScale.SetAsMinimumLimit.HasValue ? ratingScale.SetAsMinimumLimit.Value : false; } return(PartialView("_addRatingScale", addNewRating)); } catch { throw; } }