public static AFN2IRSection ReadAppConfig()
        {
            DataObject oDaO = null;

            AFN2IRSection oAppConfig = null;

            try
            {
                oDaO = EncompassApplication.Session.DataExchange.GetCustomDataObject(AFN2IRHelper.AppConfigName);

                if (oDaO != null && oDaO.Data != null)
                {
                    using (MemoryStream oXMLDataStream = new MemoryStream(oDaO.Data))
                    {
                        var oSerializer = new System.Xml.Serialization.XmlSerializer(typeof(AFN2IRSection));

                        oAppConfig = (AFN2IRSection)oSerializer.Deserialize(oXMLDataStream);
                    }
                }
            }
            catch (Exception Ex)
            {
                Macro.Alert(String.Format("Error: Reading AppConfig - {0}", Ex.Message));
            }
            finally
            {
                if (oDaO != null)
                {
                    oDaO.Dispose();
                }
            }

            return(oAppConfig);
        }
        public static void WriteAppConfig(AFN2IRSection oAFN2IRSection)
        {
            DataObject oDaO = null;

            try
            {
                var oXMLString = AFN2IRSection.ToXML(oAFN2IRSection);

                oDaO = new DataObject();
                oDaO.Load(Encoding.ASCII.GetBytes(oXMLString.ToCharArray()));

                EncompassApplication.Session.DataExchange.SaveCustomDataObject(AppConfigName, oDaO);
            }
            catch (Exception Ex)
            {
                var oMethodName = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name;
                Macro.Alert(String.Format("{0}: Error Saving AppConfig", oMethodName, Ex.Message));
            }
            finally
            {
                if (oDaO != null)
                {
                    oDaO.Dispose();
                }
            }
        }
示例#3
0
        protected void On_FormLoad(object sender, EventArgs evt)
        {
            oAFN2IRSection = AFN2IRHelper.ReadAppConfig();

            if (oAFN2IRSection != null && this.fxIRServiceEndpoint != null)
            {
                var oOptionDDL = (EMFORMS.DropdownOptionCollection) this.fxIRServiceEndpoint.Options;

                var oDefaultOption = oAFN2IRSection.AFNRequest.IRRequestSource;

                this.fxIRServiceEndpoint.SelectedIndex = oOptionDDL.IndexOf(new EMFORMS.DropdownOption(oDefaultOption));

                this.fxIRServiceEndpoint.Select();
            }
        }
示例#4
0
 protected void On_FormUnLoad(object sender, EventArgs evt)
 {
     oAFN2IRSection = null;
 }