public void DeleteMethod() { //create an instance of a class clsOrderlineCollection AllOrderline = new clsOrderlineCollection(); //create the item of test data clsOrderline TestItem = new clsOrderline(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.OrderlineID = 1; TestItem.BookingID = 1; TestItem.BookingNo = "CASD4"; TestItem.Quantity = 10; //set ThisOrderline to the test data AllOrderline.ThisOrderline = TestItem; //add the record PrimaryKey = AllOrderline.Add(); //set the primary key of the test data TestItem.OrderlineID = PrimaryKey; //find the record AllOrderline.ThisOrderline.Find(PrimaryKey); //delete the record AllOrderline.Delete(); //now find the record Boolean Found = AllOrderline.ThisOrderline.Find(PrimaryKey); //test to see that the record was not found Assert.IsFalse(Found); }
public void DeleteMethodOK() { // create an instance for the class we want to create clsOrderlineCollection AllOrderline = new clsOrderlineCollection(); // create the item of the test data clsOrderline TestItem = new clsOrderline(); // var to store the primary key Int32 PrimaryKey = 0; // set it properties TestItem.OrderlineId = 2; TestItem.OrderId = 4; TestItem.Quantity = 1; TestItem.InventoryId = 1; // set thisAdress to the test data AllOrderline.ThisOrderline = TestItem; // add the record PrimaryKey = AllOrderline.Add(); // set the primary key TestI data TestItem.OrderlineId = PrimaryKey; // find the record AllOrderline.ThisOrderline.Find(PrimaryKey); // delete the record AllOrderline.Delete(); //now find the record Boolean Found = AllOrderline.ThisOrderline.Find(PrimaryKey); // test to see that the record was not found Assert.IsFalse(Found); }
public void AddMethodOK() { // create an instance for the class we want to create clsOrderlineCollection AllOrderline = new clsOrderlineCollection(); // create the item of the test data clsOrderline TestItem = new clsOrderline(); // var to store the primary key Int32 PrimaryKey = 0; // set it properties TestItem.OrderlineId = 2; TestItem.OrderId = 1; TestItem.Quantity = 1; TestItem.InventoryId = 1; // set thisAdress to the test data AllOrderline.ThisOrderline = TestItem; // add the record PrimaryKey = AllOrderline.Add(); // set the primary key TestI data TestItem.OrderlineId = PrimaryKey; // find the record AllOrderline.ThisOrderline.Find(PrimaryKey); // test to see that the two values are the same Assert.AreEqual(AllOrderline.ThisOrderline, TestItem); }
public void InstanceOK() { clsOrderlineCollection AllOrderline = new clsOrderlineCollection(); // teat to see tha t it exist Assert.IsNotNull(AllOrderline); }
public void ReportByBookingNoTestDataFound() { //create an instance of the filtered data clsOrderlineCollection FilteredOrderline = new clsOrderlineCollection(); //var to store the outcome Boolean OK = true; //apply a booking no that doesnt exist FilteredOrderline.ReportByBookingNo("Tes12"); //check that the correct number of records are found if (FilteredOrderline.Count == 2) { //check that the first record is ID 34 if (FilteredOrderline.OrderlineList[0].OrderlineID != 34) { OK = false; } //check that the first record is ID 35 if (FilteredOrderline.OrderlineList[1].OrderlineID != 35) { OK = false; } } else { OK = false; } //test to see that there are no records Assert.IsTrue(OK); }
Int32 DisplayOrderline(string BookingNoFilter) { //var to store the BookingNo string BookingNo; //create an instance of the Orderline collection class clsOrderlineCollection Orderline = new clsOrderlineCollection(); Orderline.ReportByBookingNo(BookingNoFilter); //var to store the count of records Int32 RecordCount; //var to store the index for the loop Int32 Index = 0; //get the count of records RecordCount = Orderline.Count; //clear the list box lstOrderline.Items.Clear(); //while there are records while (Index < RecordCount) { //get the BookingNo BookingNo = Orderline.OrderlineList[Index].BookingNo; //create a new entry for the list box ListItem NewEntry = new ListItem(BookingNo + " ".ToString()); //add the staff to the list lstOrderline.Items.Add(NewEntry); //move the index to the next record Index++; } //return to the count of records found return(RecordCount); }
protected void Button_OrderLOK_Click(object sender, EventArgs e) { clsOrderline AnOrderL = new clsOrderline(); string ONumber = TextBox_OrderLONumber.Text; string Quantity = TextBox_OrderLQuantity.Text; string ShoeID = TextBox_ShoeID.Text; string Error = ""; Error = AnOrderL.Valid(ONumber, Quantity, ShoeID); if (Error == "") { AnOrderL.OLineNumber = OLineNumber; AnOrderL.ONumber = Convert.ToInt32(ONumber); AnOrderL.Quantity = Convert.ToInt32(Quantity); AnOrderL.ShoeID = Convert.ToInt32(ShoeID); clsOrderlineCollection OrderlineList = new clsOrderlineCollection(); if (OLineNumber == -1) { OrderlineList.ThisOrderline = AnOrderL; OrderlineList.Add(); } else { OrderlineList.ThisOrderline.Find(OLineNumber); OrderlineList.ThisOrderline = AnOrderL; OrderlineList.Update(); } Response.Redirect("OrderlineList.aspx"); } else { Label_OrderLError.Text = Error; } }
public void UpdateMethod() { //create an instance of a class clsOrderlineCollection AllOrderline = new clsOrderlineCollection(); //create the item of test data clsOrderline TestItem = new clsOrderline(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.BookingID = 1; TestItem.BookingNo = "CASD4"; TestItem.Quantity = 10; //set ThisOrderline to the test data AllOrderline.ThisOrderline = TestItem; //add the record PrimaryKey = AllOrderline.Add(); //set the primary key of the test data TestItem.OrderlineID = PrimaryKey; //modify the test data TestItem.BookingID = 3; TestItem.BookingNo = "FGSD7"; TestItem.Quantity = 5; //set the record based on the new test data AllOrderline.ThisOrderline = TestItem; //update the record AllOrderline.Update(); //find the record AllOrderline.ThisOrderline.Find(PrimaryKey); //test to see thisOrderline matches the test data Assert.AreEqual(AllOrderline.ThisOrderline, TestItem); }
//function for updating new records void Update() { //create an instance of the Orderline Book clsOrderlineCollection OrderlineBook = new clsOrderlineCollection(); //validate the data on the web form string Error = OrderlineBook.ThisOrderline.Valid(txtBookingNo.Text, txtQuantity.Text); //if the data is ok then add it to the object if (Error == "") { //find the record to update OrderlineBook.ThisOrderline.Find(OrderlineID); //get the data entered by the user OrderlineBook.ThisOrderline.BookingNo = txtBookingNo.Text; OrderlineBook.ThisOrderline.Quantity = Convert.ToInt32(txtQuantity.Text); //update the record OrderlineBook.Update(); //all done so redirect back to the main page Response.Redirect("OrderlineList.aspx"); } else { //report an error lblError.Text = "There are problems with the data entered " + Error; } }
public void FilterByONumber() { clsOrderlineCollection AllOrderlines = new clsOrderlineCollection(); clsOrderlineCollection FilteredOrderlines = new clsOrderlineCollection(); FilteredOrderlines.FilterByONum(1); Assert.AreEqual(AllOrderlines.Count, FilteredOrderlines.Count); }
public void InstanceOK() { //create an instance of a class clsOrderlineCollection AllOrderline = new clsOrderlineCollection(); //test to see that it exists Assert.IsNotNull(AllOrderline); }
protected void ButtonYes_Click(object sender, EventArgs e) { clsOrderlineCollection OrderlineBook = new clsOrderlineCollection(); OrderlineBook.ThisOrderline.Find(OLineNumber); OrderlineBook.Delete(); Response.Redirect("OrderlineList.aspx"); }
public void ReportByBookingNoNoneMethod() { //create an instance of the filtered data clsOrderlineCollection FilteredOrderline = new clsOrderlineCollection(); //apply a Booking Number that does not exist FilteredOrderline.ReportByBookingNo("YYYYY"); //test to see that there are no records Assert.AreEqual(0, FilteredOrderline.Count); }
void DisplayOrderline() { //create an instance of the Orderline Book clsOrderlineCollection OrderlineBook = new clsOrderlineCollection(); //find the record to update OrderlineBook.ThisOrderline.Find(OrderlineID); //disply the data for this record txtBookingNo.Text = OrderlineBook.ThisOrderline.BookingNo; txtQuantity.Text = OrderlineBook.ThisOrderline.Quantity.ToString(); }
public void ThisOrderlineProperyOK() { clsOrderlineCollection AllOrderlines = new clsOrderlineCollection(); clsOrderline TestOrderline = new clsOrderline(); TestOrderline.OLineNumber = 1; TestOrderline.ONumber = 1; TestOrderline.Quantity = 1; TestOrderline.ShoeID = 1; AllOrderlines.ThisOrderline = TestOrderline; Assert.AreEqual(AllOrderlines.ThisOrderline, TestOrderline); }
public void ReportByBookingNoMethod() { //create an instance of the class containing unfiltered results clsOrderlineCollection AllOrderline = new clsOrderlineCollection(); //create an instance of the filtered data clsOrderlineCollection FilteredOrderline = new clsOrderlineCollection(); //apply a blank string (should return all records) FilteredOrderline.ReportByBookingNo(""); //test to see that the two values are the same Assert.AreEqual(AllOrderline.Count, FilteredOrderline.Count); }
void DisplayOLineNumber() { clsOrderlineCollection OLineBook = new clsOrderlineCollection(); OLineBook.ThisOrderline.Find(OLineNumber); TextBox_OrderLONumber.Text = OLineBook.ThisOrderline.ONumber.ToString(); TextBox_Find.Text = OLineBook.ThisOrderline.OLineNumber.ToString(); TextBox_OrderLQuantity.Text = OLineBook.ThisOrderline.Quantity.ToString(); TextBox_ShoeID.Text = OLineBook.ThisOrderline.ShoeID.ToString(); TextBox_OrderLONumber.Text = OLineBook.ThisOrderline.ONumber.ToString(); }
void DeleteOrderline() { //function to delete the selected record //create a new instance of the orderline book clsOrderlineCollection OrderlineBook = new clsOrderlineCollection(); //find the record to delete OrderlineBook.ThisOrderline.Find(OrderlineID); //delete the record OrderlineBook.Delete(); }
void DisplayOrderline() { //create an instance of orderline collection clsOrderlineCollection Orderline = new clsOrderlineCollection(); //set the data source to the list of orderlines in the collection lstOrderline.DataSource = Orderline.OrderlineList; //set the name of the primary key lstOrderline.DataValueField = "OrderlineID"; //set the data field to display lstOrderline.DataTextField = "BookingNo"; //bind the data to the list lstOrderline.DataBind(); }
public void ListAndCountOk() { clsOrderlineCollection AllOrderlines = new clsOrderlineCollection(); List <clsOrderline> TestList = new List <clsOrderline>(); clsOrderline TestItem = new clsOrderline(); TestItem.OLineNumber = 1; TestItem.ONumber = 1; TestItem.Quantity = 1; TestItem.ShoeID = 1; TestList.Add(TestItem); AllOrderlines.OrderlineList = TestList; Assert.AreEqual(AllOrderlines.Count, TestList.Count); }
public void AddMethodOK() { clsOrderlineCollection AllOrderlines = new clsOrderlineCollection(); clsOrderline TestItem = new clsOrderline(); Int32 PKey = 0; TestItem.OLineNumber = 1; TestItem.ONumber = 1; TestItem.Quantity = 1; TestItem.ShoeID = 1; AllOrderlines.ThisOrderline = TestItem; PKey = AllOrderlines.Add(); TestItem.OLineNumber = PKey; AllOrderlines.ThisOrderline.Find(PKey); Assert.AreEqual(AllOrderlines.ThisOrderline, TestItem); }
public void ThisOrderlineProperty() { //create an instance of a class clsOrderlineCollection AllOrderline = new clsOrderlineCollection(); //create some test data to assign to the property clsOrderline TestOrderline = new clsOrderline(); //set the properties of the test object TestOrderline.OrderlineID = 1; TestOrderline.BookingID = 1; TestOrderline.BookingNo = "CASD4"; TestOrderline.Quantity = 10; //assign the data to the property AllOrderline.ThisOrderline = TestOrderline; //test to see that the two values are the same Assert.AreEqual(AllOrderline.ThisOrderline, TestOrderline); }
public void ThisOrderlinePropertyOK() { // create an instance of the class we want to create clsOrderlineCollection AllOrderline = new clsOrderlineCollection(); // create some test data to assign the property clsOrderline TestOrderline = new clsOrderline(); // set the properties of the object TestOrderline.OrderlineId = 1; TestOrderline.OrderId = 5; TestOrderline.Quantity = 1; TestOrderline.InventoryId = 1; // assign the data to the property AllOrderline.ThisOrderline = TestOrderline; // test to see that the two values are the same Assert.AreEqual(AllOrderline.ThisOrderline, TestOrderline); }
public void DeleteMethodOK() { clsOrderlineCollection AllOrderlines = new clsOrderlineCollection(); clsOrderline TestItem = new clsOrderline(); Int32 PKey = 0; TestItem.OLineNumber = 1; TestItem.ONumber = 1; TestItem.Quantity = 1; TestItem.ShoeID = 1; AllOrderlines.ThisOrderline = TestItem; PKey = AllOrderlines.Add(); TestItem.OLineNumber = PKey; AllOrderlines.ThisOrderline.Find(PKey); AllOrderlines.Delete(); Boolean Found = AllOrderlines.ThisOrderline.Find(PKey); Assert.IsFalse(Found); }
public void ListAndCount() { //create an instance of a class clsOrderlineCollection AllOrderline = new clsOrderlineCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsOrderline> TestList = new List <clsOrderline>(); //add an item to the list //create the item of test data clsOrderline TestItem = new clsOrderline(); //set its properties TestItem.OrderlineID = 1; TestItem.BookingID = 1; TestItem.BookingNo = "CASD4"; TestItem.Quantity = 10; //add the item to the test list TestList.Add(TestItem); //assign the data to the property AllOrderline.OrderlineList = TestList; //test to see that the two values are the same Assert.AreEqual(AllOrderline.Count, TestList.Count); }
public void AddMethod() { //create an instance of a class clsOrderlineCollection AllOrderline = new clsOrderlineCollection(); //create the item of test data clsOrderline TestItem = new clsOrderline(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.OrderlineID = 1; TestItem.BookingID = 1; TestItem.BookingNo = "CASD4"; TestItem.Quantity = 10; //set ThisOrderline to the test data AllOrderline.ThisOrderline = TestItem; //add the record PrimaryKey = AllOrderline.Add(); //set the primary key of the test data TestItem.OrderlineID = PrimaryKey; //find the record AllOrderline.ThisOrderline.Find(PrimaryKey); }
public void FilterByONumberTestDataFound() { clsOrderlineCollection FilteredOLines = new clsOrderlineCollection(); Boolean OK = true; FilteredOLines.FilterByONum(10); if (FilteredOLines.Count == 2) { if (FilteredOLines.OrderlineList[0].OLineNumber != 8) { OK = false; } if (FilteredOLines.OrderlineList[1].OLineNumber != 9) { OK = false; } } else { OK = false; } Assert.IsTrue(OK); }
public void InstanceOK() { clsOrderlineCollection AllOrderlines = new clsOrderlineCollection(); Assert.IsNotNull(AllOrderlines); }