Exemplo n.º 1
0
        /// <summary>
        /// This helper routine searches for the conference with specified meeting
        /// id in the running conference list as well as the scheduled conference
        /// list. If Conference is not found, it throws an ArgumentException.
        /// This fucntion do the following things
        /// 1-Take ConferenceRoom object with assign null
        /// 2-Find conference on the base of this method parameter "confId" in the Hash "RunningConferenceList.ConfList"
        /// and assign it to conf object of type ConferenceRoom.
        /// Note: we use "RunningConferenceList.ConfList" for maintaining all the conferences objects in the this class.
        /// 3-if conference not found in the RunningConferenceList.ConfList then it search from db
        /// and make new object of type ConferenceRoom and assign different setting
        /// </summary>
        /// <param name="confId"> Globally unique Id of the conference to search for </param>
        /// <returns> The Conference corresponding to the Id specified by the caller </returns>
        private ConferenceRoom SearchConference(String confId )
        {
            ConferenceRoom conf = null;
            string exceptionText = "No Conference with specified Id was found on the server";
            string conferenceName;
            DateTime d = DateTime.Now;
            //
            // Find this conference on the server
            //
            do
            {
                //
                // Verify whether a meeting with this Id already exists on the server.
                //
                conf = RunningConferenceList.FindConference(confId);

                if(conf != null)
                {
                    break;
                }
                //Search the conference

                Console.WriteLine(" Find Conference failed. Creating New Conference \n");
                try
                {
                    string sql = "select meeting_date,meeting_time,meeting_entry,meeting_title from ctool_meeting where meeting_completed = 0 and meeting_id = " + confId;
                    //MessageBox.Show(sql);
                    ArrayList Recordset = dbCon.Execute(sql);
                    Console.WriteLine(sql + "\n Execute. Recordset Count = " + Recordset.Count.ToString());
                    if(Recordset.Count < 1)
                    {
                        conf = null;
                        break;
                    }
                    //MessageBox.Show("Recordset is not null");
                    ArrayList Record = (ArrayList)Recordset[0];
                    conferenceName= Record[3].ToString();
                    string strdate = Record[0].ToString();//
                    string[] date = strdate.Split('-');
                    int Year = Convert.ToInt32(date[0].ToString());
                    int Month = Convert.ToInt32(date[1].ToString());
                    int Day = Convert.ToInt32(date[2].ToLower());

                    string strTime = Record[1].ToString();
                    string[] time = strTime.Split(':');
                    int hour = Convert.ToInt32(time[0]);
                    int min = Convert.ToInt32(time[1]);

                    d = new DateTime(Year,Month,Day,hour,min,0);

                    if(Record[2].ToString() == "1")
                    {

                        TimeSpan s = d.Subtract(DateTime.Now);

                        DateTime c = DateTime.Now;
                        string currentDateTimeString = c.Year.ToString() + "-" + c.Month.ToString() + "-" + c.Day.ToString() + " " + c.Hour + ":" + c.Minute + ":" + c.Second;

                        if(s.TotalDays >1 )
                        {
                            exceptionText= "Meeting is scheduled at " + strdate + " " +strTime + ". Current Time is " + currentDateTimeString ;

                            //MessageBox.Show("Total Days " + s.TotalDays.ToString());
                            break;
                        }
                        if(s.TotalDays< -1)
                        {
                            exceptionText= "Meeting was scheduled for  " + strdate + " " +strTime + ". Current Time is " + currentDateTimeString ;
                            //MessageBox.Show("Total Days " + s.TotalDays.ToString());
                            break;
                        }
                        if((s.TotalMinutes > 15))
                        {
                            exceptionText= "Meeting is scheduled at " + strdate + " " +strTime + ". Current Time is " + currentDateTimeString ;
                            //MessageBox.Show("Total Minutes " + s.TotalMinutes.ToString());
                            break;
                        }
                    }
                    Console.WriteLine("Returning from Search Conference");
                }
                catch(Exception ee)
                {
                    break;
                }
                conf = new ConferenceRoom(confId);
                /*
                 * conf.conferenceVoiceSessionID = getConferenceVoiceID();
                 * is commented because its not using in the code
                 */
                //conf.conferenceVoiceSessionID = getConferenceVoiceID();
                conf.conferenceStartTime = d;
                RunningConferenceList.Add(confId, conf);
                conf.conferenceName = conferenceName;
            } while(false);

            if(conf == null)
            {
                throw new ArgumentException(exceptionText, "Conference");
            }
            return conf;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Use this method to add a new conference to this ConferenceList. If
 /// a meeting with this Id already exists, ArgumentException is thrown.
 /// </summary>
 /// <param name="confId"> Id of the Conference to be added </param>
 /// <param name="conference"> Reference to Conference object associated with Id </param>
 public void Add(String confId, ConferenceRoom conference)
 {
     ConfList.Add(confId, conference);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Used to Marked a meeting closed.
        /// This method only called from the public void CloseConference(MessageObject msg)--ConferenceRoom
        /// with parameter ConferenceServer.staticServerInstance.CloseConference(this,true);
        /// so code in if(!ForceClose) never run, should be commented.
        /// This function do the following things
        /// -update ctool_meeting tables with meeting_completed = 1 
        /// -send attendeDropped message to all participant to passed conf object.
        /// -Add log that shows this conference is closed.
        /// -Remove passed conference object from the RunningConferenceList.ConfList hash table
        /// -Assign Conf set to null for garbage collector to collect.
        /// </summary>
        /// <param name="conf"></param>
        /// <param name="ForceClose"></param>
        public void CloseConference(ConferenceRoom conf,bool ForceClose)
        {
            try
            {
                string sql = "select meeting_date,meeting_time,meeting_dur from ctool_meeting where meeting_completed = 0 and meeting_id = " + conf.ConferenceId;
                if(!ForceClose)
                {
                    ArrayList Recordset = dbCon.Execute(sql);
                    if(Recordset.Count < 1)
                    {
                        return;
                    }
                    ArrayList Record = (ArrayList)Recordset[0];
                    string strdate = Record[0].ToString();//
                    string[] date = strdate.Split('-');
                    int Year = Convert.ToInt32(date[0].ToString());
                    int Month = Convert.ToInt32(date[1].ToString());
                    int Day = Convert.ToInt32(date[2].ToLower());

                    string strTime = Record[1].ToString();
                    string[] time = strTime.Split(':');
                    int hour = Convert.ToInt32(time[0]);
                    int min = Convert.ToInt32(time[1]);

                    DateTime d = new DateTime(Year,Month,Day,hour,min,0);
                    d.AddHours(Convert.ToInt32(Record[2].ToString()));
                    if(d > DateTime.Now)
                        return;
                }
                sql = "update ctool_meeting set meeting_completed = 1 WHERE meeting_id = " + conf.ConferenceId;
                dbCon.Execute(sql);
                try
                {
                    foreach(ClientProfile client in conf.ClientList)
                    {
                        conf.RemoveClientFromConference(client.clientURI,false);
                    }
                }
                catch(Exception ee)
                {
                }
                ST_flowMsg FlowMsgObj = new  ST_flowMsg ();
                FlowMsgObj.meetID = conf.ConferenceId ;
                FlowMsgObj.curDate= DateTime.Now.Year + "-" + DateTime.Now.Month +"-" + DateTime.Now.Day + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second;
                FlowMsgObj.curMsg = conf.conferenceName + " conference has closed." ;
                //flowMsgs.Add(FlowMsgObj);
                FlowMsgObj = null;
                //this.mconferenceVoices[conf.conferenceVoiceSessionID] = ConferenceVoiceEnum.Unused;
                RunningConferenceList.ConfList.Remove(conf.ConferenceId);
                conf.ShutDownConference();
                conf = null;
            }
            catch(Exception ee)
            {
                ee =ee;
            }
        }