コード例 #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
 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);
     }
 }