public void ManufacturersUpdateSuccessFive() { IManufacturersStorage manufacturersStorage = new ManufacturersStorage(); Manufacturers myManufacturers = CreateManufacturersForTest( "供应商4", "浙江温州4", "17733117779", "2013-06-30", "2016-06-30"); Manufacturers createdManufacturers = manufacturersStorage.CreateManufacturers(myManufacturers); Assert.AreNotEqual( 0, createdManufacturers.ManufacturersID, string.Format("Could not create Manufacturers:{0}", createdManufacturers.ManufacturersID)); myManufacturers.ManufacturersDoe = Convert.ToDateTime("2016-06-30"); manufacturersStorage.UpdateManufacturers(myManufacturers); Manufacturers updatedManufacturers = manufacturersStorage.ReadManufacturers( createdManufacturers.ManufacturersID); AssertManufacturersItemEqual(myManufacturers, updatedManufacturers); }
private void btnModfiy_Click(object sender, EventArgs e) { IManufacturersStorage manufacturersStorage = new ManufacturersStorage(); Manufacturers manufacturers = new Manufacturers(); if (textManufacturersName.Text.Trim() == "" || textManufacturersSite.Text.Trim() == "" || textManufacturersPhone.Text.Trim() == "" || dtpManufacturersDom.Text.Trim() == "" || dtpManufacturersDoe.Text.Trim() == "") { MessageBox.Show("请双击需要修改的记录!"); } else { manufacturers.ManufacturersName = textManufacturersName.Text; manufacturers.ManufacturersSite = textManufacturersSite.Text; manufacturers.ManufacturersPhone = textManufacturersPhone.Text; manufacturers.ManufacturersDom = Convert.ToDateTime(dtpManufacturersDom.Text); manufacturers.ManufacturersDoe = Convert.ToDateTime(dtpManufacturersDoe.Text); manufacturers.ManufacturersID = Convert.ToInt32(dgvManufacturers[0, dgvManufacturers.CurrentCell.RowIndex].Value.ToString()); manufacturersStorage.UpdateManufacturers(manufacturers); MessageBox.Show("更新成功!"); textManufacturersName.Text = ""; textManufacturersSite.Text = ""; textManufacturersPhone.Text = ""; dtpManufacturersDom.Text = ""; dtpManufacturersDoe.Text = ""; } }
public void ManufacturersUpdateFailureManufacturersIdArgumentException() { IManufacturersStorage manufacturersStorage = new ManufacturersStorage(); Manufacturers myManufacturers = CreateManufacturersForTest( "供应商4", "浙江温州4", "17733117779", "2013-06-30", "2016-06-30"); manufacturersStorage.CreateManufacturers(myManufacturers); myManufacturers.ManufacturersID = int.MaxValue; manufacturersStorage.UpdateManufacturers(myManufacturers); }
public void ManufacturersUpdateFailureManufacturersArgumentNullException() { IManufacturersStorage manufacturersStorage = new ManufacturersStorage(); manufacturersStorage.UpdateManufacturers(null); }