public void Add(TimeModel model) { using (DbContextApp db = new DbContextApp()) { db.Times.Add(model); db.SaveChanges(); } }
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); }
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)); }
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(); } }
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(); } }
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; }
public TimeController(TimeModel model, TimeView view) { _model = model; _view = view; RegisterController(); _view.StartTimer(); }
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)); }
public TimeModel GetTime() { var time = new TimeModel(); time.Date = DateTime.Now; time.Temperature = 45; return(time); }
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.")); } }
public Slot Get(long id) { var slot = TimeModel.getService().GetSlotByID(id); if (slot == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(slot); }
public void Test_TimeModelExists() { var sut = new TimeModel(); TimeModel sut1 = new TimeModel(); var actual = sut; Assert.IsType <TimeModel>(actual); Assert.NotNull(actual); }
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)); }
public IEnumerable <Slot> GetSlots(string project) { TimeModel timeService = TimeModel.getService(); if (!timeService.GetProjects().Contains(project)) { return(timeService.GetSlots()); } return(timeService.GetSlots(project)); }
/// <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)); }
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); }
public void ParseTime_Minuites() { //Setup string time = "1y2m3w4d5m"; //Operation TimeModel timeModel = GetProcessedDate(time); //Assertions Assert.AreEqual(timeModel.Minutes, 5); }
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 }
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()); }
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); }
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")); }
public void ToTimeString_InvalidTimeException_Null() { //Setup TimeModel data = null; //Operation GetProcessedDate(data); //Assertions //Exception assertion }
public WidgetTime(TimeModel widget) : base(widget) { InitializeComponent(); var timer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 1) }; timer.Tick += Timer_Tick; timer.Start(); }
public void Init() { conn = TimeModel.getConnection(); using (SqliteCommand cmd = conn.CreateCommand()) { cmd.CommandText = TimeModel.tableCreateCommand; cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); cmd.Dispose(); } }
public ActionResult Delete(int id, TimeModel _model) { try { _repository.DeleteTime(_model.Id); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(TimeModel _model) { try { _repository.UpdateTime(_model); return(RedirectToAction("Index")); } catch { return(View()); } }
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(); }