private ofiObj ChildNodes(string podIvor, List <Stavka> svList) { ofiObj node = new ofiObj(); foreach (Stavka stavkaVrska in svList) { if ((stavkaVrska.eKod == podIvor) && (!stavkaVrska.isProccesed) && (stavkaVrska.Kod != 1)) { node = DataOfi(stavkaVrska.eKod, "1230310007", new DateTime(2017, 12, 31), "OFI1"); node.Sum(ChildNodes(stavkaVrska.Vrska, svList)); stavkaVrska.isProccesed = true; } else if ((stavkaVrska.Kod == 1) && (stavkaVrska.eKod == podIvor)) { node = DataOfi(stavkaVrska.eKod, "1230310007", new DateTime(2017, 12, 31), "OFI1"); lsRes.Add(node); stavkaVrska.isProccesed = true; return(node); } } return(node); }
public void Sum(ofiObj childObj) { PocSostojba += childObj.PocSostojba; SteknuvanjeSO += childObj.SteknuvanjeSO; NamaluvanjeSO += childObj.NamaluvanjeSO; PromeniKR += childObj.PromeniKR; PromeniC += childObj.PromeniC; PromeniO += childObj.PromeniO; KrajSostojba += childObj.KrajSostojba; }
private ofiObj SumRes(Stavka s, List <ofiObj> lsRes) { ofiObj ofiRes = new ofiObj(); ofiRes.e_kod = s.eKod; ofiRes.Opis = s.Vrska; foreach (ofiObj o in lsRes) { ofiRes.Sum(o); } return(ofiRes); }
private ofiObj DataOfi(string eKod, string Ikod, DateTime datum, string rpt) { ofiObj ofiO = new ofiObj(); ofiO.e_kod = eKod; string dataQuery = $"SELECT eKod, PocSost, steknuvanjeSo, namaluvanjeSo, promeniKR, promeniC, promeniO, KrajSost FROM ofiData AS ofi WHERE ofi.eKod = '{eKod}' and ofi.IKODnbrm = '1230310007' AND ofi.Datum = '2017-09-30' AND ofi.rpt = 'OFI1'"; string connStr = "Data Source = E:\\vs2017\\svPloter\\eOFIdata.db; Version = 3;"; //System.Data.SQLite.SQLiteConnection.CreateFile("Data Source = Config\\Data\\eOFIdata.db; Version = 3;"); using (System.Data.SQLite.SQLiteConnection con = new System.Data.SQLite.SQLiteConnection(connStr)) { using (System.Data.SQLite.SQLiteCommand com = new System.Data.SQLite.SQLiteCommand(con)) { con.Open(); // Open the connection to the database com.CommandText = dataQuery; // Select all rows from our database table using (System.Data.SQLite.SQLiteDataReader reader = com.ExecuteReader()) { while (reader.Read()) { ofiO.PocSostojba = Convert.ToDecimal(reader["PocSost"].ToString()); ofiO.SteknuvanjeSO = Convert.ToDecimal(reader["steknuvanjeSo"].ToString()); ofiO.NamaluvanjeSO = Convert.ToDecimal(reader["namaluvanjeSo"].ToString()); ofiO.PromeniKR = Convert.ToDecimal(reader["promeniKR"].ToString()); ofiO.PromeniC = Convert.ToDecimal(reader["promeniC"].ToString()); ofiO.PromeniO = Convert.ToDecimal(reader["promeniO"].ToString()); ofiO.KrajSostojba = Convert.ToDecimal(reader["KrajSost"].ToString()); } } con.Close(); // Close the connection to the database } } return(ofiO); }