예제 #1
0
        /// <summary>
        /// Builds the parameter properties.
        /// </summary>
        /// <param name="parameterMap">The parameter map.</param>
        /// <param name="parameterMapConfig">The parameter map config.</param>
        private void BuildParameterProperties(ParameterMap parameterMap, IConfiguration parameterMapConfig)
        {
            ConfigurationCollection parametersConfig = parameterMapConfig.Children.Find(ConfigConstants.ELEMENT_PARAMETER);

            for (int i = 0; i < parametersConfig.Count; i++)
            {
                IConfiguration    parameterConfig = parametersConfig[i];
                ParameterProperty property        = null;
                try
                {
                    property = ParameterPropertyDeSerializer.Deserialize(modelStore.DataExchangeFactory, parameterMap.Class,
                                                                         parameterConfig);
                }
                catch (Exception e)
                {
                    throw new DataMapperException("In ParameterMap (" + parameterMap.Id + ") can't build the parameter property: " + ConfigurationUtils.GetStringAttribute(parameterConfig.Attributes, ConfigConstants.ATTRIBUTE_PROPERTY) + ". Cause " + e.Message, e);
                }
                parameterMap.AddParameterProperty(property);
            }
        }
예제 #2
0
        /// <summary>
        /// Creates an <see cref="Spring.Context.IApplicationContext"/> instance
        /// using the context definitions supplied in a custom
        /// configuration section.
        /// </summary>
        /// <remarks>
        /// <p>
        /// This <see cref="Spring.Context.IApplicationContext"/> instance is
        /// also used to configure the <see cref="ContextRegistry"/>.
        /// </p>
        /// </remarks>
        /// <param name="parent">
        /// The configuration settings in a corresponding parent
        /// configuration section.
        /// </param>
        /// <param name="configContext">
        /// The configuration context when called from the ASP.NET
        /// configuration system. Otherwise, this parameter is reserved and
        /// is <see langword="null"/>.
        /// </param>
        /// <param name="section">
        /// The <see cref="System.Xml.XmlNode"/> for the section.
        /// </param>
        /// <returns>
        /// An <see cref="Spring.Context.IApplicationContext"/> instance
        /// populated with the object definitions supplied in the configuration
        /// section.
        /// </returns>
        public object Create(object parent, object configContext, XmlNode section)
        {
            XmlElement contextElement = section as XmlElement;

            #region Sanity Checks

            if (contextElement == null)
            {
                throw ConfigurationUtils.CreateConfigurationException(
                          "Context configuration section must be an XmlElement.");
            }

            // sanity check on parent
            if ((parent != null) && !(parent is IApplicationContext))
            {
                throw ConfigurationUtils.CreateConfigurationException(
                          String.Format("Parent context must be of type IApplicationContext, but was '{0}'", parent.GetType().FullName));
            }

            #endregion

            // determine name of context to be created
            string contextName = GetContextName(configContext, contextElement);
            if (!StringUtils.HasLength(contextName))
            {
                contextName = AbstractApplicationContext.DefaultRootContextName;
            }

            #region Instrumentation
            if (Log.IsDebugEnabled)
            {
                Log.Debug(string.Format("creating context '{0}'", contextName));
            }
            #endregion

            IApplicationContext context = null;
            try
            {
                IApplicationContext parentContext = parent as IApplicationContext;

                // determine context type
                Type contextType = GetContextType(contextElement, parentContext);

                // determine case-sensitivity
                bool caseSensitive = GetCaseSensitivity(contextElement);

                // get resource-list
                string[] resources = GetResources(contextElement);

                // finally create the context instance
                context = InstantiateContext(parentContext, configContext, contextName, contextType, caseSensitive, resources);
                // and register with global context registry
                if (AutoRegisterWithContextRegistry)
                {
                    ContextRegistry.RegisterContext(context);
                }

                // get and create child context definitions
                XmlNode[] childContexts = GetChildContexts(contextElement);
                CreateChildContexts(context, configContext, childContexts);

                if (Log.IsDebugEnabled)
                {
                    Log.Debug(string.Format("context '{0}' created for name '{1}'", context, contextName));
                }
            }
            catch (Exception ex)
            {
                if (!ConfigurationUtils.IsConfigurationException(ex))
                {
                    throw ConfigurationUtils.CreateConfigurationException(
                              String.Format("Error creating context '{0}': {1}",
                                            contextName, ReflectionUtils.GetExplicitBaseException(ex).Message), ex);
                }
                throw;
            }
            return(context);
        }
