本文整理汇总了C#中Supplier.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Supplier.Save方法的具体用法?C# Supplier.Save怎么用?C# Supplier.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Supplier
的用法示例。
在下文中一共展示了Supplier.Save方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Demonstrate_DbReferenceFetch
public void Demonstrate_DbReferenceFetch()
{
var supplier = new Supplier { Name = "Acme" };
supplier.Save();
var product = new Product {
Name = "Shovel",
Price = "17.50",
Sku = "a3k4j22je9",
Weight = "11",
Supplier = new DbReference<Supplier>(supplier.Id)
};
product.Save();
var fetched = Product.GetById(product.Id);
Assert.AreEqual(supplier.Id, fetched.GetRef(x => x.Supplier).Id);
}
示例2: GivenManyModelsSavedInSuccession_TheConnectionPool_ShouldHandleAppropriately
public void GivenManyModelsSavedInSuccession_TheConnectionPool_ShouldHandleAppropriately()
{
Supplier.DeleteAll();
for (var i = 0; i < 100; i++) {
var supplier = new Supplier {Name = "Supplier" + i, Address = "Address" + i};
supplier.Save();
}
var suppliers = Supplier.All().ToList();
Assert.AreEqual(100, suppliers.Count());
}
示例3: GivenManyModelsSavedAndReadInSuccession_TheConnectionPool_ShouldHandleAppropriately
public void GivenManyModelsSavedAndReadInSuccession_TheConnectionPool_ShouldHandleAppropriately()
{
Supplier.DeleteAll();
var allFound = true;
for (var i = 0; i < 100; i++) {
var supplier = new Supplier { Name = "Supplier" + i, Address = "Address" + i };
supplier.Save();
var fetched = Supplier.GetById(supplier.Id);
if (fetched == null || fetched.Name != supplier.Name) { allFound = false; }
}
Assert.True(allFound);
}
示例4: GivenAModelWithADbReferenceProperty_FetchRef_ShouldReturnTheCorrectEntity
public void GivenAModelWithADbReferenceProperty_FetchRef_ShouldReturnTheCorrectEntity()
{
var supplier = new Supplier { Name = "Acme" };
supplier.Save();
var product = new Product {
Name = "Hammer",
Price = "10",
Supplier = new DbReference<Supplier>(supplier.Id)
};
product.Save();
var fetchedRef = product.GetRef(x => x.Supplier);
Assert.IsNotNull(fetchedRef);
Assert.AreEqual(fetchedRef.Name, supplier.Name);
}
示例5: btnSupplierSave_Click
private void btnSupplierSave_Click(object sender, EventArgs e)
{
if (supplierValidation.Validate())
{
Supplier sup = new Supplier();
if (supplierId != 0)
sup.LoadByPrimaryKey(supplierId);
else
sup.AddNew();
sup.CompanyInfo = cboCompanyInfo.EditValue.ToString();
sup.CompanyName = txtCompanyName.Text;
sup.Address = txtAddress.Text;
sup.ContactPerson = txtContactPerson.Text;
sup.Telephone = txtTelephone.Text;
sup.IsActive = ckIsActive.Checked;
sup.Mobile = txtMobile.Text;
sup.Email = txtEmail.Text;
sup.Save();
sup.LoadAll();
PopulateSupplier(sup);
ResetSupplier();
}
else
{
txtCompanyName.BackColor = Color.FromArgb(251, 214, 214);
}
}
示例6: Insert
public void Insert(string CompanyName,string ContactName,string ContactTitle,string Address,string City,string Region,string PostalCode,string Country,string Phone,string Fax,string HomePage)
{
Supplier item = new Supplier();
item.CompanyName = CompanyName;
item.ContactName = ContactName;
item.ContactTitle = ContactTitle;
item.Address = Address;
item.City = City;
item.Region = Region;
item.PostalCode = PostalCode;
item.Country = Country;
item.Phone = Phone;
item.Fax = Fax;
item.HomePage = HomePage;
item.Save(UserName);
}
示例7: Update
public void Update(int SupplierID,string CompanyName,string ContactName,string ContactTitle,string Address,string City,string Region,string PostalCode,string Country,string Phone,string Fax,string HomePage)
{
Supplier item = new Supplier();
item.MarkOld();
item.IsLoaded = true;
item.SupplierID = SupplierID;
item.CompanyName = CompanyName;
item.ContactName = ContactName;
item.ContactTitle = ContactTitle;
item.Address = Address;
item.City = City;
item.Region = Region;
item.PostalCode = PostalCode;
item.Country = Country;
item.Phone = Phone;
item.Fax = Fax;
item.HomePage = HomePage;
item.Save(UserName);
}