public string GetMacroArea4Descrizione(string desc_) { var m = new DB.DataWrapper.cMovimenti(); var a = m.MacroAree_e_Descrizioni(); foreach (var i in a) { if (i.Descrizione.Equals(desc_, StringComparison.OrdinalIgnoreCase)) { return(eMacroArea.Text = i.MacroArea); } } return(""); }
private void eDescrizione_Leave(object sender, EventArgs e) { if ((eMacroArea.Text == "") || (eMacroArea.Text == null)) { var m = new DB.DataWrapper.cMovimenti(); var a = m.MacroAree_e_Descrizioni(); foreach (var i in a) { if (i.Descrizione.Equals(eDescrizione.Text, StringComparison.OrdinalIgnoreCase)) { eMacroArea.Text = i.MacroArea; break; } } } }
private void Carica() { string ulMA = ""; DB.DataWrapper.cMovimenti mov = new DB.DataWrapper.cMovimenti(); List <DB.DataWrapper.cMovimenti.sMacroArea_e_Descrizione> z = mov.MacroAree_e_Descrizioni(); List <string> desc = mov.TutteLeDescrizioni_Array(false); gNoCat.ClearItems(); pArea.Controls.Clear(); if (desc != null) { if (desc.Count > 0) { gNoCat.AddRange(desc); } } if (z != null) { if (z.Count > 0) { int g = -1; int e = -1; string[] elems = new string[z.Count]; cGroupList[] G = new cGroupList[z.Count]; for (int i = 0; i < z.Count; i++) { if ((!ulMA.Equals(z[i].MacroArea, StringComparison.OrdinalIgnoreCase)) || (i == z.Count - 1)) { if (g > -1) { if (e > -1) { string[] elems2 = new string[e + 1]; Array.Copy(elems, elems2, e + 1); G[g].AddRange(elems2); e = -1; } } if (!ulMA.Equals(z[i].MacroArea, StringComparison.OrdinalIgnoreCase)) { G[g += 1] = NewG(z[i].MacroArea); } } elems[e += 1] = z[i].Descrizione; ulMA = z[i].MacroArea; } if (g > -1) { cGroupList[] G2 = new cGroupList[g + 1]; Array.Copy(G, G2, g + 1); pArea.Controls.AddRange(G2); } } } }