예제 #3
0
        /// <summary>
        /// Deserializes the specified config.
        /// </summary>
        /// <param name="config">The config.</param>
        /// <param name="dataExchangeFactory">The data exchange factory.</param>
        /// <param name="waitResultPropertyResolution">The wait result property resolution delegate.</param>
        /// <param name="waitDiscriminatorResolution">The wait discriminator resolution.</param>
        /// <returns></returns>
        public static ResultMap Deserialize(
            IConfiguration config,
            DataExchangeFactory dataExchangeFactory,
            WaitResultPropertyResolution waitResultPropertyResolution,
            WaitDiscriminatorResolution waitDiscriminatorResolution
            )
        {
            /*resultMaps子节点信息格式
             *   <resultMap id="account-result-constructor"  class="Account" >
             *      <constructor>
             *          <argument argumentName="identifiant"	column="Account_ID"/>
             *          <argument argumentName="firstName"    column="Account_FirstName"/>
             *          <argument argumentName="lastName"     column="Account_LastName"/>
             *   </constructor>
             *   <result property="EmailAddress" column="Account_Email" nullValue="*****@*****.**"/>
             *   <result property="BannerOption" column="Account_Banner_Option" dbType="Varchar" type="bool"/>
             *   <result property="CartOption"	  column="Account_Cart_Option" typeHandler="HundredsBool"/>
             * </resultMap>
             */
            //从config中对应的resultMap节点获取其属性
            string id         = config.Id;
            string className  = ConfigurationUtils.GetMandatoryStringAttribute(config, ConfigConstants.ATTRIBUTE_CLASS);
            string extends    = config.GetAttributeValue(ConfigConstants.ATTRIBUTE_EXTENDS);
            string groupBy    = config.GetAttributeValue(ConfigConstants.ATTRIBUTE_GROUPBY);
            string keyColumns = config.GetAttributeValue(ConfigConstants.ATTRIBUTE_KEYS_PROPERTIES);
            string suffix     = ConfigurationUtils.GetStringAttribute(config.Attributes, ConfigConstants.ATTRIBUTE_SUFFIX, string.Empty);
            string prefix     = ConfigurationUtils.GetStringAttribute(config.Attributes, ConfigConstants.ATTRIBUTE_PREFIX, string.Empty);

            //从工厂类的别名字典中获取
            Type type = dataExchangeFactory.TypeHandlerFactory.GetType(className);
            //根据type类型获取IDataExchange类对象
            IDataExchange dataExchange = dataExchangeFactory.GetDataExchangeForClass(type);
            IFactory      factory      = null;
            //准备存储构造函数参数argument节点信息
            ArgumentPropertyCollection arguments = new ArgumentPropertyCollection();

            #region Get the constructor & associated parameters

            //获取config下节点构造函数constructor的集合
            ConfigurationCollection constructors = config.Children.Find(ConfigConstants.ELEMENT_CONSTRUCTOR);

            if (constructors.Count > 0)
            {
                //默认获取第一个构造函数constructor节点  因为是初始化一个类  一个构造函数就足够了
                IConfiguration constructor = constructors[0];

                Type[]   argumentsType = new Type[constructor.Children.Count];
                string[] argumentsName = new string[constructor.Children.Count];

                // Builds param name list
                //argument节点的个数
                for (int i = 0; i < constructor.Children.Count; i++)
                {
                    //argumentName属性的取值
                    argumentsName[i] = ConfigurationUtils.GetStringAttribute(constructor.Children[i].Attributes, ConfigConstants.ATTRIBUTE_ARGUMENTNAME);
                }

                // Find the constructor  匹配构造函数
                ConstructorInfo constructorInfo = GetConstructor(id, type, argumentsName);

                // Build ArgumentProperty and parameter type list
                //处理构造函数的参数 每一个参数添加到arguments参数列表中
                for (int i = 0; i < constructor.Children.Count; i++)
                {
                    ArgumentProperty argumentMapping = ArgumentPropertyDeSerializer.Deserialize(
                        constructor.Children[i], //第i个Argument节点配置类
                        type,                    //当前构造函数的类
                        constructorInfo,         //当前构造函数的信息
                        dataExchangeFactory);

                    arguments.Add(argumentMapping);

                    //此处NestedResultMapName字符串应该为空
                    if (argumentMapping.NestedResultMapName.Length > 0)
                    {
                        waitResultPropertyResolution(argumentMapping);
                    }
                    //保存当前参数的类型
                    argumentsType[i] = argumentMapping.MemberType;
                }
                // Init the object factory
                //构造函数参数信息分析完成   动态初始化这个构造函数
                factory = dataExchangeFactory.ObjectFactory.CreateFactory(type, argumentsType);
            }
            else
            {
                if (!dataExchangeFactory.TypeHandlerFactory.IsSimpleType(type) && type != typeof(DataRow))
                {
                    factory = dataExchangeFactory.ObjectFactory.CreateFactory(type, Type.EmptyTypes);
                }
            }

            #endregion

            //处理result所有节点
            ResultPropertyCollection properties = BuildResultProperties(
                id,
                config,
                type,
                prefix,
                suffix,
                dataExchangeFactory,
                waitResultPropertyResolution);
            //对discriminator鉴别器的分析
            Discriminator discriminator = BuildDiscriminator(config, type, dataExchangeFactory, waitDiscriminatorResolution);

            //子节点分析完毕 将这些信息加入到resultMap父节点中
            ResultMap resultMap = new ResultMap(
                id,
                className,
                extends,
                groupBy,
                keyColumns,
                type,
                dataExchange,
                factory,
                dataExchangeFactory.TypeHandlerFactory,
                properties,
                arguments,
                discriminator
                );

            return(resultMap);
        }
