Пример #1
0
        public ActionResult Edit(int id = 0)
        {
            int userId = Convert.ToInt32(Session["UserID"]);

            using (var t = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {
                IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted
            }))
            {
                Schedules schedules = db.Schedules.Find(id);
                if (schedules == null)
                {
                    return(HttpNotFound());
                }
                if (!roomControl.CheckUserInRoom(userId, schedules.RoomId))
                {
                    return(RedirectToAction("Login", "Account"));
                }
                this.modelSchOrder.Schedules = schedules;
                this.modelSchOrder.GetOrderById(schedules.OrderId);
                this.modelSchOrder.GetMachineByUser(userId);
                this.modelSchOrder.SelectMachine(schedules.MachineId);

                return(View(this.modelSchOrder));
            }
        }
Пример #2
0
        internal override void Remove(BaseItemWin item)
        {
            if (item is HomeworkWin)
            {
                Homework.Remove(item as HomeworkWin);
            }

            else if (item is ExamWin)
            {
                Exams.Remove(item as ExamWin);
            }

            else if (item is ScheduleWin)
            {
                Schedules.Remove(item as ScheduleWin);
            }

            else if (item is WeightCategoryWin)
            {
                WeightCategories.Remove(item as WeightCategoryWin);
            }

            else
            {
                throw new NotImplementedException("Item to be removed from Class wasn't any of the supported types.");
            }
        }
Пример #3
0
        public ActionResult Assign(int id = 0)
        {
            Schedules schedules = null;
            int       userId    = Convert.ToInt32(Session["UserID"]);

            using (var t = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {
                IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted
            }))
            {
                schedules = db.Schedules.Find(id);
                if (schedules == null)
                {
                    return(HttpNotFound());
                }
                if (!roomControl.CheckUserInRoom(userId, schedules.RoomId))
                {
                    return(RedirectToAction("Login", "Account"));
                }
            }
            db.Schedules.Attach(schedules);
            schedules.DetailInfo = schedules.DetailInfo == null ? string.Empty : schedules.DetailInfo;
            schedules.NoticeInfo = schedules.NoticeInfo == null ? string.Empty : schedules.NoticeInfo;
            byte[] buff = null;
            App_Start.Coder.EncodeSchedule(schedules, out buff);
            enumErrorCode result = this.SendScheduleHandler(schedules.MachineId, buff, userId, PRE_INFO_TYPE_CREATE);

            if (result == enumErrorCode.HandlerSuccess)
            {
                schedules.Status = enumStatus.Assigned;
                db.SaveChanges();
            }
            return(RedirectToAction("Details", new { id = id, error = result }));
        }
Пример #4
0
        private void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var listView = (sender as ListView);
            var exp      = (listView.Parent as Expander);
            var h        = int.Parse((listView.SelectedItem as TextBlock).Text.Substring(0, (listView.SelectedItem as TextBlock).Text.IndexOf(':')));

            Schedules scheduleNew = new Schedules
            {
                TimeStart = new DateTime(CalendarSmall.SelectedDate.Value.Year, CalendarSmall.SelectedDate.Value.Month, CalendarSmall.SelectedDate.Value.Day, h, 0, 0),
                Date      = CalendarSmall.SelectedDate.Value,
                Duration  = 1,
                Coach     = StaffRepository.GetInstance().Get(int.Parse(exp.DataContext.ToString())),
                Services  = new AdditionalServices()
            };

            SchedulesRepository.GetInstance().Add(scheduleNew);
            var schedule = SchedulesRepository.GetInstance().GetAll();

            list      = new List <Schedules>();
            coachList = new List <Staff>();

            foreach (var item in schedule)
            {
                if (item.Date == CalendarSmall.SelectedDate)
                {
                    coachList.Add(item.Coach);
                    list.Add(item);
                }
            }
            var listSchedule = list.Where(item => item.Coach.Id == int.Parse(exp.DataContext.ToString())).ToList();

            exp.Content = null;
            exp.Content = SetGraficOfOne(listSchedule);
        }
