Пример #1
0
        public List <TransportDetail> LoadTransportDetails()
        {
            string     sql = @"SELECT [TransportID]
				, [OrderID]
				 FROM [BE_TransportDetail]"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            List <TransportDetail> ret = new List <TransportDetail>();
            SqlDataReader          dr  = cmd.ExecuteReader();

            try
            {
                while (dr.Read())
                {
                    TransportDetail iret = new TransportDetail();
                    if (!Convert.IsDBNull(dr["TransportID"]))
                    {
                        iret.TransportID = (Guid)dr["TransportID"];
                    }
                    if (!Convert.IsDBNull(dr["OrderID"]))
                    {
                        iret.OrderID = (Guid)dr["OrderID"];
                    }
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
Пример #2
0
        public int LoadTransportDetailByTransportID_OrderID(TransportDetail obj)
        {
            string     sql = @"SELECT [TransportID]
				, [OrderID]
                FROM [BE_TransportDetail] WITH(NOLOCK) WHERE [TransportID]=@TransportID AND [OrderID]=@OrderID"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pTransportID = new SqlParameter("TransportID", Convert2DBnull(obj.TransportID));

            pTransportID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pTransportID);

            SqlParameter pOrderID = new SqlParameter("OrderID", Convert2DBnull(obj.OrderID));

            pOrderID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pOrderID);

            int           ret = 0;
            SqlDataReader dr  = cmd.ExecuteReader();

            try
            {
                while (dr.Read())
                {
                    if (!Convert.IsDBNull(dr["TransportID"]))
                    {
                        obj.TransportID = (Guid)dr["TransportID"];
                    }
                    if (!Convert.IsDBNull(dr["OrderID"]))
                    {
                        obj.OrderID = (Guid)dr["OrderID"];
                    }
                    ret += 1;
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
Пример #3
0
        public int InsertTransportDetail(TransportDetail obj)
        {
            string     sql = @"INSERT INTO[BE_TransportDetail]([TransportID]
				, [OrderID]
				) VALUES(@TransportID
				, @OrderID
				)"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pTransportID = new SqlParameter("TransportID", Convert2DBnull(obj.TransportID));

            pTransportID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pTransportID);

            SqlParameter pOrderID = new SqlParameter("OrderID", Convert2DBnull(obj.OrderID));

            pOrderID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pOrderID);

            return(cmd.ExecuteNonQuery());
        }
Пример #4
0
        public List <TransportDetail> LoadTransportDetailsByOrderID(Guid orderID)
        {
            string     sql = @"SELECT [TransportID]
				, [OrderID]
				 FROM [BE_TransportDetail] WHERE [OrderID]=@OrderID"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pOrderID = new SqlParameter("OrderID", orderID);

            pOrderID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pOrderID);

            List <TransportDetail> ret = new List <TransportDetail>();
            SqlDataReader          dr  = cmd.ExecuteReader();

            try
            {
                while (dr.Read())
                {
                    TransportDetail iret = new TransportDetail();
                    if (!Convert.IsDBNull(dr["TransportID"]))
                    {
                        iret.TransportID = (Guid)dr["TransportID"];
                    }
                    if (!Convert.IsDBNull(dr["OrderID"]))
                    {
                        iret.OrderID = (Guid)dr["OrderID"];
                    }
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }