Пример #1
0
        public virtual void Delete()
        {
            int affectedRows = 0;

            if (!string.IsNullOrWhiteSpace(DEList.TableName))
            {
                DBObjectBase dataObj = DMFactory.GetDBObject(DEList.TableName, settings);

                if (dataObj.DBTypeForTable == DBObjectBase.DBType.SQLSERVER)
                {
                    affectedRows = dataObj.DeleteCurrentValues();
                }
                else if (dataObj.DBTypeForTable == DBObjectBase.DBType.DB2)
                {
                    affectedRows += dataObj.DeleteCurrentValuesDB2();
                }
            }
            else if (!string.IsNullOrWhiteSpace(DEList.FunctionName))
            {
                DBObjectBase modObject = DMFactory.GetModuleObject(DEList.ModuleObjectName, settings);
                affectedRows = modObject.DeleteCurrentValues();
            }
            affectedRows += settings.DB2AccessQueue.Execute(settings);

            if (affectedRows > 0)
            {
                DEList.StatusMessage = "Delete succeeded";
                DEList.HasError      = false;
            }
            else
            {
                DEList.StatusMessage = "Delete failed";
                DEList.HasError      = true;
            }
        }
Пример #2
0
        public void GetCurrentValueForConfig()
        {
            string className = null;

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

            foreach (string tableName in MConfigs.Select(x => x.ConfigurationItem.TableName).Distinct())
            {
                className  = Utilities.GetClassName(GlobalConstants.NS_DATAACCESS_DATAOBJECTS, tableName);
                parameters = new[] { settings };
                try
                {
                    dbBase = ReflectionUtils.CreateInstance(className, parameters);
                    if (dbBase != null)
                    {
                        System.Collections.Generic.List <ConfigurationItem> configs = GetConfigurationItems(MConfigs, tableName);
                        dbBase.RetrieveCurrentValues(configs);
                    }
                }
                catch (Exception ex)
                {
                    Utilities.InsertErrorLog(settings, this.GetType().BaseType.Name, System.Reflection.MethodBase.GetCurrentMethod().Name, GlobalConstants.LOG_ERROR_CODE, settings.BusinessUnit, "", "", "", ex.StackTrace.ToString(), ex.Message);
                }
            }
        }
Пример #3
0
        private int InsertCurrentValueForConfig(ref string key)
        {
            int affectedRows = 0;

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

            foreach (string tableName in MConfigs.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(MConfigs, tableName);
                if (dbBase.DBTypeForTable == DBObjectBase.DBType.SQLSERVER)
                {
                    affectedRows += dbBase.InsertCurrentValue(configs, null, ref key);
                }
                else if (dbBase.DBTypeForTable == DBObjectBase.DBType.DB2)
                {
                    affectedRows += dbBase.InsertCurrentValueDB2(configs, null);
                }
            }
            affectedRows += settings.DB2AccessQueue.Execute(settings);
            return(affectedRows);
        }
Пример #4
0
        public static DBObjectBase GetModuleObject(string moduleObjectName, DESettings settings)
        {
            string className = Utilities.GetClassName(GlobalConstants.NS_DATAACCESS_MODULEOBJECTS, moduleObjectName);

            object[]     parameters = new object[] { settings };
            DBObjectBase obj        = ReflectionUtils.CreateInstance(className, parameters);

            return(obj);
        }
Пример #5
0
 protected virtual void RetrieveData()
 {
     if (!string.IsNullOrWhiteSpace(DEList.TableName))
     {
         DBObjectBase dataObj   = DMFactory.GetDBObject(DEList.TableName, settings);
         DataTable    dtForList = dataObj.RetrieveDTForList();
         DEList.Data = GetDEEntities(DEList.DataColumns, DEList.VariableKeyColumns, dtForList);
     }
     else if (!string.IsNullOrWhiteSpace(DEList.FunctionName))
     {
         //function name goes to module object and call the function and get the customized datatable which may be from mroe than one table
         DBObjectBase modObject = DMFactory.GetModuleObject(DEList.ModuleObjectName, settings);
         DataTable    dtForList = modObject.RetrieveDTForList();
         DEList.Data = GetDEEntities(DEList.DataColumns, DEList.VariableKeyColumns, dtForList);
     }
 }