Пример #5
0
        /// <summary>
        /// Deactivates all schedules and activates the given <paramref name="schedule"/>.
        /// Also saves the settings to the JSON file.
        /// </summary>
        /// <param name="schedule">The <see cref="Schedule"/> object to be activated.</param>
        public void ActivateSchedule(Schedule schedule)
        {
            Schedules.ForEach(s => s.Active = false);

            schedule.Active = true;
            SaveSettings();
        }
        private async System.Threading.Tasks.Task saveTemplate()
        {
            var result = await UserDialogs.Instance.PromptAsync("Save Template");

            if (!result.Ok || string.IsNullOrEmpty(result.Text))
            {
                return;
            }

            var schedules        = Schedules.Select(i => i.Tag as Schedule);
            var scheduleTemplate = new ScheduleTemplate()
            {
                TemplateName = result.Text
            };

            scheduleTemplate.Schedules = new ObservableCollection <Schedule>();
            foreach (var s in schedules)
            {
                var toSave = Common.Clone <Schedule>(s);
                toSave.ScheduleId     = null;
                toSave.Shift          = null;
                toSave.Task           = null;
                toSave.DayOfWeek      = (int)toSave.ScheduleDateValue.DayOfWeek;
                toSave.ScheduleDate   = null;
                toSave.ScheduleTrades = null;
                toSave.Published      = false;
                scheduleTemplate.Schedules.Add(toSave);
            }
            await runTask(async() => await DataService.PostItemAsync <ScheduleTemplate>("scheduleTemplates", scheduleTemplate));
        }
Пример #7
0
        public GroupOfSchedule PutToSubgroup(string subName, Regex filter, NodeType assignedType)
        {
            if (Subgroups == null)
            {
                Subgroups = new List <GroupOfSchedule>();
            }

            var currentGroup = Subgroups.FirstOrDefault(t => string.Equals(t.GroupName, subName, StringComparison.CurrentCultureIgnoreCase));

            if (currentGroup != null)
            {
                currentGroup.Schedules.AddRange(Schedules.Where(t => filter.IsMatch(t.Name) && t.GetNodeType() == assignedType));
            }
            else
            {
                currentGroup = new GroupOfSchedule(Schedules.Where(t => filter.IsMatch(t.Name) && t.GetNodeType() == assignedType))
                {
                    GroupName = subName
                };
                Subgroups.Add(currentGroup);
            }

            Schedules.RemoveAll(t => filter.IsMatch(t.Name) && t.GetNodeType() == assignedType);
            if (Schedules.Count == 0)
            {
                Schedules = null;
            }
            return(currentGroup);
        }