예제 #4
0
 void Awake()
 {
     EventManager.Initialize();
     ConfigurationUtils.Initialize();
     ScreenUtils.Initialize();
 }
예제 #5
0
        /// <summary>
        /// Preprocess the Coherence properties specified either in the
        /// application configuration or environment variables.
        /// When both are specified, environment varialbe takes the precedence.
        /// </summary>
        /// <param name="xmlElement">The XML element to process.</param>
        /// <since>coherence 12.2.1.0.1</since>
        public static void PreprocessProp(IXmlElement xmlElement)
        {
            IXmlValue attr = xmlElement.GetAttribute("system-property");

            if (attr != null)
            {
                string property = attr.GetString();
                string val      = ConfigurationUtils.GetProperty(property, null);
                if (val != null)
                {
                    if (xmlElement.Value is Int32)
                    {
                        xmlElement.SetInt(Int32.Parse(val));
                    }
                    else
                    {
                        xmlElement.SetString(val);
                    }
                }
                xmlElement.Attributes.Remove("system-property");
            }

            string value          = xmlElement.Value.ToString();
            string newValue       = null;
            int    next           = value.IndexOf("${");
            int    i              = next + 2;
            bool   processedParam = false;

            while (next >= 0)
            {
                processedParam = true;
                string   curParam = value.Substring(i, value.IndexOf('}', i) - i);
                string[] entry    = curParam.Split(' ');
                string   property = entry[0];

                string val = ConfigurationUtils.GetProperty(property, null);
                if (val == null)
                {
                    newValue += entry[1];
                }
                else
                {
                    newValue += val;
                }

                next = value.IndexOf("${", i);
                int start = value.IndexOf('}', i) + 1;
                if (next > 0)
                {
                    newValue += value.Substring(start, next - start);
                    i         = next + 2;
                }
                else
                {
                    i = start;
                }
            }
            if (processedParam)
            {
                if (i < value.Length)
                {
                    newValue += value.Substring(i);
                }
                xmlElement.SetString(newValue);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ActorSystemApiProvider"/> class.
 /// </summary>
 /// <param name="description">
 /// The API description.
 /// </param>
 /// <param name="system">
 /// The actor system.
 /// </param>
 public ActorSystemApiProvider(ApiDescription description, ActorSystem system)
 {
     this.timeout     = ConfigurationUtils.GetRestTimeout(system);
     this.Description = description;
 }
예제 #7
0
        /// <summary>
        /// Reads the specified configuration section from the given <see cref="XmlDocument"/>
        /// </summary>
        /// <param name="document"></param>
        /// <param name="configSectionName"></param>
        /// <returns></returns>
        public static object GetSectionFromXmlDocument(XmlDocument document, string configSectionName)
        {
            string[] sectionNameParts = configSectionName.Split('/');

            string sectionHandlerPath = string.Format("//{0}/{1}", ConfigurationElement, ConfigSectionsElement);

            if (sectionNameParts.Length > 1)
            {
                // deal with sectionGroups
                for (int i = 0; i < sectionNameParts.Length - 1; i++)
                {
                    sectionHandlerPath = string.Format("{0}/{1}[@{2}='{3}']", sectionHandlerPath, ConfigSectionGroupElement, ConfigSectionNameAttribute, sectionNameParts[i]);
                }
            }
            sectionHandlerPath = string.Format("{0}/{1}[@{2}='{3}']", sectionHandlerPath, ConfigSectionElement, ConfigSectionNameAttribute, sectionNameParts[sectionNameParts.Length - 1]);

            XmlNode xmlConfig = document.SelectSingleNode(sectionHandlerPath);

            // create appropriate configuration section handler...
            Type handlerType = null;

            if (xmlConfig == null)
            {
                // none specified, use machine inherited
                XmlDocument machineConfig = new XmlDocument();
                machineConfig.Load(RuntimeEnvironment.SystemConfigurationFile);
                xmlConfig = machineConfig.SelectSingleNode(sectionHandlerPath);
                if (xmlConfig == null)
                {
                    // TOOD: better throw a sensible exception in case of a missing handler configuration?
                    handlerType = typeof(NameValueFileSectionHandler);
                }
            }

            if (xmlConfig != null)
            {
                XmlAttribute xmlConfigType = xmlConfig.Attributes[ConfigSectionTypeAttribute];
                handlerType = TypeResolutionUtils.ResolveType(xmlConfigType.Value);
            }

            if (handlerType == null)
            {
                throw new ConfigurationException(string.Format("missing 'type' attribute on section definition for '{0}'", configSectionName));
            }

            // obtain Xml node with section content
            XmlNode sectionContent = document.SelectSingleNode(string.Format("//{0}/{1}", ConfigurationElement, configSectionName));

            if (sectionContent == null)
            {
                throw ConfigurationUtils.CreateConfigurationException("Cannot read properties; config section '" + configSectionName + "' not found.");
            }

            // IConfigurationSectionHandler
            if (typeof(IConfigurationSectionHandler).IsAssignableFrom(handlerType))
            {
                IConfigurationSectionHandler handler = (IConfigurationSectionHandler)ObjectUtils.InstantiateType(handlerType);
                return(((IConfigurationSectionHandler)handler).Create(null, null, sectionContent));
            }

#if !NET_1_0 && !NET_1_1
            // NET 2.0 ConfigurationSection
            if (typeof(ConfigurationSection).IsAssignableFrom(handlerType))
            {
                ConfigurationSection section = CreateConfigurationSection(handlerType, new XmlNodeReader(sectionContent));
                return(section);
            }
#endif
            // Not supported
            throw ConfigurationUtils.CreateConfigurationException("Configuration section '" + configSectionName + "' is neither of type IConfigurationSectionHandler nor ConfigurationSection.");
        }
예제 #8
0
 /// <summary>
 /// Creates new instance of the
 /// <see cref="Oragon.Spring.Core.IO.ConfigSectionResource"/> class.
 /// </summary>
 /// <param name="resourceName">
 /// The name of the configuration section.
 /// </param>
 /// <exception cref="System.ArgumentNullException">
 /// If the supplied <paramref name="resourceName"/> is
 /// <see langword="null"/> or contains only whitespace character(s).
 /// </exception>
 public ConfigSectionResource(string resourceName) : base(resourceName)
 {
     AssertUtils.ArgumentHasText(resourceName, "resourceName");
     sectionName   = GetResourceNameWithoutProtocol(resourceName);
     configElement = (XmlElement)ConfigurationUtils.GetSection(sectionName);
 }
        private static IApplicationContext GetContextInternal(string virtualPath)
        {
            string virtualDirectory = WebUtils.GetVirtualDirectory(virtualPath);
            string contextName      = virtualDirectory;

            if (0 == string.Compare(contextName, ("" + HttpRuntime.AppDomainAppVirtualPath).TrimEnd('/') + "/", true))
            {
                contextName = DefaultRootContextName;
            }

            ILog s_weblog          = LogManager.GetLogger(typeof(WebApplicationContext));
            bool isLogDebugEnabled = s_weblog.IsDebugEnabled;

            lock (s_webContextCache)
            {
                if (isLogDebugEnabled)
                {
                    s_weblog.Debug(string.Format("looking up web context '{0}' in WebContextCache", contextName));
                }
                // first lookup in our own cache
                IApplicationContext context = (IApplicationContext)s_webContextCache[contextName];
                if (context != null)
                {
                    // found - nothing to do anymore
                    if (isLogDebugEnabled)
                    {
                        s_weblog.Debug(
                            string.Format("returning WebContextCache hit '{0}' for vpath '{1}' ", context, contextName));
                    }
                    return(context);
                }

                // lookup ContextRegistry
                lock (ContextRegistry.SyncRoot)
                {
                    if (isLogDebugEnabled)
                    {
                        s_weblog.Debug(string.Format("looking up web context '{0}' in ContextRegistry", contextName));
                    }

                    if (ContextRegistry.IsContextRegistered(contextName))
                    {
                        context = ContextRegistry.GetContext(contextName);
                    }

                    if (context == null)
                    {
                        // finally ask HttpConfigurationSystem for the requested context
                        try
                        {
                            if (isLogDebugEnabled)
                            {
                                s_weblog.Debug(
                                    string.Format(
                                        "web context for vpath '{0}' not found. Force creation using filepath '{1}'",
                                        contextName, virtualPath));
                            }

                            // assure context is resolved to the given virtualDirectory
                            using (new HttpContextSwitch(virtualDirectory))
                            {
                                context = (IApplicationContext)ConfigurationUtils.GetSection(ContextSectionName);
                            }

                            if (context != null)
                            {
                                if (isLogDebugEnabled)
                                {
                                    s_weblog.Debug(string.Format("got context '{0}' for vpath '{1}'", context, contextName));
                                }
                            }
                            else
                            {
                                if (isLogDebugEnabled)
                                {
                                    s_weblog.Debug(string.Format("no context defined for vpath '{0}'", contextName));
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            if (s_weblog.IsErrorEnabled)
                            {
                                s_weblog.Error(string.Format("failed creating context '{0}', Stacktrace:\n{1}", contextName, new StackTrace()), ex);
                            }

                            throw;
                        }
                    }
                }

                // add it to the cache
                // Note: use 'contextName' not 'context.Name' here - the same context may be used for different paths!
                s_webContextCache.Add(contextName, context);
                if (isLogDebugEnabled)
                {
                    s_weblog.Debug(
                        string.Format("added context '{0}' to WebContextCache for vpath '{1}'", context, contextName));
                }

                if (context != null)
                {
                    // register this context and all ParentContexts by their name - parent contexts may be additionally created by the HttpRuntime
                    IApplicationContext parentContext = context;
                    while (parentContext != null)
                    {
                        if (!s_webContextCache.ContainsKey(parentContext.Name))
                        {
                            s_webContextCache.Add(parentContext.Name, parentContext);
                            if (isLogDebugEnabled)
                            {
                                s_weblog.Debug(
                                    string.Format("added parent context '{0}' to WebContextCache for vpath '{1}'",
                                                  parentContext, parentContext.Name));
                            }
                        }
                        parentContext = parentContext.ParentContext;
                    }
                }
                return(context);
            } // lock(s_webContextCache)
        }
예제 #10
0
 /// <summary>
 /// Gets the app setting.
 /// </summary>
 /// <typeparam name="T">Type of setting</typeparam>
 /// <param name="settingName">Name of the setting.</param>
 /// <param name="defaultValue">The default value.</param>
 /// <param name="useDefaultValue">if set to <c>true</c> [use default value].</param>
 /// <returns>The app setting</returns>
 public static T GetAppSetting <T>(string settingName, T defaultValue, bool useDefaultValue)
 {
     return(useDefaultValue ? ConfigurationUtils.GetAppSetting(settingName, defaultValue) : ConfigurationUtils.GetAppSetting <T>(settingName));
 }
예제 #11
0
        private static void Initialize(Type componentType)
        {
            // this is to ensure, that assemblies placed next to the component assembly can be loaded
            // even when they are not strong named.
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            FileInfo componentAssemblyFile = new FileInfo(componentType.Assembly.Location);
            FileInfo assemblyFile          = new FileInfo(componentAssemblyFile.FullName);

            bool     isRunningOutOfProcess = IsRunningOutOfProcess();
            FileInfo configFile            = new FileInfo(componentAssemblyFile.FullName + ".config");

            // no config file and in-proc -> reuse app's context, error otherwise
            if (!configFile.Exists)
            {
                if (!isRunningOutOfProcess)
                {
                    // check for context with component's name
                    if (ContextRegistry.IsContextRegistered(componentType.Name))
                    {
                        Trace.WriteLine(string.Format("configuring COM InProc Server '{0}' using section <spring/context name={1}> from app.config", componentAssemblyFile.FullName, componentType.Name));
                        _appContext = ContextRegistry.GetContext(componentType.Name);
                    }
                    else
                    {
                        Trace.WriteLine(string.Format("configuring COM InProc Server '{0}' using section <spring/context> from file '{1}'", componentAssemblyFile.FullName, configFile.FullName));
                        _appContext = ContextRegistry.GetContext();
                    }
                    return;
                }
                throw ConfigurationUtils.CreateConfigurationException("Spring-exported COM components require <spring/context> section in configuration file '" + configFile.FullName + "'");
            }

            // set and switch to component assembly's directory (affects resolving relative paths during context instantiation!)
            componentDirectory           = componentAssemblyFile.Directory.FullName;
            Environment.CurrentDirectory = componentDirectory;

            if (isRunningOutOfProcess)
            {
#if NET_2_0
                Trace.WriteLine(string.Format("configuring COM OutProc Server '{0}' using '{1}'", componentAssemblyFile.FullName, configFile.FullName));
                // read in config file
                ExeConfigurationSystem comConfig = new ExeConfigurationSystem(assemblyFile.FullName);
                // make the config "global" for this process, replacing any
                // existing configuration that might already have been loaded
                ConfigurationUtils.SetConfigurationSystem(comConfig, true);
                _appContext = ContextRegistry.GetContext();
#else
                _appContext = (IApplicationContext)ConfigurationReader.GetSection(new FileSystemResource(configFile.FullName), "spring/context");
#endif
            }
            else
            {
                Trace.WriteLine(string.Format("configuring COM InProc Server '{0}' using section <spring/context> from file '{1}'", componentAssemblyFile.FullName, configFile.FullName));
                _appContext = (IApplicationContext)ConfigurationReader.GetSection(new FileSystemResource(configFile.FullName), "spring/context");
            }
            if (_appContext == null)
            {
                throw ConfigurationUtils.CreateConfigurationException("Spring-exported COM components require <spring/context> section in configuration file");
            }
            Trace.WriteLine(string.Format("completed configuring COM Component '{0}' using '{1}'", componentAssemblyFile.FullName, configFile.FullName));
        }
예제 #12
0
 public GenerarViaje()
 {
     InitializeComponent();
     monthCalendar.TodayDate      = ConfigurationUtils.Today();
     monthCalendar.SelectionStart = ConfigurationUtils.Today();
 }
예제 #13
0
 private void resetPanel()
 {
     dateTimePicker.Value = ConfigurationUtils.Today();
     panel_date.Visible   = false;
 }
예제 #14
0
 void Awake()
 {
     ConfigurationUtils.Initialize();
     EventManager.Initialize();
 }
예제 #15
0
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            if (chb_fuera_de_servicio.Checked || chb_vida_util.Checked)
            {
                if (chb_vida_util.Checked)
                {
                    SqlCommand cmd1 = Database.createCommand("[MACACO_NOT_NULL].AgregarBajaCruceroDefinitivo");
                    cmd1.Parameters.Add("@idCrucero", SqlDbType.Int).Value = crucero.cruc_id;
                    cmd1.Parameters.Add("@baja_cruc_fecha_fuera_servicio_definitiva", SqlDbType.DateTime2).Value = txt_fecha_baja_definitiva.Text;
                    Database.executeProcedure(cmd1);

                    MessageBox.Show("El  crucero fue dado de baja definitivo");
                    this.Close();
                }
                else if (chb_fuera_de_servicio.Checked)
                {
                    SqlCommand cmd2 = Database.createCommand("[MACACO_NOT_NULL].AgregarBajaCrucero");
                    cmd2.Parameters.Add("@idCrucero", SqlDbType.Int).Value = crucero.cruc_id;
                    cmd2.Parameters.Add("@baja_cruc_fecha_fuera_servicio", SqlDbType.DateTime2).Value    = txt_fecha_fuera_servicio.Text;
                    cmd2.Parameters.Add("@baja_cruc_fecha_reinicio_servicio", SqlDbType.DateTime2).Value = txt_fecha_reinicio_servicio.Text;
                    cmd2.Parameters.Add("@motivo", SqlDbType.NVarChar).Value = txt_motivo.Text;


                    Database.executeProcedure(cmd2);

                    MessageBox.Show("El  crucero fue dado de baja temporal");
                    this.Close();
                }


                if ("Reemplazar crucero por otro".Equals(ConfigurationManager.AppSettings["ESTRATEGIA_BAJA_CRUCERO"]))
                {
                    SqlCommand reemplazarCrucero = Database.createCommand("[MACACO_NOT_NULL].IdCruceroRemplazante");
                    reemplazarCrucero.Parameters.Add("@cruc_id", SqlDbType.Int).Value          = crucero.cruc_id;
                    reemplazarCrucero.Parameters.Add("@fechaDesde", SqlDbType.DateTime2).Value = ConfigurationUtils.Today();
                    int?cruceroDeReemplazo = Database.executeProcedure(reemplazarCrucero);
                    if (cruceroDeReemplazo.HasValue)
                    {
                        SqlCommand reemplazarCrucero2 = Database.createCommand("[MACACO_NOT_NULL].ReemplazarCrucero");
                        reemplazarCrucero2.Parameters.Add("@idCruceroInactivo", SqlDbType.Int).Value     = crucero.cruc_id;
                        reemplazarCrucero2.Parameters.Add("@idCruceroReemplazante", SqlDbType.Int).Value = cruceroDeReemplazo;
                        Database.executeProcedure(reemplazarCrucero2);
                        MessageBox.Show("El  crucero fue reemplazado con exito");
                    }
                    else
                    {
                        new FormAlta(crucero).Show();
                    }
                }
                else if ("Cancelar todos los pasajes".Equals(ConfigurationManager.AppSettings["ESTRATEGIA_BAJA_CRUCERO"]))
                {
                    SqlCommand cancelarTodosPasajes = Database.createCommand("[MACACO_NOT_NULL].CancelarPasajes");
                    cancelarTodosPasajes.Parameters.Add("@idCrucero", SqlDbType.Int).Value = crucero.cruc_id;
                    Database.executeProcedure(cancelarTodosPasajes);

                    MessageBox.Show("Se cancelaron todos los pasajes");
                }
                else
                {
                    MessageBox.Show("No se eligio ninguna opcion para los pasajes");
                }
            }
            else
            {
                MessageBox.Show("No se eligio ninguna opcion para los pasajes");
            }
        }
예제 #16
0
        protected override LayerDocument GetLayerDocumentCore()
        {
            string path = ConfigurationUtils.GetConfigFilePath(_templateLayer);

            return(LayerUtils.CreateLayerDocument(path));
        }
예제 #17
0
 /// <summary>
 /// Awake is called before Start
 /// </summary>
 void Awake()
 {
     // initialize configuration utils
     ConfigurationUtils.Initialize();
 }
    /// <summary>
    /// Awake is called before Start
    /// </summary>
    ///

    void Awake()
    {
        // initialize screen utils
        ScreenUtils.Initialize();
        ConfigurationUtils.Initialize();
    }
예제 #19
0
        /// <summary>
        /// Builds the result properties.
        /// </summary>
        /// <param name="resultMapId">The result map id.</param>
        /// <param name="resultMapConfig">The result map config.</param>
        /// <param name="resultClass">The result class.</param>
        /// <param name="prefix">The prefix.</param>
        /// <param name="suffix">The suffix.</param>
        /// <param name="dataExchangeFactory">The data exchange factory.</param>
        /// <param name="waitResultPropertyResolution">The wait result property resolution.</param>
        /// <returns></returns>
        private static ResultPropertyCollection BuildResultProperties(
            string resultMapId,
            IConfiguration resultMapConfig,
            Type resultClass,
            string prefix,
            string suffix,
            DataExchangeFactory dataExchangeFactory,
            WaitResultPropertyResolution waitResultPropertyResolution)
        {
            ResultPropertyCollection properties = new ResultPropertyCollection();
            //获取result节点的集合配置信息
            ConfigurationCollection resultsConfig = resultMapConfig.Children.Find(ConfigConstants.ELEMENT_RESULT);

            for (int i = 0; i < resultsConfig.Count; i++)
            {
                ResultProperty mapping = null;
                try
                {
                    mapping = ResultPropertyDeSerializer.Deserialize(resultsConfig[i], resultClass, prefix, suffix, dataExchangeFactory);
                }
                catch (Exception e)
                {
                    throw new ConfigurationException("In ResultMap (" + resultMapId + ") can't build the result property: " + ConfigurationUtils.GetStringAttribute(resultsConfig[i].Attributes, ConfigConstants.ATTRIBUTE_PROPERTY) + ". Cause " + e.Message, e);
                }
                if (mapping.NestedResultMapName.Length > 0)//resultMapping属性如果有值 此处一般会有
                {
                    //添加到DefaultModelBuilder中的ResultPropertyCollection nestedProperties集合中
                    waitResultPropertyResolution(mapping);
                }
                properties.Add(mapping);
            }

            return(properties);
        }
예제 #20
0
 // triggers calculation of screen space
 private void Awake()
 {
     ScreenUtils.Initialize();
     ConfigurationUtils.Initialize();
 }
예제 #21
0
 public GBApiContext()
     : base(ConfigurationUtils.GetConnectionString(), null)
 {
     // Uncomment for debugging purposes only
     // Console.WriteLine($"GBApiContext () => {Configuration.GetConnectionString()}");
 }