private void test() { dbLocalRecord rec = new dbLocalRecord(); FIX_STAN789_T ent = new FIX_STAN789_T(); ent = rec; }
public FIX_STAN789_T return_oraRecord(dbLocalRecord rec) { oraEnt.BREAK = rec.BREAK; oraEnt.COUNTER = rec.COUNTER; oraEnt.ERASE = rec.ERASE; oraEnt.G_UCHASTOK = rec.G_UCHASTOK; oraEnt.INCOMIN_DATE = rec.INCOMIN_DATE; oraEnt.N_STAN = rec.N_STAN; oraEnt.REPLAC = rec.REPLAC; oraEnt.START_STOP = rec.START_STOP; oraEnt.WHEN = rec.WHEN; return(oraEnt); }
public void insert(ObservableCollection <mTag> tags, bool flag) { dbLocalRecord record = new dbLocalRecord(); record = TagsToRecordEntity(tags); record.flagIsSent = flag; try { context.dbRecords.Add(record); context.SaveChanges(); logMessage("Local database record inserted"); } catch (Exception ex) { logMessage("Local database record insert error"); logMessage(ex.Message); } }
private dbLocalRecord TagsToRecordEntity(ObservableCollection <mTag> items) { dbLocalRecord ent = new dbLocalRecord(); if (items.Count > 0) { try { foreach (var p in ent.GetType().GetProperties()) { if (items.Any(k => k.NameInDb == p.Name)) { mTag t = items.First(k => k.NameInDb == p.Name); var targetType = G.IsNullableType(p.PropertyType) ? Nullable.GetUnderlyingType(p.PropertyType) : p.PropertyType; //Returns an System.Object with the specified System.Type and whose value is //equivalent to the specified object. object propertyVal = Convert.ChangeType(t.Value, targetType); //Set the value of the property p.SetValue(ent, propertyVal, null); } } } catch (Exception ex) { } ent.INCOMIN_DATE = DateTime.Now; ent.WHEN = DateTime.Now; ent.flagIsSent = false; } return(ent); }