Exemplo n.º 1
0
        public ActionResult iCalendar(HttpPostedFileBase file)
        {
            InfoConnServiceReference.InfoConnSoapClient client = new InfoConnServiceReference.InfoConnSoapClient();
            var connectorSource = client.GetConnectorSource(UserId, InfoConnServiceReference.ConnectorSourceType.iCalendar);

            if (connectorSource == null)
            {
                connectorSource = new InfoConnServiceReference.ConnectorSource
                {
                    UserId = UserId,
                    ConnectorSourceType = (int)ConnectorSourceType.iCalendar,
                    ExpiresDate = DateTime.Now,
                    LastModified = DateTime.Now,
                    IsUpdateRunning = false,
                    CacheLastUpdate_Short = DateTime.Now,
                    CacheLastUpdate_Longer = DateTime.Now,
                    CacheLastUpdate_Medium = DateTime.Now,
                    DoCacheUpdate_Longer = false,
                    DoCacheUpdate_Medium = false,
                    DoCacheUpdate_Short = false
                };

                client.AddConnectorSource(connectorSource);

            }

            var fileName = string.Format("ics_{0}_{1}", DateTime.Now.ToString("yyyyMMddHHmmssms"), Path.GetFileName(file.FileName));
            var path = Path.Combine(Server.MapPath("~/App_Data/Uploads"), fileName);
            file.SaveAs(path);

            List<Event> lst = new List<Event>();

            InfoConnServiceReference.SearchOption option = new InfoConnServiceReference.SearchOption();

            option.ICSFilePath = path;

            //Store event into cached database
            client.SaveEvents(UserId, option, InfoConnServiceReference.ConnectorSourceType.iCalendar);

            InfoConn.TestWebsite.InfoConnServiceReference.Event[] events = client.GetEvents(UserId, option, InfoConnServiceReference.ConnectorSourceType.iCalendar);
            if(events!=null && events.Length>0){
                return View(events);
            }else{
                return View();
            }
        }
Exemplo n.º 2
0
        public ActionResult fbCalendar()
        {
            InfoConnServiceReference.InfoConnSoapClient client = new InfoConnServiceReference.InfoConnSoapClient();
            var connectorSource = client.GetConnectorSource(UserId, InfoConnServiceReference.ConnectorSourceType.Facebook);

            if (connectorSource == null)
            {
                if (Request["code"] == null)
                {

                    return new RedirectResult(oAuthFacbook.AuthorizationLinkGet(), true);
                }
                else
                {
                    var conectorAuth = oAuthFacbook.AccessTokenGet(Request["code"]);
                    connectorSource = new InfoConnServiceReference.ConnectorSource
                    {
                        UserId = UserId,
                        AccessToken = conectorAuth.AccessToken,
                        RefressToken = conectorAuth.RefressToken,
                        ExpiresDate = conectorAuth.ExpiresDate,
                        ConnectorSourceType = (int)ConnectorSourceType.Facebook,
                        LastModified = DateTime.Now ,
                        IsUpdateRunning = false,
                        CacheLastUpdate_Short = DateTime.Now,
                        CacheLastUpdate_Longer = DateTime.Now,
                        CacheLastUpdate_Medium = DateTime.Now,
                        DoCacheUpdate_Longer = false,
                        DoCacheUpdate_Medium = false,
                        DoCacheUpdate_Short = false
                    };

                    client.AddConnectorSource(connectorSource);
                }
            }

            InfoConnServiceReference.SearchOption option = new InfoConnServiceReference.SearchOption();
            option.ConnectorSourceType = InfoConnServiceReference.ConnectorSourceType.Facebook;
            var model = client.GetEvents(UserId, option, InfoConnServiceReference.ConnectorSourceType.Facebook);

            return View(model);
        }
Exemplo n.º 3
0
        public ActionResult iCalendar()
        {
            //return View(new InfoConn.TestWebsite.InfoConnServiceReference.Event[0]);

            //InfoConn.TestWebsite.InfoConnServiceReference.Event[] lst;

            InfoConnServiceReference.InfoConnSoapClient client = new InfoConnServiceReference.InfoConnSoapClient();
            var connectorSource = client.GetConnectorSource(UserId, InfoConnServiceReference.ConnectorSourceType.iCalendar);

            if (connectorSource == null)
            {
                // return empty
                return View(new InfoConn.TestWebsite.InfoConnServiceReference.Event[0]);

            }

            InfoConnServiceReference.SearchOption option = new InfoConnServiceReference.SearchOption();
            option.StartDate = DateTime.Today.AddMonths(-2);
            option.EndDate = DateTime.Today.AddMonths(2).AddSeconds(-1);

            //option.ICalendarPath = @"C:\\Test01.ics";

            var model = client.GetEvents(UserId, option, InfoConnServiceReference.ConnectorSourceType.iCalendar);

            return View(model);
        }
Exemplo n.º 4
0
        public ActionResult ggCalendar(string eventId, string fromDate, string toDate, string name, string location, string calendarid, string ept, string refresh)
        {
            InfoConnServiceReference.InfoConnSoapClient client = new InfoConnServiceReference.InfoConnSoapClient();
            InfoConnServiceReference.SearchOption option = new InfoConnServiceReference.SearchOption();
            option.EventId = eventId;
            option.Location = location;
            option.Name = name;
            option.CalendarId = Server.UrlDecode(calendarid);
            if (!string.IsNullOrEmpty(fromDate))
            {
                option.StartDate = Convert.ToDateTime(fromDate);
            }
            if (!string.IsNullOrEmpty(toDate))
            {
                option.EndDate = Convert.ToDateTime(toDate);
            }

            ViewData["MyListItems"] = client.GetCalendars(UserId, InfoConnServiceReference.ConnectorSourceType.Google);
            ViewData["selectedcalendarid"] = option.CalendarId;
            var model = new List<InfoConn.TestWebsite.InfoConnServiceReference.Event>();
            var events = client.GetEvents(UserId, option, InfoConnServiceReference.ConnectorSourceType.Google);

            if (events != null)
            {
                foreach (var evt in events)
                {
                    model.Add(evt);
                }
            }
            if (ept == "Export")
            {
                Export(events);
            }

            if (refresh == "Refresh")
            {
                Refresh();
            }
            return View(model);
        }
