Exemplo n.º 1
0
        public static async Task <List <Appointment> > GetReccurantAppointments(Appointment currentAppointment,
                                                                                string localId)
        {
            var appointmentStore =
                await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AllCalendarsReadOnly);

            var resultList = new List <Appointment>();

            if (currentAppointment.Recurrence != null)
            {
                var calendar =
                    await appointmentStore.GetAppointmentCalendarAsync(currentAppointment.CalendarId);


                var appointmentInstances = await
                                           calendar.FindAllInstancesAsync(
                    localId,
                    DateTime.Today,
                    TimeSpan.FromDays(App.ViewModel.Days.Count),
                    CalendarAPI.GetFindOptions());

                resultList.AddRange(appointmentInstances);
            }
            else
            {
                resultList.Add(currentAppointment);
            }
            return(resultList);
        }
        public async Task GetEventsAsync()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Events.Clear();
                var events = await CalendarAPI.GetEventsAsync();

                foreach (var e in events)
                {
                    Events.Add(e);
                }
            }
            catch (Exception ex)
            {
                //add pop up here for error
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemplo n.º 3
0
        public HttpResponseMessage Post(List <DateTime> dateList)
        {
            var weekdays = new CalendarAPI().PostDaysOfWeek(dateList);
            var response = Request.CreateResponse(HttpStatusCode.Created, weekdays);

            return(response);
        }
 public SelectCalendarEvent()
 {
     InitializeComponent();
     calendarAPI = new CalendarAPI("*****@*****.**", "kibitzer");
     this.calendarGetEvents_endDate.Value   = DateTime.Today;
     this.calendarGetEvents_startDate.Value = DateTime.Today.AddDays(-7);
     loadEvents(false);
 }
Exemplo n.º 5
0
        public static async Task <List <Appointment> > GetNextAppointments()
        {
            var howManyDays = 2;

            if (IsolatedStorageSettings.ApplicationSettings.Contains("TileDaysInFuture"))
            {
                howManyDays = (int)IsolatedStorageSettings.ApplicationSettings["TileDaysInFuture"];
            }

            var nextAppointments = new List <Appointment>();
            var appts            = (await CalendarAPI.GetAppointments(DateTime.Now.Date, howManyDays)).ToList <Appointment>();

            // Options: Sortiere Termine aus, die von hidden Kalender sind.
            if (IsolatedStorageSettings.ApplicationSettings.Contains("HiddenCalendars"))
            {
                var hiddenCalendars = (List <string>)IsolatedStorageSettings.ApplicationSettings["HiddenCalendars"];
                foreach (var id in hiddenCalendars)
                {
                    appts.RemoveAll(x => x.CalendarId == id);
                }
            }


            // der nächste Termin, der nicht AllDay ist:
            foreach (var appt in appts)
            {
                if (appt.AllDay)
                {
                    continue;
                }

                if (appt.StartTime >= DateTime.Now)
                {
                    nextAppointments.Add(appt);
                    break;
                }
            }


            foreach (var appt in appts)
            {
                if (nextAppointments.Count == 0 || appt != nextAppointments[0])
                {
                    if (appt.StartTime >= DateTime.Now)
                    {
                        nextAppointments.Add(appt);
                    }
                    else if (appt.AllDay)
                    {
                        nextAppointments.Add(appt);
                    }
                }
            }

            return(nextAppointments);
        }
Exemplo n.º 6
0
        // GET: api/Calendar/5
        public HttpResponseMessage Get(int noofdays = -1)
        {
            var weekdays = new CalendarAPI().DaysOfWeek(noofdays);

            if (weekdays.Count < 0)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            return(Request.CreateResponse(weekdays));
        }
Exemplo n.º 7
0
        private static async Task AddAppointment(Appointment appointment)
        {
            var newAppointment = await CalendarAPI.Add(appointment);

            if (newAppointment != null)
            {
                var newPa = await App.ViewModel.CreatePocalAppoinment(newAppointment);

                PocalAppointmentUpdater.Update(null, newPa);
            }
        }
Exemplo n.º 8
0
        private async Task convertAppointmentBuffer()
        {
            _pocalAppointmentsBuffer.Clear();
            await CalendarAPI.SetCalendars(false);

            foreach (var appt in _appoinmentBuffer)
            {
                var pocalAppt = await CreatePocalAppoinment(appt);

                _pocalAppointmentsBuffer.Add(pocalAppt);
            }
        }
Exemplo n.º 9
0
        // ******** *************************** *********//
        // ******** Edits exisiting Appointment *********//
        // ******** *************************** *********//


        public static async void EditAppointment(PocalAppointment pA)
        {
            var appt = await CalendarAPI.Edit(pA.Appt);

            PocalAppointment newPa = null;

            if (appt != null)
            {
                newPa = await App.ViewModel.CreatePocalAppoinment(appt);
            }
            PocalAppointmentUpdater.Update(pA, newPa);
        }
Exemplo n.º 10
0
 private void Page_Load(System.Object sender, System.EventArgs e)
 {
     m_refMsg = m_siteRef.EkMsgRef;
         Utilities.ValidateUserLogin();
         if (m_siteRef.RequestInformationRef.IsMembershipUser == 1 || m_siteRef.RequestInformationRef.UserId == 0)
         {
             Response.Redirect(m_siteRef.ApplicationPath + "reterror.aspx?info=" + Server.UrlEncode(m_refMsg.GetMessage("msg login cms user")), false);
             return;
         }
         JSInc.Text = "<link type=\"text/css\" href=\"" + m_siteRef.AppPath + "csslib/ektron.workarea.css\"/>";
         Collection foldCol = new Collection();
         System.Text.StringBuilder outSB = new System.Text.StringBuilder();
         CalendarAPI cAPI = new CalendarAPI(m_siteRef.RequestInformationRef);
         FolderData fDat = new FolderData();
         fDat = cAPI.GetFolderWithChildren(0);
         TestDate.Text += pShowFolders(fDat).ToString();
 }
Exemplo n.º 11
0
        public async Task <PocalAppointment> CreatePocalAppoinment(Appointment appt)
        {
            var cal = CalendarAPI.Calendars.FirstOrDefault(c => c.LocalId == appt.CalendarId);

            if (cal == null)
            {
                await CalendarAPI.SetCalendars(true);

                cal = CalendarAPI.Calendars.First(c => c.LocalId == appt.CalendarId);
            }

            var pocalAppt = new PocalAppointment {
                Appt = appt, CalColor = getAppointmentColorBrush(appt, cal)
            };

            return(pocalAppt);
        }
        private void checkCredentials_Button_Click(object sender, EventArgs e)
        {
            String username = this.userName_Textbox.Text;
            String password = this.password_Textbox.Text;
            String scope    = "http://www.google.com/calendar/feeds/[email protected]/private/full";

            this.checkCredentials_Status_Textbox.Clear();
            TextBoxTraceListener _textBoxListener = new TextBoxTraceListener(this.checkCredentials_Status_Textbox);

            Trace.Listeners.Add(_textBoxListener);
            Tuple <Boolean, Boolean> check = CalendarAPI.checkCredentials(scope: scope, username: username, password: password);
            String  message = "";
            Boolean proceed = true;

            if (!check.Item1)
            {
                message += "Invalid Username and Password!!!";
                proceed  = false;
            }
            else
            {
                if (!check.Item2)
                {
                    message += "You do not have authorization to edit Indian Bridge Calendar!!!\n";
                    proceed  = false;
                }
                String sitesUrl = "https://sites.google.com/feeds/content/site/" + this.googleSiteRoot_Textbox.Text;
                if (SitesAPI.checkCredentials(url: sitesUrl, username: username, password: password))
                {
                    message = "You are authorized to publish results!!!\nPlease Click OK to continue";
                    proceed = true;
                }
                else
                {
                    message += "You do not have authorization to edit Website!!!";
                    proceed  = false;
                }
                Trace.Listeners.Remove(_textBoxListener);
            }
            MessageBox.Show(message);
            if (proceed)
            {
                ControlTabs.SelectTab("SelectEventTab");
            }
        }
Exemplo n.º 13
0
        public async void SearchAndLoadCache()
        {
            DateTime startDate = App.ViewModel.LastCachedDate;

            ViewSwitcher.Mainpage.TheSearchControl.SearchLoadingIndicator.Text = "Loading . . .";

            App.ViewModel.CachedAppointmentsForSearch = await CalendarAPI.GetAppointments(startDate, 30);

            DoSearch();

            App.ViewModel.CachedAppointmentsForSearch = await CalendarAPI.GetAppointments(startDate, 365);

            DoSearch();


            ViewSwitcher.Mainpage.TheSearchControl.SearchLoadingIndicator.Text =
                ("Loaded: " + startDate.ToShortDateString() + " - " + startDate.AddDays(365).ToShortDateString());
        }
Exemplo n.º 14
0
        private void button1_Click(object sender, EventArgs e)
        {
            TextBoxTraceListener _textBoxListener = new TextBoxTraceListener(calendarGetEvents_Status);

            Trace.Listeners.Add(_textBoxListener);
            try
            {
                CalendarAPI cApi = new CalendarAPI("*****@*****.**", "kibitzer");
                SortableBindingList <IndianCalendarEvent> test = cApi.getEvents(calendarGetEvents_startDate.Value, calendarGetEvents_endDate.Value, calendarGetEvents_SearchTextbox.Text);
                this.dataGridView1.DataSource = test;
                SpreadSheetAPI ssa   = new SpreadSheetAPI("Pair Results City And Event Names", "*****@*****.**", "kibitzer");
                DataTable      table = ssa.getValuesFromSheet("Sheet1");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            Trace.Listeners.Remove(_textBoxListener);
        }
Exemplo n.º 15
0
        public async void LoadAppointmentLinesAsync()
        {
            var listOfAppointments =
                await CalendarAPI.GetAppointments(_gridDateTimes.FirstOrDefault(), _gridDateTimes.Count);

            foreach (var item in MonthViewGrid.Children)
            {
                var brd = item as Border;
                if (brd == null)
                {
                    continue;
                }

                var dtOfBrd = (DateTime)brd.DataContext;
                var appointmentsOfThisDay =
                    listOfAppointments.Where(x => TimeFrameChecker.IsInTimeFrameOfDay(x, dtOfBrd));
                addAppointmentLines(appointmentsOfThisDay, brd);
            }
        }
 public async Task DeleteEvent(IEvent calendarEvent)
 {
     Events.Remove(calendarEvent);
     CalendarAPI.DeleteEvent(calendarEvent);
 }
Exemplo n.º 17
0
 private async Task getPocalAppointments(int howManyDays, DateTime startDay)
 {
     _appoinmentBuffer = await CalendarAPI.GetAppointments(startDay, howManyDays);
     await convertAppointmentBuffer();
 }
Exemplo n.º 18
0
    //SelectCreateContent.aspx?FolderID=0&rmadd=false&LangType=1033&browser=0
    private void Page_Load(System.Object sender, System.EventArgs e)
    {
        m_refMsg = (new Ektron.Cms.CommonApi()).EkMsgRef;
        m_refMsg = m_refSiteApi.EkMsgRef;
        RegisterResources();
        pleaseSelectMsg = m_refMsg.GetMessage("js select content block");
        try
        {
            m_refCalendarApi = new CalendarAPI(m_refContentApi.RequestInformationRef);
            if (m_refContentApi.UserId == 0 || m_refContentApi.RequestInformationRef.IsMembershipUser == 1)
            {
                Response.Redirect("login.aspx?fromLnkPg=1", false);
                return;
            }
            blnForTasks = false;
            m_refMsg = m_refContentApi.EkMsgRef;
            //Put user code to initialize the page here
            AppPath = m_refContentApi.AppPath;
            AppName = m_refContentApi.AppName;
            CalendarIcon = "<img src=\"" + AppPath + "images/ui/icons/calendarViewDay.png\" alt=\"Calendar Event\" \">";
            ContentIcon = "<img src=\"" + AppPath + "images/ui/icons/contentHtml.png\"  alt=\"" + m_refMsg.GetMessage("generic content") + "\">";
            formsIcon = "<img src=\"" + AppPath + "images/ui/icons/contentForm.png\"  alt=\"" + m_refMsg.GetMessage("generic form") + "\">";
            if (!string.IsNullOrEmpty(Request.QueryString["FolderID"]))
            {
                FolderId = Convert.ToInt64(Request.QueryString["FolderID"].ToString());
            }
            if (!string.IsNullOrEmpty(Request.QueryString["actionName"]))
            {
                actName = Request.QueryString["actionName"];
            }
            if (actName == null)
            {
                actName = "";
            }
            NextPage.Attributes.Add("onclick", "return resetPostback()");
            lnkBtnPreviousPage.Attributes.Add("onclick", "return resetPostback()");
            FirstPage.Attributes.Add("onclick", "return resetPostback()");
            LastPage.Attributes.Add("onclick", "return resetPostback()");

            if (!(Request.QueryString["ItemID"] == null))
            {
                ItemID = Convert.ToInt64(Request.QueryString["ItemID"]);
            }

            if (!(Request.QueryString["ty"] == null))
            {
                callerPage = Request.QueryString["ty"];
            }

            if (!(Request.QueryString["overrideType"] == null))
            {
                if (Request.QueryString["overrideType"] == "content")
                {
                    overrideContentEnum = "content";
                }
                else if (Request.QueryString["overrideType"].ToLower() == "forms")
                {
                    overrideContentEnum = "forms";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select form").ToString();
                }
                else if (Request.QueryString["overrideType"].ToLower() == "blog")
                {
                    overrideContentEnum = "blog";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select blog").ToString();
                }
                else if (Request.QueryString["overrideType"].ToLower() == "forum")
                {
                    overrideContentEnum = "forum";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select forum").ToString();
                }
                else if (Request.QueryString["overrideType"].ToLower() == "calendar")
                {
                    overrideContentEnum = "calendar";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select calendar").ToString();
                }
                else if (Request.QueryString["overrideType"].ToLower() == "collection")
                {
                    overrideContentEnum = "collection";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select collection").ToString();
                }
                else if (Request.QueryString["overrideType"].ToLower() == "folder")
                {
                    overrideContentEnum = "folder";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select folder").ToString();
                }
                else if (Request.QueryString["overrideType"].ToLower() == "calfolder")
                {
                    overrideContentEnum = "calfolder";
                    pleaseSelectMsg = m_refMsg.GetMessage("js select folder").ToString();
                }
            }

            if (!(Request.QueryString["StartingFolderID"] == null))
            {
                StartingFolderId = Convert.ToInt64(Request.QueryString["StartingFolderID"]);
            }

            if (IsBrowserIE())
            {
                notSupportIFrame = "0";
            }
            else
            {
                notSupportIFrame = "1";
            }

            StyleSheetJS.Text = m_refStyle.GetClientScript();
            if (Request.QueryString["rmadd"] == "true")
            {
                bRemoveAddContentBtn = true;
            }
            if (!(Request.QueryString["for_tasks"] == null))
            {
                blnForTasks = System.Convert.ToBoolean("1" == Strings.Trim(Request.QueryString["for_tasks"]));
            }
            else if (!(Request.QueryString["for_wiki"] == null))
            {
                blnForWiki = System.Convert.ToBoolean("1" == Strings.Trim(Request.QueryString["for_wiki"]));
                overrideContentEnum = "folder";
                pleaseSelectMsg = m_refMsg.GetMessage("js select folder").ToString();
            }

            if (overrideContentEnum.Length == 0 || overrideContentEnum == "content")
            {
                Page.Title = AppName + " Select Content";
            }
            else if (overrideContentEnum == "forms")
            {
                Page.Title = AppName + " Select Form";
            }
            else if (overrideContentEnum == "blog")
            {
                Page.Title = AppName + " Select Blog";
            }
            else if (overrideContentEnum == "forum")
            {
                Page.Title = AppName + " Select Forum";
            }
            else if (overrideContentEnum == "calendar")
            {
                Page.Title = AppName + " Select Calendar";
            }
            else if (overrideContentEnum == "collection")
            {
                Page.Title = AppName + " Select Collection";
            }
            else if (overrideContentEnum == "folder")
            {
                Page.Title = AppName + " Select Folder";
            }
            else if (overrideContentEnum == "calfolder")
            {
                Page.Title = AppName + " Select Folder";
            }

            if (!(Request.QueryString["LangType"] == null))
            {
                if (!string.IsNullOrEmpty(Request.QueryString["LangType"]))
                {
                    ContentLanguage = Convert.ToInt32(Request.QueryString["LangType"]);
                    m_refContentApi.SetCookieValue("LastValidLanguageID", ContentLanguage.ToString());
                }
                else
                {
                    if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
                    {
                        ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID"));
                    }
                }
            }
            else
            {
                if (m_refContentApi.GetCookieValue("LastValidLanguageID") != "")
                {
                    ContentLanguage = Convert.ToInt32(m_refContentApi.GetCookieValue("LastValidLanguageID"));
                }
            }
            if (ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
            {
                m_refContentApi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
            }
            else
            {
                m_refContentApi.ContentLanguage = ContentLanguage;
            }

            m_refContent = m_refContentApi.EkContentRef;
            gtNavs = m_refContent.GetFolderInfoWithPath(FolderId);
            FolderName = gtNavs["FolderName"];
            folderType = (EkEnumeration.FolderType)Enum.Parse(typeof(EkEnumeration.FolderType), gtNavs["FolderType"].ToString());
            ltr_folderType.Text = (string)(folderType.ToString());
            ParentFolderId = gtNavs["ParentID"];
            fPath = gtNavs["Path"];

            cTmp = new Collection();
            cTmp.Add("name", "OrderBy", null, null);
            cTmp.Add(FolderId, "FolderID", null, null);
            cTmp.Add(FolderId, "ParentID", null, null);
            cFolders = m_refContent.GetAllViewableChildFoldersv2_0(cTmp);
            if (blnForTasks == true)
            {
                cTmp.Add(true, "FilterContentAssetType", null, null);
            }

            if (!(Request.QueryString["action"] == null))
            {
                strPageAction = Request.QueryString["action"];
            }
            // RedirectFromPage: To display only child folders & NOT content.
            if (!(Request.QueryString["from_page"] == null))
            {
                RedirectFromPage = Request.QueryString["from_page"];
            }
            if (RedirectFromPage != "report" && (IsPostBack == false || isPostData.Value != ""))
            {
                FillContentInfo();
            }
            else if (isPostData.Value != "")
            {
                DrawData();
            }
            isPostData.Value = "true";
            if (!(Request.QueryString["report_type"] == null))
            {
                ReportType = Request.QueryString["report_type"];
            }

            SetJsServerVariables();

        }
        catch (Exception ex)
        {
            Utilities.ShowError(ex.Message);
        }
    }
 public async Task AddEvent()
 {
     await CalendarAPI.AddEvent(Date, new[] { Email }, new[] { FirstName + " " + LastName }, DurationMinutes);
 }
Exemplo n.º 20
0
        public async Task AddEvent(string[] email, string[] name)
        {
            await CalendarAPI.AddEvent(DateTime.Now.AddDays(1), email, name);

            //add message here
        }