Пример #8
0
 /// <summary>
 /// Adds the schedule to the travel schedule for connecting flights
 /// </summary>
 /// <param name="scheduleForTravel"></param>
 /// <param name="schedules"></param>
 private void AddScheduleForTravel(TravelSchedule scheduleForTravel, Schedules schedules)
 {
     foreach (Schedule s in schedules)
     {
         scheduleForTravel.AddSchedule(s);
     }
 }
        public async Task <IActionResult> Edit(int id, [Bind("ID,startTime,endTime,dateAct,ActID")] Schedules schedules)
        {
            if (id != schedules.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(schedules);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SchedulesExists(schedules.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            PopulateDropDownLists(schedules);
            return(View(schedules));
        }
        /// <summary>
        /// Starts this Master Controller.
        /// </summary>
        public void Initialise()
        {
            _controllers = new List <InstanceController>();
            try {
                _config = BuildStatusConfig.Load();
            } catch (Exception ex) {
                throw new LogApplicationException("Could not load the Configuration File.", ex);
            }

            // Using the Data, Load and Instantiate each of the Visualisers and Monitors.
            // ---------------------------------------------------------------------------
            if (_config != null)
            {
                FileLogger.Logger.LogVerbose("Loading Controllers.");

                foreach (var controller in _config.Controllers)
                {
                    FileLogger.Logger.LogInformation("Controller: {0} with Monitor={1} and Visualiser={2}", controller.Name, controller.Monitor, controller.Visualiser);

                    if (_visualiser.Contains(controller.Visualiser))
                    {
                        throw new ApplicationException("A visualiser cannot be used more than once.");
                    }
                    if (_config.Visualisers[controller.Visualiser] == null)
                    {
                        throw new ApplicationException("Invalid Visualiser Specified: " + controller.Visualiser);
                    }
                    if (_config.Monitors[controller.Monitor] == null)
                    {
                        throw new ApplicationException("Invalid Monitor Specified: " + controller.Monitor);
                    }
                    if (_config.Transitions[controller.Transition] == null)
                    {
                        throw new ApplicationException("Invalid Transition Specified: " + controller.Transition);
                    }

                    var monitorInfo    = _config.Monitors[controller.Monitor];
                    var visualiserInfo = _config.Visualisers[controller.Visualiser];

                    if (monitorInfo != null && visualiserInfo != null)
                    {
                        var monitor = ComponentFactory <IMonitor> .CreateComponent(monitorInfo);

                        var visualiser = ComponentFactory <IVisualiser> .CreateComponent(visualiserInfo);

                        if (monitor != null && visualiser != null)
                        {
                            visualiser.Transitions = _config.Transitions[controller.Transition];
                            _controllers.Add(new InstanceController(controller.Name, monitor, visualiser));
                        }
                    }
                    else
                    {
                        FileLogger.Logger.LogError("Invalid Monitor and/or Visualiser Data in Config file.");
                        throw new ApplicationException("Invalid Monitor and/or Visualiser Data in Config File");
                    }
                }
                _schedules = _config.Schedules;
            }
        }
Пример #11
0
        public bool CanRunNow()
        {
            List <TimeSlot> value    = new List <TimeSlot>();
            var             CurrDt   = DateTime.Now;
            int             noOfdays = 0;
            var             day      = CurrDt.ToString("dddd");

            foreach (KeyValuePair <string, List <TimeSlot> > pair in Schedules)
            {
                if (Schedules.TryGetValue(CurrDt.ToString("dddd").ToString(), out value))
                {
                    foreach (TimeSlot ts in value)
                    {
                        var starttime = DateTime.ParseExact(ts.StartTime, "HHmm", null, System.Globalization.DateTimeStyles.None).AddDays(noOfdays);
                        var endtime   = DateTime.ParseExact(ts.EndTime, "HHmm", null, System.Globalization.DateTimeStyles.None).AddDays(noOfdays);
                        if (DateTime.Now >= starttime && DateTime.Now <= endtime)
                        {
                            return(true);
                        }
                        else if (DateTime.Now < starttime)
                        {
                            Status = "Process will start at " + starttime.ToString();
                            return(false);
                        }
                    }
                }
                noOfdays++;
                CurrDt = CurrDt.AddDays(noOfdays);
            }
            Status = "Schedule Not Known";
            return(false);
        }
Пример #12
0
        /// <summary>
        /// Adds the search result for direct flights into the schedule for travel
        /// </summary>
        /// <param name="searchInformation"></param>
        /// <param name="scheduleCollection"></param>
        /// <param name="result"></param>
        /// <exception cref="DirectFlightsNotAvailableException">Throws the exception when direct flights are not available for given search information</exception>
        private void AddSearchResultForDirectFlights(SearchInfo searchInformation, Schedules scheduleCollection, SearchResult result)
        {
            TravelSchedule scheduleForTravel = null;

            foreach (Schedule s in scheduleCollection)
            {
                if (s.RouteInfo.FromCity.CityId == searchInformation.FromCity.CityId && s.RouteInfo.ToCity.CityId == searchInformation.ToCity.CityId)
                {
                    //Create a new TravelSchedule
                    scheduleForTravel = CreateTravelSchedule(ScheduleType.Direct);

                    //Add schedules to Travel Schedule
                    AddScheduleForTravel(scheduleForTravel, s);

                    //Compute total cost for the Travel Schedule
                    CalculateTotalCostForTravel(scheduleForTravel);

                    //Add the travel schedule defined to the search result
                    AddTravelScheduleToResult(scheduleForTravel, result);
                }
            }

            if (scheduleForTravel == null)
            {
                throw new DirectFlightsNotAvailableException("Direct Flights Not Available");
            }
        }
Пример #13
0
        ///<summary>Gets up to 30 days of open time slots based on the RecallType passed in.
        ///Open time slots are found by looping through operatories flagged for Web Sched and finding openings that can hold the RecallType.
        ///The RecallType passed in must be a valid recall type.
        ///Providers passed in will be the only providers considered when looking for available time slots.
        ///Passing in a null clinic will only consider operatories with clinics set to 0 (unassigned).
        ///The timeslots on and between the Start and End dates passed in will be considered and potentially returned as available.
        ///Optionally pass in a recall object in order to consider all other recalls due for the patient.  This will potentially affect the time pattern.
        ///Throws exceptions.</summary>
        public static List <TimeSlot> GetAvailableWebSchedTimeSlots(RecallType recallType, List <Provider> listProviders, Clinic clinic
                                                                    , DateTime dateStart, DateTime dateEnd, Recall recallCur = null)
        {
            //No need to check RemotingRole; no call to db.
            if (recallType == null)           //Validate that recallType is not null.
            {
                throw new ODException(Lans.g("WebSched", "The recall appointment you are trying to schedule is no longer available.") + "\r\n"
                                      + Lans.g("WebSched", "Please call us to schedule your appointment."));
            }
            //Get all the Operatories that are flagged for Web Sched.
            List <Operatory> listOperatories = Operatories.GetOpsForWebSched();

            if (listOperatories.Count < 1)             //This is very possible for offices that aren't set up the way that we expect them to be.
            {
                throw new ODException(Lans.g("WebSched", "There are no operatories set up for Web Sched.") + "\r\n"
                                      + Lans.g("WebSched", "Please call us to schedule your appointment."), ODException.ErrorCodes.NoOperatoriesSetup);
            }
            List <long>     listProvNums  = listProviders.Select(x => x.ProvNum).Distinct().ToList();
            List <Schedule> listSchedules = Schedules.GetSchedulesAndBlockoutsForWebSched(listProvNums, dateStart, dateEnd, true
                                                                                          , (clinic == null) ? 0 : clinic.ClinicNum);
            string timePatternRecall = recallType.TimePattern;

            //Apparently scheduling this one recall can potentially schedule a bunch of other recalls at the same time.
            //We need to potentially bloat our time pattern based on the other recalls that are due for this specific patient.
            if (recallCur != null)
            {
                Patient       patCur      = Patients.GetLim(recallCur.PatNum);
                List <Recall> listRecalls = Recalls.GetList(recallCur.PatNum);
                timePatternRecall = Recalls.GetRecallTimePattern(recallCur, listRecalls, patCur, new List <string>());
            }
            string timePatternAppointment = RecallTypes.ConvertTimePattern(timePatternRecall);

            return(GetTimeSlotsForRange(dateStart, dateEnd, timePatternAppointment, listProvNums, listOperatories, listSchedules, clinic));
        }
Пример #14
0
        ///<summary>Gets up to 30 days of open time slots for New Patient Appointments based on the timePattern passed in.
        ///Open time slots are found by looping through the passed in operatories and finding openings that can hold the entire appointment.
        ///Passing in a clinicNum of 0 will only consider unassigned operatories.
        ///The timeslots on and between the Start and End dates passed in will be considered and potentially returned as available.
        ///Optionally pass in an appt type def num which will only consider operatories with the corresponding appointment type.
        ///defNumApptType is required and will ONLY consider operatories that are associated to the def's corresponding appointment type.
        ///The time pattern and procedures on the appointment will be determined via the appointment type as well.
        ///Throws exceptions.</summary>
        public static List <TimeSlot> GetAvailableNewPatApptTimeSlots(DateTime dateStart, DateTime dateEnd, long clinicNum, long defNumApptType)
        {
            //No need to check RemotingRole; no call to db.
            //Get the appointment type that is associated to the def passed in.  This is required for New Pat Appts.
            AppointmentType appointmentType = AppointmentTypes.GetWebSchedNewPatApptTypeByDef(defNumApptType);

            if (appointmentType == null)
            {
                //This message will typically show to a patient and we want them to call in OR to refresh the web app which should no longer show the reason.
                throw new ODException(Lans.g("WebSched", "The reason for your appointment is no longer available.") + "\r\n"
                                      + Lans.g("WebSched", "Please call us to schedule your appointment."));
            }
            //Now we need to find all operatories that are associated to the aforementioned appointment type.
            List <Operatory> listOperatories = Operatories.GetOpsForWebSchedNewPatApptDef(defNumApptType);

            if (listOperatories.Count < 1)             //This is very possible for offices that aren't set up the way that we expect them to be.
            {
                return(new List <TimeSlot>());         //Don't throw an exception here to the patient, they can just select another reason.
            }
            //Set the timePattern from the appointment type passed in.
            string          timePattern   = AppointmentTypes.GetTimePatternForAppointmentType(appointmentType);
            List <Provider> listProviders = Providers.GetProvidersForWebSchedNewPatAppt();
            Clinic          clinic        = Clinics.GetClinic(clinicNum);
            List <long>     listProvNums  = listProviders.Select(x => x.ProvNum).Distinct().ToList();
            List <Schedule> listSchedules = Schedules.GetSchedulesAndBlockoutsForWebSched(listProvNums, dateStart, dateEnd, false, clinicNum);

            return(GetTimeSlotsForRange(dateStart, dateEnd, timePattern, listProvNums, listOperatories, listSchedules, clinic, defNumApptType));
        }
Пример #15
0
        public void TestSchedule()
        {
            var schedules1 = new Schedules();

            schedules1.Add(new Schedule("13:00", "14:00"));
            Assert.IsTrue(schedules1.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 23, 00)));
            Assert.IsTrue(schedules1.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 11, 23, 00)));

            var schedules2 = new Schedules();

            schedules2.Add(new Schedule("13:00", "14:00", "OFF"));
            Assert.IsFalse(schedules2.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 23, 00)));
            Assert.IsTrue(schedules2.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 11, 23, 00)));

            var schedules4 = new Schedules("OFF");

            schedules4.Add(new Schedule("13:00", "14:00", "OFF"));
            Assert.IsFalse(schedules4.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 23, 00)));
            Assert.IsFalse(schedules4.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 11, 23, 00)));

            var schedules5 = new Schedules("OFF");

            schedules5.Add(new Schedule("13:00", "14:00", "ON"));
            Assert.IsTrue(schedules5.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 23, 00)));
            Assert.IsFalse(schedules5.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 11, 23, 00)));

            var schedules3 = new Schedules();

            schedules3.Add(new Schedule("13:00", "14:00", "OFF", DateTime.Now.DayOfWeek.ToString()));
            Assert.IsFalse(schedules3.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 23, 00)));
            Assert.IsTrue(schedules3.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day + 1, 13, 23, 00)));
            Assert.IsTrue(schedules3.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 14, 00, 01)));
            Assert.IsTrue(schedules3.IsScheduleOn(new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day + 1, 14, 00, 01)));
        }
        async Task SyncSchedules()
        {
            if (!IsBusy)
            {
                Exception Error = null;

                Schedules.Clear();
                try
                {
                    IsBusy = true;
                    var Repository = new Repository();
                    var Items      = await Repository.GetSchedule();

                    foreach (var Service in Items)
                    {
                        Schedules.Add(Service);
                    }
                }
                catch (Exception ex)
                {
                    Error = ex;
                }
                finally
                {
                    IsBusy = false;
                }
                if (Error != null)
                {
                    await _pageDialogService.DisplayAlertAsync("Erro", Error.Message, "OK");
                }
                return;
            }
        }
