コード例 #1
0
ファイル: DMBase.cs プロジェクト: adv-hack/ETicketing
        private int UpdateCurrentValueForConfig(ModuleConfigurations objMConfigs)
        {
            int affectedRows = 0;

            object[]     parameters = null;
            DBObjectBase dbBase     = null;

            foreach (string tableName in objMConfigs.Select(x => x.ConfigurationItem.TableName).Distinct())
            {
                string className = Utilities.GetClassName(GlobalConstants.NS_DATAACCESS_DATAOBJECTS, tableName);
                parameters = new[] { settings };
                dbBase     = ReflectionUtils.CreateInstance(className, parameters);
                System.Collections.Generic.List <ConfigurationItem> configs = GetConfigurationItems(objMConfigs, tableName);
                if (dbBase.DBTypeForTable == DBObjectBase.DBType.SQLSERVER)
                {
                    affectedRows += dbBase.UpdateCurrentValue(configs);
                }
                else if (dbBase.DBTypeForTable == DBObjectBase.DBType.DB2)
                {
                    affectedRows += dbBase.UpdateCurrentValueDB2(configs);
                }
            }
            affectedRows += settings.DB2AccessQueue.Execute(settings);
            return(affectedRows);
        }
コード例 #2
0
ファイル: DMBase.cs プロジェクト: adv-hack/ETicketing
        private void ProcessHiddenFields(ModuleConfigurations MConfigs)
        {
            ModuleConfiguration objModuleConfig = null;

            foreach (DataRow row in dtHiddenFields.Rows)
            {
                objModuleConfig = MConfigs.Find(x => x.ConfigID == (string)row[FROM_COLUMN]);
                if (objModuleConfig != null)
                {
                    if ((string)row[RELATION_TYPE] == HiddenType.FOREIGN.ToString())
                    {
                        ModuleConfiguration toConfig = MConfigs.Where(c => c.ConfigID == (string)row[TO_COLUMN]).FirstOrDefault();
                        objModuleConfig.ConfigurationItem.UpdatedValue = toConfig.ConfigurationItem.UpdatedValue;
                    }
                    else if ((string)row[RELATION_TYPE] == HiddenType.DEFAULT.ToString())
                    {
                        // leaving MConfigs object as it is would work in this case
                        ModuleConfiguration DefaultConfig = MConfigs.Where(c => c.ConfigID == (string)row[FROM_COLUMN]).FirstOrDefault();
                        objModuleConfig.ConfigurationItem.UpdatedValue = DefaultConfig.ConfigurationItem.DefaultValue;
                    }
                    else if ((string)row[RELATION_TYPE] == HiddenType.SETTING.ToString())
                    {
                        //Dim toConfig As ModuleConfiguration = MConfigs.Where(Function(c) c.ConfigID = row(TO_COLUMN)).FirstOrDefault
                        //settings.GetPropertyValue("BUSINESSUNIT")
                        objModuleConfig.ConfigurationItem.UpdatedValue = settings.GetPropertyValue(System.Convert.ToString(row[PROPERTY_NAME]));
                    }
                }
            }
        }
コード例 #3
0
ファイル: DMBase.cs プロジェクト: adv-hack/ETicketing
        // New Method to add row in data table, from and to GUID and Type (Foreign)
        public DMBase(ref DESettings settings, bool initialiseData)
        {
            // VBConversions Note: Non-static class variable initialization is below.  Class variables cannot be initially assigned non-static values in C#.
            DefaultTabType = DisplayTabsType.HORIZONTAL.ToString();
            this.settings  = settings;
            dtHiddenFields = new DataTable();
            dtHiddenFields.Columns.Add(new System.Data.DataColumn(FROM_COLUMN));
            dtHiddenFields.Columns.Add(new System.Data.DataColumn(TO_COLUMN));
            dtHiddenFields.Columns.Add(new System.Data.DataColumn(RELATION_TYPE));
            dtHiddenFields.Columns.Add(new System.Data.DataColumn(PROPERTY_NAME));
            SetHiddenFields();
            MConfigs          = new ModuleConfigurations();
            tbl_config_detail = new tbl_config_detail(settings);
            tbl_table_detail  = new tbl_table_detail(settings);
            SetValues();
            tbl_page_text_lang textLang = new tbl_page_text_lang(ref settings);

            pageTexts          = textLang.GetTextsForPage(settings.DefaultBusinessUnit, "SystemDefaults.aspx");
            DisplayTabs        = new DisplayTabs(pageTexts);
            settings.PageTexts = pageTexts;
            AccordionGroup     = new AccordionGroup(pageTexts);
            if (initialiseData)
            {
                SetModuleConfiguration();
            }
        }
コード例 #4
0
ファイル: DMBase.cs プロジェクト: adv-hack/ETicketing
        private List <ConfigurationItem> GetConfigurationItems(ModuleConfigurations objMConfigs, string tableName)
        {
            var configs = new System.Collections.Generic.List <ConfigurationItem>();

            foreach (ModuleConfiguration mConfig in objMConfigs.Where(x => x.ConfigurationItem.TableName == tableName))
            {
                configs.Add(mConfig.ConfigurationItem);
            }
            return(configs);
        }
コード例 #5
0
ファイル: DMBase.cs プロジェクト: adv-hack/ETicketing
        private ModuleConfigurations GetUpdatedMConfigs(ModuleConfigurations MConfigs)
        {
            ModuleConfigurations updatedMConfig = new ModuleConfigurations();

            foreach (ModuleConfiguration config in MConfigs)
            {
                bool isEqual = string.Equals(config.ConfigurationItem.CurrentValue.Trim(), config.ConfigurationItem.UpdatedValue.Trim(), StringComparison.CurrentCultureIgnoreCase);
                if (!isEqual)
                {
                    updatedMConfig.Add(config);
                }
            }
            return(updatedMConfig);
        }
コード例 #6
0
ファイル: DMBase.cs プロジェクト: adv-hack/ETicketing
        public int Update()
        {
            ModuleConfigurations updatedMConfig = GetUpdatedMConfigs(MConfigs);

            return(UpdateCurrentValueForConfig(updatedMConfig));
        }