Esempio n. 1
0
        public ActionResult Login(LoginUser user)
        {
            if (ModelState.IsValid)
            {
                AdobeConnectXmlAPI con = new AdobeConnectXmlAPI();
                StatusInfo sInfo;
                if (con.Login(user.Username, user.Password, out sInfo))
                {
                    int id = int.Parse(con.GetUserInfo().user_id);
                    Identity Id = new Identity( id , user.Username, "T");
                    DateTime expire = DateTime.Now.AddMinutes(FormsAuthentication.Timeout.TotalMinutes);
                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(Id.ID, user.Username, DateTime.Now, expire, false, Id.GetUserData());
                    string hashTicket = FormsAuthentication.Encrypt(ticket);
                    HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hashTicket);
                    HttpContext.Response.Cookies.Add(cookie);
                    UserSession userSession = new UserSession(con.GetMyMeetings(), con.GetUserInfo());
                    using (AdobeConnectDB _db = new AdobeConnectDB()) {
                        var check = _db.AdobeUserInfo.Where(u => u.Username == user.Username).FirstOrDefault();
                        if (check == null)
                        {
                            var newlogin = new LoginUser();
                            newlogin.Username = user.Username;
                            newlogin.Password = user.Password;
                            newlogin.Id = id;
                            _db.AdobeUserInfo.Add(newlogin);
                            _db.SaveChanges();
                        }
                        else
                        {
                            check = user;
                            _db.SaveChanges();
                        }

                    }
                    Session["UserSession"] = userSession;
                }
                else {
                    return View("Login");
               }

            }

            return RedirectToAction("Index", "Dashboard");
        }
Esempio n. 2
0
        public bool checkHost(string username, string meeting)
        {
            AdobeConnectXmlAPI adobeObj = new AdobeConnectXmlAPI();
            StatusInfo sInfo;

            using (AdobeConnectDB _db = new AdobeConnectDB())
            {
                LoginUser query;
                try{
                    query = _db.AdobeUserInfo.Where(u => u.Username == username).FirstOrDefault();
                }
                catch (Exception e)
                {
                    throw e;
                }
                List<String> meetingList = new List<String>();
                if (adobeObj.Login(username, query.Password, out sInfo)){
                    var myMeeting = adobeObj.GetMyMeetings();
                    foreach(MeetingItem myMeetingItem in myMeeting){
                        meetingList.Add(myMeetingItem.meeting_name);
                    }
                    var result = meetingList.Contains(meeting);
                    return result;
                }
                return false;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="username"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public string Login(string username, string password=null)
 {
     AdobeConnectXmlAPI adobeObj = new AdobeConnectXmlAPI();
     StatusInfo sInfo;
     using (AdobeConnectDB _db = new AdobeConnectDB())
     {
         var query = _db.AdobeUserInfo.Where(u => u.Username == username).FirstOrDefault();
         if (password == null)
         {
             password = query.Password;
         }
         if (adobeObj.Login(username, password, out sInfo) == false)
         {
             if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password))
             { return ""; }
             else
            { 
                 return "";
             }
         }
         else
         {
             LoginInfo.currentUser = new LoginInfo(username, password);
             string _targetUrl = string.Format("http://turner.southern.edu/api/xml?action=login&login={0}&password={1}", username, password);                   
             return _targetUrl;                    
         }
         
     }
 }
Esempio n. 4
0
        async public Task<List<CalendarData>> GetAllAppointments(string jsDate)
        {
            DateTime Date = DateTime.Parse(jsDate);
            DateTime DateS = Date.AddHours(-2);
            DateTime DateM = Date.AddMonths(-1);
            using (AdobeConnectDB _db = new AdobeConnectDB())
            {
                AdobeConnectXmlAPI adobeObj = new AdobeConnectXmlAPI();

                List<Appointment> query = new List<Appointment>();
                //querying the data for the population of the calandar object
                try
                {
                    query = (from r in _db.Appointments where (r.end >= DateS && r.start >= DateM) select r).ToList();
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e);
                }
                
                List<CalendarData> calList = new List<CalendarData>();
                foreach(Appointment res in query)
                {
                    var obj = ConstructObject(res, HttpContext.Current.User.Identity.Name,jsDate);
                    calList.Add(obj);
                }
                 return await Task.Run(() => calList);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Function that gets and returns all rooms
 /// </summary>
 /// <returns></returns>
 public List<List<string>> GetAllRooms()
 {
     LoginInfo login = LoginInfo.currentUser;
     StatusInfo sinfo;
     AdobeConnectXmlAPI adobeObj = new AdobeConnectXmlAPI();
     List<List<string>> list = new List<List<string>> { };
     if (adobeObj.Login(login.username, login.password, out sinfo))
     {
         bool isAdmin = adobeObj.IsAdmin(adobeObj.GetUserInfo().user_id);
         if (isAdmin)
         {
             list = adobeObj.GetSharedList();
         }                
     }
     return list;
 }