Пример #17
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            List <string> list = new List <string>();

            foreach (DataGridViewRow row in dataGridView.SelectedRows)
            {
                list.Add((row.DataBoundItem as Schedule).ID);
            }
            foreach (string item in list)
            {
                Schedule     schedule = Schedules.Where(t => t.ID == item).Single();
                DialogResult result   = PersianMessageBox.Show(this, string.Format("برنامه زمانی با نام '" + schedule.Name + "' حذف شود؟"), "تایید حذف", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.Cancel)
                {
                    break;
                }
                else if (result == DialogResult.Yes)
                {
                    try
                    {
                        scheduleBindingSource.Remove(schedule);
                        RemoveSystemSchedule(schedule);
                    }
                    catch (System.IO.IOException)
                    {
                    }
                    catch (Exception ex)
                    {
                        PersianMessageBox.Show(this, "خطا در حذف برنامه زمانی با نام '" + schedule.Name + "'" + "\n\n" + ex.Message);
                    }
                }
            }
        }
Пример #18
0
        private void LoadSubscriptions(ReportItem item)
        {
            var subscriptions = _Service.ListSubscriptions(item.Path, Username);

            foreach (var subscription in subscriptions)
            {
                ExtensionSettings extensionSettings;
                string            description;
                ActiveState       active;
                string            status;
                string            eventType;
                string            matchData;
                ParameterValue[]  values;
                var result           = _Service.GetSubscriptionProperties(subscription.SubscriptionID, out extensionSettings, out description, out active, out status, out eventType, out matchData, out values);
                var subscriptionItem = new SubscriptionItem
                {
                    ExtensionSettings = extensionSettings,
                    Description       = description,
                    ActiveState       = active,
                    Status            = status,
                    EventType         = eventType,
                    MatchData         = matchData,
                    ParameterValues   = values
                };
                item.Subscriptions.Add(subscriptionItem);

                var schedule = Schedules.Select(s => s.Value)
                               .FirstOrDefault(s => s.ScheduleID == matchData);
                if (schedule != null)
                {
                    subscriptionItem.ScheduleName = schedule.Name;
                }
            }
        }
