public bool ModelSpectrumInsertOrUpdate(CloudModelSpectrum item) { using (IDbConnection conn = new SqlConnection(Model.ConnStr("Cloud"))) { List <CloudModelSpectrum> records = new List <CloudModelSpectrum>(); records.Add(item); conn.Execute("dbo.MODEL_SPECTRUM_InsertOrUpdateData @ID_MODEL, @RANK, @COLOR, @TYPE", records); return(true); } }
public void ReadCSVFileModelSpectrum(string filename) { using (var reader = new StreamReader(filename)) { List <CloudModelSpectrum> listOfRecords = new List <CloudModelSpectrum>(); var header = reader.ReadLine(); //načte hlavičku while (!reader.EndOfStream) { var line = reader.ReadLine(); var values = line.Split(';'); CloudModelSpectrum record = new CloudModelSpectrum(values[0], values[1], values[2]); listOfRecords.Add(record); } Util.l(header); foreach (var r in listOfRecords) { Util.l($"{r.id_model} : {r.rank} : {r.color}: {r.type}"); Model.Cloud.ModelSpectrumInsertOrUpdate(r); } } }