Beispiel #1
0
        //**************************************************************************
        ///    <Description>
        ///       This method uses to update data to sys_ReportDrillDown
        ///    </Description>
        ///    <Inputs>
        ///       sys_ReportDrillDownVO
        ///    </Inputs>
        ///    <Outputs>
        ///
        ///    </Outputs>
        ///    <Returns>
        ///
        ///    </Returns>
        ///    <Authors>
        ///       HungLa
        ///    </Authors>
        ///    <History>
        ///       09-Dec-2004
        ///       12/Oct/2005 Thachnn: fix bug injection
        ///    </History>
        ///    <Notes>
        ///    </Notes>
        //**************************************************************************
        public void Update(object pobjObjecVO)
        {
            const string METHOD_NAME = THIS + ".Update()";

            sys_ReportDrillDownVO objObject = (sys_ReportDrillDownVO)pobjObjecVO;

            //prepare value for parameters
            OleDbConnection oconPCS = null;
            OleDbCommand    ocmdPCS = null;

            try
            {
                string strSql = String.Empty;

                strSql = "UPDATE " + sys_ReportDrillDownTable.TABLE_NAME + " SET "
                         + sys_ReportDrillDownTable.DETAILREPORTID_FLD + "=   ?" + ","
                         + sys_ReportDrillDownTable.MASTERPARA_FLD + "=   ?" + ","
                         + sys_ReportDrillDownTable.DETAILPARA_FLD + "=   ?" + ","
                         + sys_ReportDrillDownTable.FROMCOLUMN_FLD + "=   ?" + ","
                         + sys_ReportDrillDownTable.PARAORDER_FLD + "=  ?"
                         + " WHERE " + sys_ReportDrillDownTable.MASTERREPORTID_FLD + "= ?";

                Utils utils = new Utils();
                oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString);
                ocmdPCS = new OleDbCommand(strSql, oconPCS);

                ocmdPCS.Parameters.Add(new OleDbParameter(sys_ReportDrillDownTable.DETAILREPORTID_FLD, OleDbType.VarWChar));
                ocmdPCS.Parameters[sys_ReportDrillDownTable.DETAILREPORTID_FLD].Value = objObject.DetailReportID;

                ocmdPCS.Parameters.Add(new OleDbParameter(sys_ReportDrillDownTable.MASTERPARA_FLD, OleDbType.VarWChar));
                ocmdPCS.Parameters[sys_ReportDrillDownTable.MASTERPARA_FLD].Value = objObject.MasterPara;

                ocmdPCS.Parameters.Add(new OleDbParameter(sys_ReportDrillDownTable.DETAILPARA_FLD, OleDbType.VarWChar));
                ocmdPCS.Parameters[sys_ReportDrillDownTable.DETAILPARA_FLD].Value = objObject.DetailPara;

                ocmdPCS.Parameters.Add(new OleDbParameter(sys_ReportDrillDownTable.FROMCOLUMN_FLD, OleDbType.Boolean));
                ocmdPCS.Parameters[sys_ReportDrillDownTable.FROMCOLUMN_FLD].Value = objObject.FromColumn;

                ocmdPCS.Parameters.Add(new OleDbParameter(sys_ReportDrillDownTable.PARAORDER_FLD, OleDbType.Integer));
                ocmdPCS.Parameters[sys_ReportDrillDownTable.PARAORDER_FLD].Value = objObject.ParaOrder;

                ocmdPCS.Parameters.Add(new OleDbParameter(sys_ReportDrillDownTable.MASTERREPORTID_FLD, OleDbType.VarWChar));
                ocmdPCS.Parameters[sys_ReportDrillDownTable.MASTERREPORTID_FLD].Value = objObject.MasterReportID;

                ocmdPCS.CommandText = strSql;
                ocmdPCS.Connection.Open();
                ocmdPCS.ExecuteNonQuery();
            }
            catch (OleDbException ex)
            {
                if (ex.Errors[1].NativeError == ErrorCode.SQLDUPLICATE_KEYCODE)
                {
                    throw new PCSDBException(ErrorCode.DUPLICATE_KEY, METHOD_NAME, ex);
                }
                else
                {
                    throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME, ex);
                }
            }

            catch (InvalidOperationException ex)
            {
                throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME, ex);
            }
            catch (Exception ex)
            {
                throw new PCSDBException(ErrorCode.OTHER_ERROR, METHOD_NAME, ex);
            }

            finally
            {
                if (oconPCS != null)
                {
                    if (oconPCS.State != ConnectionState.Closed)
                    {
                        oconPCS.Close();
                    }
                }
            }
        }
