//Program.Parent.menustrip2 menustrip2 = new System.Windows.Forms.MenuStrip(); public void Proccess() { DataBaseBroker db = new DataBaseBroker(); string sselect = "; WITH RekurzivnoStablo (ID_MenuCsStablo,Naziv, NazivJavni,BrDok,Vezan,RedniBroj,ccopy, Level,slave,pd,pp) AS " + "(SELECT e.ID_MenuCsStablo,e.Naziv,e.NazivJavni,e.BrDok, e.Vezan,e.RedniBroj,e.ccopy,0 AS Level, CASE e.vrstacvora WHEN 'f' THEN 0 ELSE 1 END as slave," + " PrikazDetaljaDaNe as pd,PrikazPo as pp " + "FROM MenuCsStablo AS e WITH (NOLOCK)" + " UNION ALL " + " SELECT e.ID_MenuCsStablo,e.Naziv,e.NazivJavni, e.BrDok,e.Vezan,e.RedniBroj, e.ccopy,Level +1 , CASE e.vrstacvora WHEN 'f' THEN 0 ELSE 1 END as slave," + "PrikazDetaljaDaNe As pd, PrikazPo As pp " + " FROM MenuCsStablo AS e INNER JOIN RekurzivnoStablo AS d " + " ON e.ID_MenuCsStablo = d.Vezan) " + " SELECT distinct ID_MenuCsStablo as ID, NazivJavni,Naziv,BrDok, Vezan,RedniBroj, slave,pd, pp FROM RekurzivnoStablo " + " where ccopy=0 order by RedniBroj"; DataTable ti = db.ReturnDataTable(sselect); DataTable tj = ti; if (ti.Rows.Count > 0) { } //PUNIStablo: string Naziv = ""; string JavniNaziv = ""; string Parent = ""; int vveza = 0; int i = 0; int j = 0; int slave; int ttag = 0; int upisan = 0; //var menustrip2 = new System.Windows.Forms.MenuStrip(); //var pparent = new System.Windows.Forms.ToolStripMenuItem(); do // po i { if (vveza != Convert.ToInt32(ti.Rows[i]["vezan"])) { vveza = Convert.ToInt32(ti.Rows[i]["vezan"]); } Naziv = ti.Rows[i]["Naziv"].ToString(); JavniNaziv = ti.Rows[i]["NazivJavni"].ToString(); if (Naziv == "ProcesiranjeDnevnogIzvestaja") { upisan = 1; break; } if (vveza != ttag) { slave = Convert.ToInt32(ti.Rows[i]["slave"]); ttag = Convert.ToInt32(ti.Rows[i]["ID"]); AddMenu(Naziv, JavniNaziv, slave, ttag); if (slave == 0) // ima decu { j = 0; do //po j // pronadji svu decu { if (Convert.ToInt32(tj.Rows[j]["vezan"]) == ttag) { Naziv = tj.Rows[j]["Naziv"].ToString(); JavniNaziv = ti.Rows[j]["NazivJavni"].ToString(); slave = 3; //// deca Convert.ToInt32(ti.Rows[j]["slave"]); AddMenu(Naziv, JavniNaziv, slave, ttag); } else { } j = j + 1; }while (j < tj.Rows.Count); /// kraj while po j } } i = i + 1; }while (i < ti.Rows.Count); //kraj while po i } // kraj obradastablaNew.
{ // OBUHVACENE SU SVE SPECIFICNOSTI STABLA POMOCNIH SIFARNIKA public string Proces(string Stablo, string Dokument, int IdTree) { DataBaseBroker db = new DataBaseBroker(); Form form1 = new Form(); form1 = Program.Parent.ActiveMdiChild; string sselect = ""; string mselect = ""; //form1.Controls["lidstablo"].Text = IdTree.ToString(); string uslov = ""; string Oorder = ""; //((Bankom.frmChield)form1).toolStripTexIme.Text = Dokument; mselect = "Select Upit From Upiti Where ime='GgRr" + Dokument + "StavkeView'"; Console.WriteLine(mselect); DataTable tu = db.ReturnDataTable(mselect); //if (tu.Rows.Count ) sselect = tu.Rows[0]["Upit"].ToString(); if (sselect.ToUpper().Contains("WHERE") == true) { uslov = " AND ID_" + Dokument + "StavkeView>1"; } else { uslov = " WHERE ID_" + Dokument + "StavkeView>1"; } Console.WriteLine(sselect); int vv = sselect.ToUpper().IndexOf("ORDER BY"); if (vv == -1) { //Djora 12.07.21 if (Dokument == "KadroviIOrganizacionaStruktura") { Oorder = " ORDER BY suser "; } //Djora 12.07.21 if (Dokument == "Dozvole") { Oorder = " ORDER BY Naziv "; } //vv = sselect.Length; } else { Oorder = sselect.Substring(vv); sselect = sselect.Substring(0, vv - 1); } //Djora 09.09.21 pocetak -------------------------------- if (Stablo == "PomocniSifarnici") { //Oorder = " order by id_" + Dokument.Trim() + "StavkeView asc"; DataTable dt = new DataTable(); string ssel = "SELECT DISTINCT OOrder FROM dbo.Upiti WHERE(NazivDokumenta = @param0) AND (Ime LIKE N'GGRr%')"; dt = db.ParamsQueryDT(ssel, Dokument); if (dt.Rows.Count != 0) { foreach (DataRow row in dt.Rows) { Oorder = " order by " + row["OOrder"].ToString(); } } } //Djora 09.09.21 kraj ------------------------------------ Console.WriteLine(sselect + " " + uslov + " " + Oorder); return(sselect + " " + uslov + " " + Oorder); }