Esempio n. 1
0
 public void Add(TimeModel model)
 {
     using (DbContextApp db = new DbContextApp())
     {
         db.Times.Add(model);
         db.SaveChanges();
     }
 }
Esempio n. 2
0
 public string UserFromReservation(TimeModel time, TableModel table)
 {
     if (reservations.Count > 0)
     {
         var tableReservation = reservations[table.Number];
         return(tableReservation.GetUser(time.Id));
     }
     return(string.Empty);
 }
        //Create an empty model to store in db
        private TimeModel createModel(IndexViewModel vm)
        {
            TimeModel model = new TimeModel();

            model.startTime = vm.startTime;
            model.hours     = vm.hours;
            model.endTime   = vm.endTime;
            return(model);
        }
Esempio n. 4
0
        public async Task <TimeModel> AdicionarTimeAsync(TimeModel time)
        {
            var novoTime = _mapper.Map <Time>(time);

            var timeAdicionado = await _uow.TimeRepositorio
                                 .SaveAsync(novoTime);

            return(_mapper.Map <TimeModel>(timeAdicionado));
        }
Esempio n. 5
0
 public void Edit(TimeModel model)
 {
     using (DbContextApp db = new DbContextApp())
     {
         var modelToUpdate = db.Times.Single(m => m.ID == model.ID);
         db.Entry(modelToUpdate).CurrentValues.SetValues(model);
         db.SaveChanges();
     }
 }
Esempio n. 6
0
 public void Delete(TimeModel model)
 {
     using (DbContextApp db = new DbContextApp())
     {
         var modelToDelete = db.Times.Single(m => m.ID == model.ID);
         db.Times.Remove(modelToDelete);
         db.SaveChanges();
     }
 }
Esempio n. 7
0
        public async void BindCombo()
        {
            Common          common          = new Common();
            MenuController  MenuControllers = new MenuController();
            TimeModel       timeModel       = MenuControllers.GetModules();
            List <TimeList> timeListsres    = common.BindDropdownlist("R", "", timeModel.Start_Time, timeModel.End_Time);

            ViewBag.timeListsres = timeListsres;
        }
Esempio n. 8
0
    public TimeController(TimeModel model, TimeView view)
    {
        _model = model;
        _view  = view;

        RegisterController();

        _view.StartTimer();
    }
Esempio n. 9
0
        public string SaveTime(TimeModel timeModel)
        {
            if (!DateTime.TryParseExact(timeModel.Data_De_Fundacao__c, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime date))
            {
                throw new Exception("Informar formato de data válido (dd/MM/yyyy)");
            }

            return(new TimeService().SaveTimeOnSalesForce(timeModel));
        }
Esempio n. 10
0
        public TimeModel GetTime()
        {
            var time = new TimeModel();

            time.Date        = DateTime.Now;
            time.Temperature = 45;

            return(time);
        }
Esempio n. 11
0
        public async Task create(CommandContext ctx, [Description("Nome do time"), RemainingText] String nome)
        {
            List <EventoModel> eventos = new Evento().FindAll(_ => true);

            if (eventos.Count > 0)
            {
                TimeModel time = new TimeModel
                {
                    Nome      = nome,
                    LiderId   = ctx.Member.Id,
                    Jogadores = new[] { ctx.Member.Id }.ToList()
                };
                List <Page> pages = new List <Page>();
                eventos.ForEach(async e => pages.Add(new Page($"", new DiscordEmbedBuilder(await EmbedExtended.AsyncEventoEmbed(e)))));
                PaginationEmojis emojis = new PaginationEmojis
                {
                    Left      = DiscordEmoji.FromName(ctx.Client, ":arrow_left:"),
                    Stop      = DiscordEmoji.FromName(ctx.Client, ":stop_button:"),
                    Right     = DiscordEmoji.FromName(ctx.Client, ":arrow_right:"),
                    SkipLeft  = null,
                    SkipRight = null
                };
                var msg = await ctx.RespondAsync(embed : EmbedBase.InputEmbed($"Selecione o evento que deseja participar. Depois clique em {emojis.Stop.ToString()} para confirmar."));

                await ctx.Channel.SendPaginatedMessageAsync(ctx.User, pages.ToArray(), emojis, PaginationBehaviour.WrapAround, PaginationDeletion.Default, TimeSpan.FromMinutes(30));

                var lastMsg = (await ctx.Channel.GetMessagesAfterAsync(msg.Id)).ToList().FirstOrDefault(x => x.Author == msg.Author && msg.Embeds.Count > 0);
                var id      = int.Parse(lastMsg.Embeds[0].Fields.ToList().Find(x => x.Name == "Id").Value);
                var evento  = eventos.Find(x => x.Id == id);
                if (new Time().Find(x => x.EventoId == id && x.LiderId == ctx.Member.Id) != null)
                {
                    await lastMsg.DeleteAsync();

                    await msg.ModifyAsync(embed : EmbedBase.OutputEmbed("Você já possui um time nesse evento."));
                }
                else
                {
                    time.EventoId = id;
                    await lastMsg.DeleteAsync();

                    if (evento.LimiteTimes == 0 || evento.Times == null || evento.Times.Count < evento.LimiteTimes)
                    {
                        new Time().Insert(time);
                        await msg.ModifyAsync(embed : EmbedBase.OutputEmbed($"Selecionado : {evento.Nome}. Time criado."));
                    }
                    else
                    {
                        await msg.ModifyAsync(embed : EmbedBase.OutputEmbed($"Inscrições para esse evento foram fechadas. Peça uma vaga aos organizadores do evento."));
                    }
                }
            }
            else
            {
                await ctx.RespondAsync(embed : EmbedBase.OutputEmbed("Não há eventos ativos no momento. Inscrição de times foi desativada."));
            }
        }