Пример #19
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            using (var ctx = new CADContext())
            {
                Schedules schedules = ctx.Schedules.Find(id);
                schedules.ScheduleVMsList.Clear();
                schedules.Name      = Schedule.Name;
                schedules.StartTime = Schedule.StartTime;
                schedules.StopTime  = Schedule.StopTime;

                var sceduleVMs = ctx.ScheduleVM.Where(s => s.ScheduleId == Schedule.Id).ToList();
                foreach (var res in sceduleVMs)
                {
                    ctx.ScheduleVM.Remove(res);
                }

                foreach (var res in SelectedVmsId)
                {
                    var        vm         = ctx.VMs.Find(res);
                    ScheduleVM scheduleVM = new ScheduleVM();
                    scheduleVM.ScheduleId = 1;
                    scheduleVM.Schedules  = Schedule;
                    scheduleVM.VMId       = vm.Id;
                    scheduleVM.VM         = vm;
                    ctx.ScheduleVM.Add(scheduleVM);
                    Schedule.ScheduleVMsList.Add(scheduleVM);
                }

                ctx.SaveChanges();
            }

            return(RedirectToPage("./Index"));
        }
Пример #20
0
        public void OnGet()
        {
            string output    = getData("https://mobilefoodschedules.azurewebsites.net/api/SAApprovedFoodSchedules");
            var    schedules = Schedules.FromJson(output);

            ViewData["schedules"] = schedules;
        }
