private int?CalculateFinal_Score(AuditSheetModel AuditSheetModel) { try { int?val = 0; //int? Total = 0; int countoffields = (AuditSheetModel.Formfields).Count(); for (int i = 0; i < (AuditSheetModel.Formfields).Count(); i++) { if ((AuditSheetModel.Formfields[i].Parameter_Status == true)) { val = val + AuditSheetModel.Formfields[i].Max_Score; } } if ((AuditSheetModel.Call_p1 == "Non_Calling")) { val = val + 10; } return(val); } catch (Exception) { throw; } }
// GET: TimeSheet public ActionResult Add(int FormsCode = 0) { AuditSheetModel auditSheetModel = new AuditSheetModel(); auditSheetModel.Formfields = _IAuditSheet.ListofFormsField(FormsCode); auditSheetModel.GetListofTrack = _IAuditSheet.GetListofTrack(); auditSheetModel.GetListofForms = _IAuditSheet.GetListofForms(); return(View(auditSheetModel)); }
//Calculate status Add private string CalculateStatus(AuditSheetModel AuditSheetModel) { try { string Overall_Status = ""; //int? Total = 0; int countoffields = (AuditSheetModel.Formfields).Count(); for (int i = 0; i < (AuditSheetModel.Formfields).Count(); i++) { if ((AuditSheetModel.Call_p1 == "Calling")) { if ((AuditSheetModel.Formfields[i].Metric == "FATAL ACCURACY") && (AuditSheetModel.Formfields[i].Parameter_Status == false)) { Overall_Status = "Fail"; break; } else { if ((AuditSheetModel.Formfields[i].Metric == "FATAL ACCURACY") && (AuditSheetModel.Formfields[i].Parameter_Status == true)) { Overall_Status = "Pass"; } } } else { if ((AuditSheetModel.Formfields[i].FieldID != '2') && (AuditSheetModel.Formfields[i].Parameter_Status == true)) { Overall_Status = "Pass"; break; } else { if ((AuditSheetModel.Formfields[i].FieldID != '2') && (AuditSheetModel.Formfields[i].Parameter_Status == false)) { Overall_Status = "Fail"; } } } } return(Overall_Status); } catch (Exception) { throw; } }
//Add Save public void Save(AuditSheetModel auditsheetmodel, int Audit_MasterID) { try { // foreach (var item in AuditSheetModel.Max_Score) for (int i = 0; i < (1); i++) { if ((auditsheetmodel.FormsCode != 0)) { // auditsheetmodel.Formfields = new List<Formfields>(); // var test = auditsheetmodel.Formfields[1].Questions; #region Project 1 foreach (var item in auditsheetmodel.Formfields) { var FormsCode = auditsheetmodel.FormsCode; var FieldID = item.FieldID; var Questions = item.Questions; var Parameter_Status = Convert.ToBoolean(item.Parameter_Status); var Metric = item.Metric; var Max_Score = item.Max_Score; var Final_Score = 0; if ((Parameter_Status == true) || (Parameter_Status == false && auditsheetmodel.Call_p1 == "Non_Calling" && FieldID == 2)) { Final_Score = item.Max_Score; } else { Final_Score = 0; } SaveAuditSheetDetail(FormsCode, FieldID, Questions, Parameter_Status, Metric, Max_Score, Final_Score, Audit_MasterID); } #endregion } } } catch (Exception) { throw; } }
public ActionResult Add(AuditSheetModel auditsheetmodel) { try { if (auditsheetmodel == null) { ModelState.AddModelError("", "Values Posted Are Not Accurate"); return(Json("Add", "AuditSheet")); } // var Formfields = auditsheetmodel.Formfields.ToList(); AuditSheetMaster objauditsheetmaster = new AuditSheetMaster(); objauditsheetmaster.Audit_MasterID = 0; objauditsheetmaster.Audit_Date = DateTime.Now; objauditsheetmaster.Team_Name = auditsheetmodel.TeamName_p1; if (Session["QualityLead"] != null) { objauditsheetmaster.Auditor_ID = Convert.ToInt32(Session["QualityLead"]); } else { objauditsheetmaster.Auditor_ID = Convert.ToInt32(Session["Quality"]); } objauditsheetmaster.UserName = auditsheetmodel.UserName; objauditsheetmaster.Agent_Supervisor = auditsheetmodel.Agent_Supervisor; objauditsheetmaster.Agent_Manager = auditsheetmodel.Agent_Manager; objauditsheetmaster.Transaction_Date = auditsheetmodel.hdtext5; objauditsheetmaster.Coaching_Comments = auditsheetmodel.textt1_p1; // objauditsheetmaster.call_Type = CalculateFinal_Score(auditsheetmodel).ToString(); // objauditsheetmaster.First_call_Resolution = auditsheetmodel.textt2_p1; objauditsheetmaster.Need_Training = auditsheetmodel.textt3_p1; objauditsheetmaster.Order_Date = auditsheetmodel.hdtext2; //need to fix objauditsheetmaster.CPU = auditsheetmodel.text4_p1; objauditsheetmaster.Denial_Date = auditsheetmodel.hdtext3; //need to fix objauditsheetmaster.Invoice_Number = auditsheetmodel.textt6_p1; objauditsheetmaster.Equipment = auditsheetmodel.textt7_p1; objauditsheetmaster.Current_Lac = auditsheetmodel.text8_p1; objauditsheetmaster.Call_Disposition = auditsheetmodel.text9_p1; objauditsheetmaster.Call_ID = auditsheetmodel.text10_p1; objauditsheetmaster.Call_Duration = auditsheetmodel.text11_p1; // objauditsheetmaster.Call_Details = auditsheetmodel.text12_p1; objauditsheetmaster.Date_Of_Service = auditsheetmodel.hdtext4;//need to fix objauditsheetmaster.ACIS_ID = auditsheetmodel.text13_p1; objauditsheetmaster.Denial_Reason = auditsheetmodel.text14_p1; objauditsheetmaster.Payor_ID = auditsheetmodel.text15_p1; objauditsheetmaster.Audit_Type = auditsheetmodel.text16_p1; objauditsheetmaster.Previous_Lac = auditsheetmodel.text17_p1; objauditsheetmaster.Timeof_Call = auditsheetmodel.text18_p1; objauditsheetmaster.Final_Status = CalculateFinal_Score(auditsheetmodel).ToString(); objauditsheetmaster.BuzzRule_Loaded_or_not = auditsheetmodel.textt2_p1; objauditsheetmaster.Is_AR_Issuelog_Open = auditsheetmodel.text12_p1; objauditsheetmaster.Invoice_Balance = auditsheetmodel.text21_p1; objauditsheetmaster.Alternate_LAC = auditsheetmodel.text22_p1; objauditsheetmaster.Correct_Outcome = auditsheetmodel.text23_p1; objauditsheetmaster.Overall_Status = CalculateStatus(auditsheetmodel); objauditsheetmaster.Mode_of_Monitoring = auditsheetmodel.Mode_of_Monitoring; objauditsheetmaster.AuditSheetStatus = 1; int Audit_MasterID = _IAuditSheet.AddAuditSheetMaster(objauditsheetmaster); var UserName = auditsheetmodel.UserName; if (Audit_MasterID > 0) { Save(auditsheetmodel, Audit_MasterID); _IAuditSheet.InsertAuditSheetAuditLog(InsertAuditSheetAudit(Audit_MasterID, 1, UserName)); } TempData["AuditCardMessage"] = "Audit Saved Successfully"; return(RedirectToAction("Add", "AuditSheet")); } catch (Exception) { throw; } }