Exemplo n.º 5
0
        public ActionResult ggCalendar()
        {
            //InfoConnServiceReference.InfoConnSoapClient client = new InfoConnServiceReference.InfoConnSoapClient();
            //var connectorSource = client.GetConnectorSource(UserId, InfoConnServiceReference.ConnectorSourceType.Google);

            //if (connectorSource == null)
            //{
            //    if (Request["code"] == null)
            //    {

            //        return new RedirectResult(oAuthGoogle.AuthorizationLinkGet(), true);
            //    }
            //}

            //InfoConnServiceReference.SearchOption option = new InfoConnServiceReference.SearchOption();
            //InfoConn.TestWebsite.InfoConnServiceReference.Calendar[] obj = client.GetCalendars(UserId, InfoConnServiceReference.ConnectorSourceType.Google);
            //option.CalendarId = obj[2].CalendarId;
            //var model = client.GetEvents(UserId, option, InfoConnServiceReference.ConnectorSourceType.Google);

            //ViewData["MyListItems"] = obj;

            //return View(model);
            InfoConnServiceReference.InfoConnSoapClient client = new InfoConnServiceReference.InfoConnSoapClient();
            var connectorSource = client.GetConnectorSource(UserId, InfoConnServiceReference.ConnectorSourceType.Google);

            if (connectorSource == null)
            {
                if (Request["code"] == null)
                {

                    return new RedirectResult(oAuthGoogle.AuthorizationLinkGet(), true);
                }
                else
                {
                    var conectorAuth = oAuthFacbook.AccessTokenGet(Request["code"]);
                    connectorSource = new InfoConnServiceReference.ConnectorSource
                    {
                        UserId = UserId,
                        AccessToken = conectorAuth.AccessToken,
                        RefressToken = conectorAuth.RefressToken,
                        ExpiresDate = conectorAuth.ExpiresDate,
                        ConnectorSourceType = (int)ConnectorSourceType.Facebook,
                        LastModified = DateTime.Now,
                        IsUpdateRunning = false,
                        CacheLastUpdate_Short = DateTime.Now,
                        CacheLastUpdate_Longer = DateTime.Now,
                        CacheLastUpdate_Medium = DateTime.Now,
                        DoCacheUpdate_Longer = false,
                        DoCacheUpdate_Medium = false,
                        DoCacheUpdate_Short = false
                    };

                    client.AddConnectorSource(connectorSource);
                }
            }

            InfoConnServiceReference.SearchOption option = new InfoConnServiceReference.SearchOption();
            option.ConnectorSourceType = InfoConnServiceReference.ConnectorSourceType.Google;
            var model = client.GetEvents(UserId, option, InfoConnServiceReference.ConnectorSourceType.Google);
            ViewData["MyListItems"] = client.GetCalendars(UserId, InfoConnServiceReference.ConnectorSourceType.Google);
            return View(model);
        }
Exemplo n.º 6
0
        public ActionResult GetCalendarEvents(string calendarId)
        {
            InfoConnServiceReference.InfoConnSoapClient client = new InfoConnServiceReference.InfoConnSoapClient();
            InfoConnServiceReference.SearchOption option = new InfoConnServiceReference.SearchOption();

            option.CalendarId = calendarId;
            InfoConn.TestWebsite.InfoConnServiceReference.Calendar[] obj = client.GetCalendars(UserId, InfoConnServiceReference.ConnectorSourceType.Google);
            var model = client.GetEvents(UserId, option, InfoConnServiceReference.ConnectorSourceType.Google);

            return PartialView("GetCalendarEvents", model);
        }
Exemplo n.º 7
0
        public ActionResult fbCalendar(string eventId, string fromDate, string toDate, string name, string location, string ept, string refresh)
        {
            InfoConnServiceReference.InfoConnSoapClient client = new InfoConnServiceReference.InfoConnSoapClient();
            InfoConnServiceReference.SearchOption option = new InfoConnServiceReference.SearchOption();
            option.EventId = eventId;
            option.Location = location;
            option.Name = name;
            option.ConnectorSourceType = InfoConnServiceReference.ConnectorSourceType.Facebook;
            if (!string.IsNullOrEmpty(fromDate))
                option.StartDate = Convert.ToDateTime(fromDate);
            if (!string.IsNullOrEmpty(toDate))
                option.EndDate = Convert.ToDateTime(toDate);
            List<InfoConn.TestWebsite.InfoConnServiceReference.Event> model = new List<InfoConn.TestWebsite.InfoConnServiceReference.Event>();

            var events = client.GetEvents(UserId, option, InfoConnServiceReference.ConnectorSourceType.Facebook);

            if (events != null)
            {
                foreach (var evt in events)
                {
                    model.Add(evt);
                }

            }
            if (ept == "Export")
            {
                Export(events);
            }

            if (refresh == "Refresh")
            {
                Refresh();
            }
            return View(model);
        }