public async Task <IActionResult> Put(int schedulingId, Scheduling model) { try { //verifica se o registro existe para realizar atualização var scheduling = await _repo.GetScheduling(schedulingId); if (scheduling == null) { return(NotFound()); } _repositoryContext.Update(model); if (await _repositoryContext.SaveChanges()) { return(Created($"/api/scheduling/{model.Id}", model)); } } catch (System.Exception ex) { return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Banco de dados sem acesso. {ex.Message}")); } return(BadRequest()); }
/** * \brief <b>Brief Description</b> - Execute <b><i>class method</i></b> - An overload of the entry point into the reconcile summary viewing menu * \details <b>Details</b> * * This takes in the existing patient information, if it should return a patient and the demographics library * * \return <b>void</b> */ public void Execute(Scheduling scheduling, Demographics demographics, Billing billing) { Container.DisplayContent(new List <Pair <string, string> >() { { new Pair <string, string>("", "") } }, 2, 1, MenuCodes.BILLING, "Billing", Description); // let the user pick a month DateTime getMonth = DatePicker.GetDate(scheduling, DateTime.Today, false); // check if user did not cancel during month selection screen if (getMonth.Ticks != 0) { // generate the government file name string date = string.Format("{0}{1}govFile.txt", getMonth.Year, getMonth.Month); // get the list of the report contents List <string> report = billing.ReconcileMonthlyBilling(date); List <Pair <string, string> > content = new List <Pair <string, string> >(); // create the content using the lines in the report foreach (string line in report) { content.Add(new Pair <string, string>(line, "")); } // display the contents of the report Container.DisplayContent(content, 2, -1, MenuCodes.BILLING, "Billing", Description); Console.ReadKey(); } }
//create an instance of Session to lunch session public Session CreateLunchSession(DateTime dayOfTheSession) { try { Session session = new Session() { Title = "Lunch Session", Order = 2 }; //for definition the lunch start at 12AM session.StartHour = new DateTime(dayOfTheSession.Year, dayOfTheSession.Month, dayOfTheSession.Day, 12, 0, 0); //for definition the lunch end at 1PM session.EndHour = new DateTime(dayOfTheSession.Year, dayOfTheSession.Month, dayOfTheSession.Day, 13, 0, 0); //create a new scheduling Scheduling scheduling = new Scheduling() { StartHour = session.StartHour, EndHour = session.EndHour, Session = session }; scheduling.Talk = new Talk() { Title = "Lunch", Duration = 60, IsLightning = false }; session.SchedulingList = new List <Scheduling>(); session.SchedulingList.Add(scheduling); sessionRepository.Save(session); return(session); } catch (Exception exception) { throw exception; } }
private async Task <HttpResponseMessage> Atualizar(Scheduling item) { var client = new ClientApi(); var content = JsonConvert.SerializeObject(item); return(await client.Put($"schedulings/{item.Id}", content)); }
// Ferdi Events public override async Task CEFFill(QryProxy request, IServerStreamWriter <CEFProxy> responseStream, ServerCallContext context) { CEFProxy proxy = new CEFProxy(); List <CEFProxy> proxyList = new List <CEFProxy>(); Type proxyType = typeof(CEFProxy); PropertyInfo[] proxyProperties = proxyType.GetProperties().Where(x => x.CanRead && x.CanWrite).ToArray(); await Scheduling.RunTask(() => { IEnumerable <CEF> rows = null; if (request.Query == "CC") { rows = Db.SQL <CEF>("select r from CEF r where r.CC.ObjectNo = ?", ulong.Parse(request.Param)); } else { rows = Db.SQL <CEF>("select r from CEF r"); } foreach (var row in rows) { proxy = CRUDsHelper.ToProxy <CEFProxy, CEF>(row); proxyList.Add(proxy); } }); foreach (var p in proxyList) { await responseStream.WriteAsync(p); } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddSingleton <IConfiguration>(Configuration); try { throw new Exception("Random exception"); _Scheduler = Scheduling.Create().Result; services.AddSingleton <IScheduler>(_Scheduler); } catch (Exception ex) { Log.Logger.Error(ex, "Failed to startup scheduling."); } services.AddSingleton <FacebookOptions>(new FacebookOptions() { AppSecret = "6259b3e435b7971f92f2af0dc38792ca", AppToken = "EAAPjbVpgI9cBALWZBRS0xVkxhTZCNZBBR3eS388MU5zrmx9uQiLPCeohEeo6VglNzKDbJHHmMbW0LELGvnBLJTbefmzd4DREz1SF4QOcqnoofk8FPzCELV5Iop8ZACR5G5L7P9LzrG4nGe9PEx3KYnwZBBV5OZBhPiqS1tlRZA3tAZDZD", ShouldVerifySignature = false, VerifyToken = "my_verify_token" }); services.AddSingleton <DialogManager>(); //string eventhubHostFormat = "amqps://{0}:{1}@{2}.servicebus.windows.net"; //var address = string.Format(eventhubHostFormat, "RootManageSharedAccessKey", Uri.EscapeUriString("i4O7XCN0bK7wjbyQJo1H30ZfTb0RVPejysh1pmMu/Zw="), "healthcoach"); //services.AddSingleton<IEventingClient>(new AzureEventingClient(address)); Azure.RegisterServices(Configuration, services).Wait(); // Add framework services. services.AddMvc(); }
public async Task DistributeAsync(UserEventMessage userEvent) { using (Telemetry.Activities.StartActivity("HandleUserEvent")) { try { var user = await userStore.GetCachedAsync(userEvent.AppId, userEvent.UserId); if (user == null) { throw new DomainException(Texts.Notification_NoUser); } var dueTime = Scheduling.CalculateScheduleTime(userEvent.Scheduling, clock, user.PreferredTimezone); await userEventQueue.ScheduleAsync(ScheduleKey(userEvent), userEvent, dueTime, true); } catch (DomainException ex) { await logStore.LogAsync(userEvent.AppId, ex.Message); await userNotificationsStore.TrackFailedAsync(userEvent); } } }
public void CronPerInterval_GivenIntervalAndTime_ReturnsCorrectCronString(Scheduling schedule, int year, int month, int day, string expected) { var dateToTest = new DateTime(year, month, day); var result = CronStringHelper.CronPerInterval(schedule, dateToTest); Assert.Equal(expected, result); }
// ┌───────────── minute (0 - 59) // │ ┌───────────── hour (0 - 23) // │ │ ┌───────────── day of the month (1 - 31) // │ │ │ ┌───────────── month (1 - 12) // │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday; // │ │ │ │ │ 7 is also Sunday on some systems) // │ │ │ │ │ // │ │ │ │ │ // * * * * * <command to execute> public static string CronPerInterval(Scheduling interval, DateTime zeroTime, bool enforceLastDayInMonth = false) { var dayComponent = (zeroTime.Day == 31 || enforceLastDayInMonth) ? "L" : $"{zeroTime.Day}"; //L is extended cron syntax and results in last day of the month for all months. switch (interval) { case Scheduling.Hour: return($"{CronPatternDefaults.TriggerMinute} * * * *"); case Scheduling.Day: return($"{CronPatternDefaults.TriggerMinute} {CronPatternDefaults.TriggerHourUTC} * * *"); case Scheduling.Week: return($"{CronPatternDefaults.TriggerMinute} {CronPatternDefaults.TriggerHourUTC} * * {zeroTime.DayOfWeek:D}"); case Scheduling.Month: return($"{CronPatternDefaults.TriggerMinute} {CronPatternDefaults.TriggerHourUTC} {dayComponent} * *"); case Scheduling.Quarter: return($"{CronPatternDefaults.TriggerMinute} {CronPatternDefaults.TriggerHourUTC} {dayComponent} {ComputeOffsetMonth(zeroTime, 4)}-12/3 *"); case Scheduling.Semiannual: return($"{CronPatternDefaults.TriggerMinute} {CronPatternDefaults.TriggerHourUTC} {dayComponent} {ComputeOffsetMonth(zeroTime, 2)}-12/6 *"); case Scheduling.Year: return($"{CronPatternDefaults.TriggerMinute} {CronPatternDefaults.TriggerHourUTC} {dayComponent} {zeroTime.Month} *"); case Scheduling.Immediate: // Fallthrough intended default: throw new ArgumentOutOfRangeException(nameof(interval), interval, null); } }
protected void btnUpdate_Click(object sender, EventArgs e) { Scheduling sche = new Scheduling(); sche.FK_CarriersID = Convert.ToInt32(Session["CarriersID"]); sche.Toll = Convert.ToDouble(txtToll.Text); sche.OilCost = Convert.ToDouble(txtOilCost.Text); sche.Fine = Convert.ToDouble(txtFine.Text); sche.OtherCost = Convert.ToDouble(txtOtherCost.Text); if (LogisticsManagerBLL.SchedulingBLL.UpdateFourCostById(sche) > 0) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + btnUpdate.Text + "成功!')", true); if (Session["User"] != null) { int userId = (Session["User"] as List <Users>)[0].UserID; BindCost(userId); } return; } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + btnUpdate.Text + "失败!')", true); return; } }
public void VerifyDatesMaintainTimeWithDailyRecurrency() { var startWithTime = start.AddSeconds(2500); Scheduling.RecurrencyDays(RecurrencyFrequency.Daily, startWithTime.Date, startWithTime.AddDays(2).Date, startWithTime) .Should().BeSameAs(new [] { startWithTime, startWithTime.AddDays(1) }); }
public void VerifyDatesWithBiweeklyRecurrencyWhereEventIsBeforeStartDate() { var endDate = end.AddDays(22); Scheduling.RecurrencyDays(RecurrencyFrequency.Biweekly, start, endDate, eventDate) .Should().BeSameAs(new [] { new DateTime(Year, 2, 4), new DateTime(Year, 2, 18), new DateTime(Year, 3, 4) }); }
public void Update_updates_item_from_database() { var options = new DbContextOptionsBuilder <DatabaseContext>() .UseInMemoryDatabase(databaseName: "Update_updates_item_from_database") .Options; using (var context = new DatabaseContext(options)) { var scheduling = new Scheduling { Day = DateTime.Today, Hour = 12, Id = 1, Status = SchedulingStatus.Active }; var service = new SchedulingService(context, new SchedulingRepository(context)); service.Add(scheduling); Assert.Single(context.Set <Scheduling>().ToList()); Assert.Equal(12, context.Set <Scheduling>().Single().Hour); scheduling.Hour = 13; service.Update(1, scheduling); Assert.Equal(13, context.Set <Scheduling>().Single().Hour); } }
/** * \brief <b>Brief Description</b> - GenerateCalendarList <b><i>class method</i></b> - Generates the contents of the calendar * \details <b>Details</b> * * This takes in the weeks in the selected month, the scheduling library and which month it is * * \return <b>List<string[,]></b> - the contents of the calendar line by line */ private static List <string[, ]> GenerateCalendarList(List <Week> month, Scheduling scheduling, int monthInt) { List <string[]> retCalendar = new List <string[]>(); // loop through every week in the month for (int week = 0; week < month.Count; week++) { // add a week for the calendar to the calendar retCalendar.Add(new string[7]); // loop through every day in the week for (int day = 0; day < 7; day++) { // get the day object of the current day Day dayOfWeek = month[week].GetAllAvailableDays()[day]; // create a string with the day number and number of free appointments on that day if (scheduling.GetDateFromDay(dayOfWeek).Month == monthInt) { retCalendar[week][day] = string.Format("{0},({1})", scheduling.GetDateFromDay(dayOfWeek).Day, dayOfWeek.NumberOfScheduledAppointments()); } } } return(FormatCalendar(retCalendar)); }
protected void btn_Delete_Click(object sender, EventArgs e) { try { try { string ids = this.hf_CheckIDS.Value.ToString(); ids = ids.TrimEnd(',').TrimStart(','); foreach (string id in ids.Split(',')) { int iid = Convert.ToInt32(id); Scheduling Scheduling = db.Scheduling.FirstOrDefault(t => t.ID == iid); if (Scheduling != null) { db.Scheduling.Remove(Scheduling); } } db.SaveChanges(); new SysLogDAO().AddLog(LogType.操作日志_删除, "成功删除点检排班信息", UserID); } catch { ShowMessage("删除失败"); return; } } catch (Exception ex) { ShowMessage(ex.Message); new SysLogDAO().AddLog(LogType.系统日志, ex.Message, UserID); } DataListBind(); this.hf_CheckIDS.Value = ""; }
public void Delete_deletes_from_database() { var options = new DbContextOptionsBuilder <DatabaseContext>() .UseInMemoryDatabase(databaseName: "Delete_deletes_from_database") .Options; using (var context = new DatabaseContext(options)) { var scheduling = new Scheduling { Day = DateTime.Today, Hour = 12, Status = SchedulingStatus.Active }; var service = new SchedulingService(context, new SchedulingRepository(context)); service.Add(scheduling); Assert.Single(context.Set <Scheduling>().ToList()); var insertedScheduling = service.GetAll().First(); service.Delete(insertedScheduling.Id); Assert.Empty(context.Set <Scheduling>().ToList()); } }
// DepartmanTanim public override async Task KdtL(QueryLookupProxy request, IServerStreamWriter <KdtLookupProxy> responseStream, ServerCallContext context) { KdtLookupProxy proxy; BbMsg bbMsg; List <KdtLookupProxy> proxyList = new List <KdtLookupProxy>(); await Scheduling.RunTask(() => { for (int i = 0; i < 1; i++) { foreach (var row in Db.SQL <KDT>("select r from KDT r")) { bbMsg = new BbMsg { Kd = row.Kd ?? "", Ad = row.Ad ?? "", Info = row.Info ?? "", }; proxy = new KdtLookupProxy { RowKey = row.GetObjectNo(), BB = bbMsg }; proxyList.Add(proxy); } } }); foreach (var p in proxyList) { await responseStream.WriteAsync(p); } }
public override Task <PPRDProxy> PPRDUpdate(PPRDProxy request, ServerCallContext context) { Scheduling.RunTask(() => { // RowSte: Added, Modified, Deletede, Unchanged Db.Transact(() => { if (request.RowSte == "A") { PPRD row = CRUDsHelper.FromProxy <PPRDProxy, PPRD>(request); request = CRUDsHelper.ToProxy <PPRDProxy, PPRD>(row); } else if (request.RowSte == "M") { // Sadece IsFerdi degisebilir if (request.RowErr == string.Empty) { PPRD row = CRUDsHelper.FromProxy <PPRDProxy, PPRD>(request); request = CRUDsHelper.ToProxy <PPRDProxy, PPRD>(row); } } else if (request.RowSte == "D") { request.RowErr = "Silemezsiniz"; } }); }).Wait(); Session.RunTaskForAll((s, id) => { s.CalculatePatchAndPushOnWebSocket(); }); return(Task.FromResult(request)); }
public void Scheduling_CheckBusyTimeStartTime_ShouldBeOk() { //Cenário Scheduling scheduling = ObjectMother.GetScheduling(); //Ação }
public void Delete(int id) { Scheduling scheduling = _context.Schedulings.Find(id); _context.Schedulings.Remove(scheduling); _context.SaveChanges(); }
public void Put([FromBody] Scheduling value) { Scheduling scheduling = _schedulingRepository.GetById(value.ID); scheduling.STATUS = "C"; _schedulingRepository.Update(scheduling); }
private object[] Take(Scheduling scheduling, bool hasId = true) { object[] parametros = null; if (hasId) { parametros = new object[] { "@StartTime", scheduling.StartTime, "@EndTime", scheduling.EndTime, "@EmployeeId", scheduling.Employee.Id, "@RoomId", scheduling.Room.Id, "@Id", scheduling.Id }; } else { parametros = new object[] { "@StartTime", scheduling.StartTime, "@EndTime", scheduling.EndTime, "@EmployeeId", scheduling.Employee.Id, "@RoomId", scheduling.Room.Id }; } return(parametros); }
public IActionResult UpdateScheduling([FromBody] Scheduling scheduling, int id) { if (!ModelState.IsValid) { return(BadRequest(DefaultMessages.nonStandardUpdate)); } var x = context.TB_Scheduling.Where(y => y.idScheduling == id).FirstOrDefault(); x.checkIn = scheduling.checkIn; x.checkOut = scheduling.checkOut; x.clientId = scheduling.clientId; x.employeeId = scheduling.employeeId; x.saleId = scheduling.saleId; x.status = scheduling.status; context.TB_Scheduling.Update(x); int rs = context.SaveChanges(); if (rs < 1) { return(BadRequest(DefaultMessages.internalfailureUpdate)); } else { return(Ok(scheduling)); } }
public void Add_writes_to_database() { var options = new DbContextOptionsBuilder <DatabaseContext>() .UseInMemoryDatabase(databaseName: "Add_writes_to_database") .Options; using (var context = new DatabaseContext(options)) { var scheduling = new Scheduling { Day = DateTime.Today, Hour = 12, Id = 1, Status = SchedulingStatus.Active, SchedulingRequestId = 1 }; var service = new SchedulingService(context, new SchedulingRepository(context)); service.Add(scheduling); } using (var context = new DatabaseContext(options)) { Assert.Single(context.Set <Scheduling>().ToList()); Assert.Equal(1, context.Set <Scheduling>().Single().Id); } }
public Scheduling Update(Scheduling entity) { try { var scheduling = Get(entity.SchedulingKey); if ((scheduling.Data != entity.Data || scheduling.Hora != entity.Hora) && _schedulingRepository.Exists(entity)) { throw new ForbbidenException("Scheduling already exists"); } var address = _addressRepository.Get(entity.Address.AddressKey); entity.Address = address ?? throw new NotFoundException("New Address not found"); return(_schedulingRepository.Update(entity)); } catch (ForbbidenException ex) { throw new ForbbidenException($"Not was possible update the Scheduling: {ex.Message}"); } catch (NotFoundException ex) { throw new NotFoundException($"Not was possible update the Scheduling: {ex.Message}"); } catch (Exception ex) { throw new InternalServerErrorException($"Not was possible update the Scheduling: {ex.Message}"); } }
/** * \brief <b>Brief Description</b> - Execute <b><i>class method</i></b> - gets confirmation that the user does indeed want to exit * \details <b>Details</b> * * This method is there only for the structure of the menu. It is one of the major menu * selections therefore it has no code behind. It it mostly accessed for its description. * * \return <b>void</b> */ public void Execute(Scheduling scheduling, Demographics demographics, Billing billing) { if (ExitConfirmation()) { Environment.Exit(0); } }
/** * \brief <b>Brief Description</b> - Execute <b><i>class method</i></b> - Entry point into the reconcile month menu * \details <b>Details</b> * * This takes in the scheduling, demographics and billing libraries * * \return <b>void</b> */ public void Execute(Scheduling scheduling, Demographics demographics, Billing billing) { // display a clear screen Container.DisplayContent(new List <Pair <string, string> >() { { new Pair <string, string>("", "") } }, 1, 1, MenuCodes.BILLING, "Billing", Description); // get the month to generate the report for DateTime getMonth = DatePicker.GetDate(scheduling, DateTime.Today, false); // check if the user didnt cancel the month selection if (getMonth.Ticks != 0) { // format the name of the text file string date = string.Format("{0}{1}govFile.txt", getMonth.Year, getMonth.Month); // generate the report for the reconciled month List <string> report = billing.ReconcileMonthlyBilling(date); // display the success message Container.DisplayContent(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("Report successfully generated!", "") }, 1, -1, MenuCodes.BILLING, "Billing", Description); // wait for confirmation from user that they read the message Console.ReadKey(); } }
public void VerifyDaysInRangeFromDateAndVistaMonthAreCorrect() { var agendaDayWithTasks = Scheduling.Range(new DateTime(Year, Month, 21), CalendarView.Month); agendaDayWithTasks.First.Date.Should().Be(new DateTime(Year, 2, 25)); agendaDayWithTasks.Last.Date.Should().Be(new DateTime(Year, 4, 6)); }
public void VerifyDaysInRangeFromDateAndVistaSevenAreCorrect() { var agendaDayWithTasks = Scheduling.Range(new DateTime(Year, Month, 21), CalendarView.Week); agendaDayWithTasks.First.Date.Should().Be(new DateTime(Year, Month, 18)); agendaDayWithTasks.Last.Date.Should().Be(new DateTime(Year, Month, 24)); }
public async Task <IActionResult> Edit(int id, [Bind("ScheduleID,TermID,PatientID,Diagnose")] Scheduling scheduling) { if (id != scheduling.ScheduleID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(scheduling); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SchedulingExists(scheduling.ScheduleID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PatientID"] = new SelectList(_context.Patients, "Id", "FirstName", scheduling.PatientID); ViewData["TermID"] = new SelectList(_context.Terms, "TermID", "Category", scheduling.TermID); return(View(scheduling)); }
/// <summary> /// Register tasks. /// </summary> /// <param name="tasks"></param> public virtual void RegisterTasks(Scheduling.TaskCollection tasks) { }
public abstract void RunEventSchedule(Scheduling.EventName objEventName);
private void ThisAddIn_StatusChanged (object sender, Scheduling.SchedulerStatusEventArgs e) { SynchronizeNowButton.Enabled = !e.IsRunning; }