Beispiel #2
0
        //**************************************************************************
        ///    <Description>
        ///       This method uses to get data from sys_ReportDrillDown
        ///    </Description>
        ///    <Inputs>
        ///        MasterID, DetailID
        ///    </Inputs>
        ///    <Outputs>
        ///       ArrayList
        ///    </Outputs>
        ///    <Returns>
        ///       ArrayList
        ///    </Returns>
        ///    <Authors>
        ///       DungLA
        ///    </Authors>
        ///    <History>
        ///       06-Jan-2005
        ///       12/Oct/2005 Thachnn: fix bug injection
        ///    </History>
        ///    <Notes>
        ///    </Notes>
        //**************************************************************************
        public ArrayList GetObjectVOs(string pstrMasterID, string pstrDetailID)
        {
            const string METHOD_NAME = THIS + ".GetObjectVO()";

            ArrayList       arrObjectVOs = new ArrayList();
            OleDbConnection oconPCS      = null;
            OleDbCommand    ocmdPCS      = null;
            OleDbDataReader odrPCS       = null;

            try
            {
                string strSql = String.Empty;
                strSql = "SELECT "
                         + sys_ReportDrillDownTable.MASTERREPORTID_FLD + ","
                         + sys_ReportDrillDownTable.DETAILREPORTID_FLD + ","
                         + sys_ReportDrillDownTable.MASTERPARA_FLD + ","
                         + sys_ReportDrillDownTable.DETAILPARA_FLD + ","
                         + sys_ReportDrillDownTable.FROMCOLUMN_FLD + ","
                         + sys_ReportDrillDownTable.PARAORDER_FLD
                         + " FROM " + sys_ReportDrillDownTable.TABLE_NAME
                         + " WHERE " + sys_ReportDrillDownTable.MASTERREPORTID_FLD + "= ? "                // + pstrMasterID + "'"
                         + " AND " + sys_ReportDrillDownTable.DETAILREPORTID_FLD + "= ? ";                 //+ pstrDetailID + "'";

                Utils utils = new Utils();
                oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString);

                ocmdPCS = new OleDbCommand(strSql, oconPCS);
                ocmdPCS.Parameters.Add(new OleDbParameter(sys_ReportDrillDownTable.MASTERREPORTID_FLD, OleDbType.VarWChar));
                ocmdPCS.Parameters[sys_ReportDrillDownTable.MASTERREPORTID_FLD].Value = pstrMasterID;
                ocmdPCS.Parameters.Add(new OleDbParameter(sys_ReportDrillDownTable.DETAILREPORTID_FLD, OleDbType.VarWChar));
                ocmdPCS.Parameters[sys_ReportDrillDownTable.DETAILREPORTID_FLD].Value = pstrDetailID;
                ocmdPCS.Connection.Open();
                odrPCS = ocmdPCS.ExecuteReader();

                while (odrPCS.Read())
                {
                    sys_ReportDrillDownVO voDrillDown = new sys_ReportDrillDownVO();

                    voDrillDown.MasterReportID = odrPCS[sys_ReportDrillDownTable.MASTERREPORTID_FLD].ToString().Trim();
                    voDrillDown.DetailReportID = odrPCS[sys_ReportDrillDownTable.DETAILREPORTID_FLD].ToString().Trim();
                    voDrillDown.MasterPara     = odrPCS[sys_ReportDrillDownTable.MASTERPARA_FLD].ToString().Trim();
                    voDrillDown.DetailPara     = odrPCS[sys_ReportDrillDownTable.DETAILPARA_FLD].ToString().Trim();
                    voDrillDown.FromColumn     = Boolean.Parse(odrPCS[sys_ReportDrillDownTable.FROMCOLUMN_FLD].ToString().Trim());
                    voDrillDown.ParaOrder      = int.Parse(odrPCS[sys_ReportDrillDownTable.PARAORDER_FLD].ToString().Trim());

                    arrObjectVOs.Add(voDrillDown);
                }
                arrObjectVOs.TrimToSize();
                return(arrObjectVOs);
            }
            catch (OleDbException ex)
            {
                throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME, ex);
            }

            catch (Exception ex)
            {
                throw new PCSDBException(ErrorCode.OTHER_ERROR, METHOD_NAME, ex);
            }

            finally
            {
                if (oconPCS != null)
                {
                    if (oconPCS.State != ConnectionState.Closed)
                    {
                        oconPCS.Close();
                    }
                }
            }
        }
