public string InsertInspection(UpdateInspectionGroup updateInspectionGroup) { string msg = string.Empty; try { DAL objDAL = new DAL(); msg = objDAL.InsertInspection(updateInspectionGroup); if (msg == "") { string result = ""; msg = validateResult(updateInspectionGroup, ref result); if (msg == "") { msg = objDAL.UpdateTruckTimeIn(updateInspectionGroup.Company, updateInspectionGroup.Key1); msg = objDAL.UpdateTruckStatus(updateInspectionGroup.Company, updateInspectionGroup.Key1, result); } msg = result; } } catch (Exception ex) { msg = ex.Message.ToString(); } return(msg); }
public string validateResult(UpdateInspectionGroup uig, ref string result) { string msg = ""; try { int canvasType = (from i in uig.Items where i.CriteriaType == "Canvas" && i.Result == true select i).Count(); if (canvasType > 0) { int ila = (from i in uig.Items where i.CriteriaType == "Inner Layer Applied" && i.Result == false select i).Count(); if (ila > 0) { result = "INSPECTION FAILED"; } } if (result == "") { int r = (from i in uig.Items where i.CriteriaType != "Canvas" && i.CriteriaType != "Inner Layer Applied" && i.Result == false select i).Count(); if (r > 0) { result = "INSPECTION FAILED"; } else { result = "INSPECTION PASSED"; } } } catch (Exception ex) { msg = ex.Message.ToString(); } return(msg); }