public void DateOfOrderExtremeMax() { ClsOrder AnOrder = new ClsOrder(); String Error = ""; DateTime TestDate; TestDate = DateTime.Now.Date; TestDate = TestDate.AddYears(100); string DateOfOrder = TestDate.ToString(); // This should fail Error = AnOrder.Valid(DateOfOrder, OrderPrice, OrderStatus); Assert.AreNotEqual(Error, ""); }
public void ThisOrderProperyOK() { clsOrderCollection AllOrders = new clsOrderCollection(); ClsOrder TestItem = new ClsOrder(); TestItem.ONumber = 1; TestItem.CustomerID = 1; TestItem.Notes = ""; TestItem.Complete = true; TestItem.Date = DateTime.Now.Date; AllOrders.ThisOrder = TestItem; Assert.AreEqual(AllOrders.ThisOrder, TestItem); }
public void ShippingAddressMinLessOne() { //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 string ShippingAddress = ""; Error = AnOrder.Valid(OrderID, OrderDate, CustomerID, ShippingAddress); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void DateOfOrderMinPlusOne() { ClsOrder AnOrder = new ClsOrder(); String Error = ""; DateTime TestDate; TestDate = DateTime.Now.Date; TestDate = TestDate.AddDays(1); string DateOfOrder = TestDate.ToString(); // This should pass Error = AnOrder.Valid(DateOfOrder, OrderPrice, OrderStatus); Assert.AreNotEqual(Error, ""); }
public void CustomerIDMin() { //create an instance of the class we want to create ClsOrder AnOrder = new ClsOrder(); //string variable to store any error message String Error = ""; //string variable to store any error message string CustomerID = ""; //invoke the method Error = AnOrder.Valid(OrderID, OrderDate, CustomerID, ShippingAddress); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void CustomerIDExtremeMax() { //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 string CustomerID = ""; CustomerID = CustomerID.PadRight(500, 'a'); Error = AnOrder.Valid(OrderID, OrderDate, CustomerID, ShippingAddress); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void FindMethodOK() { //Creates a new instance of the Order class ClsOrder anOrder = new ClsOrder(); //boolean variable to store the result of the validation. Boolean Found = false; //creates some test data that is assigned to a variable. int OrderID = 49; //assigns the data to the property. Found = anOrder.Find(OrderID); //test to see that the result is correct Assert.IsTrue(Found); }
public void NotesMinPlusOne() { //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 String Notes = "aa"; //this should be ok //invoke the method Error = AnOrder.Valid(CustomerID, Notes, Date); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void CustomerIDExtremeMax() { //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 String CustomerID = "2000"; //this should fail //invoke the method Error = AnOrder.Valid(CustomerID, Notes, Date); //test to see that the result is correct Assert.AreNotEqual(Error, ""); }
public void FindMethodOkay() { //create an instance of the class we want to create ClsOrder AnOrder = new ClsOrder(); //Boolean value to store the results of the validation Boolean Found = false; //Create some test data to use with the method Int32 OrderID = 1; //Invoke the method Found = AnOrder.Find(OrderID); //test to see if the result is true Assert.IsTrue(Found); }
public void OrderDateMin() { //create an instance of the class we want to create ClsOrder AnOrder = new ClsOrder(); //string variable to store any error message String Error = ""; DateTime TestDate; TestDate = DateTime.Now.Date; string OrderDate = TestDate.ToString(); Error = AnOrder.Valid(OrderID, OrderDate, CustomerID, ShippingAddress); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void FindONumberOK() { ClsOrder AnOrder = new ClsOrder(); Boolean Found = false; Boolean OK = true; Int32 ONumber = 1; Found = AnOrder.Find(ONumber); if (AnOrder.ONumber != 1) { OK = false; } Assert.IsTrue(OK); }
public void FindDateOK() { ClsOrder AnOrder = new ClsOrder(); Boolean Found = false; Boolean OK = true; Int32 ONumber = 1; Found = AnOrder.Find(ONumber); if (AnOrder.Date != Convert.ToDateTime("11/01/2020")) { OK = false; } Assert.IsTrue(OK); }
public void FindNotesOK() { ClsOrder AnOrder = new ClsOrder(); Boolean Found = false; Boolean OK = true; Int32 ONumber = 1; Found = AnOrder.Find(ONumber); if (AnOrder.Notes != "Leave with reception") { OK = false; } Assert.IsTrue(OK); }
protected void Page_Load(object sender, EventArgs e) { //creates a new instance of ClsOrder ClsOrder AnOrder = new ClsOrder(); //gets the data from session object AnOrder = (ClsOrder)Session["AnOrder"]; //displays the Order ID for this entry Response.Write(AnOrder.OrderID + "<br />"); Response.Write(AnOrder.OrderDate + "<br />"); Response.Write(AnOrder.OrderShipped + "<br />"); Response.Write(AnOrder.CustomerID + "<br />"); Response.Write(AnOrder.ShippingAddress + "<br />"); Response.Write(AnOrder.OrderStatus + "<br />"); }
protected void Page_Load(object sender, EventArgs e) { if (Request.Cookies["user"] == null) { Response.Redirect("~/Default.aspx"); } DataTable table = GetTable(); if (!IsPostBack) { if (Request.QueryString["alert"] == "notpass") { Response.Write("<script>alert('لم يتم الحفظ');</script>"); } if (Request.QueryString["id"].ToString() != null) { if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0) { Order order = new ClsOrder().get(Convert.ToInt32(Request.QueryString["id"].ToString())); ddlSupplier.SelectedValue = order.SupplierID.ToString(); txtDeliveryDate.Text = order.DeliveryDate.ToString(); ddlStatus.SelectedValue = order.Status.ToString(); txtRejectionReason.Text = order.RejectReason.ToString(); txtRemarks.Text = order.Remarks.ToString(); for (int i = 0; i < order.OrderItems.Count; i++) { DataRow dr = table.NewRow(); dr["ProductID"] = order.OrderItems[i].ProductWarehouseID; dr["Cost"] = order.OrderItems[i].Cost; dr["Quantity"] = order.OrderItems[i].Amount; dr["Total"] = order.OrderItems[i].Cost * order.OrderItems[i].Amount; table.Rows.Add(dr); } Session["OrderItems"] = table; // Gbind(); btnSave.Visible = false; btnEdit.Visible = false; } else { // table = GetTable(); btnSave.Visible = true; btnEdit.Visible = false; } } } }
public void ListAndCountOk() { clsOrderCollection AllOrders = new clsOrderCollection(); List <ClsOrder> TestList = new List <ClsOrder>(); ClsOrder TestItem = new ClsOrder(); TestItem.ONumber = 1; TestItem.CustomerID = 1; TestItem.Notes = ""; TestItem.Complete = true; TestItem.Date = DateTime.Now.Date; TestList.Add(TestItem); AllOrders.OrderList = TestList; Assert.AreEqual(AllOrders.Count, TestList.Count); }
public void ThisOrderPropertyOK() { ClsOrderCollection AllOrders = new ClsOrderCollection(); ClsOrder TestItem = new ClsOrder(); TestItem.CustomerID = 2; TestItem.CarID = 2; TestItem.DateOfOrder = DateTime.Now.Date; TestItem.ServiceID = 1; TestItem.OrderPrice = 5000; TestItem.OrderStatus = "Done"; TestItem.PaymentID = 1; TestItem.Completed = true; AllOrders.ThisOrder = TestItem; Assert.AreEqual(AllOrders.ThisOrder, TestItem); }
public void OrderListOK() { ClsOrderCollection AllOrder = new ClsOrderCollection(); List <ClsOrder> TestList = new List <ClsOrder>(); ClsOrder TestItem = new ClsOrder(); TestItem.OrderID = 1; TestItem.CustomerID = 45879632; TestItem.ShippingAddress = "64 potter Lane"; TestItem.OrderStatus = "Pending"; TestItem.OrderDate = DateTime.Now.Date; TestItem.OrderShipped = false; TestList.Add(TestItem); AllOrder.OrderList = TestList; Assert.AreEqual(AllOrder.OrderList, TestList); }
protected void Button_OFind_Click(object sender, EventArgs e) { ClsOrder AnOrder = new ClsOrder(); Int32 ONumber; Boolean Found = false; ONumber = Convert.ToInt32(TextBox_ONum.Text); Found = AnOrder.Find(ONumber); if (Found == true) { TextBox_CID.Text = AnOrder.CustomerID.ToString(); TextBox_Notes.Text = AnOrder.Notes; TextBox_DateA.Text = AnOrder.Date.ToString(); CheckBox_OComplete.Checked = AnOrder.Complete; } }
public void AddMethodOK() { clsOrderCollection AllOrders = new clsOrderCollection(); ClsOrder TestItem = new ClsOrder(); Int32 PKey = 0; TestItem.ONumber = 1; TestItem.CustomerID = 1; TestItem.Notes = "work"; TestItem.Complete = true; TestItem.Date = DateTime.Now.Date; AllOrders.ThisOrder = TestItem; PKey = AllOrders.Add(); TestItem.ONumber = PKey; AllOrders.ThisOrder.Find(PKey); Assert.AreEqual(AllOrders.ThisOrder, TestItem); }
public void ListAndCountOK() { ClsOrderCollection AllOrders = new ClsOrderCollection(); List <ClsOrder> TestList = new List <ClsOrder>(); ClsOrder TestItem = new ClsOrder(); TestItem.CustomerID = 2; TestItem.CarID = 2; TestItem.DateOfOrder = DateTime.Now.Date; TestItem.ServiceID = 66; TestItem.OrderPrice = 5000; TestItem.OrderStatus = "test"; TestItem.PaymentID = 1; TestItem.Completed = true; TestList.Add(TestItem); AllOrders.OrderList = TestList; Assert.AreEqual(AllOrders.Count, TestList.Count); }
public void ThisOrderPropertyOK() { ClsOrderCollection AllOrder = new ClsOrderCollection(); //Test data to assign to property ClsOrder TestOrder = new ClsOrder(); //Set properties of the test item TestOrder.OrderID = 1; TestOrder.CustomerID = 45879632; TestOrder.ShippingAddress = "64 potter Lane"; TestOrder.OrderStatus = "Pending"; TestOrder.OrderDate = DateTime.Now.Date; TestOrder.OrderShipped = false; //Assign data to the property AllOrder.ThisOrder = TestOrder; //Test to see that the two are the same Assert.AreEqual(AllOrder.ThisOrder, TestOrder); }
public void DateAddedMin() { //create an instance of the class we want to create 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 totodays date TestDate = DateTime.Now.Date; //convert the date variable to a string variable string Date = TestDate.ToString(); //invoke the method Error = AnOrder.Valid(CustomerID, Notes, Date); //test to see that the result is correct Assert.AreEqual(Error, ""); }
public void AllPropertiesPropertyOK() { //Creates a new instance of the Order class ClsOrder anOrder = new ClsOrder(); //assigns the data to the property. string TestData = "OrderID: " + OrderID + ", CustomerID: " + CustomerID + ", CarID: " + CarID + ", PaymentID: " + PaymentID + ", Date Of Order: " + DateOfOrder + ", ServiceID: " + ServiceID + ", Order Price: " + OrderPrice + ", Order Status:" + OrderStatus + ", Completed: " + false; anOrder.OrderID = OrderID; anOrder.CustomerID = CustomerID; anOrder.CarID = CarID; anOrder.PaymentID = PaymentID; anOrder.DateOfOrder = DateTime.Now.Date; anOrder.ServiceID = ServiceID; anOrder.OrderPrice = Convert.ToDouble(OrderPrice); anOrder.OrderStatus = OrderStatus; anOrder.Completed = false; //test to see that the 2 values are the same. Assert.AreEqual(anOrder.allProperties, TestData); }
public void TestOrderStatusFound() { //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 variable to record if data is OK (assume it is) Boolean Okay = true; //create some test data to use with the method Int32 OrderID = 21; //invoke the method Found = AnOrder.Find(OrderID); //check the Order Status if (AnOrder.OrderStatus != "Test Order Status") { Okay = false; } }
protected void btnSave_Click(object sender, EventArgs e) { string sql = "select max(id)as lastID from Inv_Orders"; DataTable dt = DataAccess.ExecuteSQLQuery(sql); int id = int.Parse(dt.Rows[0]["lastID"].ToString()) + 1; Order order = new Order(); order.OrderCode = "OP" + id; order.SupplierID = Convert.ToInt32(ddlSupplier.SelectedValue.ToString()); order.DeliveryDate = Convert.ToDateTime(txtDeliveryDate.Text); order.Status = Convert.ToInt32(ddlStatus.SelectedValue.ToString()); order.RejectReason = txtRejectionReason.Text; order.Remarks = txtRemarks.Text; order.Active = 1; DataTable dt2 = Session["OrderItems"] as DataTable; List <OrderItem> OrderItems = new List <OrderItem>(); for (int i = 0; i < dt.Rows.Count; i++) { OrderItem orderItem = new OrderItem(); orderItem.ProductWarehouseID = Convert.ToInt32(dt.Rows[i]["ProductID"].ToString()); orderItem.Amount = Convert.ToInt32(dt.Rows[i]["Quantity"].ToString()); orderItem.Cost = Convert.ToDouble(dt.Rows[i]["Cost"].ToString()); orderItem.Active = 1; OrderItems.Add(orderItem); } order.OrderItems = OrderItems; HttpCookie myCookie = Request.Cookies["user"]; order.OperatorID = Convert.ToInt32(myCookie.Values["userid"].ToString()); int res = new ClsOrder().insert(order); if (res > 0) { Response.Redirect("~/Inventory/Orders.aspx?alert=success"); } else { Response.Redirect("~/Inventory/NewOrder.aspx?id=0&&alret=notpass"); } }
public void BindDropDownListForOrder(ClsOrder objClsOrder, bool blBindDropDownFromDb) { try { if (blBindDropDownFromDb) { objClsOrder.lstOrderCategory = this.objiClsOrderCategory.GetAllOrderCategoryForDropDown().ToList(); objClsOrder.lstUsers = this.objiClsUser.GetUsersOfUserForDropDown().ToList(); } else { objClsOrder.lstOrderCategory = new List <SelectListItem>(); objClsOrder.lstUsers = new List <SelectListItem>(); } } catch (Exception ex) { Functions.Write(ex, System.Reflection.MethodBase.GetCurrentMethod().Name, PageMaster.Order); } }
public void TestCompletedFound() { //Creates a new instance of the Order class ClsOrder anOrder = new ClsOrder(); //boolean variable to store the result of the validation. Boolean Found = false; //boolean variable to record if data is OK Boolean OK = true; //creates some test data that is assigned to a variable. int OrderID = 49; //assigns the data to the property. Found = anOrder.Find(OrderID); if (anOrder.Completed != true) { OK = false; } //test to see that the result is correct Assert.IsTrue(OK); }
public void DeleteMethodOK() { clsOrderCollection AllOrders = new clsOrderCollection(); ClsOrder TestItem = new ClsOrder(); Int32 PKey = 0; TestItem.ONumber = 21; TestItem.CustomerID = 1; TestItem.Notes = ""; TestItem.Complete = true; TestItem.Date = DateTime.Now.Date; AllOrders.ThisOrder = TestItem; PKey = AllOrders.Add(); TestItem.ONumber = PKey; AllOrders.ThisOrder.Find(PKey); AllOrders.Delete(); Boolean Found = AllOrders.ThisOrder.Find(PKey); Assert.IsFalse(Found); }