Exemple #1
0
 public ViewObject(UserSession session, Appointment appointment)
 {
     this.Session     = session;
     this.Appointment = appointment;
 }
Exemple #2
0
 public ViewObject(UserSession session, Appointment appointment)
 {
     this.Session = session;
     this.Appointment = appointment;
 }
Exemple #3
0
        public bool AddAppointment(bool isChecked,bool isUpdate, string roomId, string userId, string name, string roomSize, string url, string path, string JsdateTime, string Jsmin, bool jsHandle)
        {
            
            DateTime date = DateTime.Parse(JsdateTime);
            int endtime = int.Parse(Jsmin);
            DateTime end = date.AddMinutes(endtime);
            if (int.Parse(roomSize) > 50)
            {
                return false;
            }
            if (!isUpdate)
            {
                using (AdobeConnectDB _db = new AdobeConnectDB())
                {
                    Appointment appointment = new Appointment();
                    CalendarData callendarData = new CalendarData();
                    appointment.userId = userId;
                    appointment.title = name;
                    appointment.roomSize = int.Parse(roomSize);
                    appointment.url = path;
                    appointment.adobeUrl = url;
                    appointment.start = date;
                    appointment.end = end;
                    if (isChecked)
                    {
                        _db.Appointments.Add(appointment);
                        _db.SaveChanges();
                        Clients.All.addEvent(appointment, isChecked,isUpdate,jsHandle);
                        return true;
                    }
                    else
                    {
                        Clients.Caller.addEvent(appointment, isChecked,isUpdate,jsHandle);
                        return false;
                    }
                }
            }
            else
            {
                int Id = int.Parse(roomId);
                using (AdobeConnectDB _db = new AdobeConnectDB())
                {
                    var query = (from appointmnet in _db.Appointments where appointmnet.id == Id select appointmnet).Single();
                    query.start = date;
                    query.roomSize = int.Parse(roomSize);
                    query.title = name;
                    query.adobeUrl = url;
                    query.url = path;
                    query.start = date;
                    query.end = end;
                    if (isChecked)
                    {
                        _db.SaveChanges();
                        Clients.All.addEvent(query, isChecked, true,jsHandle);
                        return true;
                    }
                    else
                    {
                        Clients.Caller.addEvent(query, isChecked,isUpdate,jsHandle);
                        return false;
                    }
                }
            }

        }
Exemple #4
0
        public CalendarData ConstructObject(Appointment appointment, string id, string jsDate)
        {
            Clients.Caller.date(jsDate);
            DateTime Date = DateTime.Parse(jsDate);
            CalendarData callendarData = new CalendarData();
            callendarData.id = appointment.id;
            callendarData.userId = appointment.userId;
            callendarData.title = appointment.title;
            callendarData.url = appointment.url;
            callendarData.color = "#c4afb9";
            callendarData.adobeUrl = appointment.adobeUrl;
            callendarData.roomSize = appointment.roomSize;
            callendarData.start = appointment.start;
            callendarData.end = appointment.end;
            callendarData.editable = true;
            callendarData.open = true;
            callendarData.archived = false;
            callendarData.isRep = appointment.isRep;
            callendarData.repititionId = appointment.repititionId;
            callendarData.endRepDate = appointment.endRepDate;
            callendarData.repititionType = appointment.repititionType;

            if (!checkHost(id,callendarData.title))
            {
                callendarData.color = "#d3bf96";
                callendarData.url = "";
                callendarData.editable = false;
            }

            if (checkHost(id, callendarData.title))
            {
                if (Date < callendarData.start)
                {
                    callendarData.color = "#bac7c3";
                    callendarData.open = false;
                    callendarData.url = "";
                }

            }

            if (Date > callendarData.end)
            {
                callendarData.color = "gray";
                callendarData.open = false;
                callendarData.url = "";
                callendarData.editable = false;
                callendarData.archived = true;
            }
            return callendarData;
        }
Exemple #5
0
        /// <summary>
        /// An overloaded function which returns a Tuple containing the list of rooms and the 
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        /*public Tuple<List<List<string>>, string> Login(string username, string password = null)
        {
            AdobeConnectXmlAPI adobeObj = new AdobeConnectXmlAPI();
            Tuple<List<List<string>>, string> result = new Tuple<List<List<string>>,string>(null,"");
            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 result; }
                    else
                    {
                        return result;
                    }
                }
                else
                {
                    string _targetUrl = string.Format("http://turner.southern.edu/api/xml?action=login&login={0}&password={1}", username, password);
                    List<List<string>> list = null;
                    bool isAdmin = adobeObj.IsAdmin(adobeObj.GetUserInfo().user_id);
                    if (isAdmin)
                    {
                        list = adobeObj.GetSharedList();
                    }

                    result = new Tuple<List<List<string>>, string>(list, _targetUrl);

                    return result;
                }
            }
        }*/

        public void addSelf(Appointment data, string id, bool isChecked, bool isUpdate, int max, bool jsHandle, string jsDate)
        {
            int selfTotal = 0;
            int remaining;
            using (AdobeConnectDB _db = new AdobeConnectDB())
            {
                var query = (from r in _db.Appointments
                             where ((data.start >= r.start && data.start <= r.end) || (data.end >= r.start && data.end <= r.end))
                             select r
                    );

                foreach (Appointment appoinment in query)
                {
                    if (appoinment.id != data.id) {
                        selfTotal += appoinment.roomSize;
                    }
                }

                var calendarData = ConstructObject(data, id,jsDate);
                remaining = 50 - selfTotal;
                if (isUpdate) {
                    if (isChecked)
                    {
                        Clients.Caller.updateSelf(calendarData);
                        return;
                    }
                }
                if (isChecked)
                {
                    Clients.Caller.addSelf(true, calendarData, remaining,jsHandle);
                    return;
                }
                Clients.Caller.addSelf(false, calendarData, remaining,jsHandle);
                return;
            }           
        }