Пример #21
0
        /// <summary>
        /// Add new control points
        /// </summary>
        /// <param name="LabelName">Label</param>
        /// <param name="Type">Optional Type, defaults to VARS</param>
        public void Add(string LabelName, IdentifierTypes Type = IdentifierTypes.VARS)
        {
            ControlPointInfo newControlPoint = new ControlPointInfo(LabelName, Type);

            switch (Type)
            {
            case IdentifierTypes.VARS:
                Variables.Add(newControlPoint);
                break;

            case IdentifierTypes.INS:
                Inputs.Add(newControlPoint);
                break;

            case IdentifierTypes.OUTS:
                Outputs.Add(newControlPoint);
                break;

            case IdentifierTypes.PRGS:
                Programs.Add(newControlPoint);
                break;

            case IdentifierTypes.SCHS:
                Schedules.Add(newControlPoint);
                break;

            case IdentifierTypes.HOLS:
                Holidays.Add(newControlPoint);
                break;

            default:
                break;
            }
        }
Пример #22
0
        /// <summary>
        /// Constructor that takes 6 params.
        /// </summary>
        /// <param name="yourZendeskUrl">Will be formated to "https://yoursite.zendesk.com/api/v2"</param>
        /// <param name="user">Email adress of the user</param>
        /// <param name="password">LEAVE BLANK IF USING TOKEN</param>
        /// <param name="apiToken">Used if specified instead of the password</param>
        /// <param name="locale">Locale to use for Help Center requests. Defaults to "en-us" if no value is provided.</param>
        public ZendeskApi(string yourZendeskUrl,
                          string user,
                          string password,
                          string apiToken,
                          string locale,
                          string p_OAuthToken)
        {
            var formattedUrl = GetFormattedZendeskUrl(yourZendeskUrl).AbsoluteUri;

            Tickets             = new Tickets(formattedUrl, user, password, apiToken, p_OAuthToken);
            Attachments         = new Attachments(formattedUrl, user, password, apiToken, p_OAuthToken);
            Brands              = new Brands(formattedUrl, user, password, apiToken, p_OAuthToken);
            Views               = new Views(formattedUrl, user, password, apiToken, p_OAuthToken);
            Users               = new Users(formattedUrl, user, password, apiToken, p_OAuthToken);
            Requests            = new Requests.Requests(formattedUrl, user, password, apiToken, p_OAuthToken);
            Groups              = new Groups(formattedUrl, user, password, apiToken, p_OAuthToken);
            CustomAgentRoles    = new CustomAgentRoles(formattedUrl, user, password, apiToken, p_OAuthToken);
            Organizations       = new Organizations(formattedUrl, user, password, apiToken, p_OAuthToken);
            Search              = new Search(formattedUrl, user, password, apiToken, p_OAuthToken);
            Tags                = new Tags(formattedUrl, user, password, apiToken, p_OAuthToken);
            AccountsAndActivity = new AccountsAndActivity(formattedUrl, user, password, apiToken, p_OAuthToken);
            JobStatuses         = new JobStatuses(formattedUrl, user, password, apiToken, p_OAuthToken);
            Locales             = new Locales(formattedUrl, user, password, apiToken, p_OAuthToken);
            Macros              = new Macros(formattedUrl, user, password, apiToken, p_OAuthToken);
            SatisfactionRatings = new SatisfactionRatings(formattedUrl, user, password, apiToken, p_OAuthToken);
            SharingAgreements   = new SharingAgreements(formattedUrl, user, password, apiToken, p_OAuthToken);
            Triggers            = new Triggers(formattedUrl, user, password, apiToken, p_OAuthToken);
            HelpCenter          = new HelpCenterApi(formattedUrl, user, password, apiToken, locale, p_OAuthToken);
            Voice               = new Voice(formattedUrl, user, password, apiToken, p_OAuthToken);
            Schedules           = new Schedules(formattedUrl, user, password, apiToken, p_OAuthToken);
            Targets             = new Targets(formattedUrl, user, password, apiToken, p_OAuthToken);

            ZendeskUrl = formattedUrl;
        }
