Beispiel #1
0
        //**************************************************************************
        ///    <Description>
        ///       This method uses to add data to IV_MiscellaneousIssueDetail
        ///    </Description>
        ///    <Inputs>
        ///        IV_MiscellaneousIssueDetailVO
        ///    </Inputs>
        ///    <Outputs>
        ///       newly inserted primarkey value
        ///    </Outputs>
        ///    <Returns>
        ///       void
        ///    </Returns>
        ///    <Authors>
        ///       HungLa
        ///    </Authors>
        ///    <History>
        ///       Monday, December 19, 2005
        ///    </History>
        ///    <Notes>
        ///    </Notes>
        //**************************************************************************
        public void Add(object pobjObjectVO)
        {
            const string METHOD_NAME = THIS + ".Add()";

            OleDbConnection oconPCS = null;
            OleDbCommand    ocmdPCS = null;

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

                strSql = "INSERT INTO IV_MiscellaneousIssueDetail("
                         + IV_MiscellaneousIssueDetailTable.LOT_FLD + ","
                         + IV_MiscellaneousIssueDetailTable.QUANTITY_FLD + ","
                         + IV_MiscellaneousIssueDetailTable.MISCELLANEOUSISSUEMASTERID_FLD + ","
                         + IV_MiscellaneousIssueDetailTable.PRODUCTID_FLD + ","
                         + IV_MiscellaneousIssueDetailTable.STOCKUMID_FLD + ")"
                         + "VALUES(?,?,?,?,?)";

                ocmdPCS.Parameters.Add(new OleDbParameter(IV_MiscellaneousIssueDetailTable.LOT_FLD, OleDbType.WChar));
                ocmdPCS.Parameters[IV_MiscellaneousIssueDetailTable.LOT_FLD].Value = objObject.Lot;

                ocmdPCS.Parameters.Add(new OleDbParameter(IV_MiscellaneousIssueDetailTable.QUANTITY_FLD, OleDbType.Decimal));
                ocmdPCS.Parameters[IV_MiscellaneousIssueDetailTable.QUANTITY_FLD].Value = objObject.Quantity;

                ocmdPCS.Parameters.Add(new OleDbParameter(IV_MiscellaneousIssueDetailTable.MISCELLANEOUSISSUEMASTERID_FLD, OleDbType.Integer));
                ocmdPCS.Parameters[IV_MiscellaneousIssueDetailTable.MISCELLANEOUSISSUEMASTERID_FLD].Value = objObject.MiscellaneousIssueMasterID;

                ocmdPCS.Parameters.Add(new OleDbParameter(IV_MiscellaneousIssueDetailTable.PRODUCTID_FLD, OleDbType.Integer));
                ocmdPCS.Parameters[IV_MiscellaneousIssueDetailTable.PRODUCTID_FLD].Value = objObject.ProductID;

                ocmdPCS.Parameters.Add(new OleDbParameter(IV_MiscellaneousIssueDetailTable.STOCKUMID_FLD, OleDbType.Integer));
                ocmdPCS.Parameters[IV_MiscellaneousIssueDetailTable.STOCKUMID_FLD].Value = objObject.StockUMID;


                ocmdPCS.CommandText = strSql;
                ocmdPCS.Connection.Open();
                ocmdPCS.ExecuteNonQuery();
            }
            catch (OleDbException ex)
            {
                if (ex.Errors.Count > 1)
                {
                    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 IV_MiscellaneousIssueDetail
        ///    </Description>
        ///    <Inputs>
        ///        ID
        ///    </Inputs>
        ///    <Outputs>
        ///       IV_MiscellaneousIssueDetailVO
        ///    </Outputs>
        ///    <Returns>
        ///       IV_MiscellaneousIssueDetailVO
        ///    </Returns>
        ///    <Authors>
        ///       HungLa
        ///    </Authors>
        ///    <History>
        ///       Monday, December 19, 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 "
                         + IV_MiscellaneousIssueDetailTable.MISCELLANEOUSISSUEDETAILID_FLD + ","
                         + IV_MiscellaneousIssueDetailTable.LOT_FLD + ","
                         + IV_MiscellaneousIssueDetailTable.QUANTITY_FLD + ","
                         + IV_MiscellaneousIssueDetailTable.MISCELLANEOUSISSUEMASTERID_FLD + ","
                         + IV_MiscellaneousIssueDetailTable.PRODUCTID_FLD + ","
                         + IV_MiscellaneousIssueDetailTable.STOCKUMID_FLD
                         + " FROM " + IV_MiscellaneousIssueDetailTable.TABLE_NAME
                         + " WHERE " + IV_MiscellaneousIssueDetailTable.MISCELLANEOUSISSUEDETAILID_FLD + "=" + pintID;

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

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

                IV_MiscellaneousIssueDetailVO objObject = new IV_MiscellaneousIssueDetailVO();

                while (odrPCS.Read())
                {
                    objObject.MiscellaneousIssueDetailID = int.Parse(odrPCS[IV_MiscellaneousIssueDetailTable.MISCELLANEOUSISSUEDETAILID_FLD].ToString().Trim());
                    objObject.Lot      = odrPCS[IV_MiscellaneousIssueDetailTable.LOT_FLD].ToString().Trim();
                    objObject.Quantity = Decimal.Parse(odrPCS[IV_MiscellaneousIssueDetailTable.QUANTITY_FLD].ToString().Trim());
                    objObject.MiscellaneousIssueMasterID = int.Parse(odrPCS[IV_MiscellaneousIssueDetailTable.MISCELLANEOUSISSUEMASTERID_FLD].ToString().Trim());
                    objObject.ProductID = int.Parse(odrPCS[IV_MiscellaneousIssueDetailTable.PRODUCTID_FLD].ToString().Trim());
                    objObject.StockUMID = int.Parse(odrPCS[IV_MiscellaneousIssueDetailTable.STOCKUMID_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();
                    }
                }
            }
        }