示例#1
0
    protected void btnSaveAll_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }

        Int64 SupplierId = SuppliersSessionHelper.SupplierId();

        (new Query(SupplierProduct.TableSchema).Where(SupplierProduct.Columns.SupplierId, SupplierId).Delete()).Execute();
        ProductCollection pcol = ProductCollection.FetchByQuery(new Query(Product.TableSchema).Where(Product.Columns.IsDeleted, false));

        foreach (Product item in pcol)
        {
            SupplierProduct sp = new SupplierProduct();
            sp.SupplierId = SupplierId;
            sp.ProductId  = item.ProductId;
            sp.Gift       = "";
            sp.Save();
            check_price_deviation(sp);
        }
        LoadItem();
    }