コード例 #1
0
        protected virtual void UpdateDatabase(DataSet ds)
        {
            //Update the underlying database using a dataset
            //as opposed to individual commands.
            ICustomDataAdapter da = DataAccess.GetCustomDataAdapter();

            da.SelectCommand = SelectCommand;
            da.UpdateCommand = UpdateCommand;
            da.DeleteCommand = DeleteCommand;
            da.InsertCommand = InsertCommand;

            try
            {
                da.Update(ds, m_dataTableName);
            }
            catch (System.Exception ex)
            {
                if (ex.Message.IndexOf(m_userContentionErrorCode) > -1)
                {
                    //User contention error, perculate the error to the calling
                    //application as such.
                    throw new DBConcurrencyException(ErrorStringContention, ex);
                }

                System.ApplicationException newEx = new ApplicationException("Error in performing add operation on: " +
                                                                             "Portfolio", ex);
                //Perculate our exception up the call stack.
                throw newEx;
            }
            finally
            {
                da.Dispose();
            }
        }
コード例 #2
0
        public DataSet GetDetailsByPk(System.Decimal locId)
        {
            ICustomDataAdapter da      = DataAccess.GetCustomDataAdapter();
            DataSet            results = new DataSet(); //make sure we use a loosely typed dataset as there will be more columns returned than just from the hedge table

            return(results);
        }
コード例 #3
0
        public DataSet GetByPkDataSet(System.Decimal locId)
        {
            ICustomDataAdapter da      = DataAccess.GetCustomDataAdapter();
            DataSet            results = new DataSet(); //make sure we use a loosely typed dataset as there will be more columns returned than just from the hedge table

            IDbCommand       cmd;
            IDbDataParameter param;

            cmd         = SelectByPkCommand;
            param       = (IDbDataParameter)cmd.Parameters["locId"];
            param.Value = locId;

            param       = (IDbDataParameter)cmd.Parameters["UserId"];
            param.Value = CurrentUser;

            try
            {
                da.SelectCommand = cmd;
                da.Fill(results);
            }
            catch (Exception ex)
            {
                //If we get an error opening the result for the stored
                //procedure, we likely have a a farily major problem.
                //Permissions issues or something of the kind.  We will
                //percolate the call back up the stack so the front end
                //may report it and thus the user can log the error
                //for repair.
                throw ex;
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Connection.Close();
                    cmd.Connection.Dispose();
                    cmd.Dispose();
                    cmd = null;
                }

                if (da != null)
                {
                    da.Dispose();
                    da = null;
                }
            }
            return(results);
        }
コード例 #4
0
        public DataSet SearchLessonsLearned()
        {
            ICustomDataAdapter da      = DataAccess.GetCustomDataAdapter();
            DataSet            results = new DataSet(); //make sure we use a loosely typed dataset as there will be more columns returned than just from the hedge table

            IDbCommand cmd;

            cmd             = DBConnection.CreateCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "LL_LEARNED_PKG.SEARCH_RECORD";

            CreateParameter(ref cmd, "userId", ParameterDirection.Input, DbType.String, "USER_ID");
            CreateParameter(ref cmd, "pkeywords", ParameterDirection.Input, DbType.String, "KEY_WORDS");
            CreateParameter(ref cmd, "psbuids", ParameterDirection.Input, DbType.String, "SBU_IDS");
            CreateParameter(ref cmd, "pbuids", ParameterDirection.Input, DbType.String, "BU_IDS");
            CreateParameter(ref cmd, "pprojectids", ParameterDirection.Input, DbType.String, "PROJECT_IDS");
            CreateParameter(ref cmd, "pprocessids", ParameterDirection.Input, DbType.String, "PROCESS_IDS");
            CreateParameter(ref cmd, "pdisciplineids", ParameterDirection.Input, DbType.String, "DISCIPLINE_IDS");
            CreateParameter(ref cmd, "pstageids", ParameterDirection.Input, DbType.String, "STAGE_IDS");
            CreateParameter(ref cmd, "pcategoryids", ParameterDirection.Input, DbType.String, "CATEGORY_IDS");

            ((IDbDataParameter)cmd.Parameters["userId"]).Value         = CurrentUser;
            ((IDbDataParameter)cmd.Parameters["pkeywords"]).Value      = KeyWords.ToString();
            ((IDbDataParameter)cmd.Parameters["psbuids"]).Value        = SBUIds.ToString();
            ((IDbDataParameter)cmd.Parameters["pbuids"]).Value         = BUIds.ToString();
            ((IDbDataParameter)cmd.Parameters["pprojectids"]).Value    = ProjectIds.ToString();
            ((IDbDataParameter)cmd.Parameters["pprocessids"]).Value    = ProcessIds.ToString();
            ((IDbDataParameter)cmd.Parameters["pdisciplineids"]).Value = DisciplineIds.ToString();
            ((IDbDataParameter)cmd.Parameters["pstageids"]).Value      = StageIds.ToString();
            ((IDbDataParameter)cmd.Parameters["pcategoryids"]).Value   = CategoryIds.ToString();

            try
            {
                da.SelectCommand = cmd;
                da.Fill(results);
            }
            catch (Exception ex)
            {
                //If we get an error opening the result for the stored
                //procedure, we likely have a a farily major problem.
                //Permissions issues or something of the kind.  We will
                //percolate the call back up the stack so the front end
                //may report it and thus the user can log the error
                //for repair.
                throw ex;
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Connection.Close();
                    cmd.Connection.Dispose();
                    cmd.Dispose();
                    cmd = null;
                }

                if (da != null)
                {
                    da.Dispose();
                    da = null;
                }
            }

            return(results);
        }