protected void btnOK_Click(object sender, EventArgs e) { clsOrder AOrder = new clsOrder(); string OrderNo = txtOrderNo.Text; string DeliveryAddress = txtDeliveryAddress.Text; string ItemColour = txtItemColour.Text; string ItemPrice = txtItemPrice.Text; string OrderPlaced = txtOrderPlaced.Text; string ItemDescription = txtItemDescription.Text; string StaffId = txtStaffId.Text; string Error = ""; Error = AOrder.Valid(OrderNo, ItemDescription, StaffId, DeliveryAddress, ItemColour, OrderPlaced, ItemPrice); if (Error == "") { AOrder.OrderNo = Convert.ToInt32(OrderNo); AOrder.DeliveryAddress = txtDeliveryAddress.Text; AOrder.ItemColour = txtItemColour.Text; AOrder.ItemPrice = Convert.ToDecimal(ItemPrice); AOrder.OrderPlaced = Convert.ToDateTime(OrderPlaced); AOrder.ItemDescription = txtItemDescription.Text; AOrder.ItemAvailability = chkItemAvailability.Checked; AOrder.StaffId = Convert.ToInt32(StaffId); clsOrderCollection OrderList = new clsOrderCollection(); if (this.OrderNo == -1) { OrderList.ThisOrder = AOrder; OrderList.Add(); } else { OrderList.ThisOrder.Find(Convert.ToInt32(OrderNo)); OrderList.ThisOrder = AOrder; OrderList.Update(); } Response.Redirect("OrdersList.aspx"); } else { //display error message lblError.Text = Error; } }
public void UpdateMethodOK() { //create an instance of the class we want to create clsOrderCollection AllOrders = new clsOrderCollection(); //create the item of test data clsOrder TestItem = new clsOrder(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties TestItem.OrderId = 123; TestItem.ItemName = "Test Item"; TestItem.Price = 22.22; TestItem.DateOrderMade = DateTime.Now.Date; TestItem.ItemShipped = true; //set ThisOrder to the test data AllOrders.ThisOrder = TestItem; //add the record PrimaryKey = AllOrders.Add(); //set the primary key of the test data TestItem.OrderId = PrimaryKey; //modify the test data TestItem.OrderId = 124; TestItem.ItemName = "Test It3m"; TestItem.Price = 22.33; TestItem.DateOrderMade = DateTime.Now.Date; TestItem.ItemShipped = false; //set ThisOrder to the test data AllOrders.ThisOrder = TestItem; //update the record AllOrders.Update(); //find the record AllOrders.ThisOrder.Find(PrimaryKey); //test to see ThisAddress matches the test data Assert.AreEqual(AllOrders.ThisOrder, TestItem); }
public void AddMethodOK() { clsOrderCollection AllOrders = new clsOrderCollection(); clsOrder TestItem = new clsOrder(); Int32 PrimaryKey = 0; TestItem.ItemAvailable = true; TestItem.OrderID = 1234; TestItem.TotalItem = 10; TestItem.TotalPrice = 15.55; TestItem.DeliveryAddress = "1, A Street, LE1 5AB, Leicester"; TestItem.DateOrdered = DateTime.Now.Date; AllOrders.ThisOrder = TestItem; PrimaryKey = AllOrders.Add(); TestItem.OrderID = PrimaryKey; AllOrders.ThisOrder.Find(PrimaryKey); Assert.AreEqual(AllOrders.ThisOrder, TestItem); }
public void ListAndCountOK() { clsOrderCollection AllOrders = new clsOrderCollection(); List <clsOrder> TestList = new List <clsOrder>(); clsOrder TestItem = new clsOrder(); TestItem.OrderNo = 1; TestItem.ItemDescription = "multiplayer game"; TestItem.StaffId = 24; TestItem.DeliveryAddress = "FK19 0JK"; TestItem.ItemColour = "orange"; TestItem.OrderPlaced = DateTime.Now.Date; TestItem.ItemPrice = 50; TestItem.ItemAvailability = true; TestList.Add(TestItem); AllOrders.OrderList = TestList; Assert.AreEqual(AllOrders.Count, TestList.Count); }
public void ThisOrderPropertyOK() { //create the instance of the class we want to create clsOrderCollection AllOrders = new clsOrderCollection(); //create some test data to assign to the property clsOrder TestOrder = new clsOrder(); //set the properties of the test object TestOrder.OrderId = 1; TestOrder.ShippingAddress = "99 Granby Street, Leicester, UK"; TestOrder.Phonenum = "1111111111111111"; TestOrder.Email = "Noman Malik"; TestOrder.DateOrdered = DateTime.Now.Date; //assign the data to the property AllOrders.ThisOrder = TestOrder; //test to see that the two values are the same Assert.AreEqual(AllOrders.ThisOrder, TestOrder); }
public void ListAndCountOK() { clsOrderCollection AllOrders = new clsOrderCollection(); List <clsOrder> TestList = new List <clsOrder>(); clsOrder TestItem = new clsOrder(); //TestItem.OrderID = 1; TestItem.CustomerID = 1; TestItem.ShippingAddress = "AddressTest"; TestItem.OrderDate = DateTime.Now.Date; TestItem.OrderShipped = true; TestList.Add(TestItem); AllOrders.OrderList = TestList; Assert.AreEqual(AllOrders.Count, TestList.Count); }
public void ListAndCountOK() { clsOrderCollection AllOrders = new clsOrderCollection(); List <clsOrder> TestList = new List <clsOrder>(); clsOrder TestItem = new clsOrder(); TestItem.OrderNum = 1; TestItem.CustomerNum = 5; TestItem.ItemNum = 7; TestItem.DateFinalised = DateTime.Now.Date; TestItem.StandaloneOrSet = "Set"; TestItem.Quantity = 1; TestItem.TotalPrice = 14.99; TestItem.ReadyForShipping = true; TestList.Add(TestItem); AllOrders.OrderList = TestList; Assert.AreEqual(AllOrders.Count, TestList.Count); }
public void ThisOrderPropertyOK() { //create an instance of the class we want to create clsOrderCollection AllOrders = new clsOrderCollection(); //create some test data to assign the order clsOrder TestOrder = new clsOrder(); //set the properties of the test object TestOrder.OrderID = 1; TestOrder.CustomerID = 1; TestOrder.StaffID = 1; TestOrder.OrderDate = DateTime.Now.Date; TestOrder.OrderStatus = "Cooking"; //assign the data to the property AllOrders.ThisOrder = TestOrder; //test to see that the two values are the same Assert.AreEqual(AllOrders.ThisOrder, TestOrder); }
protected void Page_Load(object sender, EventArgs e) { clsOrder AnOrder = new clsOrder(); AnOrder = (clsOrder)Session["AnOrder"]; OrderId = Convert.ToInt32(Session["OrderId"]); if (IsPostBack == false) { if (OrderId != -1) { DisplayOrders(); } } //Response.Write(AnOrder.OrderId); }
public void ThisOrderPropertyOK() { //create an instance of the class we want to create clsOrderCollection AllOrders = new clsOrderCollection(); //create some data to assign to the property clsOrder TestOrder = new clsOrder(); //set properties of test Order TestOrder.OrderId = 1111; TestOrder.ItemName = "Test Item"; TestOrder.ItemShipped = true; TestOrder.Price = 22.22; TestOrder.DateOrderMade = DateTime.Now.Date; //assign the data to the property AllOrders.ThisOrder = TestOrder; //test to see that the two values are the same Assert.AreEqual(AllOrders.ThisOrder, TestOrder); }
public void DelivaryDateExtremeMin() { //create an instance of the class we want to create clsOrder AnOrder = new clsOrder(); //string variable to store any error message String Error = ""; //create some test data to pass to the method DateTime TestDate; TestDate = DateTime.Now.Date; TestDate = TestDate.AddYears(-100); string DeliveryDate = TestDate.ToString(); //invoke the method Error = AnOrder.Valid(GameTitle, TotalPrice, DeliveryDate); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void DateOrderedMin() { clsOrder AnOrder = new clsOrder(); //string variable to store any error message String Error = ""; //create a variable to store the test date data DateTime TestDate; //set the date to today's date TestDate = DateTime.Now.Date; //convert the date variable to a string variable string DateOrdered = TestDate.ToString(); //invoke the method Error = AnOrder.Valid(DateOrdered, DeliveryAddress); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void PostcodeMid() { //create an instance of the class I want to create clsOrder AnOrder = new clsOrder(); //boolean variable to store the result of the validation Boolean OK = false; //Create some test data to pass to the method String HouseNo = "5"; String Street = "Test Street"; String Town = "Test Town"; String Postcode = "aaaa"; String OrderDate = Convert.ToString(DateTime.Now.Date); //invoke the method OK = AnOrder.Valid(HouseNo, Street, Town, Postcode, OrderDate); //test to see that the result is correct Assert.IsTrue(OK); }
public void ListAndCountOK() { clsOrderCollection AllOrders = new clsOrderCollection(); List <clsOrder> TestList = new List <clsOrder>(); clsOrder TestItem = new clsOrder(); TestItem.Payed = true; TestItem.OrderNumber = 1; TestItem.OrderPrice = 10; TestItem.ItemCount = 2; TestItem.Address = "ankara"; TestItem.Date = DateTime.Now.Date; TestList.Add(TestItem); AllOrders.OrderList = TestList; Assert.AreEqual(AllOrders.Count, TestList.Count); }
public void TestISBNFound() { // create an Instance of the class we want to create clsOrder AnOrder = new clsOrder(); //boolean variable to store the result of the search Boolean Found = false; Boolean OK = true; int Order_ID = 1; Found = AnOrder.Find(Order_ID); if (AnOrder.ISBN != " 1111111111111") { OK = false; } Assert.IsTrue(OK); }
public void StreetMinLessOne() { //create an instance of the class I want to create clsOrder AnOrder = new clsOrder(); //boolean variable to store the result of the validation Boolean OK = false; //Create some test data to pass to the method String HouseNo = "5"; String Street = ""; String Town = "Test Town"; String Postcode = "xxx xxx"; String OrderDate = "30/03/2017"; //invoke the method OK = AnOrder.Valid(HouseNo, Street, Town, Postcode, OrderDate); //test to see that the result is correct Assert.IsFalse(OK); }
protected void btnFind_Click(object sender, EventArgs e) { clsOrder AnOrder = new clsOrder(); Int32 OrderNum; Boolean Found = false; OrderNum = Convert.ToInt32(txtOrderNum.Text); Found = AnOrder.Find(OrderNum); if (Found == true) { txtCustomerNum.Text = AnOrder.CustomerNum.ToString(); txtItemNum.Text = AnOrder.ItemNum.ToString(); txtDateFinalised.Text = AnOrder.DateFinalised.ToString(); txtStandaloneOrSet.Text = AnOrder.StandaloneOrSet; txtQuantity.Text = AnOrder.Quantity.ToString(); txtTotalPrice.Text = AnOrder.TotalPrice.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { //create an instance of clsOrder clsOrder AnOrder = new clsOrder(); //get the data from the session object AnOrder = (clsOrder)Session["AnOrder"]; //display the order id for this entry Response.Write(AnOrder.OrderID); //display the customer id for this entry Response.Write(AnOrder.CustomerID); //display the employee id for this entry Response.Write(AnOrder.StaffID); //display the order date for this entry Response.Write(AnOrder.OrderDate); //display the order status for this entry Response.Write(AnOrder.OrderStatus); }
public void UpdateMethodOK() { //create an instance of the class we want to create clsOrderCollection AllOrders = new clsOrderCollection(); //create the item of test data clsOrder TestItem = new clsOrder(); //var to store the primary key Int32 PrimaryKey = 0; //set its properties //TestItem.OrderNo = 33; TestItem.Active = true; TestItem.CollectionPostcode = "LE2 7EE"; TestItem.DestinationCountry = "United Kingdom"; TestItem.DestinationPostcode = "LE2 7FZ"; TestItem.DateCreated = "2018/02/01"; TestItem.ParcelSize = "M"; TestItem.Status = "Dispatching"; TestItem.CustomerNo = 1; //set ThisAddress to the test data AllOrders.ThisOrder = TestItem; //add the record PrimaryKey = AllOrders.Add(); //set the primary key of the test data TestItem.OrderNo = PrimaryKey; //modify the test data //TestItem.OrderNo = 33; TestItem.Active = true; TestItem.CollectionPostcode = "LE2 7EE"; TestItem.DestinationCountry = "United Kingdom"; TestItem.DestinationPostcode = "LE2 7FZ"; TestItem.DateCreated = "2018/02/01"; TestItem.ParcelSize = "M"; TestItem.Status = "Delivered"; TestItem.CustomerNo = 1; //set the record based on the new test data AllOrders.ThisOrder = TestItem; //update the recode AllOrders.Update(); //find the recode AllOrders.ThisOrder.Find(PrimaryKey); //test to see ThisTutor matches the test data Assert.AreEqual(AllOrders.ThisOrder, TestItem); }
protected void btnOk_Click(object sender, EventArgs e) { clsOrder anOrder = new clsOrder(); string OrderNumber = txtOrderNumber.Text; string Address = txtAddress.Text; string ItemCount = txtItemCount.Text; string OrderPrice = txtOrderPrice.Text; string Date = txtDate.Text; string Error = ""; Error = anOrder.Valid(Address, ItemCount, OrderPrice, Date); if (Error == "") { anOrder.OrderNumber = Convert.ToInt32(OrderNumber); anOrder.Address = Address; anOrder.OrderPrice = Convert.ToDouble(OrderPrice); anOrder.ItemCount = Convert.ToInt32(ItemCount); anOrder.Date = Convert.ToDateTime(Date); anOrder.Payed = cbPayed.Checked; clsOrderCollection OrderList = new clsOrderCollection(); if (Convert.ToInt32(OrderNumber) == -1) { OrderList.ThisOrder = anOrder; OrderList.Add(); } else { OrderList.ThisOrder.Find(Convert.ToInt32(OrderNumber)); OrderList.ThisOrder = anOrder; OrderList.Update(); } Response.Redirect("OrderList.aspx"); } else { lblError.Text = Error; } }
public void OrderDateInvalidData() { //create an instance of the class I want to create clsOrder AnOrder = new clsOrder(); //boolean variable to store the result of the validation Boolean OK = false; //Create some test data to pass to the method String HouseNo = "5"; String Street = "Test Street"; String Town = "Test Town"; String Postcode = "xxx xxx"; //set the OrderDate to a non date value String OrderDate = "this is not a date!"; //invoke the method OK = AnOrder.Valid(HouseNo, Street, Town, Postcode, OrderDate); //test to see that the result is correct Assert.IsFalse(OK); }
public void AddMethodOk() { clsOrdersCollection AllOrders = new clsOrdersCollection(); clsOrder TestItem = new clsOrder(); Int32 Primarykey = 0; TestItem.Dispatched = true; TestItem.ProductName = "kenny"; TestItem.ProductNo = 1; TestItem.Date = DateTime.Now.Date; TestItem.Price = 84.0000; TestItem.OrderNo = 1; AllOrders.ThisOrder = TestItem; Primarykey = AllOrders.Add(); TestItem.OrderNo = Primarykey; AllOrders.ThisOrder.Find(Primarykey); Assert.AreEqual(AllOrders.ThisOrder, TestItem); }
public void OrderListOK() { clsOrderCollection orderCollection = new clsOrderCollection(); List <clsOrder> testList = new List <clsOrder>(); clsOrder testItem = new clsOrder(); testItem.OrderId = 1; testItem.StaffId = 1; testItem.CustomerId = 1; testItem.Date = DateTime.Now.Date; testItem.Details = "test"; testList.Add(testItem); orderCollection.orderList = testList; Assert.AreEqual(orderCollection.orderList, testList); }
public void DateMin() { //create an instance of the class we want to create clsOrder AOrder = new clsOrder(); //string variable to store any error message String Error = ""; //create a variable to store the test date data DateTime TestDate; //set the date to todays date TestDate = DateTime.Now.Date; //convert the date variable to a string variable string Date = TestDate.ToString(); //invoke the method Error = AOrder.Valid(ItemName, Price, Quantity, Date); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void ThisOrderPropertyOK() { //create an instance of the class we want to create clsOrderCollection AllOrders = new clsOrderCollection(); //create some data to assign to the property clsOrder TestOrder = new clsOrder(); //set the properties of the test object TestOrder.OrderNo = 2; TestOrder.EmailAddress = "*****@*****.**"; TestOrder.OrderValue = 1; TestOrder.DeliveryTown = "Test Town"; TestOrder.OrderStatus = "Test Status"; TestOrder.DateAdded = DateTime.Now.Date; //assign the data to the property AllOrders.ThisOrder = TestOrder; //test to see that the two values are equal Assert.AreEqual(AllOrders.ThisOrder, TestOrder); }
public void ProductNameMaxPlusOne() { //Create instance of the class we want to create clsOrder AnOrder = new clsOrder(); //Boolean to store result of validation Boolean OK = false; //create test data to pass the method string DateOrdered = DateTime.Now.Date.ToString(); string ProductName = ""; ProductName = ProductName.PadRight(31, 'a'); String QuantityNo = "1"; String OrderPrice = "1"; //invoke method OK = AnOrder.Valid(DateOrdered, ProductName, QuantityNo, OrderPrice); //test to see result is correct Assert.IsFalse(OK); }
public void AddMethodOK() { clsOrderCollection AllOrders = new clsOrderCollection(); clsOrder TestItem = new clsOrder(); Int32 PrimaryKey = 0; TestItem.Delivered = true; TestItem.OrderId = 1; TestItem.CustomerId = 1; TestItem.OrderPrice = 1; TestItem.DateReceived = DateTime.Now.Date; TestItem.Description = "Blue Shirt"; TestItem.Quantity = 1; AllOrders.ThisOrder = TestItem; PrimaryKey = AllOrders.Add(); TestItem.OrderId = PrimaryKey; AllOrders.ThisOrder.Find(PrimaryKey); Assert.AreEqual(AllOrders.ThisOrder, TestItem); }
public void AddMethodOK() { clsOrderCollection AllOrders = new clsOrderCollection(); clsOrder TestItem = new clsOrder(); Int32 PrimaryKey = 0; TestItem.Payed = true; TestItem.OrderNumber = 1; TestItem.OrderPrice = 10; TestItem.ItemCount = 2; TestItem.Address = "ankara"; TestItem.Date = DateTime.Now.Date; AllOrders.ThisOrder = TestItem; PrimaryKey = AllOrders.Add(); TestItem.OrderNumber = PrimaryKey; AllOrders.ThisOrder.Find(PrimaryKey); Assert.AreEqual(AllOrders.ThisOrder, TestItem); }
public void AddMethodOk() //check if add works { clsOrderCollection AllOrders = new clsOrderCollection(); clsOrder TestItem = new clsOrder(); Int32 PrimaryKey = 0; TestItem.Shipment = true; TestItem.orderID = 1; TestItem.GameTitle = "game1"; TestItem.TotalPrice = 1; TestItem.DeliveryDate = DateTime.Now.Date; AllOrders.ThisOrder = TestItem; PrimaryKey = AllOrders.Add(); //add attributes to 1 key TestItem.orderID = PrimaryKey; AllOrders.ThisOrder.Find(PrimaryKey); Assert.AreEqual(AllOrders.ThisOrder, TestItem); }
public void AddMethodOK() { clsOrderCollection AllOrder = new clsOrderCollection(); clsOrder TestItem = new clsOrder(); Int32 PrimaryKey = 0; // TestItem.OrderID = 1; TestItem.CustomerID = 1; TestItem.StaffID = 1; TestItem.CarID = 1; TestItem.Date = DateTime.Now.Date; TestItem.Email = "jkjkjkj"; TestItem.Price = 177; AllOrder.ThisOrder = TestItem; PrimaryKey = AllOrder.Add(); TestItem.OrderID = PrimaryKey; AllOrder.ThisOrder.Find(PrimaryKey); Assert.AreEqual(AllOrder.ThisOrder, TestItem); }