/// <summary> /// This method uses to add data to PRO_ComponentScrapDetail /// </summary> /// <Inputs> /// PRO_ComponentScrapDetailVO /// </Inputs> /// <Returns> /// void /// </Returns> /// <History> /// Tuesday, June 07, 2005 /// </History> public void Add(object pobjObjectVO) { const string METHOD_NAME = THIS + ".Add()"; OleDbConnection oconPCS = null; OleDbCommand ocmdPCS = null; try { PRO_ComponentScrapDetailVO objObject = (PRO_ComponentScrapDetailVO)pobjObjectVO; string strSql = String.Empty; Utils utils = new Utils(); oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString); ocmdPCS = new OleDbCommand("", oconPCS); strSql = "INSERT INTO PRO_ComponentScrapDetail(" + PRO_ComponentScrapDetailTable.LOT_FLD + "," + PRO_ComponentScrapDetailTable.SERIAL_FLD + "," + PRO_ComponentScrapDetailTable.SCRAPQUANTITY_FLD + "," + PRO_ComponentScrapDetailTable.COMPONENTSCRAPMASTERID_FLD + "," + PRO_ComponentScrapDetailTable.WORKORDERMASTERID_FLD + "," + PRO_ComponentScrapDetailTable.WORKORDERDETAILID_FLD + "," + PRO_ComponentScrapDetailTable.COMPONENTID_FLD + "," + PRO_ComponentScrapDetailTable.PRODUCTID_FLD + "," + PRO_ComponentScrapDetailTable.LINE_FLD + "," + PRO_ComponentScrapDetailTable.WOROUTINGID_FLD + "," + PRO_ComponentScrapDetailTable.SCRAPREASONID_FLD + ")" + "VALUES(?,?,?,?,?,?,?,?,?,?)"; ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ComponentScrapDetailTable.LOT_FLD, OleDbType.VarWChar)); ocmdPCS.Parameters[PRO_ComponentScrapDetailTable.LOT_FLD].Value = objObject.Lot; ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ComponentScrapDetailTable.SERIAL_FLD, OleDbType.VarWChar)); ocmdPCS.Parameters[PRO_ComponentScrapDetailTable.SERIAL_FLD].Value = objObject.Serial; ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ComponentScrapDetailTable.SCRAPQUANTITY_FLD, OleDbType.Decimal)); ocmdPCS.Parameters[PRO_ComponentScrapDetailTable.SCRAPQUANTITY_FLD].Value = objObject.ScrapQuantity; ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ComponentScrapDetailTable.COMPONENTSCRAPMASTERID_FLD, OleDbType.Integer)); ocmdPCS.Parameters[PRO_ComponentScrapDetailTable.COMPONENTSCRAPMASTERID_FLD].Value = objObject.ComponentScrapMasterID; ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ComponentScrapDetailTable.WORKORDERMASTERID_FLD, OleDbType.Integer)); ocmdPCS.Parameters[PRO_ComponentScrapDetailTable.WORKORDERMASTERID_FLD].Value = objObject.WorkOrderMasterID; ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ComponentScrapDetailTable.WORKORDERDETAILID_FLD, OleDbType.Integer)); ocmdPCS.Parameters[PRO_ComponentScrapDetailTable.WORKORDERDETAILID_FLD].Value = objObject.WorkOrderDetailID; ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ComponentScrapDetailTable.COMPONENTID_FLD, OleDbType.Integer)); ocmdPCS.Parameters[PRO_ComponentScrapDetailTable.COMPONENTID_FLD].Value = objObject.ComponentID; ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ComponentScrapDetailTable.PRODUCTID_FLD, OleDbType.Integer)); ocmdPCS.Parameters[PRO_ComponentScrapDetailTable.PRODUCTID_FLD].Value = objObject.ProductID; ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ComponentScrapDetailTable.LINE_FLD, OleDbType.Integer)); ocmdPCS.Parameters[PRO_ComponentScrapDetailTable.LINE_FLD].Value = objObject.Line; ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ComponentScrapDetailTable.WOROUTINGID_FLD, OleDbType.Integer)); ocmdPCS.Parameters[PRO_ComponentScrapDetailTable.LINE_FLD].Value = objObject.WORoutingID; ocmdPCS.Parameters.Add(new OleDbParameter(PRO_ComponentScrapDetailTable.SCRAPREASONID_FLD, OleDbType.Integer)); ocmdPCS.Parameters[PRO_ComponentScrapDetailTable.SCRAPREASONID_FLD].Value = objObject.ScrapReasonID; 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(); } } } }
/// <summary> /// This method uses to add data to PRO_ComponentScrapDetail /// </summary> /// <Inputs> /// PRO_ComponentScrapDetailVO /// </Inputs> /// <Returns> /// void /// </Returns> /// <History> /// Tuesday, June 07, 2005 /// </History> 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_ComponentScrapDetailTable.COMPONENTSCRAPDETAILID_FLD + "," + PRO_ComponentScrapDetailTable.LOT_FLD + "," + PRO_ComponentScrapDetailTable.SERIAL_FLD + "," + PRO_ComponentScrapDetailTable.SCRAPQUANTITY_FLD + "," + PRO_ComponentScrapDetailTable.COMPONENTSCRAPMASTERID_FLD + "," + PRO_ComponentScrapDetailTable.WORKORDERMASTERID_FLD + "," + PRO_ComponentScrapDetailTable.WORKORDERDETAILID_FLD + "," + PRO_ComponentScrapDetailTable.COMPONENTID_FLD + "," + PRO_ComponentScrapDetailTable.PRODUCTID_FLD + "," + PRO_ComponentScrapDetailTable.LINE_FLD + "," + PRO_ComponentScrapDetailTable.WOROUTINGID_FLD + "," + PRO_ComponentScrapDetailTable.SCRAPREASONID_FLD + " FROM " + PRO_ComponentScrapDetailTable.TABLE_NAME + " WHERE " + PRO_ComponentScrapDetailTable.COMPONENTSCRAPDETAILID_FLD + "=" + pintID; Utils utils = new Utils(); oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString); ocmdPCS = new OleDbCommand(strSql, oconPCS); ocmdPCS.Connection.Open(); odrPCS = ocmdPCS.ExecuteReader(); PRO_ComponentScrapDetailVO objObject = new PRO_ComponentScrapDetailVO(); while (odrPCS.Read()) { objObject.ComponentScrapDetailID = int.Parse(odrPCS[PRO_ComponentScrapDetailTable.COMPONENTSCRAPDETAILID_FLD].ToString().Trim()); objObject.Lot = odrPCS[PRO_ComponentScrapDetailTable.LOT_FLD].ToString().Trim(); objObject.Serial = odrPCS[PRO_ComponentScrapDetailTable.SERIAL_FLD].ToString().Trim(); objObject.ScrapQuantity = Decimal.Parse(odrPCS[PRO_ComponentScrapDetailTable.SCRAPQUANTITY_FLD].ToString().Trim()); objObject.ComponentScrapMasterID = int.Parse(odrPCS[PRO_ComponentScrapDetailTable.COMPONENTSCRAPMASTERID_FLD].ToString().Trim()); objObject.WorkOrderMasterID = int.Parse(odrPCS[PRO_ComponentScrapDetailTable.WORKORDERMASTERID_FLD].ToString().Trim()); objObject.WorkOrderDetailID = int.Parse(odrPCS[PRO_ComponentScrapDetailTable.WORKORDERDETAILID_FLD].ToString().Trim()); objObject.ComponentID = int.Parse(odrPCS[PRO_ComponentScrapDetailTable.COMPONENTID_FLD].ToString().Trim()); objObject.ProductID = int.Parse(odrPCS[PRO_ComponentScrapDetailTable.PRODUCTID_FLD].ToString().Trim()); objObject.Line = int.Parse(odrPCS[PRO_ComponentScrapDetailTable.LINE_FLD].ToString().Trim()); objObject.WORoutingID = int.Parse(odrPCS[PRO_ComponentScrapDetailTable.WOROUTINGID_FLD].ToString().Trim()); objObject.ScrapReasonID = int.Parse(odrPCS[PRO_ComponentScrapDetailTable.SCRAPREASONID_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(); } } } }