Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void accessValidation()
- {
- var accessListe = ACCESS_Page.Columns[0].ExistingCells.ToArray();
- var cells = MPD_Page.Columns[4].ExistingCells.ToArray();
- var zonesListes = MPD_Page.Columns[6].ExistingCells.ToArray();
- string[] accessValue = new string[accessListe.Length];
- for (int i = 0; i < accessListe.Length; i++)
- {
- accessValue[i] = accessListe[i].Value.ToString();
- }
- string indice = "";
- for (int i = 1; i < cells.Length; i++)
- {
- indice = "E" + (i + 1).ToString();
- bool notFound = false;
- string[] ligneAccess , zones ;
- string[] access;
- string[] cellAccessValues , cellAccessValuesReversed;
- if (cells[i].Value.ToString() == "")
- {
- continue;
- }
- zones = zonesListes[i].Value.ToString().Split('\n');
- ligneAccess = cells[i].Value.ToString().Split('\n');
- if (zones.Length < ligneAccess.Length)
- {
- MPD_Page.Cells[indice].FillColor = Color.Red;
- continue;
- }
- cellAccessValues = cells[i].Value.ToString().Replace('\n', ';').Split(';');
- cellAccessValuesReversed = cells[i].Value.ToString().Replace('\n', ';').Split(';');
- Array.Reverse(cellAccessValuesReversed);
- foreach (var itemligne in ligneAccess)
- {
- if (itemligne != "") {
- access = itemligne.Split(';');
- foreach (var itemaccess in access)
- {
- if (Array.IndexOf(accessValue, itemaccess)== -1 || (Array.IndexOf(cellAccessValues, itemaccess) != (cellAccessValues.Length - Array.IndexOf(cellAccessValuesReversed, itemaccess)) - 1))
- {
- notFound = true;
- MPD_Page.Cells[indice].FillColor = Color.Red;
- break;
- }
- }
- if (notFound)
- {
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement