Exemplo n.º 1
0
        private void UpdateAppointmentInStorage(ITypeInfo typeInfo, IEvent iEvent)
        {
            _schedulerStorage.EnableReminders = false;
            var appointment = _appointmentStorage.GetAppointmentById(iEvent.AppointmentId);

            if (appointment == null)
            {
                appointment = new Appointment(AppointmentType.Normal, iEvent.StartOn, iEvent.EndOn - iEvent.StartOn, iEvent.Subject, iEvent.AppointmentId);
                _appointmentStorage.Add(appointment);
            }
            appointment.Subject  = iEvent.Subject;
            appointment.StatusId = iEvent.Status;
            appointment.Start    = iEvent.StartOn;
            appointment.End      = iEvent.EndOn;
            var reminderInfo = iEvent.GetReminderInfoMemberValue();

            appointment.HasReminder = reminderInfo.HasReminder;
            appointment.CustomFields[BoTypeCustomField] = typeInfo.Type;

            var reminder       = appointment.CreateNewReminder();
            var reminderHelper = new ReminderXmlPersistenceHelper(reminder, DateSavingType.LocalTime);

            reminderHelper.FromXml(reminderInfo.Info);
            _schedulerStorage.EnableReminders = true;
        }
Exemplo n.º 2
0
        public Dictionary <IEvent, Appointment> CreateAppoitments(IEnumerable <IEvent> iEvents)
        {
            var appointments = new Dictionary <IEvent, Appointment>();

            SchedulerStorage.Instance.EnableReminders = false;
            foreach (var iEvent in iEvents)
            {
                var reminderInfo = iEvent.GetReminderInfoMemberValue();
                var appointment  = new AppointmentInstance()
                {
                    Start = iEvent.StartOn, End = iEvent.EndOn, Duration = iEvent.EndOn - iEvent.StartOn, Subject = iEvent.Subject
                };
                SetupAppointment(appointment, iEvent);
                var reminder = CreateReminder(iEvent, appointment);
                appointment.Reminders.RemoveAt(0);
                appointment.Reminders.Add(reminder);
                var helper = new ReminderXmlPersistenceHelper(reminder);
                reminderInfo.Info = helper.ToXml();
                appointments.Add(iEvent, appointment);
                SchedulerStorage.Instance.Appointments.Add(appointment);
            }
            SchedulerStorage.Instance.EnableReminders = true;
            SchedulerStorage.Instance.TriggerAlerts();
            return(appointments);
        }
        private void UpdateReminderInfo()
        {
            var reminderInfo = GetReminderInfo();

            if (!reminderInfo.HasReminder)
            {
                reminderInfo.Info = null;
            }
            else
            {
                var appointment = CreateAppointment();
                var reminder    = appointment.CreateNewReminder();
                var helper      = new ReminderXmlPersistenceHelper(reminder, DateSavingType.LocalTime);
                reminderInfo.Info = helper.ToXml();
            }
        }
Exemplo n.º 4
0
        /*
         * protected void ASPxDataView3_DataBound(object sender, EventArgs e)
         * {
         *      if (ASPxDataView3.Items.Count > 0)
         *      {
         *              for (int i = 0; i < ASPxDataView3.Items.Count; i++)
         *              {
         *                      ASPxLabel lbl = new ASPxLabel();
         *                      lbl = (ASPxLabel)ASPxDataView3.FindItemControl("ASPxLabel3", ASPxDataView3.Items[i]);
         *                      lbl.Text = (ASPxDataView3.Items[i].DataItem as DataRowView)["Type"].ToString() + " List";
         *
         *                      ASPxDataView dataview = new ASPxDataView();
         *                      dataview = (ASPxDataView)ASPxDataView3.FindItemControl("ASPxDataView2", ASPxDataView3.Items[i]);
         *
         *                      DataTable dt2 = VSWebBL.DashboardBL.DashboardBL.Ins.GetStatusGrid((ASPxDataView3.Items[i].DataItem as DataRowView)["Type"].ToString());
         *                      dataview.DataSource = dt2;
         *                      dataview.DataBind();
         *
         *
         *                      //if (dataview.Items.Count > 0)
         *                      //{
         *                        //  for (int j = 0; j < dataview.Items.Count; j++)
         *                              //{
         *                                //  ASPxPanel panel = new ASPxPanel();
         *                                 // panel = (ASPxPanel)dataview.FindItemControl("ASPxPanel1",dataview.Items[j]);
         *                                      //panel.BackColor = GetColor(dataview.Items[j].DataItem);
         *
         *                                      //ASPxLabel lbl = new ASPxLabel();
         *                                      //lbl = (ASPxLabel)panel.FindControl("ASPxLabel1");
         *                                      //lbl = (ASPxLabel)ASPxDataView2.FindItemControl("ASPxLabel1", ASPxDataView2.VisibleItems[i]);
         *                                      //lbl.Text = (dataview.Items[j].DataItem as DataRowView)["Name"].ToString();
         *
         *                                      //ASPxImage img = new ASPxImage();
         *                                      //img = (ASPxImage)panel.FindControl("ASPxImage1");
         *                                      //img = (ASPxImage)ASPxDataView2.FindItemControl("ASPxImage1", ASPxDataView2.Items[i]);
         *                                      //img.ImageUrl = (dataview.Items[j].DataItem as DataRowView)["imgsource"].ToString();
         *
         *                                      //ASPxLabel lbl2 = new ASPxLabel();
         *                                      //lbl2 = (ASPxLabel)panel.FindControl("ASPxLabel2");
         *                                      //lbl2.Text = (dataview.Items[j].DataItem as DataRowView)["Status"].ToString();
         *                              //}
         *                      //}
         *              }
         *      }
         * }*/



        protected void BtnApply_Click(object sender, EventArgs e)
        {
            //    Mukund 10Jun2014
            //VSPLUS-673: Executive Summary should have the same right-click menu as other screens

            try
            {
                // DataRow row = (DataRow)Session["myRow"];
                //if (row != null)
                if (hfName.Value != null)
                {
                    List <string> serverIDValues     = new List <string>();
                    List <string> servertypeIDValues = new List <string>();
                    Random        random             = new Random((int)DateTime.Now.Ticks);
                    //RandomString(5, random);
                    //string Name = row["Name"].ToString() + "-Temp-" + DateTime.Now.ToLongDateString();
                    string        Name          = hfName.Value + "-Temp-" + DateTime.Now.ToString();    //.ToLongDateString();
                    string        StartDate     = DateTime.Now.ToShortDateString();
                    string        StartTime     = DateTime.Now.ToShortTimeString();
                    DateTime      sdt           = Convert.ToDateTime(StartDate);
                    string        Duration      = TbDuration.Text;
                    string        EndDate       = DateTime.Now.ToShortDateString();
                    DateTime      edt           = Convert.ToDateTime(EndDate);
                    string        MaintType     = "1";
                    string        MaintDaysList = "";
                    string        altime        = DateTime.Now.ToShortTimeString();
                    DateTime      al            = Convert.ToDateTime(altime);
                    ASPxScheduler sh            = new ASPxScheduler();
                    Appointment   apt           = sh.Storage.CreateAppointment(AppointmentType.Pattern);
                    Reminder      r             = apt.CreateNewReminder();

                    //int min = Convert.ToInt32(MaintDurationTextBox.Text);
                    int min = Convert.ToInt32(TbDuration.Text);
                    r.AlertTime = al.AddMinutes(min);
                    //3/24/2015 NS modified for DevExpress upgrade 14.2
                    //ReminderXmlPersistenceHelper reminderHelper = new ReminderXmlPersistenceHelper(r, DateSavingType.LocalTime);
                    ReminderXmlPersistenceHelper reminderHelper = new ReminderXmlPersistenceHelper(r);
                    string rem = reminderHelper.ToXml().ToString();

                    RecurrenceInfo reci = new RecurrenceInfo();
                    reci.BeginUpdate();
                    reci.AllDay      = false;
                    reci.Periodicity = 10;
                    reci.Range       = RecurrenceRange.EndByDate;
                    reci.Start       = sdt;
                    reci.End         = edt;
                    reci.Duration    = edt - sdt;
                    reci.Type        = RecurrenceType.Yearly;


                    OccurrenceCalculator calc = OccurrenceCalculator.CreateInstance(reci);
                    TimeInterval         ttc  = new TimeInterval(reci.Start, reci.End + new TimeSpan(1, 0, 0));


                    var bcoll = calc.CalcOccurrences(ttc, apt);
                    if (bcoll.Count != 0)
                    {
                        reci.OccurrenceCount = bcoll.Count;
                    }
                    else
                    {
                        reci.OccurrenceCount = 1;
                    }
                    reci.Range = RecurrenceRange.OccurrenceCount;
                    reci.EndUpdate();
                    string s = reci.ToXml();

                    string EndDateIndicator = "";
                    //DataTable dt = VSWebBL.SecurityBL.ServersBL.Ins.GetServerDetailsByName(row["Name"].ToString());
                    DataTable dt = VSWebBL.SecurityBL.ServersBL.Ins.GetServerDetailsByName(hfName.Value);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        //VSPLUS-833:Suspend temporarily is not working correctly
                        //19Jul14, Mukund, The below two were reversely assigned so suspend wasnt working.
                        servertypeIDValues.Add(dt.Rows[0][2].ToString());
                        serverIDValues.Add(dt.Rows[0][0].ToString());
                    }
                    bool update = false;
                    if (servertypeIDValues != null && servertypeIDValues.Count > 0)
                    {
                        update = VSWebBL.ConfiguratorBL.MaintenanceBL.Ins.UpdateMaintenanceWindows(null, Name, StartDate, StartTime, Duration,
                                                                                                   EndDate, MaintType, MaintDaysList, EndDateIndicator, serverIDValues, s, rem, 1, true, servertypeIDValues, "true", "1");
                    }
                    if (update == true)
                    {
                        //SuccessMsg.InnerHtml = "Monitoring for " + row["Name"].ToString() + " has been temporarily suspended for a duration of " + TbDuration.Text + " minutes.";
                        //10/3/2014 NS modified for VSPLUS-990
                        SuccessMsg.InnerHtml = "Monitoring for " + hfName.Value + " has been temporarily suspended for a duration of " + TbDuration.Text + " minutes." +
                                               "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";

                        SuccessMsg.Style.Value = "display: block";

                        BindDataView();
                    }
                    else
                    {
                        //10/3/2014 NS modified for VSPLUS-990
                        ErrorMsg.InnerHtml = "The Settings were NOT updated." +
                                             "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span></button>";
                        ErrorMsg.Style.Value = "display: block";
                    }
                    SuspendPopupControl.ShowOnPageLoad = false;
                }
            }
            catch (Exception ex)
            {
                Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex);
                throw ex;
            }
        }
Exemplo n.º 5
0
        private void UpdateAppointmentInStorage(ITypeInfo typeInfo, IEvent iEvent) {
            _schedulerStorage.EnableReminders = false;
            var appointment = _appointmentStorage.GetAppointmentById(iEvent.AppointmentId);
            if (appointment == null) {
                appointment = new Appointment(AppointmentType.Normal, iEvent.StartOn, iEvent.EndOn - iEvent.StartOn, iEvent.Subject, iEvent.AppointmentId);
                _appointmentStorage.Add(appointment);
            }
            appointment.Subject = iEvent.Subject;
            appointment.StatusId = iEvent.Status;
            appointment.Start = iEvent.StartOn;
            appointment.End = iEvent.EndOn;
            var reminderInfo = iEvent.GetReminderInfoMemberValue();
            appointment.HasReminder = reminderInfo.HasReminder;
            appointment.CustomFields[BoTypeCustomField] = typeInfo.Type;

            var reminder = appointment.CreateNewReminder();
            var reminderHelper = new ReminderXmlPersistenceHelper(reminder, DateSavingType.LocalTime);
            reminderHelper.FromXml(reminderInfo.Info);
            _schedulerStorage.EnableReminders = true;
        }
Exemplo n.º 6
0
        private static string CreateReminderString(Appointment appointment)
        {
            ReminderXmlPersistenceHelper helper = new ReminderXmlPersistenceHelper(appointment.Reminder);

            return(helper.ToXml());
        }