Esempio n. 1
0
        //**************************************************************************
        ///    <Description>
        ///       This method uses to add data to PRO_ChangeCategoryMatrix
        ///    </Description>
        ///    <Inputs>
        ///        PRO_ChangeCategoryMatrixVO
        ///    </Inputs>
        ///    <Outputs>
        ///       newly inserted primarkey value
        ///    </Outputs>
        ///    <Returns>
        ///       void
        ///    </Returns>
        ///    <Authors>
        ///       HungLa
        ///    </Authors>
        ///    <History>
        ///       Wednesday, September 07, 2005
        ///    </History>
        ///    <Notes>
        ///    </Notes>
        //**************************************************************************


        public void Add(object pobjObjectVO)
        {
            const string METHOD_NAME = THIS + ".Add()";

            OleDbConnection oconPCS = null;
            OleDbCommand    ocmdPCS = null;

            try
            {
                PRO_ChangeCategoryMatrixVO objObject = (PRO_ChangeCategoryMatrixVO)pobjObjectVO;
                string strSql = String.Empty;
                Utils  utils  = new Utils();
                oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString);
                ocmdPCS = new OleDbCommand("", oconPCS);

                strSql = "INSERT INTO PRO_ChangeCategoryMatrix("
                         + PRO_ChangeCategoryMatrixTable.SOURCEPRODUCTID_FLD + ","
                         + PRO_ChangeCategoryMatrixTable.DESTPRODUCTID_FLD + ","
                         + PRO_ChangeCategoryMatrixTable.CHANGETIME_FLD + ","
                         + PRO_ChangeCategoryMatrixTable.CHANGECATEGORYMASTERID_FLD + ")"
                         + "VALUES(?,?,?,?)";

                ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ChangeCategoryMatrixTable.SOURCEPRODUCTID_FLD, OleDbType.Integer));
                ocmdPCS.Parameters[PRO_ChangeCategoryMatrixTable.SOURCEPRODUCTID_FLD].Value = objObject.SourceProductID;

                ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ChangeCategoryMatrixTable.DESTPRODUCTID_FLD, OleDbType.Integer));
                ocmdPCS.Parameters[PRO_ChangeCategoryMatrixTable.DESTPRODUCTID_FLD].Value = objObject.DestProductID;

                ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ChangeCategoryMatrixTable.CHANGETIME_FLD, OleDbType.Integer));
                ocmdPCS.Parameters[PRO_ChangeCategoryMatrixTable.CHANGETIME_FLD].Value = objObject.ChangeTime;

                ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ChangeCategoryMatrixTable.CHANGECATEGORYMASTERID_FLD, OleDbType.Integer));
                ocmdPCS.Parameters[PRO_ChangeCategoryMatrixTable.CHANGECATEGORYMASTERID_FLD].Value = objObject.ChangeCategoryMasterID;



                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();
                    }
                }
            }
        }
Esempio n. 2
0
        //**************************************************************************
        ///    <Description>
        ///       This method uses to get data from PRO_ChangeCategoryMatrix
        ///    </Description>
        ///    <Inputs>
        ///        ID
        ///    </Inputs>
        ///    <Outputs>
        ///       PRO_ChangeCategoryMatrixVO
        ///    </Outputs>
        ///    <Returns>
        ///       PRO_ChangeCategoryMatrixVO
        ///    </Returns>
        ///    <Authors>
        ///       HungLa
        ///    </Authors>
        ///    <History>
        ///       Wednesday, September 07, 2005
        ///    </History>
        ///    <Notes>
        ///    </Notes>
        //**************************************************************************

        public object GetObjectVO(int pintID)
        {
            const string METHOD_NAME = THIS + ".GetObjectVO()";
            DataSet      dstPCS      = new DataSet();

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

            try
            {
                string strSql = String.Empty;
                strSql = "SELECT "
                         + PRO_ChangeCategoryMatrixTable.CHANGECATEGORYMATRIXID_FLD + ","
                         + PRO_ChangeCategoryMatrixTable.SOURCEPRODUCTID_FLD + ","
                         + PRO_ChangeCategoryMatrixTable.DESTPRODUCTID_FLD + ","
                         + PRO_ChangeCategoryMatrixTable.CHANGETIME_FLD + ","
                         + PRO_ChangeCategoryMatrixTable.CHANGECATEGORYMASTERID_FLD
                         + " FROM " + PRO_ChangeCategoryMatrixTable.TABLE_NAME
                         + " WHERE " + PRO_ChangeCategoryMatrixTable.CHANGECATEGORYMATRIXID_FLD + "=" + pintID;

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

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

                PRO_ChangeCategoryMatrixVO objObject = new PRO_ChangeCategoryMatrixVO();

                while (odrPCS.Read())
                {
                    objObject.ChangeCategoryMatrixID = int.Parse(odrPCS[PRO_ChangeCategoryMatrixTable.CHANGECATEGORYMATRIXID_FLD].ToString().Trim());
                    objObject.SourceProductID        = int.Parse(odrPCS[PRO_ChangeCategoryMatrixTable.SOURCEPRODUCTID_FLD].ToString().Trim());
                    objObject.DestProductID          = int.Parse(odrPCS[PRO_ChangeCategoryMatrixTable.DESTPRODUCTID_FLD].ToString().Trim());
                    objObject.ChangeTime             = int.Parse(odrPCS[PRO_ChangeCategoryMatrixTable.CHANGETIME_FLD].ToString().Trim());
                    objObject.ChangeCategoryMasterID = int.Parse(odrPCS[PRO_ChangeCategoryMatrixTable.CHANGECATEGORYMASTERID_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();
                    }
                }
            }
        }