コード例 #1
0
        public void Update(object pobjObjecVO)
        {
            const string METHOD_NAME = THIS + ".Update()";

            SO_ConfirmShipDetailVO objObject = (SO_ConfirmShipDetailVO)pobjObjecVO;


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

            try
            {
                string strSql = String.Empty;
                Utils  utils  = new Utils();
                oconPCS = new OleDbConnection(Utils.Instance.OleDbConnectionString);
                ocmdPCS = new OleDbCommand(strSql, oconPCS);
                strSql  = "UPDATE SO_ConfirmShipDetail SET "
                          + SO_ConfirmShipDetailTable.CONFIRMSHIPMASTERID_FLD + "=   ?" + ","
                          + SO_ConfirmShipDetailTable.SALEORDERDETAILID_FLD + "=   ?" + ","
                          + SO_ConfirmShipDetailTable.DELIVERYSCHEDULEID_FLD + "=   ?" + ","
                          + SO_ConfirmShipDetailTable.PRODUCTID_FLD + "=  ?"
                          + " WHERE " + SO_ConfirmShipDetailTable.CONFIRMSHIPDETAILID_FLD + "= ?";

                ocmdPCS.Parameters.Add(new OleDbParameter(SO_ConfirmShipDetailTable.CONFIRMSHIPMASTERID_FLD, OleDbType.Integer));
                ocmdPCS.Parameters[SO_ConfirmShipDetailTable.CONFIRMSHIPMASTERID_FLD].Value = objObject.ConfirmShipMasterID;

                ocmdPCS.Parameters.Add(new OleDbParameter(SO_ConfirmShipDetailTable.SALEORDERDETAILID_FLD, OleDbType.Integer));
                ocmdPCS.Parameters[SO_ConfirmShipDetailTable.SALEORDERDETAILID_FLD].Value = objObject.SaleOrderDetailID;

                ocmdPCS.Parameters.Add(new OleDbParameter(SO_ConfirmShipDetailTable.DELIVERYSCHEDULEID_FLD, OleDbType.Integer));
                ocmdPCS.Parameters[SO_ConfirmShipDetailTable.DELIVERYSCHEDULEID_FLD].Value = objObject.DeliveryScheduleID;

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

                ocmdPCS.Parameters.Add(new OleDbParameter(SO_ConfirmShipDetailTable.CONFIRMSHIPDETAILID_FLD, OleDbType.Integer));
                ocmdPCS.Parameters[SO_ConfirmShipDetailTable.CONFIRMSHIPDETAILID_FLD].Value = objObject.ConfirmShipDetailID;


                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();
                    }
                }
            }
        }
コード例 #2
0
        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 "
                         + SO_ConfirmShipDetailTable.CONFIRMSHIPDETAILID_FLD + ","
                         + SO_ConfirmShipDetailTable.CONFIRMSHIPMASTERID_FLD + ","
                         + SO_ConfirmShipDetailTable.SALEORDERDETAILID_FLD + ","
                         + SO_ConfirmShipDetailTable.DELIVERYSCHEDULEID_FLD + ","
                         + SO_ConfirmShipDetailTable.PRODUCTID_FLD
                         + " FROM " + SO_ConfirmShipDetailTable.TABLE_NAME
                         + " WHERE " + SO_ConfirmShipDetailTable.CONFIRMSHIPDETAILID_FLD + "=" + pintID;

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

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

                SO_ConfirmShipDetailVO objObject = new SO_ConfirmShipDetailVO();

                while (odrPCS.Read())
                {
                    objObject.ConfirmShipDetailID = int.Parse(odrPCS[SO_ConfirmShipDetailTable.CONFIRMSHIPDETAILID_FLD].ToString().Trim());
                    objObject.ConfirmShipMasterID = int.Parse(odrPCS[SO_ConfirmShipDetailTable.CONFIRMSHIPMASTERID_FLD].ToString().Trim());
                    objObject.SaleOrderDetailID   = int.Parse(odrPCS[SO_ConfirmShipDetailTable.SALEORDERDETAILID_FLD].ToString().Trim());
                    objObject.DeliveryScheduleID  = int.Parse(odrPCS[SO_ConfirmShipDetailTable.DELIVERYSCHEDULEID_FLD].ToString().Trim());
                    objObject.ProductID           = int.Parse(odrPCS[SO_ConfirmShipDetailTable.PRODUCTID_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();
                    }
                }
            }
        }