예제 #1
0
        public string GetXmlDataForUpdatingMeeting(SVCMMeetingDetail detail, string operationType, HandlerSession session)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><updateConfer></updateConfer>");

            XmlNode root = xmlDoc.SelectSingleNode("updateConfer");

            this.AddChildrenNode(xmlDoc, root, "messageId", session.MessageId.ToString());
            this.AddChildrenNode(xmlDoc, root, "token", session.Token);
            this.AddChildrenNode(xmlDoc, root, "conferId", detail.Id);
            this.AddChildrenNode(xmlDoc, root, "conferName", detail.Name);
            this.AddChildrenNode(xmlDoc, root, "startTime", detail.StartTime.ToString("yyyy-MM-dd HH:mm:ss"));
            this.AddChildrenNode(xmlDoc, root, "durationHour", detail.DurantionHours.ToString());
            this.AddChildrenNode(xmlDoc, root, "durationMinute", detail.DurantionMinutes.ToString());
            this.AddChildrenNode(xmlDoc, root, "confPassword", detail.Password??string.Empty);
            this.AddChildrenNode(xmlDoc, root, "conferMemo", detail.Memo);
            this.AddChildrenNode(xmlDoc, root, "meetingRoom", detail.MainRoom == null ? string.Empty : detail.MainRoom.RoomId.Split(",".ToCharArray())[0]);
            this.AddChildrenNode(xmlDoc, root, "termIds", detail.RoomIds);
            this.AddChildrenNode(xmlDoc, root, "videoSet", ((int)detail.VideoSet).ToString());
            this.AddChildrenNode(xmlDoc, root, "participatorNumber", detail.ParticipatorNumber.ToString());
            this.AddChildrenNode(xmlDoc, root, "phone", detail.Phone);
            this.AddChildrenNode(xmlDoc, root, "ipdesc", detail.IPDesc);
            //点对点会议是否上MCU,0:不上MCU,1:上MCU,快乐平安新增字段,保留,默认填0
            this.AddChildrenNode(xmlDoc, root, "inMCU", "0");
            this.AddChildrenNode(xmlDoc, root, "leader", detail.LeaderListStr);
            this.AddChildrenNode(xmlDoc, root, "leaderRoom", detail.LeaderRoom);
            this.AddChildrenNode(xmlDoc, root, "conferType", ((int)detail.ConfType).ToString());
            this.AddChildrenNode(xmlDoc, root, "conferMideaType", ((int)detail.ConfMideaType).ToString());
            this.AddChildrenNode(xmlDoc, root, "operateType", operationType);

            //----会议操作对象,1:web端,2:outlook客户端,3:快乐平安客户端---
            this.AddChildrenNode(xmlDoc, root, "conf_operate_obj", "2");

            return xmlDoc.InnerXml;
        }
        public bool AudioControl(int meetingId, string alias, string ip, bool isMute, HandlerSession session, out string error)
        {
            error = string.Empty;
            try
            {
                session.AddMessageId();
                string xmlData = string.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?><AudioCtrl><messageId>{0}</messageId><token>{1}</token><confId>{2}</confId><alias>{3}</alias><mute>{4}</mute><ip>{5}</ip></AudioCtrl>", session.MessageId, session.Token, meetingId, alias, isMute ? 1 : 0, ip);
                var response = this._client.DoHttpWebRequest(session.BaseUrl + "AudioCtrl", xmlData);
                XmlNode root = response.SelectSingleNode("AudioCtrl");
                string status = root.SelectSingleNode("result").InnerText;

                if (status == "200")
                {
                    return true;
                }
                else
                {
                    error = response.SelectSingleNode("AudioCtrl").SelectSingleNode("result").Attributes["property"].Value;
                    this.ReLogin(session, response.SelectSingleNode("AudioCtrl").SelectSingleNode("result"));
                    return false;
                }
            }
            catch (Exception ex)
            {
                this.Login(ref session);
            }

            return false;
        }
예제 #3
0
        public string GetXmlDataFromMeetingDetail(SVCMMeetingDetail detail, HandlerSession session)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><startConfer></startConfer>");

            XmlNode root = xmlDoc.SelectSingleNode("startConfer");

            this.AddChildrenNode(xmlDoc, root, "messageId", session.MessageId.ToString());
            this.AddChildrenNode(xmlDoc, root, "token", session.Token);
            this.AddChildrenNode(xmlDoc, root, "conferName", detail.Name);
            this.AddChildrenNode(xmlDoc, root, "startTime", detail.StartTime.ToString("yyyy-MM-dd HH:mm:ss"));
            this.AddChildrenNode(xmlDoc, root, "durationHour", detail.DurantionHours.ToString());
            this.AddChildrenNode(xmlDoc, root, "durationMinute", detail.DurantionMinutes.ToString());
            this.AddChildrenNode(xmlDoc, root, "mcuTemplateId", "");
            this.AddChildrenNode(xmlDoc, root, "confPassword", detail.Password);
            this.AddChildrenNode(xmlDoc, root, "chairPassword", "");
            this.AddChildrenNode(xmlDoc, root, "caption", "");
            this.AddChildrenNode(xmlDoc, root, "conferMemo", detail.Memo);
            if(detail.MainRoom != null && detail.MainRoom.RoomId != null)
            this.AddChildrenNode(xmlDoc, root, "meetingRoom", detail.MainRoom.RoomId.Split(",".ToCharArray())[0]);
            else
                this.AddChildrenNode(xmlDoc, root, "meetingRoom", "");

            this.AddChildrenNode(xmlDoc, root, "termIds", detail.RoomIds);
            this.AddChildrenNode(xmlDoc, root, "videoSet", ((int)detail.VideoSet).ToString());
            //是否设定轮询 1 是 0 否,平安业务无此字段,保留
            this.AddChildrenNode(xmlDoc, root, "ifPolling", "1");
            //主席会场 0:表示无主席会场 ,平安业务无此字段,保留
            this.AddChildrenNode(xmlDoc, root, "chairRoom", "1");
            //与会人Ids,平安业务无此字段,保留
            this.AddChildrenNode(xmlDoc, root, "participateIds", "");
            //是否发送会议短信,平安业务无此字段,保留
            this.AddChildrenNode(xmlDoc, root, "sendmsgflag", "");
            //是否音视频分离,平安业务无此字段,保留
            this.AddChildrenNode(xmlDoc, root, "isSperate", "");
            this.AddChildrenNode(xmlDoc, root, "participatorNumber", detail.ParticipatorNumber.ToString());
            this.AddChildrenNode(xmlDoc, root, "phone", detail.Phone);
            this.AddChildrenNode(xmlDoc, root, "ipdesc", detail.IPDesc);
            //点对点会议是否上MCU,0:不上MCU,1:上MCU,快乐平安新增字段,保留,默认填0
            this.AddChildrenNode(xmlDoc, root, "inMCU", "0");
            this.AddChildrenNode(xmlDoc, root, "leader", detail.LeaderListStr);
            this.AddChildrenNode(xmlDoc, root, "leaderRoom", detail.LeaderRoom);
            this.AddChildrenNode(xmlDoc, root, "conferType", ((int)detail.ConfType).ToString());
            this.AddChildrenNode(xmlDoc, root, "conferMideaType", ((int)detail.ConfMideaType).ToString());
            this.AddChildrenNode(xmlDoc, root, "regularMeetingType", detail.RegularMeetingType.ToString());
            this.AddChildrenNode(xmlDoc, root, "regularMaxnum", detail.RegularMaxNum.ToString());
            this.AddChildrenNode(xmlDoc, root, "regularMeetingNum", detail.RegularMeetingNum.ToString());
            this.AddChildrenNode(xmlDoc, root, "multiExceptDay", detail.MultiExceptDay);
            this.AddChildrenNode(xmlDoc, root, "multiExceptWeek", detail.MultiExceptWeek);
            this.AddChildrenNode(xmlDoc, root, "everyFewMonths", ((int)detail.EveryFewMonths).ToString());
            this.AddChildrenNode(xmlDoc, root, "theFirstFew", ((int)detail.TheFirstFew).ToString());
            this.AddChildrenNode(xmlDoc, root, "week", detail.Week.ToString());

            //----会议操作对象,1:web端,2:outlook客户端,3:快乐平安客户端---
            this.AddChildrenNode(xmlDoc, root, "conf_operate_obj", "1");
            return xmlDoc.InnerXml;
        }
        public string Login(string username, string password, string IP, string Port)
        {
            hSession = new HandlerSession();
            hSession.UserName = username;
            hSession.IP = IP;
            hSession.Port = Port;

            this.session = new SessionResponse();

            if (ClientServiceFactory.Create().Login(ref hSession))
            {
                this.session.Result = true;
                this.session.UserName = username;
                this.session.Token = hSession.Token;
            }
            else
            {
                this.session.Result = false;
                this.session.UserName = username;
                this.session.Error = "登录失败";
            }

            return JsonConvert.SerializeObject(this.session);
        }
        public bool TryGetMeetingScheduler(MeetingSchedulerQuery query, HandlerSession session, out List<MeetingScheduler> schedulerList)
        {
            schedulerList = new List<MeetingScheduler>();

            try
            {
                session.AddMessageId();
                string xmlData = string.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?><termConferList><messageId>{0}</messageId><token>{1}</token><roomName>{2}</roomName><levelId>{3}</levelId><seriesId>{4}</seriesId><provinceCode>{5}</provinceCode><cityCode>{6}</cityCode><boroughCode>{7}</boroughCode><boardroomState>{8}</boardroomState><roomIfTerminal>{9}</roomIfTerminal><capacity>{10}</capacity><startTime>{11}</startTime><endTime>{12}</endTime><dataAll>{13}</dataAll></termConferList>",
                                               session.MessageId,
                                               session.Token,
                                               query.RoomName,
                                               query.LevelId,
                                               query.SeriesId,
                                               query.ProvinceCode,
                                               query.CityCode,
                                               query.BoroughCode,
                                               query.BoardRoomState,
                                               query.RoomIfTerminal,
                                               query.Capacity,
                                               query.StartTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                               query.EndTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                               query.DataAll);
                //logger.Debug(string.Format("TryGetMeetingScheduler, xmldata: {0}", xmlData));
                var response = this._client.DoHttpWebRequest(session.BaseUrl + "termConferList", xmlData);
                ////logger.Debug(string.Format("TryGetMeetingScheduler response, xmldata: {0}", response.OuterXml));
                XmlNode root = response.SelectSingleNode("termConferList");
                string status = root.SelectSingleNode("result").InnerText;

                if (status == "200")
                {
                    foreach (var item in root.SelectSingleNode("roomList").SelectNodes("roomInfo"))
                    {
                        var node = item as XmlNode;

                        string roomId = node.SelectSingleNode("roomId").InnerText;
                        string roomName = node.SelectSingleNode("roomName").InnerText;
                        string seriesName = node.SelectSingleNode("seriesName").InnerText;
                        int IfTerminal = int.Parse(node.SelectSingleNode("IfTerminal").InnerText);
                        string property = node.SelectSingleNode("property").InnerText;
                        string address = node.SelectSingleNode("seriesName").InnerText;

                        var conferIdNodes = node.SelectNodes("conferId");
                        var startTimeNodes = node.SelectNodes("startTime");
                        var endTimeNodes = node.SelectNodes("endTime");
                        var approveStatusNodes = node.SelectNodes("approveStatus");
                        var statusNodes = node.SelectNodes("status");

                        if (conferIdNodes != null && conferIdNodes.Count > 0)
                        {
                            for (int i = 0; i < conferIdNodes.Count; i++)
                            {
                                var meeting = new MeetingScheduler();
                                meeting.RoomId = roomId;
                                meeting.RoomName = roomName;
                                meeting.IfTerminal = IfTerminal;
                                meeting.Property = property;
                                meeting.Address = address;
                                meeting.SeriesName = seriesName;

                                meeting.ConferId = conferIdNodes[i].InnerText;
                                meeting.StartTime = DateTime.Parse(startTimeNodes[i].InnerText);
                                meeting.EndTime = DateTime.Parse(endTimeNodes[i].InnerText);
                                meeting.ApproveStatus = int.Parse(approveStatusNodes[i].InnerText);
                                meeting.Status = int.Parse(statusNodes[i].InnerText);

                                schedulerList.Add(meeting);
                            }
                        }
                        else
                        {
                            var meeting = new MeetingScheduler();
                            meeting.RoomId = roomId;
                            meeting.RoomName = roomName;
                            meeting.IfTerminal = IfTerminal;
                            meeting.Property = property;
                            meeting.Address = address;
                            meeting.SeriesName = seriesName;
                            meeting.StartTime = DateTime.MinValue;

                            schedulerList.Add(meeting);
                        }
                    }

                    return true;
                }
                else
                {
                    //logger.Error(string.Format("TryGetMeetingScheduler failed, status: {0}, error:{1}", status, response.InnerXml));
                    this.ReLogin(session, root.SelectSingleNode("result"));
                    return false;
                }
            }
            catch (Exception ex)
            {
                //logger.Error("TryGetMeetingScheduler failed, error:" + ex.Message + "\n" + ex.StackTrace);
                this.Login(ref session);

            }

            return false;
        }
        private void ReLogin(HandlerSession session, XmlNode resultNode)
        {
            string property = resultNode.Attributes["property"].Value;
            string status = resultNode.InnerText;

            if (property == "TOKEN不存在!" || property == "MESSAGEID有误,出现丢包现象!" || status == "404" || status == "502")
            {
                //重新登录
                this.Login(ref session);
            }
        }