Exemplo n.º 1
0
        public int UpdateProductBOMStatusByBOMID(ProductBOM obj)
        {
            string sql = @"Update [ProductBOM] Set
                             [Status]=@Status
                          Where BOMID=@BOMID";

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

            SqlParameter pBOMID = new SqlParameter("BOMID", Convert2DBnull(obj.BOMID));

            pBOMID.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pBOMID);

            SqlParameter pProductCode = new SqlParameter("ProductCode", Convert2DBnull(obj.ProductCode));

            pProductCode.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pProductCode);

            SqlParameter pStatus = new SqlParameter("Status", Convert2DBnull(obj.Status));

            pStatus.SqlDbType = SqlDbType.Bit;
            cmd.Parameters.Add(pStatus);

            return(cmd.ExecuteNonQuery());
        }
Exemplo n.º 2
0
        public List <ProductBOM> LoadProductBOMByID(ProductBOM obj)
        {
            string sql = @"Select 
                              [ID]
                             ,[BOMID]
                             ,[ProductCode]
                             ,[Status]
                             ,[Created]
                             ,[CreatedBy]
                       From [ProductBOM] With(NoLock) Where ID=@ID";

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

            SqlParameter pID = new SqlParameter("ID", Convert2DBnull(obj.ID));

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

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

            try
            {
                while (dr.Read())
                {
                    ProductBOM iret = new ProductBOM();
                    if (!Convert.IsDBNull(dr["ID"]))
                    {
                        iret.ID = (int)dr["ID"];
                    }
                    if (!Convert.IsDBNull(dr["BOMID"]))
                    {
                        iret.BOMID = (string)dr["BOMID"];
                    }
                    if (!Convert.IsDBNull(dr["ProductCode"]))
                    {
                        iret.ProductCode = (string)dr["ProductCode"];
                    }
                    if (!Convert.IsDBNull(dr["Status"]))
                    {
                        iret.Status = (bool)dr["Status"];
                    }
                    if (!Convert.IsDBNull(dr["Created"]))
                    {
                        iret.Created = (DateTime)dr["Created"];
                    }
                    if (!Convert.IsDBNull(dr["CreatedBy"]))
                    {
                        iret.CreatedBy = (string)dr["CreatedBy"];
                    }
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
Exemplo n.º 3
0
        public List <ProductBOM> LoadProductBOMs()
        {
            string sql = @"Select 
                              [ID]
                             ,[BOMID]
                             ,[ProductCode]
                             ,[Status]
                             ,[Created]
                             ,[CreatedBy]
                       From [ProductBOM] With(NoLock)";

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

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

            try
            {
                while (dr.Read())
                {
                    ProductBOM iret = new ProductBOM();
                    if (!Convert.IsDBNull(dr["ID"]))
                    {
                        iret.ID = (int)dr["ID"];
                    }
                    if (!Convert.IsDBNull(dr["BOMID"]))
                    {
                        iret.BOMID = (string)dr["BOMID"];
                    }
                    if (!Convert.IsDBNull(dr["ProductCode"]))
                    {
                        iret.ProductCode = (string)dr["ProductCode"];
                    }
                    if (!Convert.IsDBNull(dr["Status"]))
                    {
                        iret.Status = (bool)dr["Status"];
                    }
                    if (!Convert.IsDBNull(dr["Created"]))
                    {
                        iret.Created = (DateTime)dr["Created"];
                    }
                    if (!Convert.IsDBNull(dr["CreatedBy"]))
                    {
                        iret.CreatedBy = (string)dr["CreatedBy"];
                    }
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
Exemplo n.º 4
0
        public int InsertProductBOM(ProductBOM obj)
        {
            string sql = @"Insert Into [ProductBOM](
                             [BOMID]
                             ,[ProductCode]
                             ,[Status]
                             ,[Created]
                             ,[CreatedBy]
            )Values (
                             @BOMID
                             ,@ProductCode
                             ,@Status
                             ,@Created
                             ,@CreatedBy
                    )";

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

            SqlParameter pBOMID = new SqlParameter("BOMID", Convert2DBnull(obj.BOMID));

            pBOMID.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pBOMID);

            SqlParameter pProductCode = new SqlParameter("ProductCode", Convert2DBnull(obj.ProductCode));

            pProductCode.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pProductCode);

            SqlParameter pStatus = new SqlParameter("Status", Convert2DBnull(obj.Status));

            pStatus.SqlDbType = SqlDbType.Bit;
            cmd.Parameters.Add(pStatus);

            SqlParameter pCreated = new SqlParameter("Created", Convert2DBnull(obj.Created));

            pCreated.SqlDbType = SqlDbType.DateTime;
            cmd.Parameters.Add(pCreated);

            SqlParameter pCreatedBy = new SqlParameter("CreatedBy", Convert2DBnull(obj.CreatedBy));

            pCreatedBy.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pCreatedBy);

            return(cmd.ExecuteNonQuery());
        }
Exemplo n.º 5
0
        public int UpdateProductBOMByID(ProductBOM obj)
        {
            string sql = @"Update [ProductBOM] Set
                              [BOMID]=@BOMID
                             ,[ProductCode]=@ProductCode
                             ,[Status]=@Status
                             ,[Created]=@Created
                             ,[CreatedBy]=@CreatedBy
                          Where ID=@ID";

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

            SqlParameter pID = new SqlParameter("ID", Convert2DBnull(obj.ID));

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

            SqlParameter pBOMID = new SqlParameter("BOMID", Convert2DBnull(obj.BOMID));

            pBOMID.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pBOMID);

            SqlParameter pProductCode = new SqlParameter("ProductCode", Convert2DBnull(obj.ProductCode));

            pProductCode.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pProductCode);

            SqlParameter pStatus = new SqlParameter("Status", Convert2DBnull(obj.Status));

            pStatus.SqlDbType = SqlDbType.Bit;
            cmd.Parameters.Add(pStatus);

            SqlParameter pCreated = new SqlParameter("Created", Convert2DBnull(obj.Created));

            pCreated.SqlDbType = SqlDbType.DateTime;
            cmd.Parameters.Add(pCreated);

            SqlParameter pCreatedBy = new SqlParameter("CreatedBy", Convert2DBnull(obj.CreatedBy));

            pCreatedBy.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pCreatedBy);

            return(cmd.ExecuteNonQuery());
        }