Esempio n. 12
0
        public Slot Get(long id)
        {
            var slot = TimeModel.getService().GetSlotByID(id);

            if (slot == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
            return(slot);
        }
Esempio n. 13
0
        public void Test_TimeModelExists()
        {
            var       sut  = new TimeModel();
            TimeModel sut1 = new TimeModel();

            var actual = sut;

            Assert.IsType <TimeModel>(actual);
            Assert.NotNull(actual);
        }
Esempio n. 14
0
        private IEnumerable <Slot> GetSlots(string project, DateTime start, DateTime end)
        {
            TimeModel timeService = TimeModel.getService();

            if (!timeService.GetProjects().Contains(project))
            {
                return(timeService.GetSlots(start, end));
            }
            return(timeService.GetSlots(project, start, end));
        }
Esempio n. 15
0
        public IEnumerable <Slot> GetSlots(string project)
        {
            TimeModel timeService = TimeModel.getService();

            if (!timeService.GetProjects().Contains(project))
            {
                return(timeService.GetSlots());
            }
            return(timeService.GetSlots(project));
        }
Esempio n. 16
0
        /// <summary>
        /// 获取方向下某时间波形
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <param name="ids">方向</param>
        /// <param name="time">时间</param>
        /// <returns></returns>
        public ResultData GetDataTwByDirId(string parameter, IdsModel ids, TimeModel time)
        {
            List <DataTw>      list    = _dataTwDal.GetDataTwByDirId(GetTableName(parameter), ids, time);
            List <DataTwModel> dtmList = new List <DataTwModel>();

            foreach (DataTw item in list)
            {
                dtmList.Add(_mapper.Map <DataTwModel>(item));
            }
            return(new ResultData(dtmList));
        }
Esempio n. 17
0
        public TimeModel GetTimeValues()
        {
            TimeModel timeValues = (from tv in Db.gameTimes
                                    select new TimeModel
            {
                CurrentTime = (DateTime)tv.currentTime,
                EndTime = (DateTime)tv.endTime
            }).ToList().Last();

            return(timeValues);
        }
Esempio n. 18
0
        public void ParseTime_Minuites()
        {
            //Setup
            string time = "1y2m3w4d5m";

            //Operation
            TimeModel timeModel = GetProcessedDate(time);

            //Assertions
            Assert.AreEqual(timeModel.Minutes, 5);
        }
Esempio n. 19
0
    public LootBoxModel()
    {
        if (Instance != null)
        {
            Debug.LogWarning("Replacing the current model!");
        }
        Instance = this;

        List <Units> unitTypes = Enum.GetValues(typeof(Units)).Cast <Units>().ToList();

        Resources = new Dictionary <Units, Resource>();
        for (int i = 0; i < unitTypes.Count; i++)
        {
            Units type = unitTypes[i];
            Resources.Add(type, new Resource(type, 0));
        }

        UpgradeManager          = new UpgradeManager(this);
        UpgradeManager.IsActive = true;
        Time = new TimeModel(this);

        Life          = new LifeModel(this);
        Life.IsActive = true;

        Job          = new JobModel(this);
        Job.IsActive = false;

        MacGuffinQuest          = new MacGuffinQuest(this);
        MacGuffinQuest.IsActive = false;

        Influencer          = new InfluencerModel(this);
        Influencer.IsActive = false;

        Studio          = new StudioModel(this);
        Studio.IsActive = false;

        Public          = new PublicModel(this);
        Public.IsActive = false;

        SetInitialState();

#if DEBUG
        if (UnlockAllViews)
        {
            Life.IsActive           = true;
            UpgradeManager.IsActive = true;
            Job.IsActive            = true;
            MacGuffinQuest.IsActive = true;
            Influencer.IsActive     = true;
            Studio.IsActive         = true;
            Public.IsActive         = true;
        }
#endif
    }
Esempio n. 20
0
        public void ParseTime_Weeks()
        {
            //Setup
            string time = "1y2m3w4d5m";

            //Operation
            TimeModel timeModel = GetProcessedDate(time);

            //Assertions
            Assert.AreEqual(timeModel.Weeks, 3);
        }
        public ActionResult Time(TimeModel t)
        {
            if (t.month != 0)
            {
                Session["DevelopmentTime"] = t.month;

                return(RedirectToAction("TotalEffort", "SLIM"));
            }

            return(View());
        }
Esempio n. 22
0
        public static TimeEntity MapToEntity(TimeModel detailModel, IEntityFactory entityFactory)
        {
            var entity = (entityFactory ??= new DummyEntityFactory()).Create <TimeEntity>(detailModel.Id);

            entity.Id         = detailModel.Id;
            entity.Discipline = detailModel.Discipline;
            entity.Time       = detailModel.Time;
            entity.Person     = PersonMapper.MapToEntity(detailModel.Person, entityFactory);
            entity.Team       = TeamMapper.MapToEntity(detailModel.Team, entityFactory);
            return(entity);
        }
Esempio n. 23
0
    private async Task CreateTimeMVCAsync()
    {
        TimeModel timeModel = TimeFactory.Instance.CreateTimeModel();
        TimeView  timeView  = await TimeFactory.Instance.CreateTimeView(_view.GameAreaView);

        _timeController = TimeFactory.Instance.CreateTimeController(timeModel, timeView);

        _timeController.TimeFinish += OnTimeFinish;
        TimeRestart += _timeController.OnTimeRestart;
        RoundFinish += _timeController.OnRoundFinish;
    }
        public ActionResult Delete(TimeModel time)
        {
            TimeModel time2 = db.Times
                              .Where(s => s.Id == time.Id)
                              .FirstOrDefault <TimeModel>();

            db.Times.Remove(time2);
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
Esempio n. 25
0
        public void ToTimeString_InvalidTimeException_Null()
        {
            //Setup
            TimeModel data = null;

            //Operation
            GetProcessedDate(data);

            //Assertions
            //Exception assertion
        }
Esempio n. 26
0
        public WidgetTime(TimeModel widget) : base(widget)
        {
            InitializeComponent();

            var timer = new DispatcherTimer {
                Interval = new TimeSpan(0, 0, 0, 1)
            };

            timer.Tick += Timer_Tick;
            timer.Start();
        }
Esempio n. 27
0
        public void Init()
        {
            conn = TimeModel.getConnection();

            using (SqliteCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = TimeModel.tableCreateCommand;
                cmd.CommandType = CommandType.Text;
                cmd.ExecuteNonQuery();
                cmd.Dispose();
            }
        }
Esempio n. 28
0
 public ActionResult Delete(int id, TimeModel _model)
 {
     try
     {
         _repository.DeleteTime(_model.Id);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Esempio n. 29
0
 public ActionResult Edit(TimeModel _model)
 {
     try
     {
         _repository.UpdateTime(_model);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Esempio n. 30
0
 public ActionResult Create(TimeModel _model)
 {
     try
     {
         _repository.AddTime(_model);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public static void Reset()
 {
     TimeModel = null;
     PlayerStatsModel = null;
 }
	private void Start () {
        timeModel = GameUIService.GetTimeModel();
        if (timeModel != null)
            TimeFastforward();
	}
    public GameUIService(Image uberOuter)
    {
        if (TimeModel == null)
        {
            TimeModel = new TimeModel();
            TimeModel.Month = TimeModel.Months[Random.Range(0, 11)];
        }
        else
            TimeModel.Day++;

        //Set the wake up hour
        TimeModel.Hour = 6;
        TimeModel.Minute = 0;

        if (PlayerStatsModel == null)
            PlayerStatsModel = new PlayerStatsModel();

        uberModel = new UberModel(false);
        this.uberOuter = uberOuter;

        InputManager.instance.onCameraClickPressedListener += ShowUberUI;
        InputManager.instance.onCameraClickUpListener += HideUberUI;

        if(uberOuter != null)
            uberOuter.gameObject.SetActive(false);
    }
 void Start()
 {
     timeModel = GameUIService.GetTimeModel();
     playerStatsModel = GameUIService.GetPlayerStatsModel();
 }