Exemple #6
0
        /// <summary>
        /// Overloaded function of AddAppointment
        /// </summary>
        /// <param name="isChecked"></param>
        /// <param name="isUpdate"></param>
        /// <param name="roomId"></param>
        /// <param name="userId"></param>
        /// <param name="name"></param>
        /// <param name="roomSize"></param>
        /// <param name="url"></param>
        /// <param name="path"></param>
        /// <param name="JsdateTime"></param>
        /// <param name="Jsmin"></param>
        /// <param name="jsHandle"></param>
        /// <param name="isMultiple"></param>
        /// <param name="repId"></param>
        /// <param name="JSendRepDate"></param>
        /// <param name="repType"></param>
        /// <param name="changeAll"></param>
        /// <returns></returns>
        public bool AddAppointment(bool isChecked, bool isUpdate, string roomId, string userId, string name, string roomSize, string url, string path, string JsdateTime, string Jsmin, bool jsHandle, bool isMultiple, string repId, string JSendRepDate, string repType, bool changeAll)
        {

            DateTime date = DateTime.Parse(JsdateTime);
            int endtime = int.Parse(Jsmin);
            DateTime end = date.AddMinutes(endtime);
            DateTime endRepTime;
            //if there is no end rep time
            if (JSendRepDate == "")
            {
                endRepTime = end;
            }
            else
            {
                endRepTime = DateTime.Parse(JSendRepDate);
            }
            if (int.Parse(roomSize) > 50)
            {
                return false;
            }
            using (AdobeConnectDB _db = new AdobeConnectDB())
            {
                if (!isUpdate)
                {
                    Appointment appointment = new Appointment();
                    CalendarData callendarData = new CalendarData();
                    if (isMultiple)
                    {
                        appointment.userId = userId;
                        appointment.title = name;
                        appointment.roomSize = int.Parse(roomSize);
                        appointment.url = path;
                        appointment.adobeUrl = url;
                        appointment.start = date;
                        appointment.end = end;
                        appointment.endRepDate = endRepTime;
                        appointment.repititionId = repId;
                        appointment.isRep = isMultiple;
                        appointment.repititionType = repType;
                        
                    }
                    else
                    {
                        appointment.userId = userId;
                        appointment.title = name;
                        appointment.roomSize = int.Parse(roomSize);
                        appointment.url = path;
                        appointment.adobeUrl = url;
                        appointment.start = date;
                        appointment.end = end;
                        appointment.endRepDate = date;
                        appointment.repititionId = null;
                        appointment.isRep = isMultiple;
                        appointment.repititionType = repType;
                    }
                    if (isChecked)
                    {
                        _db.Appointments.Add(appointment);
                        _db.SaveChanges();
                        Clients.All.addEvent(appointment, isChecked, isUpdate, jsHandle);
                        return true;
                    }
                    else
                    {
                        Clients.Caller.addEvent(appointment, isChecked, isUpdate, jsHandle);
                        return false;
                    }

                }
                //if it is indeed an update
                else
                {

                    int Id = int.Parse(roomId);
                    List<Appointment> query = new List<Appointment>();

                    //if it is not an update to a series of events
                    if (!changeAll)
                    {
                        query = (from appointmnet in _db.Appointments where appointmnet.id == Id select appointmnet).ToList();
                        foreach (Appointment res in query)
                        {
                            res.start = date;
                            res.roomSize = int.Parse(roomSize);
                            res.title = name;
                            res.adobeUrl = url;
                            res.url = path;
                            res.start = date;
                            res.end = end;
                            res.endRepDate = endRepTime;
                        }
                    }
                    //if it is an update to a series of events
                    else
                    {
                        Appointment first = new Appointment();
                        first = (from appointmnet in _db.Appointments where appointmnet.id == Id select appointmnet).Single();
                        string repititionId = first.repititionId;
                        query = (from appointmnet in _db.Appointments where appointmnet.repititionType == repititionId select appointmnet).ToList();
                        foreach (Appointment res in query)
                        {
                            res.start = date;
                            res.roomSize = int.Parse(roomSize);
                            res.title = name;
                            res.adobeUrl = url;
                            res.url = path;
                            res.start = date;
                            res.end = end;
                            res.endRepDate = endRepTime;
                        }
                    }

                    if (isChecked)
                    {
                        _db.SaveChanges();
                        foreach (Appointment res in query)
                        {
                            Clients.All.addEvent(res, isChecked, true, jsHandle);
                        }

                        return true;
                    }
                    else
                    {
                        foreach (Appointment res in query)
                        {
                            Clients.Caller.addEvent(res, isChecked, isUpdate, jsHandle);
                        }
                        return false;
                    }
                }
            }

        }