public ModuleModel GetModule(string moduleNumber) { vmsServerLinqDataContext datacontext = new vmsServerLinqDataContext(); ModuleModel model = new ModuleModel(); Module query = (from m in datacontext.Modules where m.ModuleNumber == moduleNumber select m).SingleOrDefault<Module>(); model.ModuleNumber = query.ModuleNumber; model.ModuleType = query.ModuleType; model.IsActive = Convert.ToBoolean(query.IsActive); return model; }
public ModuleModel GetModule(string moduleNumber) { vmsServerLinqDataContext datacontext = new vmsServerLinqDataContext(); ModuleModel model = new ModuleModel(); Module query = (from m in datacontext.Modules where m.ModuleNumber == moduleNumber select m).SingleOrDefault <Module>(); model.ModuleNumber = query.ModuleNumber; model.ModuleType = query.ModuleType; model.IsActive = Convert.ToBoolean(query.IsActive); return(model); }
public void Save(SystemLogModel model) { vmsServerLinqDataContext datacontext = new vmsServerLinqDataContext(); SystemLog log = new SystemLog(); log.LogID = GetLongID(); log.LogValue = model.LogValue; log.Type = model.LogType; log.Time = model.LogTime; log.Source = model.Source; log.StackTrace = model.StackTrace; datacontext.SystemLogs.InsertOnSubmit(log); datacontext.SubmitChanges(); }
public void Save(TrackingModel model) { vmsServerLinqDataContext datacontext = new vmsServerLinqDataContext(); Tracking objTracking = new Tracking(); objTracking.TrackingID = GetLongID(); objTracking.ModuleID = model.ModuleNumber; objTracking.Longtitude = model.Longtitude; objTracking.Latitude = model.Latitude; objTracking.Speed = model.Speed; objTracking.FuelLevel = model.FuelLevel; objTracking.Time = DateTime.Now; datacontext.Trackings.InsertOnSubmit(objTracking); datacontext.SubmitChanges(); }
public void Save(ModuleModel model) { vmsServerLinqDataContext datacontext = new vmsServerLinqDataContext(); Module objModule = new Module(); try { objModule = datacontext.Modules.Single(m => m.ModuleNumber == model.ModuleNumber); objModule.ModuleNumber = model.ModuleNumber; objModule.ModuleType = model.ModuleType; objModule.IsActive = model.IsActive; datacontext.SubmitChanges(); } catch { objModule.ModuleNumber = model.ModuleNumber; objModule.ModuleType = model.ModuleType; objModule.IsActive = model.IsActive; datacontext.Modules.InsertOnSubmit(objModule); datacontext.SubmitChanges(); } }
public TrackingModel GetModule(long id) { vmsServerLinqDataContext datacontext = new vmsServerLinqDataContext(); var query = (from t in datacontext.Trackings where t.TrackingID == id select t).SingleOrDefault(); TrackingModel model = new TrackingModel(); try { model.TrackingID = query.TrackingID; model.ModuleNumber = query.ModuleID; model.Longtitude = Convert.ToDouble(query.Longtitude); model.Latitude = Convert.ToDouble(query.Latitude); model.Speed = Convert.ToDouble(query.Speed); model.FuelLevel = Convert.ToDouble(query.FuelLevel); model.Time = Convert.ToDateTime(query.Time); return model; } catch { return null; } }
public TrackingModel GetModule(long id) { vmsServerLinqDataContext datacontext = new vmsServerLinqDataContext(); var query = (from t in datacontext.Trackings where t.TrackingID == id select t).SingleOrDefault(); TrackingModel model = new TrackingModel(); try { model.TrackingID = query.TrackingID; model.ModuleNumber = query.ModuleID; model.Longtitude = Convert.ToDouble(query.Longtitude); model.Latitude = Convert.ToDouble(query.Latitude); model.Speed = Convert.ToDouble(query.Speed); model.FuelLevel = Convert.ToDouble(query.FuelLevel); model.Time = Convert.ToDateTime(query.Time); return(model); } catch { return(null); } }