Пример #23
0
        public void AddScheduledTask(ScheduledTaskModel scheduledTask)
        {
            if (scheduledTask == null)
            {
                throw new ArgumentNullException("ScheduledTask cannot be null!");
            }

            if (string.IsNullOrWhiteSpace(scheduledTask.ScheduleExpression))
            {
                throw new ArgumentException("ScheduledTask has to have a schedule expression!");
            }

            if (CrontabSchedule.Parse(scheduledTask.ScheduleExpression) == null)
            {
                throw new ArgumentException("ScheduledTask has to have a legal schedule expression!");
            }

            if (scheduledTask.Task == null)
            {
                throw new ArgumentException("ScheduledTask has to have a task");
            }

            lock (lockObject)
            {
                Schedules.Add(scheduledTask);
            }
        }
        public ActionResult RemoveStatus(int?pmId, string day)
        {
            Schedules schedule = db.Schedules.SingleOrDefault(x => x.ProjectmanagerId == pmId);

            switch (day)
            {
            case "monday":
                schedule.Monday = "available";
                break;

            case "tuesday":
                schedule.Tuesday = "available";
                break;

            case "wednesday":
                schedule.Wednesday = "available";
                break;

            case "thursday":
                schedule.Thursday = "available";
                break;

            case "friday":
                schedule.Friday = "available";
                break;
            }

            db.Entry(schedule).State = EntityState.Modified;

            db.SaveChanges();

            return(PartialView(""));
        }
