示例#1
0
		public void OrderDetailsTest()
		{
			DALDB db = new DALDB();
			int n = 10248;
			Assert.AreEqual(true, db.OrderDetails(n));

		}
示例#2
0
		public void EmptyTablegOrderDetailsTest()
		{
			DALDB db = new DALDB();
			int n = 10;
			Assert.AreEqual(true, db.OrderDetails(n));

		}
        public List<WorkOrder.Workorder> JSONDataAll()
        {
            DALDB dal = new DALDB(connStr);

            List<Workorder> lstWO = new List<Workorder>();
            lstWO = dal.GetWorkorders();
            //string json = "";
            //MemoryStream stream1 = new MemoryStream();
            //DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(List<Employee>));

            //ser.WriteObject(stream1, lstEmps);

            return lstWO;
        }
        //public string JSONData(string id)
        //{
        //    return "You requested product " + id;
        //}
        public WorkOrder.Workorder JSONData(string ID)
        {
            DALDB dal = new DALDB(connStr);
            int id = int.Parse(ID);
            Workorder wo = dal.GetWorkorder(id);
            //string strEmp = emp.getEmployeeName(id);

            //MemoryStream stream1 = new MemoryStream();
            //DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(Employee));
            //ser.WriteObject(stream1, emp);
            //string json = Encoding.Default.GetString(stream1.ToArray());

            return wo;
        }
示例#5
0
		public void CreateWrongOrderTest()
		{
			DALDB db = new DALDB();

			string CustomerID = "";
			int EmployeeID = 0;
			DateTime OrderDate = DateTime.MinValue;
			DateTime RequiredDate = DateTime.MinValue;
			DateTime ShippedDate = DateTime.MinValue;
			int ShipVia = -1;
			float Freight = -1;
			string ShipName = "Rattlesnake Canyon Grocery";
			string ShipAddress = "2817 Milton Dr.";
			string ShipCity = "Albuquerque";
			string ShipRegion = "NM";
			string ShipPostalCode = "87110";
			string ShipCountry = "USA";

			Orders note = new Orders(CustomerID, EmployeeID, OrderDate,
			RequiredDate, ShippedDate, ShipVia, Freight, ShipName, ShipAddress,
			ShipCity, ShipRegion, ShipPostalCode, ShipCountry);

			Assert.AreEqual(false, db.CreateOrder(note));
		}
        public int UpdateWorkorder(Stream stream)
        {
            DALDB dal = new DALDB(connStr);
            WorkOrder.Workorder wo = new Workorder();
            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(WorkOrder.Workorder));
            wo = (WorkOrder.Workorder)ser.ReadObject(stream);

            if (wo != null)
            {
                if (dal.GetWorkorder(wo.wo_ID) != null)
                {
                    dal.UpdateWorkorder(wo);
                }
                return 1;
            }
            dal.AddWorkorder(wo);
            //string fileName = Server.MapPath("Output.txt");
            // write a text file
            FileStream fs = new FileStream(@"c:\xworkorders.txt", FileMode.Append);
            TextWriter tws = new StreamWriter(fs);

            // write the current datetime to the stream
            tws.WriteLine(DateTime.Now);

            // write test strings to the stream
            tws.WriteLine(wo.wo_ID);
            tws.WriteLine(wo.wo_Number);
            tws.WriteLine(wo.wo_Date);
            tws.WriteLine(wo.wo_Debtor);
            tws.WriteLine(wo.wo_Address);
            tws.WriteLine(wo.wo_StartTime);

            tws.Close();   // close the stream

            return 1;
        }
示例#7
0
		public void EmptyTableCustOrdersDetailTest()
		{
			DALDB db = new DALDB();
			int s = -9;
			Assert.AreEqual(true, db.CustOrdersDetail(s));
		}
示例#8
0
		public void CustOrdersDetailTest()
		{
			DALDB db = new DALDB();
			int s = 10250;
			Assert.AreEqual(true, db.CustOrdersDetail(s));
		}
示例#9
0
		public void EmptyTableCustOrderHistTest()
		{
			DALDB db = new DALDB();
			string s = "test";
			Assert.AreEqual(true, db.CustOrderHist(s));
		}
示例#10
0
		public void CustOrderHistTest()
		{
			DALDB db = new DALDB();
			string s = "RATTC";
			Assert.AreEqual(true, db.CustOrderHist(s));
		}
示例#11
0
		public void ShowOrdersTest()
		{
			DALDB db = new DALDB();
			Assert.AreEqual(true, db.ShowOrders());
		}
示例#12
0
		public void GetWrongOrderTest()
		{
			DALDB db = new DALDB();
			int id = -15;
			Assert.AreEqual(false, db.GetOrder(id));
		}
示例#13
0
		public void GetOrderTest()
		{
			DALDB db = new DALDB();
			int id = 12083;
			Assert.AreEqual(true, db.GetOrder(id));
		}
示例#14
0
		public void SendWrongOrderTest()
		{
			DALDB db = new DALDB();
			int id = 0;
			Assert.AreEqual(false, db.SendOrder(id));
		}