Exemple #1
0
        public List <ProductionOrderComponent> LoadProductionOrderComponents()
        {
            string sql = @"Select 
                              [ProductionID]
                             ,[ComponentID]
                       From [BE_ProductionOrderComponent] With(NoLock)";

            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

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

            try
            {
                while (dr.Read())
                {
                    ProductionOrderComponent iret = new ProductionOrderComponent();
                    if (!Convert.IsDBNull(dr["ProductionID"]))
                    {
                        iret.ProductionID = (Guid)dr["ProductionID"];
                    }
                    if (!Convert.IsDBNull(dr["ComponentID"]))
                    {
                        iret.ComponentID = (int)dr["ComponentID"];
                    }
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
Exemple #2
0
        public int UpdateProductionOrderComponentByProductionID(ProductionOrderComponent obj)
        {
            string sql = @"Update [BE_ProductionOrderComponent] Set
                              [ComponentID]=@ComponentID
                          Where ProductionID=@ProductionID";

            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pProductionID = new SqlParameter("ProductionID", Convert2DBnull(obj.ProductionID));

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

            SqlParameter pComponentID = new SqlParameter("ComponentID", Convert2DBnull(obj.ComponentID));

            pComponentID.SqlDbType = SqlDbType.Int;
            cmd.Parameters.Add(pComponentID);

            return(cmd.ExecuteNonQuery());
        }
Exemple #3
0
        public List <ProductionOrderComponent> LoadProductionOrderComponentByProductionID(ProductionOrderComponent obj)
        {
            string sql = @"Select 
                              [ProductionID]
                             ,[ComponentID]
                       From [BE_ProductionOrderComponent] With(NoLock) Where ProductionID=@ProductionID";

            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pProductionID = new SqlParameter("ProductionID", Convert2DBnull(obj.ProductionID));

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

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

            try
            {
                while (dr.Read())
                {
                    ProductionOrderComponent iret = new ProductionOrderComponent();
                    if (!Convert.IsDBNull(dr["ProductionID"]))
                    {
                        iret.ProductionID = (Guid)dr["ProductionID"];
                    }
                    if (!Convert.IsDBNull(dr["ComponentID"]))
                    {
                        iret.ComponentID = (int)dr["ComponentID"];
                    }
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
Exemple #4
0
        public int InsertProductionOrderComponent(ProductionOrderComponent obj)
        {
            string sql = @"Insert Into [BE_ProductionOrderComponent](
                              [ProductionID]
                             ,[ComponentID]
            )Values (
                              @ProductionID
                             ,@ComponentID
                    )";

            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pProductionID = new SqlParameter("ProductionID", Convert2DBnull(obj.ProductionID));

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

            SqlParameter pComponentID = new SqlParameter("ComponentID", Convert2DBnull(obj.ComponentID));

            pComponentID.SqlDbType = SqlDbType.Int;
            cmd.Parameters.Add(pComponentID);

            return(cmd.ExecuteNonQuery());
        }