Пример #1
0
        public int InsertProductWarehouseMain(ProductWarehouseMain obj)
        {
            string     sql = @"INSERT INTO[BE_ProductWarehouseMain]([InID]
				, [BillNo]
				, [OrderID]
				, [Created]
				, [CreatedBy]
				, [Modified]
				, [ModifiedBy]
				) VALUES(@InID
				, @BillNo
				, @OrderID
				, @Created
				, @CreatedBy
				, @Modified
				, @ModifiedBy
				)"                ;
            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 pBillNo = new SqlParameter("BillNo", Convert2DBnull(obj.BillNo));

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

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

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

            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);

            SqlParameter pModified = new SqlParameter("Modified", Convert2DBnull(obj.Modified));

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

            SqlParameter pModifiedBy = new SqlParameter("ModifiedBy", Convert2DBnull(obj.ModifiedBy));

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

            return(cmd.ExecuteNonQuery());
        }
Пример #2
0
        public List <ProductWarehouseMain> LoadProductWarehouseMainsByModifiedBy(string modifiedBy)
        {
            string     sql = @"SELECT [InID]
				, [BillNo]
				, [OrderID]
				, [Created]
				, [CreatedBy]
				, [Modified]
				, [ModifiedBy]
				 FROM [BE_ProductWarehouseMain] WHERE [ModifiedBy]=@ModifiedBy"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pModifiedBy = new SqlParameter("ModifiedBy", modifiedBy);

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

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

            try
            {
                while (dr.Read())
                {
                    ProductWarehouseMain iret = new ProductWarehouseMain();
                    if (!Convert.IsDBNull(dr["InID"]))
                    {
                        iret.InID = (Guid)dr["InID"];
                    }
                    iret.BillNo = dr["BillNo"].ToString();
                    if (!Convert.IsDBNull(dr["OrderID"]))
                    {
                        iret.OrderID = (Guid)dr["OrderID"];
                    }
                    if (!Convert.IsDBNull(dr["Created"]))
                    {
                        iret.Created = (DateTime)dr["Created"];
                    }
                    iret.CreatedBy = dr["CreatedBy"].ToString();
                    if (!Convert.IsDBNull(dr["Modified"]))
                    {
                        iret.Modified = (DateTime)dr["Modified"];
                    }
                    iret.ModifiedBy = dr["ModifiedBy"].ToString();
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
Пример #3
0
        public int LoadProductWarehouseMainByInID(ProductWarehouseMain obj)
        {
            string     sql = @"SELECT [InID]
				, [BillNo]
				, [OrderID]
				, [Created]
				, [CreatedBy]
				, [Modified]
				, [ModifiedBy]
                FROM [BE_ProductWarehouseMain] WITH(NOLOCK) WHERE [InID]=@InID"                ;
            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);

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

            try
            {
                while (dr.Read())
                {
                    if (!Convert.IsDBNull(dr["InID"]))
                    {
                        obj.InID = (Guid)dr["InID"];
                    }
                    obj.BillNo = dr["BillNo"].ToString();
                    if (!Convert.IsDBNull(dr["OrderID"]))
                    {
                        obj.OrderID = (Guid)dr["OrderID"];
                    }
                    if (!Convert.IsDBNull(dr["Created"]))
                    {
                        obj.Created = (DateTime)dr["Created"];
                    }
                    obj.CreatedBy = dr["CreatedBy"].ToString();
                    if (!Convert.IsDBNull(dr["Modified"]))
                    {
                        obj.Modified = (DateTime)dr["Modified"];
                    }
                    obj.ModifiedBy = dr["ModifiedBy"].ToString();
                    ret           += 1;
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
Пример #4
0
        public int UpdateProductWarehouseMainByInID(ProductWarehouseMain obj)
        {
            string     sql = @"UPDATE [BE_ProductWarehouseMain] SET [BillNo]=@BillNo
				, [OrderID]=@OrderID
				, [Created]=@Created
				, [CreatedBy]=@CreatedBy
				, [Modified]=@Modified
				, [ModifiedBy]=@ModifiedBy
                WHERE [InID]=@InID"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pBillNo = new SqlParameter("BillNo", Convert2DBnull(obj.BillNo));

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

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

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

            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);

            SqlParameter pModified = new SqlParameter("Modified", Convert2DBnull(obj.Modified));

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

            SqlParameter pModifiedBy = new SqlParameter("ModifiedBy", Convert2DBnull(obj.ModifiedBy));

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

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

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

            return(cmd.ExecuteNonQuery());
        }