private bool Convert(Event e, out MobileEvent mobEvent) { try { mobEvent = this.autoMapper.Map <Event, MobileEvent>(e); foreach (var category in mobEvent.Categories) { category.EventId = mobEvent.Id; } mobEvent.UserEventStatus = 0; if (e.UserEvents.FirstOrDefault() != null) { mobEvent.UserEventStatus = e.UserEvents.FirstOrDefault().Status.Id; } } catch { mobEvent = null; return(false); } return(true); }
public HistogramaDetencionesDetailVo(MobileEvent mobileEvent) { Intern = mobileEvent.Intern; Driver = mobileEvent.Driver; Responsable = mobileEvent.Responsable; EventTime = mobileEvent.EventTime; Duration = mobileEvent.Duration; InitialCross = mobileEvent.InitialCross; MobileType = mobileEvent.MobileType; Id = mobileEvent.Id; }
public MobileRouteEventVo(MobileEvent mobileEvent) { IconUrl = mobileEvent.IconUrl; Driver = mobileEvent.Driver; Responsable = mobileEvent.Responsable; EventTime = mobileEvent.EventTime; Duration = mobileEvent.Duration; Message = mobileEvent.Message; InitialCross = mobileEvent.InitialCross; FinalCross = mobileEvent.FinalCross; Id = mobileEvent.Id; }
public short ReportDelivery(int routeId, long jobId, Coordinate coord, int messageId, short jobStatus, string deviceId, DateTime dateTime) { var ticket = DaoFactory.ViajeDistribucionDAO.FindById(routeId); var ciclo = new CicloLogisticoDistribucion(ticket, DaoFactory, new MessageSaver(DaoFactory)); var evento = new MobileEvent(dateTime, jobId, coord.Latitude, coord.Longitude, jobStatus, messageId, deviceId); try { ciclo.ProcessEvent(evento); } catch (Exception ex) { return(-9); } return(evento.Estado); }
public Entity Convert(MobileEntity item) { bool coversionResult = false; Entity entity = null; // ReSharper disable once CanBeReplacedWithTryCastAndCheckForNull if (item is MobileUser) { MobileUser mobUser = ((MobileUser)item); User user; coversionResult = this.Convert(mobUser, out user); entity = user; } else if (item is MobileEvent) { MobileEvent mobEvent = ((MobileEvent)item); Event @event; coversionResult = this.Convert(mobEvent, out @event); entity = @event; } /* * else if (item is Category) * { * Category category = ((Category)item); * MobileCategory mobCategory; * coversionResult = Convert(category, out mobCategory); * mobEntity = mobCategory; * } */ else { throw new InvalidOperationException(); } if (!coversionResult || entity == null) { throw new InvalidOperationException("Could not convert from MobileEntity to Entity"); } return(entity); }
public int RaiseEvent(MobileEvent mobEvent, Credentials credentials) { // If credentials not valid --> return false if (!Membership.ValidateUser(credentials.UserName, credentials.Password)) { return(-1); } try { // Create new Event Event newEvent = new Event(); newEvent.EventCode = (short)mobEvent.EventCode; newEvent.Description = mobEvent.Description; newEvent.Level = (short)mobEvent.Level; newEvent.PositionLatitude = mobEvent.Latitude; newEvent.PositionLongitude = mobEvent.Longitude; // Set missing values newEvent.UserID = (Guid)Membership.GetUser(credentials.UserName).ProviderUserKey; newEvent.Raised = DateTime.Now; // If we are here, credentials are fine, let's store this event using (braceletEntities context = new braceletEntities()) { // Store newEvent.Status = (int)CommonNames.EventStatus.New; context.Events.AddObject(newEvent); context.SaveChanges(); // Return OK return(newEvent.ID); } } catch (Exception) { // If something went wrong return(-1); } }
private bool Convert(MobileEvent mobEvent, out Event e) { try { e = this.autoMapper.Map <MobileEvent, Event>(mobEvent); e.UserEvents = new List <UserEvent>(); UserEvent newUserEvent = new UserEvent { Status = new UserEventStatus { Id = mobEvent.UserEventStatus } }; //ToDo use global status switch (mobEvent.UserEventStatus) { case 1: newUserEvent.Status.Status = "accepted"; break; case 2: newUserEvent.Status.Status = "declined"; break; default: newUserEvent.Status.Status = "unknown"; break; } newUserEvent.Rating = (uint)mobEvent.Rating; e.UserEvents.Add(newUserEvent); } catch { e = null; return(false); } return(true); }
public MobileEventVo(MobileEvent mobileEvent) { _mobileEvent = mobileEvent; }
protected virtual void Process(MobileEvent data) { }
public void ConnectDatabase() { var fileName = "SQliteDatabaseTest.db3"; var path = Path.Combine(Path.GetTempPath(), fileName); Console.WriteLine(path); if (File.Exists(path)) { File.Delete(path); } _connection = new SQLiteConnection(new SQLite.Net.Platform.Win32.SQLitePlatformWin32(), path, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.SharedCache); _connection.CreateTable <MobileCategory>(); _connection.CreateTable <MobileUser>(); _connection.CreateTable <MobileEvent>(); MobileCategory party = new MobileCategory() { Id = 0, Name = "Party" }; MobileCategory sport = new MobileCategory() { Id = 1, Name = "Sport" }; MobileEvent neunzigerParty = new MobileEvent() { Categories = new List <MobileCategory>(), City = "Amberg", Description = "90iger Party", Id = "0", EventType = 0 }; neunzigerParty.Categories.Add(party); MobileUser max = new MobileUser() { Guid = "max.urvent", Gender = 0, EMail = "*****@*****.**", Birthday = DateTime.Now, AccessToken = "token", AccessTokenReceived = DateTime.Now, AttractedTo = 1, EventDateRange = 0, ExcludedCategories = new List <MobileCategory>(), FacebookAccessToken = "fbToken", FacebookAccessTokenReceived = DateTime.Now, MaxDistance = 20, Longitude = 0, Latitude = 0, LastLogin = DateTime.Now, UserEvents = new List <MobileEvent>() }; max.UserEvents.Add(neunzigerParty); //_connection.Insert(party); //_connection.Insert(sport); //_connection.Insert(neunzigerParty); _connection.InsertWithChildren(max, true); }