Пример #25
0
 private void GetSchedules()
 {
     Schedules.Clear();
     foreach (var item in _dataService.GetSchedules())
     {
         Schedules.Add(item);
     }
 }
Пример #26
0
        public void EditSchedule(Schedule schedule)
        {
            Schedule prevSchedule = Schedules.Where(s => s.Id == schedule.Id).FirstOrDefault();

            _scheduleRepository.Update(schedule);
            RemoveFromNotifyListIfNeeded(schedule);
            AddToNotifyIfNeeded(schedule);
        }
Пример #27
0
 public bool BuySeats(Schedules schedule, string MapSeats)
 {
     if (schedule == null || MapSeats == "")
     {
         return(false);
     }
     return(sche.AddMapSeats(schedule, MapSeats));
 }
Пример #28
0
        public ActionResult DeleteConfirmed(int id)
        {
            Schedules schedules = db.Schedules.Find(id);

            db.Schedules.Remove(schedules);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public void ScedulePutMaker(Schedules schedulesInDb, ViewSchedules viewSchedules)
 {
     schedulesInDb.AllWorkTime   = viewSchedules.AllWorkTime;
     schedulesInDb.EndWorkTime   = viewSchedules.EndWorkTime;
     viewSchedules.GuId          = schedulesInDb.GuId;
     schedulesInDb.IsAccessible  = viewSchedules.IsAccessible;
     schedulesInDb.StartWorkTime = viewSchedules.StartWorkTime;
 }
 private void deleteSchedule()
 {
     if (SelectedSchedule != null && ShowConfirm("确定要删除选中的计划?"))
     {
         Schedules.Remove(SelectedSchedule);
         refreshItems();
     }
 }
Пример #31
0
 public static void Register(Schedules scheduled)
 {
     Guard.ArgumentNotNull(scheduled, "scheduled is null");
     if (!dicSchedules.Contains(scheduled))
     {
         dicSchedules.Add(scheduled);
         doList = dicSchedules.ToList();
     }
 }