Example #1
0
        public List <WarehouseInDetail> LoadWarehouseInDetailsByLocationID(Guid locationID)
        {
            string     sql = @"SELECT [DetailID]
				, [InID]
				, [MaterialID]
				, [Qty]
				, [Price]
				, [LocationID]
				 FROM [BE_WarehouseInDetail] WHERE [LocationID]=@LocationID"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pLocationID = new SqlParameter("LocationID", locationID);

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

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

            try
            {
                while (dr.Read())
                {
                    WarehouseInDetail iret = new WarehouseInDetail();
                    if (!Convert.IsDBNull(dr["DetailID"]))
                    {
                        iret.DetailID = (Guid)dr["DetailID"];
                    }
                    if (!Convert.IsDBNull(dr["InID"]))
                    {
                        iret.InID = (Guid)dr["InID"];
                    }
                    if (!Convert.IsDBNull(dr["MaterialID"]))
                    {
                        iret.MaterialID = (Guid)dr["MaterialID"];
                    }
                    if (!Convert.IsDBNull(dr["Qty"]))
                    {
                        iret.Qty = (decimal)dr["Qty"];
                    }
                    if (!Convert.IsDBNull(dr["Price"]))
                    {
                        iret.Price = (decimal)dr["Price"];
                    }
                    if (!Convert.IsDBNull(dr["LocationID"]))
                    {
                        iret.LocationID = (Guid)dr["LocationID"];
                    }
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
Example #2
0
        public int LoadWarehouseInDetailByDetailID(WarehouseInDetail obj)
        {
            string     sql = @"SELECT [DetailID]
				, [InID]
				, [MaterialID]
				, [Qty]
				, [Price]
				, [LocationID]
                FROM [BE_WarehouseInDetail] WITH(NOLOCK) WHERE [DetailID]=@DetailID"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pDetailID = new SqlParameter("DetailID", Convert2DBnull(obj.DetailID));

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

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

            try
            {
                while (dr.Read())
                {
                    if (!Convert.IsDBNull(dr["DetailID"]))
                    {
                        obj.DetailID = (Guid)dr["DetailID"];
                    }
                    if (!Convert.IsDBNull(dr["InID"]))
                    {
                        obj.InID = (Guid)dr["InID"];
                    }
                    if (!Convert.IsDBNull(dr["MaterialID"]))
                    {
                        obj.MaterialID = (Guid)dr["MaterialID"];
                    }
                    if (!Convert.IsDBNull(dr["Qty"]))
                    {
                        obj.Qty = (decimal)dr["Qty"];
                    }
                    if (!Convert.IsDBNull(dr["Price"]))
                    {
                        obj.Price = (decimal)dr["Price"];
                    }
                    if (!Convert.IsDBNull(dr["LocationID"]))
                    {
                        obj.LocationID = (Guid)dr["LocationID"];
                    }
                    ret += 1;
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
Example #3
0
        public List <WarehouseInDetail> LoadWarehouseInDetails()
        {
            string     sql = @"SELECT [DetailID]
				, [InID]
				, [MaterialID]
				, [Qty]
				, [Price]
				, [LocationID]
				 FROM [BE_WarehouseInDetail]"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

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

            try
            {
                while (dr.Read())
                {
                    WarehouseInDetail iret = new WarehouseInDetail();
                    if (!Convert.IsDBNull(dr["DetailID"]))
                    {
                        iret.DetailID = (Guid)dr["DetailID"];
                    }
                    if (!Convert.IsDBNull(dr["InID"]))
                    {
                        iret.InID = (Guid)dr["InID"];
                    }
                    if (!Convert.IsDBNull(dr["MaterialID"]))
                    {
                        iret.MaterialID = (Guid)dr["MaterialID"];
                    }
                    if (!Convert.IsDBNull(dr["Qty"]))
                    {
                        iret.Qty = (decimal)dr["Qty"];
                    }
                    if (!Convert.IsDBNull(dr["Price"]))
                    {
                        iret.Price = (decimal)dr["Price"];
                    }
                    if (!Convert.IsDBNull(dr["LocationID"]))
                    {
                        iret.LocationID = (Guid)dr["LocationID"];
                    }
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
Example #4
0
        public int InsertWarehouseInDetail(WarehouseInDetail obj)
        {
            string     sql = @"INSERT INTO[BE_WarehouseInDetail]([DetailID]
				, [InID]
				, [MaterialID]
				, [Qty]
				, [Price]
				, [LocationID]
				) VALUES(@DetailID
				, @InID
				, @MaterialID
				, @Qty
				, @Price
				, @LocationID
				)"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pDetailID = new SqlParameter("DetailID", Convert2DBnull(obj.DetailID));

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

            SqlParameter pInID = new SqlParameter("InID", Convert2DBnull(obj.InID));

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

            SqlParameter pMaterialID = new SqlParameter("MaterialID", Convert2DBnull(obj.MaterialID));

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

            SqlParameter pQty = new SqlParameter("Qty", Convert2DBnull(obj.Qty));

            pQty.SqlDbType = SqlDbType.Decimal;
            cmd.Parameters.Add(pQty);

            SqlParameter pPrice = new SqlParameter("Price", Convert2DBnull(obj.Price));

            pPrice.SqlDbType = SqlDbType.Decimal;
            cmd.Parameters.Add(pPrice);

            SqlParameter pLocationID = new SqlParameter("LocationID", Convert2DBnull(obj.LocationID));

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

            return(cmd.ExecuteNonQuery());
        }
Example #5
0
        public int UpdateWarehouseInDetailByDetailID(WarehouseInDetail obj)
        {
            string     sql = @"UPDATE [BE_WarehouseInDetail] SET [InID]=@InID
				, [MaterialID]=@MaterialID
				, [Qty]=@Qty
				, [Price]=@Price
				, [LocationID]=@LocationID
                WHERE [DetailID]=@DetailID"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pInID = new SqlParameter("InID", Convert2DBnull(obj.InID));

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

            SqlParameter pMaterialID = new SqlParameter("MaterialID", Convert2DBnull(obj.MaterialID));

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

            SqlParameter pQty = new SqlParameter("Qty", Convert2DBnull(obj.Qty));

            pQty.SqlDbType = SqlDbType.Decimal;
            cmd.Parameters.Add(pQty);

            SqlParameter pPrice = new SqlParameter("Price", Convert2DBnull(obj.Price));

            pPrice.SqlDbType = SqlDbType.Decimal;
            cmd.Parameters.Add(pPrice);

            SqlParameter pLocationID = new SqlParameter("LocationID", Convert2DBnull(obj.LocationID));

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

            SqlParameter pDetailID = new SqlParameter("DetailID", Convert2DBnull(obj.DetailID));

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

            return(cmd.ExecuteNonQuery());
        }