Inheritance: ConferenceInfo
        public TPOASDKResponse<RecurrenceConfInfo> editRecurrenceConference(RecurrenceConfInfo scheduleConf, System.Nullable<System.DateTime> beginTime)
        {
            TPOASDKResponse<RecurrenceConfInfo> resp = new TPOASDKResponse<RecurrenceConfInfo>();
            TPProfessionalConfMgrService confMgr = new TPProfessionalConfMgrService(appSetting);
            //UtilsSettings appSetting = new UtilsSettings();
            confMgr.Header = appSetting.Header;
            try
            {
                //rsa = new RSA2048(platformKeyURL);
                if (null != scheduleConf.auxVideoFormat)
                {
                    scheduleConf.auxVideoFormatSpecified = true;
                }
                if (null != scheduleConf.auxVideoProtocol)
                {
                    scheduleConf.auxVideoProtocolSpecified = true;
                }
                if (null != scheduleConf.isRecording)
                {
                    scheduleConf.isRecordingSpecified = true;
                }
                if (null != scheduleConf.isLiveBroadcast)
                {
                    scheduleConf.isLiveBroadcastSpecified = true;
                }

                if (null != scheduleConf.status)
                {
                    scheduleConf.statusSpecified = true;
                }

                for (int i = 0; i < scheduleConf.sites.Length; i++)
                {
                    if (scheduleConf.sites[i].videoFormat != null)
                    {
                        scheduleConf.sites[i].videoFormatSpecified = true;
                    }
                    if (scheduleConf.sites[i].videoProtocol != null)
                    {
                        scheduleConf.sites[i].videoProtocolSpecified = true;
                    }
                    if (scheduleConf.sites[i].status != null)
                    {
                        scheduleConf.sites[i].statusSpecified = true;
                    }
                }

                if (null != scheduleConf.frequency)
                {
                    scheduleConf.frequencySpecified = true;
                }

                if (null != scheduleConf.interval)
                {
                    scheduleConf.intervalSpecified = true;
                }

                if (scheduleConf.endDate != null)
                {
                    scheduleConf.endDateSpecified = true;
                }
                //if (scheduleConf.password != null && scheduleConf.password != "")
                //{
                //    scheduleConf.password = rsa.RSAEncrypt(scheduleConf.password);
                //}
                //if (scheduleConf.chairmanPassword != null && scheduleConf.chairmanPassword != "")
                //{
                //    scheduleConf.chairmanPassword = rsa.RSAEncrypt(scheduleConf.chairmanPassword);
                //}
                int resultCode;
                RecurrenceConfInfo conferenceInfoEx;
                bool beginTimeSpecified = false;
                if (null != beginTime)
                {
                    beginTimeSpecified = true;
                }
                resultCode = confMgr.editRecurrenceConference(scheduleConf, beginTime, beginTimeSpecified, out conferenceInfoEx);

                resp.resultCode = resultCode;
                resp.result = 0 == resultCode ? conferenceInfoEx : null;

                return resp;
            }
            catch (SoapHeaderException e)
            {
                int errorCode = ExceptionUtils.processSoapException(e);
                resp.resultCode = errorCode;
                return resp;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取周期性会议信息
        /// </summary>
        /// <param name="ConfInfo">周期性会议信息</param>
        private void setRecurrenceConferenceInfo(ref RecurrenceConfInfo recurrenceConfInfo, AppointmentItem ai, bool bSingle)
        {
            //获取智真会议参数
            recurrenceConfInfo.name = ai.Subject;
            recurrenceConfInfo.beginTime = ai.Start.ToUniversalTime();

            TimeSpan span = ai.End - ai.Start;
            string duration = String.Format("P0Y0M{0}DT{1}H{2}M{3}S", span.Days, span.Hours, span.Minutes, span.Seconds);
            recurrenceConfInfo.duration = duration;
            recurrenceConfInfo.mediaEncryptType = ThisAddIn.g_SystemSettings.nMediaEncryptType;
            recurrenceConfInfo.rate = ThisAddIn.g_SystemSettings.strSiteRate;

            recurrenceConfInfo.isLiveBroadcast = ThisAddIn.g_SystemSettings.nLiving;
            recurrenceConfInfo.isRecording = ThisAddIn.g_SystemSettings.nRecording;

            recurrenceConfInfo.timeZone = transSysTimezone2SMC(ai.StartTimeZone);

            recurrenceConfInfo.billCode = ThisAddIn.g_SystemSettings.strBillCode;
            recurrenceConfInfo.password = ThisAddIn.g_SystemSettings.strConfPWD;
            recurrenceConfInfo.chairmanPassword = ThisAddIn.g_SystemSettings.strConfPWD;
            recurrenceConfInfo.cpResouce = ThisAddIn.g_SystemSettings.nCPResource;

            #region
            UserProperty up = ai.UserProperties.Find(PROPERTY_NAME_CONF_INFO, Type.Missing);
            if (up != null)
            {
                recurrenceConfInfo.confId = up.Value;
            }
            else
            {
                UserProperty upConfoID = ai.UserProperties.Add(ThisAddIn.PROPERTY_NAME_CONF_INFO, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
            }

            up = ai.UserProperties.Find(PROPERTY_CONFERENCE_PASSWORD, Type.Missing);
            if (up != null)
            {
                recurrenceConfInfo.password = up.Value;
                recurrenceConfInfo.chairmanPassword = up.Value;
            }
            else
            {
                UserProperty upConfoPassword = ai.UserProperties.Add(ThisAddIn.PROPERTY_CONFERENCE_PASSWORD, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upConfoPassword.Value = ThisAddIn.g_SystemSettings.strConfPWD;
            }

            up = ai.UserProperties.Find(PROPERTY_IS_RECORDING, Type.Missing);
            if (up != null)
            {
                recurrenceConfInfo.isRecording = Convert.ToInt32(up.Value);
            }
            else
            {
                UserProperty upRecording = ai.UserProperties.Add(ThisAddIn.PROPERTY_IS_RECORDING, Outlook.OlUserPropertyType.olYesNo, Type.Missing, Type.Missing);
                upRecording.Value = Convert.ToBoolean(ThisAddIn.g_SystemSettings.nRecording);
            }

            up = ai.UserProperties.Find(PROPERTY_IS_LIVING, Type.Missing);
            if (up != null)
            {
                recurrenceConfInfo.isLiveBroadcast = Convert.ToInt32(up.Value);
            }
            else
            {
                UserProperty upLiving = ai.UserProperties.Add(ThisAddIn.PROPERTY_IS_LIVING, Outlook.OlUserPropertyType.olYesNo, Type.Missing, Type.Missing);
                upLiving.Value = Convert.ToBoolean(ThisAddIn.g_SystemSettings.nLiving);
            }

            up = ai.UserProperties.Find(PROPERTY_SITE_RATE, Type.Missing);
            if (up != null)
            {
                recurrenceConfInfo.rate = up.Value;
            }
            else
            {
                UserProperty upSiteRate = ai.UserProperties.Add(ThisAddIn.PROPERTY_SITE_RATE, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upSiteRate.Value = ThisAddIn.g_SystemSettings.strSiteRate;
            }

            up = ai.UserProperties.Find(PROPERTY_SECURITY_LEVEL, Type.Missing);
            if (up != null)
            {
                recurrenceConfInfo.mediaEncryptType = up.Value;
            }
            else
            {
                UserProperty upSecurityLevel = ai.UserProperties.Add(ThisAddIn.PROPERTY_SECURITY_LEVEL, Outlook.OlUserPropertyType.olInteger, Type.Missing, Type.Missing);
                upSecurityLevel.Value = ThisAddIn.g_SystemSettings.nMediaEncryptType;
            }

            up = ai.UserProperties.Find(PROPERTY_BILL_CODE, Type.Missing);
            if (up != null)
            {
                recurrenceConfInfo.billCode = up.Value;
            }
            else
            {
                UserProperty upBillCode = ai.UserProperties.Add(ThisAddIn.PROPERTY_BILL_CODE, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upBillCode.Value = ThisAddIn.g_SystemSettings.strBillCode;
            }

            up = ai.UserProperties.Find(PROPERTY_CPRESOURCE, Type.Missing);
            if (up != null)
            {
                if (false == ThisAddIn.g_SystemSettings.bShowCPResource)
                {
                    recurrenceConfInfo.cpResouce = 0;
                }
                else
                {
                    recurrenceConfInfo.cpResouce = up.Value;
                }
            }
            else//非智真会场入口
            {
                UserProperty upCPResource = ai.UserProperties.Add(ThisAddIn.PROPERTY_CPRESOURCE, Outlook.OlUserPropertyType.olInteger, Type.Missing, Type.Missing);

                if (false == ThisAddIn.g_SystemSettings.bShowCPResource)
                {
                    upCPResource.Value = 0;
                    recurrenceConfInfo.cpResouce = 0;
                }
                else
                {
                    upCPResource.Value = ThisAddIn.g_SystemSettings.nCPResource;
                }
            }

            #endregion
            ThisAddIn.g_log.Info(string.Format("recurrence conf id is: {0}", recurrenceConfInfo.confId));
            ThisAddIn.g_log.Info(string.Format("recurrence conf name is: {0}", recurrenceConfInfo.name));
            ThisAddIn.g_log.Info(string.Format("recurrence conf begin at utc: {0}", recurrenceConfInfo.beginTime.ToString()));
            ThisAddIn.g_log.Info(string.Format("appointment item begin at local: {0}", ai.Start.ToString()));

            ThisAddIn.g_log.Info(string.Format("recurrence conf duration: {0}", recurrenceConfInfo.duration));
            ThisAddIn.g_log.Info(string.Format("recurrence conf rate is: {0}", recurrenceConfInfo.rate));
            ThisAddIn.g_log.Info(string.Format("recurrence conf media encrypt type is: {0}", recurrenceConfInfo.mediaEncryptType));
            ThisAddIn.g_log.Info(string.Format("recurrence conf recording is: {0}", recurrenceConfInfo.isRecording));

            ThisAddIn.g_log.Info(string.Format("recurrence conf living is: {0}", recurrenceConfInfo.isLiveBroadcast));
            ThisAddIn.g_log.Info(string.Format("recurrence conf bill code is: {0}", recurrenceConfInfo.billCode));
            ThisAddIn.g_log.Info(string.Format("recurrence conf password is: ******"));
            ThisAddIn.g_log.Info(string.Format("recurrence conf chairman password is: ******"));
            ThisAddIn.g_log.Info(string.Format("recurrence conf CPResource is: {0}", recurrenceConfInfo.cpResouce));
            ThisAddIn.g_log.Info(string.Format("recurrence conf timezone is: {0}", recurrenceConfInfo.timeZone));

            //视频会场
            ArrayList list = new ArrayList();
            SiteInfo tempSite = null;
            int nVideoCount = 0;

            up = ai.UserProperties.Find(PROPERTY_VIDEO_SITES_COUNT, Type.Missing);
            if (up != null)
            {
                nVideoCount = up.Value;
            }
            else
            {
                UserProperty upVideoSiteCounts = ai.UserProperties.Add(ThisAddIn.PROPERTY_VIDEO_SITES_COUNT, Outlook.OlUserPropertyType.olInteger, Type.Missing, Type.Missing);
                upVideoSiteCounts.Value = ThisAddIn.g_SystemSettings.nVideoSitesCount;
                nVideoCount = ThisAddIn.g_SystemSettings.nVideoSitesCount;
            }

            if (nVideoCount > 0)
            {
                for (int i = 0; i < nVideoCount; i++)
                {
                    tempSite = new SiteInfo();
                    tempSite.type = 4;
                    list.Add(tempSite);
                }
            }

            //语音会场
            int nVoiceCount = 0;
            up = ai.UserProperties.Find(PROPERTY_VOICE_SITES_COUNT, Type.Missing);
            if (up != null)
            {
                nVoiceCount = up.Value;
            }
            else
            {
                UserProperty upVoiceSiteCounts = ai.UserProperties.Add(ThisAddIn.PROPERTY_VOICE_SITES_COUNT, Outlook.OlUserPropertyType.olInteger, Type.Missing, Type.Missing);
                upVoiceSiteCounts.Value = ThisAddIn.g_SystemSettings.nVoiceSitesCount;
                nVoiceCount = ThisAddIn.g_SystemSettings.nVoiceSitesCount;
            }

            if (nVoiceCount > 0)
            {
                for (int i = 0; i < nVoiceCount; i++)
                {
                    tempSite = new SiteInfo();
                    tempSite.type = 9;
                    list.Add(tempSite);
                }
            }

            //2015-7-8 w00322557 临时会场
            up = ai.UserProperties.Find(PROPERTY_TEMP_SITES, Type.Missing);
            if (up != null)
            {
                List<SiteInfo> listTempSites = XmlHelper.Desrialize<List<SiteInfo>>(up.Value);
                foreach (SiteInfo site in listTempSites)
                {
                    list.Add(site);
                    ThisAddIn.g_log.Info(string.Format("Temp site name: {0}", site.name));
                    ThisAddIn.g_log.Info(string.Format("Temp site uri: {0}", site.uri));
                    ThisAddIn.g_log.Info(string.Format("Temp site type: {0}", site.type));
                }
            }
            else
            {
                ThisAddIn.g_log.Debug("Temp site is null or empty!");
            }

            //从地址栏获取智真会场
            List<string> listSites = GetTPSitesFromLocation(ai);

            if (listSites != null)
            {
                SiteInfo[] sites = new SiteInfo[listSites.Count];
                for (int i = 0; i < listSites.Count; i++)
                {
                    sites[i] = new SiteInfo();
                    sites[i].uri = listSites[i];
                    sites[i].type = -1;//2015-7-13 w00322557 smc会场类型修改为-1
                    list.Add(sites[i]);

                    ThisAddIn.g_log.Info(string.Format("TP site uri is: {0}", sites[i].uri));
                }
            }

            if (list.Count > 0)
            {
                recurrenceConfInfo.sites = (SiteInfo[])list.ToArray(typeof(SiteInfo));
                ThisAddIn.g_log.Info(string.Format("RecurrenceConfInfo sites length is: {0}", recurrenceConfInfo.sites.Length));
                ThisAddIn.g_log.Info(string.Format("Total TP sites count is: {0}", list.Count));
            }
            else
            {
                ThisAddIn.g_log.Error(string.Format("There is no TP sites!"));
            }

            if (bSingle == false)
            {
                ThisAddIn.g_log.Info("setRecurrenceConferenceInfo recurrence");

                //周期信息
                RecurrencePattern recurrencePattern = ai.GetRecurrencePattern();
                OlDaysOfWeek daysOfWeek = recurrencePattern.DayOfWeekMask;//一周中的天数
                //recurrenceConfInfo.count = recurrencePattern.Occurrences;//周期性会议重复次数
                //recurrencePattern.GetOccurrence()//根据指定日期,返回AppointmentItem

                if (recurrencePattern.NoEndDate == true)
                {
                    recurrencePattern.NoEndDate = false;
                }

                //周期类型(天=0、周=1、月=2)
                if (recurrencePattern.RecurrenceType == OlRecurrenceType.olRecursDaily)//天
                {
                    recurrenceConfInfo.frequency = 0;
                    recurrenceConfInfo.interval = recurrencePattern.Interval;//周期间隔

                    if (true == recurrenceConfInfo.endDateSpecified)
                    {
                        recurrenceConfInfo.endDate = Convert.ToDateTime(recurrencePattern.PatternEndDate.ToShortDateString());//周期性会议结束日期
                    }
                    else
                    {
                        recurrenceConfInfo.count = recurrencePattern.Occurrences;//周期性会议重复次数
                    }
                }
                else if (recurrencePattern.RecurrenceType == OlRecurrenceType.olRecursWeekly)//周
                {
                    recurrenceConfInfo.frequency = 1;
                    //
                    Int32[] weekDays = this.getWeekDays(daysOfWeek);
                    if (weekDays != null)
                    {
                        recurrenceConfInfo.weekDays = weekDays;
                    }

                    if (0 == recurrencePattern.Interval)
                    {
                        recurrenceConfInfo.interval = 1;//周期间隔
                    }
                    else
                    {
                        recurrenceConfInfo.interval = recurrencePattern.Interval;
                    }

                    if (true == recurrenceConfInfo.endDateSpecified)
                    {
                        recurrenceConfInfo.endDate = Convert.ToDateTime(recurrencePattern.PatternEndDate.ToShortDateString());//周期性会议结束日期
                    }
                    else
                    {
                        recurrenceConfInfo.count = recurrencePattern.Occurrences;//周期性会议重复次数
                    }
                }
                else if (recurrencePattern.RecurrenceType == OlRecurrenceType.olRecursMonthly)//月
                {
                    recurrenceConfInfo.frequency = 2;
                    int nDay = recurrencePattern.PatternStartDate.Day;
                    recurrenceConfInfo.monthDay = nDay;

                    recurrenceConfInfo.interval = recurrencePattern.Interval;//周期间隔

                    if (true == recurrenceConfInfo.endDateSpecified)
                    {
                        recurrenceConfInfo.endDate = Convert.ToDateTime(recurrencePattern.PatternEndDate.ToShortDateString());//周期性会议结束日期
                    }
                    else
                    {
                        recurrenceConfInfo.count = recurrencePattern.Occurrences;//周期性会议重复次数
                    }
                }
                else if (recurrencePattern.RecurrenceType == OlRecurrenceType.olRecursMonthNth)
                {
                    recurrenceConfInfo.frequency = 2;
                    recurrenceConfInfo.weekDay = recurrencePattern.Instance;
                    recurrenceConfInfo.weekDays = this.getWeekDays(daysOfWeek);
                    recurrenceConfInfo.interval = recurrencePattern.Interval;//周期间隔

                    if (true == recurrenceConfInfo.endDateSpecified)
                    {
                        recurrenceConfInfo.endDate = Convert.ToDateTime(recurrencePattern.PatternEndDate.ToShortDateString());//周期性会议结束日期
                    }
                    else
                    {
                        recurrenceConfInfo.count = recurrencePattern.Occurrences;//周期性会议重复次数
                    }
                }
                else
                {
                    ThisAddIn.g_log.Error("RecurrenceType is year!");
                }
            }
            else
            {
                //recurrenceConfInfo.timeZone = null;
                recurrenceConfInfo.frequency = null;
                recurrenceConfInfo.interval = null;
                ThisAddIn.g_log.Info("setRecurrenceConferenceInfo single");
            }

            ThisAddIn.g_log.Info("setRecurrenceConferenceInfo success");
        }
Ejemplo n.º 3
0
        public static void SaveRecurrenceReturnUserProperties(RecurrenceConfInfo confInfo, AppointmentItem ai, List<RecurrenceAppoint> rAppoints)
        {
            ThisAddIn.g_log.Info(string.Format("SaveRecurrenceReturnUserProperties begin"));
            try
            {
                ThisAddIn.g_log.Info(string.Format("Recurrence return conf name is: {0}", confInfo.name));
                ThisAddIn.g_log.Info(string.Format("Recurrence return conf beginTime is: {0}", confInfo.beginTime.ToLocalTime()));

                if (confInfo.isLiveBroadcastSpecified)
                {
                    ThisAddIn.g_log.Info(string.Format("Recurrence return conf isLiveBroadcast is: {0}", confInfo.isLiveBroadcast));
                }

                if (confInfo.isRecordingSpecified)
                {
                    ThisAddIn.g_log.Info(string.Format("Recurrence return conf isRecording is: {0}", confInfo.isRecording));
                }

                if (confInfo.endDateSpecified)
                {
                    ThisAddIn.g_log.Info(string.Format("Recurrence return conf endDate is: {0}", confInfo.endDate.ToShortDateString()));
                }

                if (confInfo.frequencySpecified)
                {
                    if (confInfo.frequency != null)
                    {
                        ThisAddIn.g_log.Info(string.Format("Recurrence return conf frequency is: {0}", confInfo.frequency));
                    }
                }

                if (confInfo.intervalSpecified)
                {
                    if (confInfo.interval != null)
                    {
                        ThisAddIn.g_log.Info(string.Format("Recurrence return conf interval is: {0}", confInfo.interval));
                    }
                }

                ThisAddIn.g_log.Info(string.Format("Recurrence return conf monthDay is: {0}", confInfo.monthDay));
                ThisAddIn.g_log.Info(string.Format("Recurrence return conf weekDay is: {0}", confInfo.weekDay));
                if (confInfo.weekDays != null)
                {
                    ThisAddIn.g_log.Info(string.Format("Recurrence return conf weekDays is: {0}", confInfo.weekDays));
                }

                foreach (SiteAccessInfo site in confInfo.siteAccessInfos)
                {
                    ThisAddIn.g_log.Info(string.Format("Recurrence return conf site mcuUri is: {0}", site.mcuUri));
                    ThisAddIn.g_log.Info(string.Format("Recurrence return conf site uri is: {0}", site.uri));
                    ThisAddIn.g_log.Info(string.Format("Recurrence return conf site beginTime is: {0}", site.beginTime.ToLocalTime().ToLongTimeString()));
                    ThisAddIn.g_log.Info(string.Format("Recurrence return conf site confAccessCode is: {0}", site.confAccessCode));
                }

                //confId
                UserProperty upConfoID = ai.UserProperties.Add(PROPERTY_NAME_CONF_INFO, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upConfoID.Value = confInfo.confId;
                ThisAddIn.g_log.Info(string.Format("return recurrence conf id is: {0}", confInfo.confId));

                //access code
                UserProperty upAccessCode = ai.UserProperties.Add(PROPERTY_ACCESS_CODE, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upAccessCode.Value = confInfo.accessCode;
                ThisAddIn.g_log.Info(string.Format("return recurrence conf access code is: {0}", confInfo.siteAccessInfos[0].confAccessCode));

                //recording address
                UserProperty upRecordingAddress = ai.UserProperties.Add(PROPERTY_RECORDING_ADDRESS, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upRecordingAddress.Value = confInfo.recorderAddr;
                ThisAddIn.g_log.Info(string.Format("return recurrence conf recorder url is: {0}", confInfo.recorderAddr));

                //
                UserProperty upRightBeginTime = ai.UserProperties.Add(PROPERTY_RIGHT_BEGIN_TIME, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upRightBeginTime.Value = XmlHelper.Serialize(rAppoints);
                ThisAddIn.g_log.Info(string.Format("return recurrence conf begin time is: {0}", XmlHelper.Serialize(rAppoints)));
            }
            catch (System.Exception ex)
            {
                ThisAddIn.g_log.Error(string.Format("SaveRecurrenceReturnUserProperties exception,{0}", ex.Message));
                MessageBox.Show(ex.Message);
            }
            ThisAddIn.g_log.Info(string.Format("SaveRecurrenceReturnUserProperties end"));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 预约周期性智真会议
        /// </summary>
        /// <returns>native接口返回值</returns>
        private int scheduleRecurrenceTPConf(ref AppointmentItem ai)
        {
            ThisAddIn.g_log.Info("scheduleRecurrenceTPConf enter");
            Inspector ins = ai.GetInspector;

            RecurrenceConfInfo ConfInfo = new RecurrenceConfInfo();
            setRecurrenceConferenceInfo(ref ConfInfo, ai, false);

            //2015-5-25 w00322557 账号传入“eSDK账号,Outlook邮箱账号”
            //string strAccountName = ThisAddIn.g_AccountInfo.strUserName;
            Outlook.ExchangeUser mainUser = Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry.GetExchangeUser();
            string strOutlookAccount = string.Empty;
            if (mainUser != null)
            {
                strOutlookAccount = mainUser.PrimarySmtpAddress;
            }

            string strAccountName = string.Format("{0},{1}", ThisAddIn.g_AccountInfo.strUserName, strOutlookAccount);
            string strAccountPWD = ThisAddIn.g_AccountInfo.strPWD;
            string strServerAddress = ThisAddIn.g_AccountInfo.strServer;

            ThisAddIn.g_log.Debug(string.Format("Account is: {0}", strAccountName));
            ThisAddIn.g_log.Debug("PWD is: ******");
            ThisAddIn.g_log.Debug(string.Format("Server is: {0}", strServerAddress));

            TPOASDKResponse<RecurrenceConfInfo> responseRecurrence = null;
            try
            {
                //密码不存在,返回
                if (string.IsNullOrEmpty(ThisAddIn.g_AccountInfo.strPWD))
                {
                    ThisAddIn.g_log.Info("pwd is null");
                    MessageBox.Show(GlobalResourceClass.getMsg("INPUT_OUTLOOK_PASSWORD"));
                }

                ConferenceMgrService conferenceServiceEx = ConferenceMgrService.Instance(strAccountName, strAccountPWD, strServerAddress);
                responseRecurrence = conferenceServiceEx.scheduleRecurrenceConference(ConfInfo);
            }
            catch (System.Exception ex)
            {
                ThisAddIn.g_log.Error(string.Format("scheduleRecurrenceTPConf exception,because {0}", ex.Message));
                return PARAM_ERROR;
            }

            if (0 == responseRecurrence.resultCode)
            {
                try
                {
                    //预约成功,将返回的confId作为属性保存
                    RecurrenceConfInfo retConfInfo = responseRecurrence.result;

                    //2014/10/14 新增测试
                    List<RecurrenceAppoint> retConfInfoArray = new List<RecurrenceAppoint>();
                    ArrayList tempCon = new ArrayList();
                    if (retConfInfo.siteAccessInfos != null)
                    {
                        RecurrenceAppoint appo = null;
                        for (int i = 0; i < retConfInfo.siteAccessInfos.Length; i++)
                        {
                            DateTime time = retConfInfo.siteAccessInfos[i].beginTime.ToLocalTime();
                            if (!tempCon.Contains(time))//
                            {
                                tempCon.Add(time);

                                appo = new RecurrenceAppoint();
                                appo.AppointDate = time.ToShortDateString();
                                appo.AppointTime = time.ToLongTimeString();
                                appo.AccessCode = retConfInfo.siteAccessInfos[i].confAccessCode;

                                //2015-6-17 w00322557 保存会场
                                appo.AppointSites += retConfInfo.sites[i].name + ",";
                                retConfInfoArray.Add(appo);
                            }
                            else
                            {
                                appo.AppointSites += retConfInfo.sites[i].name + ",";
                            }

                            ThisAddIn.g_log.Info(string.Format("RecurrenceAppoint sites name: {0}", retConfInfo.sites[i].name));
                        }
                    }

                    SaveRecurrenceReturnUserProperties(retConfInfo, ai, retConfInfoArray);

                    DateTime tmpBeginTime = retConfInfo.siteAccessInfos[0].beginTime.ToLocalTime();
                    if (ai.Start != tmpBeginTime)
                    {
                        RecurrencePattern recurrencePattern = ai.GetRecurrencePattern();
                        recurrencePattern.StartTime = DateTime.Parse(tmpBeginTime.ToShortTimeString());
                    }

                    if (string.IsNullOrEmpty(ai.Subject))
                    {
                        ai.Subject = retConfInfo.name;
                        ThisAddIn.g_log.Info(string.Format("outlook subject is empty. return subject is: {0}", retConfInfo.name));
                    }

                    //HTML模板
                    Microsoft.Office.Interop.Word.Document objDoc = ins.WordEditor as Microsoft.Office.Interop.Word.Document;
                    if (null != objDoc)
                    {
                        //获取当前语言通知模板的路径
                        string strFilePath = string.Empty;
                        strFilePath = SetNotificationLanguage(GetNotificationCurrentLanguage(ThisAddIn.g_AccountInfo.strLanguage));

                        if (!File.Exists(strFilePath))
                        {
                            ThisAddIn.g_log.Error("notification file path not exist.");
                            return PARAM_ERROR;
                        }

                        string textTemplate = System.IO.File.ReadAllText(strFilePath, Encoding.GetEncoding("utf-8"));
                        string strNotify = this.replaceContentsInTemplateRecurrence(ai, textTemplate, ref retConfInfo);

                        Clipboard.Clear();
                        VideoConfSettingsForm.CopyHtmlToClipBoard(strNotify);
                        object html = Clipboard.GetData(DataFormats.Html);

                        ThisAddIn.g_log.Info("schedule recurrence paste enter.");

                        object start = 0;
                        Range newRang = objDoc.Range(ref start, ref start);

                        int ioo = objDoc.Sections.Count;
                        Section sec = objDoc.Sections.Add(Type.Missing, Type.Missing);

                        sec.Range.InsertBreak(Type.Missing);//插入换行符

                        //2014/11/13 测试,防止异常,邮件体出现空白
                        for (int i = 0; i < 5; i++)
                        {
                            try
                            {
                                sec.Range.PasteAndFormat(WdRecoveryType.wdPasteDefault);
                                break;
                            }
                            catch (System.Exception ex)
                            {
                                ThisAddIn.g_log.Error(ex.Message);
                                Thread.Sleep(500);
                            }
                        }

                        ThisAddIn.g_log.Info("schedule recurrence paste end");

                        #region 2014/11/3 注销,合并入SendMailNotification()
                        ThisAddIn.g_log.Info("schedule send mail enter.");

                        //MailItem email = this.Application.CreateItem(OlItemType.olMailItem);
                        //string smtpAddress = "";

                        //Outlook.Recipients recipients = ai.Recipients;
                        //foreach (Outlook.Recipient recipient in recipients)
                        //{
                        //    Outlook.ExchangeUser exchangeUser = recipient.AddressEntry.GetExchangeUser();

                        //    if (exchangeUser != null)
                        //    {
                        //        smtpAddress += exchangeUser.PrimarySmtpAddress + ";";//获取账户信息,作为默认第一个收件人
                        //    }
                        //    else
                        //    {
                        //        smtpAddress += recipient.Address + ";";//添加收件人地址
                        //    }
                        //}

                        //email.To = smtpAddress;  //收件人地址
                        //email.Subject = "[Successfully Scheduled]" + ai.Subject;
                        //email.BodyFormat = OlBodyFormat.olFormatHTML;//body格式
                        //email.HTMLBody = strNotify;

                        //((Outlook._MailItem)email).Send();//发送邮件

                        //ThisAddIn.g_log.Info("sendMailNotifications exit");
                        //ThisAddIn.g_log.Info("schedule send mail exit.");
                        #endregion

                        Outlook.Recipients recipients = ai.Recipients;
                        sendMailNotifications(ai, OperatorType.Schedule, recipients);

                        //3's
                        MessageBoxTimeOut mes = new MessageBoxTimeOut();
                        string strFormat = GlobalResourceClass.getMsg("OPERATOR_MESSAGE");
                        string messageBody = string.Format(strFormat, GlobalResourceClass.getMsg("OPERATOR_TYPE_SCHEDULE"));
                        mes.Show(messageBody, GlobalResourceClass.getMsg("OPERATOR_SUCCESS"), 3000);
                    }
                }
                catch (System.Exception ex)
                {
                    ThisAddIn.g_log.Error(string.Format("recurrence email notification error,because {0}.", ex.Message));
                }
            }
            else
            {
                //
                ThisAddIn.g_log.Info(string.Format("scheduleRecurrenceTPConf failed with: {0}", responseRecurrence.resultCode.ToString()));
            }

            ThisAddIn.g_log.Info("scheduleRecurrenceTPConf exit");
            return responseRecurrence.resultCode;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 替换通知模板中的内容
        /// </summary>
        /// <param name="textTemplate">通知模板</param>
        /// <param name="confInfo">会议信息</param>  
        /// <returns>新的通知消息</returns>
        private string replaceContentsInTemplateRecurrence(AppointmentItem ai, string textTemplate, ref RecurrenceConfInfo confInfo)
        {
            //begin 替换模板中的数据
            string[] strLanguages = ThisAddIn.g_AccountInfo.strLanguage.Split(';');
            int nLanguage = 1033;
            bool bContain = textTemplate.Contains("{Recurrence_Type}");
            if (true == bContain)
            {
                if (string.Equals(strLanguages[0].ToLower(), "zh_cn"))
                {
                    textTemplate = textTemplate.Replace("{Recurrence_Type}", "重复周期");
                    nLanguage = 2052;
                }
                else if (string.Equals(strLanguages[0].ToLower(), "ru") || string.Equals(strLanguages[0].ToLower(), "ru_ru"))
                {
                    textTemplate = textTemplate.Replace("{Recurrence_Type}", "Интервал повтора");
                    nLanguage = 1049;
                }
                else
                {
                    textTemplate = textTemplate.Replace("{Recurrence_Type}", "Recurrence");
                    nLanguage = 1033;
                }
            }

            bContain = textTemplate.Contains("{Recurrence_Time}");
            if (true == bContain)
            {
                if (string.Equals(strLanguages[0].ToLower(), "zh_cn"))
                {
                    textTemplate = textTemplate.Replace("{Recurrence_Time}", "有效时间");
                }
                else if (string.Equals(strLanguages[0].ToLower(), "ru") || string.Equals(strLanguages[0].ToLower(), "ru_ru"))
                {
                    textTemplate = textTemplate.Replace("{Recurrence_Time}", "Срок действия");
                }
                else
                {
                    textTemplate = textTemplate.Replace("{Recurrence_Time}", "Valid Time");
                }
            }
            //替换模板中的"会议名称"
            bContain = textTemplate.Contains("{Conf_Subject}");
            string strNewString = "";
            if (true == bContain)
            {
                if (string.IsNullOrEmpty(ai.Subject))
                {
                    strNewString = textTemplate.Replace("{Conf_Subject}", confInfo.name);
                }
                else
                {
                    string myEncodedString = HttpUtility.HtmlEncode(ai.Subject);
                    strNewString = textTemplate.Replace("{Conf_Subject}", myEncodedString);
                }
            }

            //替换模板中的"会议密码"
            bContain = strNewString.Contains("{Conf_Password}");
            string strNewString2 = "";
            if (true == bContain)
            {
                UserProperty up = ai.UserProperties.Find(ThisAddIn.PROPERTY_CONFERENCE_PASSWORD, Type.Missing);
                if (up != null)
                {
                    strNewString2 = strNewString.Replace("{Conf_Password}", up.Value);
                }
                else
                {
                    strNewString2 = strNewString.Replace("{Conf_Password}", ThisAddIn.g_SystemSettings.strConfPWD);
                }

            }
            else
            {
                strNewString2 = strNewString;
            }

            //替换模板中的"会议开始时间"
            bContain = strNewString2.Contains("{Conf_Start_Time}");
            string strNewString3 = "";
            if (true == bContain)
            {
                RecurrencePattern rp = ai.GetRecurrencePattern();
                string strTemp = string.Empty;
                DateTime dateTime = rp.PatternStartDate.AddHours(rp.StartTime.Hour);
                dateTime = dateTime.AddMinutes(rp.StartTime.Minute);
                string strFormat = string.Empty;
                if (rp.RecurrenceType == OlRecurrenceType.olRecursDaily)//天
                {
                    if (rp.Interval < 2)
                    {
                        strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_EVERY_DAY", nLanguage));
                    }
                    else
                    {
                        strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_WITH_DAY", nLanguage), rp.Interval);
                    }

                }
                else if (rp.RecurrenceType == OlRecurrenceType.olRecursWeekly)//周
                {
                    string strDayOfWeek = string.Empty;
                    int[] nDayOfWeek = getWeekDays(rp.DayOfWeekMask);
                    for (int i = 0; i < nDayOfWeek.Length; i++)
                    {
                        switch (nDayOfWeek[i])
                        {
                            case 0:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_SUNDAY", nLanguage);
                                break;
                            case 1:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_MONDAY", nLanguage);
                                break;
                            case 2:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_TUESDAY", nLanguage);
                                break;
                            case 3:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_WEDNESDAY", nLanguage);
                                break;
                            case 4:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_THURSDAY", nLanguage);
                                break;
                            case 5:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_FRIDAY", nLanguage);
                                break;
                            case 6:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_SATURDAY", nLanguage);
                                break;
                            default:
                                break;
                        }
                    }

                    if (!string.IsNullOrEmpty(strDayOfWeek) && strDayOfWeek.Length > 0)
                    {
                        strDayOfWeek = strDayOfWeek.Trim();
                        strDayOfWeek = strDayOfWeek.Remove(strDayOfWeek.Length - 1);
                    }

                    if (rp.Interval < 2)
                    {
                        strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_EVERY_WEEK", nLanguage), strDayOfWeek);
                    }
                    else
                    {
                        //2014/10/11修改
                        if (string.Equals(strLanguages[0].ToLower(), "zh_cn"))//中文
                        {
                            strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_WITH_WEEK", nLanguage), rp.Interval, strDayOfWeek);
                        }
                        else//英文
                        {
                            strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_WITH_WEEK", nLanguage), strDayOfWeek, rp.Interval);
                        }

                    }

                }
                else if (rp.RecurrenceType == OlRecurrenceType.olRecursMonthly)//月
                {
                    if (rp.Interval < 2)
                    {
                        strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_EVERY_MONTH", nLanguage), rp.DayOfMonth, (rp.DayOfMonth < 4 ? (MonthDayNum)rp.DayOfMonth : (MonthDayNum)4));
                    }
                    else
                    {
                        if (nLanguage == 1033)//2015-4-22 w00322557英文格式
                        {
                            strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_WITH_MONTH", nLanguage), rp.DayOfMonth, (rp.DayOfMonth < 4 ? (MonthDayNum)rp.DayOfMonth : (MonthDayNum)4), rp.Interval);
                        }
                        else if (nLanguage == 1049)//2015-4-22 w00322557俄文格式
                        {
                            strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_WITH_MONTH", nLanguage), rp.DayOfMonth, rp.Interval);
                        }
                        else
                        {
                            strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_WITH_MONTH", nLanguage), rp.Interval, rp.DayOfMonth);
                        }
                    }
                    ThisAddIn.g_log.Info(string.Format("RECURRENCE_WITH_MONTH : {0}", strTemp));
                }
                else if (rp.RecurrenceType == OlRecurrenceType.olRecursMonthNth)
                {
                    string strDayOfWeek = string.Empty;
                    int[] nDayOfWeek = getWeekDays(rp.DayOfWeekMask);
                    for (int i = 0; i < nDayOfWeek.Length; i++)
                    {
                        switch (nDayOfWeek[i])
                        {
                            case 0:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_SUNDAY", nLanguage);
                                break;
                            case 1:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_MONDAY", nLanguage);
                                break;
                            case 2:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_TUESDAY", nLanguage);
                                break;
                            case 3:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_WEDNESDAY", nLanguage);
                                break;
                            case 4:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_THURSDAY", nLanguage);
                                break;
                            case 5:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_FRIDAY", nLanguage);
                                break;
                            case 6:
                                strDayOfWeek += GlobalResourceClass.getMsg("RECURRENCE_SATURDAY", nLanguage);
                                break;
                            default:
                                break;
                        }
                    }

                    if (!string.IsNullOrEmpty(strDayOfWeek) && strDayOfWeek.Length > 0)
                    {
                        strDayOfWeek = strDayOfWeek.Trim();
                        strDayOfWeek = strDayOfWeek.Remove(strDayOfWeek.Length - 1);
                    }

                    if (rp.Interval < 2)//每个
                    {
                        if (string.Equals(strLanguages[0].ToLower(), "en_us"))//English
                        {
                            strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_EVERY_MONTHLY", nLanguage), (MonthWeekNum)rp.Instance, strDayOfWeek);
                        }
                        else if (string.Equals(strLanguages[0].ToLower(), "ru") || string.Equals(strLanguages[0].ToLower(), "ru_ru"))//russian
                        {
                            strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_EVERY_MONTHLY", nLanguage), (MonthWeekNumRU)rp.Instance, strDayOfWeek);
                        }
                        else//中文
                        {
                            if (rp.Instance > 4)//每月最后一周
                            {
                                strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_EVERY_MONTHLY_LAST", nLanguage), strDayOfWeek);
                            }
                            else
                            {
                                strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_EVERY_MONTHLY", nLanguage), rp.Instance, strDayOfWeek);
                            }
                        }
                        ThisAddIn.g_log.Info(string.Format("RECURRENCE_EVERY_MONTHLY : {0}", strTemp));
                    }
                    else//每?个
                    {

                        if (string.Equals(strLanguages[0].ToLower(), "en_us"))//English
                        {
                            strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_WITH_MONTHLY", nLanguage), (MonthWeekNum)rp.Instance, strDayOfWeek, rp.Interval);
                        }
                        else if (string.Equals(strLanguages[0].ToLower(), "ru") || string.Equals(strLanguages[0].ToLower(), "ru_ru"))//russian
                        {
                            strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_WITH_MONTHLY", nLanguage), (MonthWeekNumRU)rp.Instance, strDayOfWeek, rp.Interval);
                        }
                        else// (string.Equals(strLanguages[0].ToLower(), "zh_cn"))//chinese
                        {
                            if (rp.Instance > 4)
                            {
                                strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_WITH_MONTHLY_LAST", nLanguage), strDayOfWeek, rp.Interval);
                            }
                            else
                            {
                                strTemp = string.Format(GlobalResourceClass.getMsg("RECURRENCE_WITH_MONTHLY", nLanguage), rp.Instance, strDayOfWeek, rp.Interval);
                            }
                        }
                        ThisAddIn.g_log.Info(string.Format("RECURRENCE_WITH_MONTHLY : {0}", strTemp));
                    }
                }
                strNewString3 = strNewString2.Replace("{Conf_Start_Time}", strTemp);
            }
            else
            {
                strNewString3 = strNewString2;
            }

            //替换模板中的"会议结束"
            bContain = strNewString3.Contains("{Conf_End_Time}");
            string strNewString4 = "";
            if (true == bContain)
            {
                RecurrencePattern rp = ai.GetRecurrencePattern();
                DateTime dateTime = rp.PatternEndDate;

                //time zone
                Outlook.TimeZone tz = ai.StartTimeZone;

                string strRes;
                if (string.Equals(strLanguages[0].ToLower(), "zh_cn"))//中文,2014/11/14 修改,预约过去会议与SMC保持一致
                {
                    strRes = string.Format(GlobalResourceClass.getMsg("RECURRENCE_FROM_TO", nLanguage), rp.PatternStartDate.ToShortDateString(),
                                                                                                rp.PatternEndDate.ToShortDateString(),
                                                                                                rp.StartTime.ToShortTimeString(),
                                                                                                rp.EndTime.ToShortTimeString()) + " " + ai.StartTimeZone.Name;
                }
                else//英文
                {
                    strRes = string.Format(GlobalResourceClass.getMsg("RECURRENCE_FROM_TO", nLanguage), rp.StartTime.ToShortTimeString(),
                                                                                             rp.EndTime.ToShortTimeString(),
                                                                                             rp.PatternStartDate.ToShortDateString(),
                                                                                             rp.PatternEndDate.ToShortDateString()) + " " + ai.StartTimeZone.Name;
                }

                strNewString4 = strNewString3.Replace("{Conf_End_Time}", strRes);
            }
            else
            {
                strNewString4 = strNewString3;
            }

            //替换模板中的"会议接入号"
            bContain = strNewString4.Contains("{Conf_Access_Number}");
            string strNewString5 = "";
            if (true == bContain)
            {
                if (string.IsNullOrEmpty(confInfo.siteAccessInfos[0].confAccessCode))
                {
                    strNewString5 = strNewString4.Replace("{Conf_Access_Number}", "");
                }
                else
                {
                    //2015-6-16 w00322557 有前缀则中间添加“-”分割,若无前缀,则无分隔符
                    if (string.IsNullOrEmpty(ThisAddIn.g_AccountInfo.strLync))
                    {
                        strNewString5 = strNewString4.Replace("{Conf_Access_Number}", confInfo.siteAccessInfos[0].confAccessCode);
                    }
                    else
                    {
                        //2014/10/10 修改,为接入码加入9000- 前缀
                        strNewString5 = strNewString4.Replace("{Conf_Access_Number}", ThisAddIn.g_AccountInfo.strLync + "-" + confInfo.siteAccessInfos[0].confAccessCode);
                    }
                }
            }
            else
            {
                strNewString5 = strNewString4;
            }

            //替换模板中的"终端会场"
            bContain = strNewString5.Contains("{Conf_Sites}");
            string strNewString6 = "";
            if (true == bContain)
            {
                string strTempSites = "";

                //2014/10/20 测试
                ConferenceInfo cInfo = (ConferenceInfo)confInfo;
                for (int i = 0; i < confInfo.siteAccessInfos.Length; i++)
                {
                    SiteAccessInfo sInfo = confInfo.siteAccessInfos[i];

                    if (sInfo.beginTime.ToLocalTime().ToShortDateString() == ai.Start.ToShortDateString())
                    {
                        if ((cInfo.sites[i].uri == sInfo.uri) && (!string.IsNullOrEmpty(sInfo.uri)))
                        {
                            strTempSites += cInfo.sites[i].name + "; ";
                        }
                    }
                }
                strNewString6 = strNewString5.Replace("{Conf_Sites}", strTempSites);
            }

            //替换模板中的"Lync一键入会"
            bContain = strNewString6.Contains("conf_lync_ctc");
            string strNewString7 = "";
            if (true == bContain)
            {
                if (true == ThisAddIn.g_SystemSettings.bLyncCTC)
                {
                    strNewString7 = strNewString6.Replace("conf_lync_ctc", "sip:" + ThisAddIn.g_AccountInfo.strLync + confInfo.siteAccessInfos[0].confAccessCode + ThisAddIn.g_AccountInfo.strMCU);
                }
                else
                {
                    strNewString7 = strNewString6.Replace("conf_lync_ctc", "");
                }
            }
            else
            {
                strNewString7 = strNewString6;
            }

            //替换模板中的"数据会议地址"
            bContain = strNewString7.Contains("conf_living_address");
            string strNewString8 = "";
            if (true == bContain)
            {
                strNewString8 = strNewString7.Replace("conf_living_address", confInfo.recorderAddr);
            }
            else
            {
                strNewString8 = strNewString7;
            }

            //替换模板中的"{Prefix_ISDN}"
            bContain = strNewString8.Contains("{Prefix_ISDN}");
            string strNewString9 = "";
            if (true == bContain)
            {
                strNewString9 = strNewString8.Replace("{Prefix_ISDN}", ThisAddIn.g_AccountInfo.strLync);
            }
            else
            {
                strNewString9 = strNewString8;
            }

            //替换模板中的"{Prefix_Cisco}"
            bContain = strNewString9.Contains("{Prefix_Cisco}");
            string strNewString10 = "";
            if (true == bContain)
            {
                //2015-6-16 w00322557 有前缀则中间添加“-”分割,若无前缀,则无分隔符
                if (string.IsNullOrEmpty(ThisAddIn.g_AccountInfo.strCisco))
                {
                    strNewString10 = strNewString9.Replace("{Prefix_Cisco}", confInfo.siteAccessInfos[0].confAccessCode);
                }
                else
                {
                    strNewString10 = strNewString9.Replace("{Prefix_Cisco}", ThisAddIn.g_AccountInfo.strCisco + "-" + confInfo.siteAccessInfos[0].confAccessCode);
                }
            }
            else
            {
                strNewString10 = strNewString9;
            }

            //
            if (string.IsNullOrEmpty(strNewString10))
            {
                ThisAddIn.g_log.Error("Recurrence template is empty.");
            }
            else
            {
                ThisAddIn.g_log.Info(string.Format("template length is: {0}", strNewString10.Length));
            }

            return strNewString10;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 修改周期性智真会议
        /// </summary>
        /// <returns>native接口返回值</returns>
        private int editRecurrenceTPConf(AppointmentItem ai, ref RecurrenceConfInfo ConfInfo, MeetingItem meetingItem)
        {
            ThisAddIn.g_log.Info("editRecurrenceTPConf enter");
            Inspector ins = ai.GetInspector;

            string accessCode = null;
            List<SiteInfo> siteInfos = new List<SiteInfo>();

            //编辑周期会议中单个子会议
            DateTime? date = null;
            if (OlRecurrenceState.olApptException == ai.RecurrenceState || OlRecurrenceState.olApptOccurrence == ai.RecurrenceState)
            {

                UserProperty upRightBeginTime = ai.UserProperties.Find(PROPERTY_RIGHT_BEGIN_TIME, Type.Missing);
                string val = upRightBeginTime.Value;

                List<RecurrenceAppoint> appointList = XmlHelper.Desrialize<List<RecurrenceAppoint>>(val);
                foreach (RecurrenceAppoint Rappoint in appointList)
                {
                    if (Rappoint.AppointDate.Equals(ai.Start.ToShortDateString()))
                    {
                        string s = string.Format("{0} {1}", Rappoint.AppointDate, Rappoint.AppointTime);
                        date = DateTime.Parse(s).ToUniversalTime();
                        break;
                    }
                }

                if (date == null)//证明修改了时间
                {
                    return ERROR_CODE_CHANGE_DATE;
                }

                setRecurrenceConferenceInfo(ref ConfInfo, ai, true);

            }
            else
            {
                setRecurrenceConferenceInfo(ref ConfInfo, ai, false);
            }

            TPOASDKResponse<RecurrenceConfInfo> responseRecurrence = null;
            int resultCode = -1;

            //2015-5-25 w00322557 账号传入“eSDK账号,Outlook邮箱账号”
            //string strAccountName = ThisAddIn.g_AccountInfo.strUserName;
            Outlook.ExchangeUser mainUser = Globals.ThisAddIn.Application.Session.CurrentUser.AddressEntry.GetExchangeUser();
            string strOutlookAccount = string.Empty;
            if (mainUser != null)
            {
                strOutlookAccount = mainUser.PrimarySmtpAddress;
            }

            string strAccountName = string.Format("{0},{1}", ThisAddIn.g_AccountInfo.strUserName, strOutlookAccount);
            string strAccountPWD = ThisAddIn.g_AccountInfo.strPWD;
            string strServerAddress = ThisAddIn.g_AccountInfo.strServer;

            ThisAddIn.g_log.Debug(string.Format("Account is: {0}", strAccountName));
            ThisAddIn.g_log.Debug("PWD is: ******");
            ThisAddIn.g_log.Debug(string.Format("Server is: {0}", strServerAddress));

            try
            {
                //密码不存在,返回
                if (string.IsNullOrEmpty(ThisAddIn.g_AccountInfo.strPWD))
                {
                    ThisAddIn.g_log.Info("pwd is null");
                    MessageBox.Show(GlobalResourceClass.getMsg("INPUT_OUTLOOK_PASSWORD"));
                }

                ConferenceMgrService conferenceServiceEx = ConferenceMgrService.Instance(strAccountName, strAccountPWD, strServerAddress);
                responseRecurrence = conferenceServiceEx.editRecurrenceConference(ConfInfo, date);

                //已关联
                resultCode = responseRecurrence.resultCode;

            }
            catch (System.Exception ex)
            {
                ThisAddIn.g_log.Error(string.Format("editRecurrenceTPConf exception with: {0}", ex.Message));
                return PARAM_ERROR;
            }

            if (0 == resultCode)
            {
                //预约成功,将返回的会议信息作为属性保存
                if (string.IsNullOrEmpty(ai.Subject))
                {
                    ai.Subject = ConfInfo.name;
                }

                ConferenceInfo confInfo = null;

                if (responseRecurrence != null)
                {
                    //预约成功,将返回的confId作为属性保存
                    RecurrenceConfInfo retConfInfo = responseRecurrence.result;

                    //2014/10/21 测试
                    confInfo = (ConferenceInfo)retConfInfo;

                    //2014/10/14 新增测试
                    List<RecurrenceAppoint> retConfInfoArray = new List<RecurrenceAppoint>();
                    ArrayList tempCon = new ArrayList();
                    try
                    {
                        RecurrenceAppoint appo = null;
                        for (int i = 0; i < retConfInfo.siteAccessInfos.Length; i++)
                        {
                            DateTime time = retConfInfo.siteAccessInfos[i].beginTime.ToLocalTime();

                            if (!tempCon.Contains(time))
                            {
                                tempCon.Add(time);
                                appo = new RecurrenceAppoint();
                                appo.AppointDate = time.ToShortDateString();
                                appo.AppointTime = time.ToLongTimeString();
                                appo.AccessCode = retConfInfo.siteAccessInfos[i].confAccessCode;

                                //2015-6-17 w00322557 保存会场
                                appo.AppointSites = retConfInfo.sites[i].name + ",";
                                retConfInfoArray.Add(appo);
                            }
                            else
                            {
                                appo.AppointSites += retConfInfo.sites[i].name + ",";
                            }

                            ThisAddIn.g_log.Info(string.Format("Edit RecurrenceAppoint sites name: {0}", retConfInfo.sites[i].name));

                            //保存当天会议的接入码
                            if (time.ToString("yyyy-MM-dd HH:mm") == ai.Start.ToString("yyyy-MM-dd HH:mm"))
                            {
                                accessCode = retConfInfo.siteAccessInfos[i].confAccessCode;
                                SiteInfo info = new SiteInfo();
                                //info.name = retConfInfo.siteAccessInfos[i].uri;
                                //siteInfos.Add(info);
                                //2014/10/21 测试
                                info.name = confInfo.sites[i].name;
                                siteInfos.Add(info);
                            }
                        }
                    }
                    catch (System.Exception ex)
                    {
                        ThisAddIn.g_log.Error(string.Format("editRecurrenceTPConf exception: {0}", ex.Message));
                    }

                    //SaveRecurrenceReturnUserProperties(retConfInfo, ai,retConfInfoArray);

                    //HTML模板
                    Microsoft.Office.Interop.Word.Document objDoc = ins.WordEditor as Microsoft.Office.Interop.Word.Document;
                    if (null != objDoc)
                    {
                        string strFilePath = string.Empty;
                        strFilePath = SetNotificationLanguage(GetNotificationCurrentLanguage(ThisAddIn.g_AccountInfo.strLanguage));

                        if (!File.Exists(strFilePath))
                        {
                            ThisAddIn.g_log.Error("notification file path not exist.");
                            return PARAM_ERROR;
                        }

                        //读取会议邮件通知模板内容
                        string textTemplate = System.IO.File.ReadAllText(strFilePath, Encoding.GetEncoding("utf-8"));

                        //2014/10/16 测试
                        string strNotify;
                        if (OlRecurrenceState.olApptException == ai.RecurrenceState)//证明修改的是周期会议的子会议
                        {
                            //传接入码
                            confInfo.accessCode = accessCode;

                            //传会场
                            SiteInfo[] infos = siteInfos.ToArray();
                            confInfo.sites = infos;
                            strNotify = this.replaceContentsInTemplate(ai, textTemplate, ref confInfo);
                            SaveRecuConfReturnUserProperties(retConfInfo, ai, retConfInfoArray);
                        }
                        else
                        {
                            SaveRecurrenceReturnUserProperties(retConfInfo, ai, retConfInfoArray);
                            strNotify = this.replaceContentsInTemplateRecurrence(ai, textTemplate, ref retConfInfo);
                        }

                        //将会议通知模板数据拷贝/粘贴到文档中
                        Clipboard.Clear();
                        VideoConfSettingsForm.CopyHtmlToClipBoard(strNotify);
                        object html = Clipboard.GetData(DataFormats.Html);

                        ThisAddIn.g_log.Info("edit recurrence paste enter");
                        objDoc.Range().WholeStory();

                        try
                        {
                            objDoc.Range().PasteAndFormat(WdRecoveryType.wdPasteDefault);
                        }
                        catch (System.Exception ex)
                        {
                            ThisAddIn.g_log.Error(ex.Message);
                        }

                        ThisAddIn.g_log.Info("edit recurrence paste end");
                    }
                }
                SendRecipientsInfo(ai, meetingItem);
                MessageBoxTimeOut mes = new MessageBoxTimeOut();
                string messageBody = string.Format(GlobalResourceClass.getMsg("OPERATOR_MESSAGE"), GlobalResourceClass.getMsg("OPERATOR_TYPE_MODIFY"));
                mes.Show(messageBody, GlobalResourceClass.getMsg("OPERATOR_SUCCESS"), 3000);
            }
            else
            {
                //返回错误码,计入日志
                ThisAddIn.g_log.Error(string.Format("editRecurrenceTPConf return: {0}", responseRecurrence.resultCode.ToString()));
            }

            ThisAddIn.g_log.Info("editRecurrenceTPConf exit");
            return resultCode;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 修改预约会议
        /// </summary>
        /// <param name="tempAppt">相应的AppointmentItem</param>
        /// <param name="tempAppt">相应的MeetingItem,主要用于获取MeetingItem的人员</param>
        private int EditConference(ref AppointmentItem tempAppt, MeetingItem tempMeet)
        {
            ThisAddIn.g_log.Info("EditConference enter");
            int nResult = PARAM_ERROR;
            UserProperty upConfInfo = tempAppt.UserProperties.Find(PROPERTY_NAME_CONF_INFO, Type.Missing);
            string strContent = upConfInfo.Value;
            if (string.IsNullOrEmpty(strContent))
            {
                ThisAddIn.g_log.Error("ConfInfo UserProperty is empty!");
                return nResult;
            }

            //修改会议
            if (true == tempAppt.IsRecurring)
            {
                //获取ConferenceInfo属性
                RecurrenceConfInfo recurrenceConfInfo = new RecurrenceConfInfo();
                recurrenceConfInfo.confId = strContent;
                nResult = this.editRecurrenceTPConf(tempAppt, ref recurrenceConfInfo, tempMeet);
            }
            else
            {
                ConferenceInfo confInfo = this.GetConfInfoUserProperty(tempAppt);
                nResult = this.editTPConf(tempAppt, ref confInfo, tempMeet);
            }

            //2015-3-20 w00322557 智真或lync会场个数小于2,直接透传产品错误码信息

            ThisAddIn.g_log.Info(string.Format("EditConference exit with {0}", nResult));
            return nResult;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 2014/10/24 保存会议属性,不包含ConfId
        /// </summary>
        /// <param name="confInfo"></param>
        /// <param name="ai"></param>
        /// <param name="rAppoints"></param>
        private static void SaveRecuConfReturnUserProperties(RecurrenceConfInfo confInfo, AppointmentItem ai, List<RecurrenceAppoint> rAppoints)
        {
            ThisAddIn.g_log.Info(string.Format("SaveRecurrenceReturnUserProperties begin"));
            try
            {
                //access code
                UserProperty upAccessCode = ai.UserProperties.Add(PROPERTY_ACCESS_CODE, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upAccessCode.Value = confInfo.accessCode;
                ThisAddIn.g_log.Info(string.Format("return recurrence conf access code is: {0}", confInfo.siteAccessInfos[0].confAccessCode));

                //recording address
                UserProperty upRecordingAddress = ai.UserProperties.Add(PROPERTY_RECORDING_ADDRESS, Outlook.OlUserPropertyType.olText, Type.Missing, Type.Missing);
                upRecordingAddress.Value = confInfo.recorderAddr;
                ThisAddIn.g_log.Info(string.Format("return recurrence conf recorder url is: {0}", confInfo.recorderAddr));

                UserProperty upRightBeginTime = ai.UserProperties.Add(PROPERTY_RIGHT_BEGIN_TIME, Outlook.OlUserPropertyType.olText, false, Type.Missing);
                upRightBeginTime.Value = XmlHelper.Serialize(rAppoints);
                ThisAddIn.g_log.Info(string.Format("return recurrence conf begin time is: {0}", XmlHelper.Serialize(rAppoints)));
            }
            catch (System.Exception ex)
            {
                ThisAddIn.g_log.Error(string.Format("SaveRecurrenceReturnUserProperties exception,{0}", ex.Message));
                MessageBox.Show(ex.Message);
            }
            ThisAddIn.g_log.Info(string.Format("SaveRecurrenceReturnUserProperties end"));
        }