public AppraiseeDetails GetAppraiseeDetails(int empID) { var lstProbableApraisee = new AppraiseeDetails(); var objApr = new Appraisal(); try { var AppraisalList = objApr.GetAppraiseeDetails(empID); return(AppraisalList); } catch (Exception ex) { throw ex; } }
public HttpResponseMessage For(int empId) { /* * Get menu * get section for each Menu * Get data for each Menu * Create Section Wise data * -> section name * -> section data * -> review Comment * Create JSON Object * Send to data Base * */ var response = Request.CreateResponse(); try { List <AppraisalReviewPost> _data = new List <AppraisalReviewPost>(); var loggedinUser = Convert.ToInt32(HttpContext.Current.User.Identity.Name); var menu = objApr.Menu(empId, loggedinUser); int sectionId = 0; foreach (var menuItem in menu.MenuList) { var menuUrlArr = menuItem.URL.Split('/'); if (!string.IsNullOrEmpty(Convert.ToString(menuUrlArr[menuUrlArr.Length - 2])) && Convert.ToString(menuUrlArr[menuUrlArr.Length - 2]).ToLower() != "for") { sectionId = int.Parse(menuUrlArr[menuUrlArr.Length - 2]); } var appraisalSection = objApr.Section(sectionId, empId, loggedinUser); var appraisalSectionPost = new AppraisalSectionPost { EmpId = empId, SectionId = sectionId, LoggedUser = loggedinUser, SectionTypeParser = appraisalSection.sectionTypeParser }; if (appraisalSection.sectionTypeParser != null) { var data = objApr.GetAppraisalData(appraisalSectionPost); _data.Add(new AppraisalReviewPost { Data = data.Data, param = appraisalSection.param, SectionName = appraisalSection.sectionName, Questions = GetQuestions(appraisalSection.questions), SectionId = appraisalSection.sectionId, Type = appraisalSection.sectionTypeParser, Appraiser1Comment = "", Appraiser2Comment = "" }); } } AppraiseeDetails objAppraiseeDetail = objApr.GetAppraiseeDetails(empId); AppraisalReviewList reviewPost = new AppraisalReviewList() { sections = _data, Appriasee = new Appraisee { FullName = objAppraiseeDetail.Employeename, EmployeeCode = Convert.ToInt32(objAppraiseeDetail.EmployeeCode) } }; response.Content = new ObjectContent(typeof(AppraisalReviewList), reviewPost, new JsonMediaTypeFormatter()); } catch (Exception ex) { var num = incident.Next(10000, 99999).ToString(); log.Error("Error while generating menu. Please contact support /administrator with incidentID : " + num, ex); throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Error while generating menu. Please contact support /administrator with incidentID : " + num)); } return(response); }