Beispiel #3
0
        //**************************************************************************
        ///    <Description>
        ///       This method uses to get data from sys_ReportDrillDown
        ///    </Description>
        ///    <Inputs>
        ///        ID
        ///    </Inputs>
        ///    <Outputs>
        ///       sys_ReportDrillDownVO
        ///    </Outputs>
        ///    <Returns>
        ///       sys_ReportDrillDownVO
        ///    </Returns>
        ///    <Authors>
        ///       HungLa
        ///    </Authors>
        ///    <History>
        ///       Monday, December 27, 2004
        ///       12/Oct/2005 Thachnn: fix bug injection
        ///    </History>
        ///    <Notes>
        ///    </Notes>
        //**************************************************************************
        public object GetObjectVO(int pintID)
        {
            const string METHOD_NAME = THIS + ".GetObjectVO()";

            OleDbDataReader odrPCS  = null;
            OleDbConnection oconPCS = null;
            OleDbCommand    ocmdPCS = null;

            try
            {
                string strSql = String.Empty;
                strSql = "SELECT "
                         + sys_ReportDrillDownTable.MASTERREPORTID_FLD + ","
                         + sys_ReportDrillDownTable.DETAILREPORTID_FLD + ","
                         + sys_ReportDrillDownTable.MASTERPARA_FLD + ","
                         + sys_ReportDrillDownTable.DETAILPARA_FLD + ","
                         + sys_ReportDrillDownTable.FROMCOLUMN_FLD + ","
                         + sys_ReportDrillDownTable.PARAORDER_FLD
                         + " FROM " + sys_ReportDrillDownTable.TABLE_NAME
                         + " WHERE " + sys_ReportDrillDownTable.MASTERREPORTID_FLD + "=" + pintID;

                Utils utils = new Utils();
                oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString);
                ocmdPCS = new OleDbCommand(strSql, oconPCS);

                ocmdPCS.Connection.Open();
                odrPCS = ocmdPCS.ExecuteReader();

                sys_ReportDrillDownVO objObject = new sys_ReportDrillDownVO();

                while (odrPCS.Read())
                {
                    objObject.MasterReportID = odrPCS[sys_ReportDrillDownTable.MASTERREPORTID_FLD].ToString().Trim();
                    objObject.DetailReportID = odrPCS[sys_ReportDrillDownTable.DETAILREPORTID_FLD].ToString().Trim();
                    objObject.MasterPara     = odrPCS[sys_ReportDrillDownTable.MASTERPARA_FLD].ToString().Trim();
                    objObject.DetailPara     = odrPCS[sys_ReportDrillDownTable.DETAILPARA_FLD].ToString().Trim();
                    objObject.FromColumn     = Boolean.Parse(odrPCS[sys_ReportDrillDownTable.FROMCOLUMN_FLD].ToString().Trim());
                    objObject.ParaOrder      = int.Parse(odrPCS[sys_ReportDrillDownTable.PARAORDER_FLD].ToString().Trim());
                }
                return(objObject);
            }
            catch (OleDbException ex)
            {
                throw new PCSDBException(ErrorCode.ERROR_DB, METHOD_NAME, ex);
            }

            catch (Exception ex)
            {
                throw new PCSDBException(ErrorCode.OTHER_ERROR, METHOD_NAME, ex);
            }

            finally
            {
                if (oconPCS != null)
                {
                    if (oconPCS.State != ConnectionState.Closed)
                    {
                        oconPCS.Close();
                    }
                }
            }
        }