/// <summary> /// Valida los datos de los folios cancelados /// </summary> /// <param name="lstFoliosCancell">Lista a validar</param> /// <returns>Cadena de texto</returns> /// <history> /// [emoguel] created 06/05/2016 /// </history> private string ValidateCancelled(List <FolioCxCCancellation> lstFoliosCancell, List <FolioCxCPR> lstFoliosPR) { string strMsj = ""; int nIndex = 0; ValidationFolioData validate; foreach (FolioCxCCancellation folio in lstFoliosCancell) { nIndex = lstFoliosCancell.IndexOf(folio); if (folio.fccrcf == null) { GridHelper.SelectRow(dgrCancelled, nIndex, 2, true); strMsj = "Reason is a required value, cannot be empty."; break; } else if (folio.fccFrom == 0 || folio.fccTo == 0) { GridHelper.SelectRow(dgrCancelled, nIndex, 0, true); strMsj = "Values must be greatter than 0"; break; } else if (folio.fccTo <= folio.fccFrom) { GridHelper.SelectRow(dgrCancelled, nIndex, 1, true); strMsj = "From value must be greatter or equal than To value."; break; } else if (!ValidateFoliosRange(lstFoliosPR, folio)) { GridHelper.SelectRow(dgrCancelled, nIndex, 0, true); strMsj = "The range of the canceled folios must be in the range of the asigned folios."; break; } validate = BRFoliosCXCPR.ValidateFolio(personnel.peID, folio.fccFrom, folio.fccTo, true); if (validate.Result == 1) { GridHelper.SelectRow(dgrAssigned, nIndex, 0, true); strMsj = "There is a PR with same Folio, check PR: " + validate.PR.ToString(); break; } } return(strMsj); }
/// <summary> /// Valida que todos los FoliosByPR cumplan con los requisitos /// </summary> /// <param name="lstFolios">Lista a validar</param> /// <returns>Cadena de texto</returns> /// <history> /// [emoguel] created 06/05/2016 /// </history> private string ValidateFoliosPR(List <FolioCxCPR> lstFolios) { string strMsj = ""; int nIndex = 0; ValidationFolioData validate; foreach (FolioCxCPR folio in lstFolios) { nIndex = lstFolios.IndexOf(folio); if (folio.fcpFrom == 0 || folio.fcpTo == 0) { GridHelper.SelectRow(dgrAssigned, nIndex, 0, true); strMsj = "Values must be greatter than 0."; break; } else if (folio.fcpTo < folio.fcpFrom) { GridHelper.SelectRow(dgrAssigned, nIndex, 1, true); strMsj = "From value must be greatter or equal than To value."; break; } else if (!BRFoliosCXCPR.ValidateFolioRange(folio.fcpFrom, folio.fcpTo)) { GridHelper.SelectRow(dgrAssigned, nIndex, 0, true); strMsj = "The assigned range does not exists in the Folios CxC catalog."; break; } validate = BRFoliosCXCPR.ValidateFolio(personnel.peID, folio.fcpFrom, folio.fcpTo, false); if (validate.Result == 1) { GridHelper.SelectRow(dgrAssigned, nIndex, 0, true); strMsj = "There is a PR with same Folio , check PR: " + validate.PR.ToString(); break; } } return(strMsj); }