public bool UpdateCustomerCoreScore(int PerId, string ComCSV) { SendReviewToCustomer coDetails = _db.SendReviewToCustomers.Where(x => x.Id == PerId && x.Archived == false).FirstOrDefault(); EditSegmentViewModel model = new EditSegmentViewModel(); JavaScriptSerializer js = new JavaScriptSerializer(); model.CoworkerSegment = js.Deserialize <List <CoworkerSegment> >(ComCSV); int totalScore = 0, totalQue = 0; foreach (var item in model.CoworkerSegment) { item.questionDataList = js.Deserialize <List <CoworkerSegmentQuetion> >(item.questionData); totalQue = totalQue + item.questionDataList.Count(); foreach (var data in item.questionDataList) { totalScore = totalScore + Convert.ToInt32(data.Score); } } int AvgCoreScore = totalScore / totalQue; coDetails.CoWorkerScoreJSC = ComCSV; coDetails.CoreScore = Convert.ToString(AvgCoreScore); coDetails.MailStatus = "See Response"; _db.SaveChanges(); return(true); }
public bool UpdateCustomerDetailsForMeDecline(int perID) { SendReviewToCustomer coDetails = _db.SendReviewToCustomers.Where(x => x.Id == perID && x.Archived == false).FirstOrDefault(); coDetails.MailStatus = "Declined"; _db.SaveChanges(); return(true); }
public int SaveCustomerInviteLinkForMeEmployee(int invitEmpID, int PerfId, int empID, int reviewID, string fullName) { SendReviewToCustomer model = new SendReviewToCustomer(); model.InviteeEmployee = invitEmpID; model.EmployeeID = empID; model.PerformanceID = PerfId; model.Archived = false; model.MailStatus = "Invited"; model.ReviewID = reviewID; model.EmailSentDate = DateTime.Now; model.EmailSentBy = empID; model.FullName = fullName; _db.SendReviewToCustomers.Add(model); _db.SaveChanges(); return(model.Id); }