public OLS ConstructOLS(tbl_servicedata service, tbl_labourerdata labourer, tbl_offeredservicesdata offeredServiceObj) { OLS ols = new OLS(); ols.fld_addedtowishlist = 0; ols.fld_address = labourer.fld_address; ols.fld_area = offeredServiceObj.fld_area; ols.fld_category = service.fld_category; ols.fld_cost = Convert.ToInt32(offeredServiceObj.fld_cost * 100); ols.fld_dateofbirth = labourer.fld_dateofbirth; ols.fld_description = service.fld_description; ols.fld_email = labourer.fld_email; ols.fld_firstname = labourer.fld_firstname; ols.fld_gender = labourer.fld_gender; ols.fld_imagelink = service.fld_imagelink; ols.fld_labourerid = labourer.fld_labourerid; ols.fld_lastname = labourer.fld_lastname; ols.fld_name = service.fld_name; ols.fld_phonenumber = labourer.fld_phonenumber; ols.fld_serviceid = service.fld_serviceid; ols.fld_stillavailable = offeredServiceObj.fld_stillavailable; ols.fld_timefirst = offeredServiceObj.fld_timefirst.ToString(); ols.fld_timelast = offeredServiceObj.fld_timelast.ToString(); ols.fld_timesbought = offeredServiceObj.fld_timesbought; ols.fld_zipcode = labourer.fld_zipcode; ols.fld_offeredserviceid = offeredServiceObj.fld_offeredserviceid; return(ols); }
public void Insert_Two_Node() { OLS <string> list = new OLS <string>(); list.Add_in_Tail("Смирнов"); list.Add_in_Head("Петров"); Assert.AreEqual(list.tail.Data, "Смирнов"); Assert.AreEqual(list.head.Data, "Петров"); }
public void ТоСписокУдален() { OLS <string> .Node <string> current = list.head; while (current != null) { Assert.AreEqual(current.Data, null); current = current.Next; } }
public void Insert_Node_in_Tail_List() //добавить узел в хвост списка { OLS <string> list = new OLS <string>(); list.Add_in_Head("Мышкин"); list.Add_in_Head("Иванова"); list.Add_in_Head("Смирнов"); list.Add_in_Tail("Кравчук"); list.Add_in_Head("Петров"); Assert.AreEqual(list.tail.Data, "Кравчук"); }
public void ТоДанныйУзелУдален() { Assert.AreEqual(list.count, 3); OLS <string> .Node <string> current = list.head; while (current != null) { Assert.AreNotEqual(current.Data, "Петров"); current = current.Next; } }
public void ТоПослеЗданногоУзлаБудетДобавленныйЭлемент() { OLS <string> .Node <string> current = list.head; int i = 0; while (i != 3) { current = current.Next; i++; } Assert.AreNotEqual(current.Data, "Кузнецова"); }
public IActionResult OLSPreview(string offeredService, string serviceId, string labourerId) { tbl_servicedata service = EsServiceQuery.FindById(Convert.ToInt32(serviceId)); tbl_labourerdata labourer = EsLabourerQuery.FindById(Convert.ToInt32(labourerId)); tbl_offeredservicesdata offeredServiceObj = JsonConvert.DeserializeObject <tbl_offeredservicesdata>(offeredService); offeredServiceObj.fld_offeredserviceid = 0; OLS ols = ConstructOLS(service, labourer, offeredServiceObj); return(PartialView("OLSPreview", ols)); }
public void Remove_the_Entire_List() //удалить весь список { OLS <string> list = new OLS <string>(); list.Add_in_Tail("Смирнов"); list.Add_in_Head("Петров"); list.Add_in_Head("Иванов"); list.Add_in_Head("Васичкин"); list.Clear(); OLS <string> .Node <string> current = list.head; while (current != null) { Assert.AreEqual(current.Data, null); current = current.Next; } }
public void Remove_Specified_Node() // удалить заданный узел { OLS <string> list = new OLS <string>(); list.Add_in_Tail("Смирнов"); list.Add_in_Head("Петров"); list.Add_in_Head("Иванов"); list.Add_in_Head("Васичкин"); list.Remove("Петров"); Assert.AreEqual(list.count, 3); OLS <string> .Node <string> current = list.head; while (current != null) { Assert.AreNotEqual(current.Data, "Петров"); current = current.Next; } }
public void Insert_Node_last_Specified_Node() // добавить узел после заданного узла { OLS <string> list = new OLS <string>(); list.Add_in_Tail("Смирнов"); list.Add_in_Head("Петров"); list.Add_in_Head("Иванов"); list.Add_in_Head("Васичкин"); list.Add("Кузнецова", "Иванов"); OLS <string> .Node <string> current = list.head; int i = 0; while (i != 3) { current = current.Next; i++; } Assert.AreNotEqual(current.Data, "Кузнецова"); }
public void Insert_Node() { OLS <string> list = new OLS <string>(); list.Add_in_Tail("Смирнов"); list.Add_in_Head("Петров"); list.Add_in_Head("Иванов"); list.Add_in_Head("Васичкин"); list.Add("Кузнецова", "Иванов"); OLS <string> .Node <string> current = list.head; int i = 0; while (i != 3) { current = current.Next; i++; } Assert.AreNotEqual(current.Data, "Кузнецова"); }
public void TestEstimates() { double[] TestY = new double[] { 1, 2.5, 3, 4, 5, 6 }; double[][] TestX = new double[][] { new double[] { 0, 1, 3, 4 }, new double[] { 1, 27.5, 0.3, 4 }, new double[] { 1, 34, 3.6, 4 }, new double[] { 4, 6.5, 300, 26 }, new double[] { 1, 2.5, 30, 28 }, new double[] { 1, 06, 3, 46 } }; OLS model = new OLS(TestX, TestY); RegResults estimates = model.Fit(); foreach (double el in estimates.Beta) { Console.Write(el + "\n"); } Assert.AreEqual(TestX[0].Length, estimates.Beta.Length); }
public void TestEstimatesAccuracy() { double[] TestY = new double[] { 1, 2.5, 3, 4, 5, 6 }; double[][] TestX = new double[][] { new double[] { 0, 1, 3, 4 }, new double[] { 1, 27.5, 0.3, 4 }, new double[] { 1, 34, 3.6, 4 }, new double[] { 4, 6.5, 300, 26 }, new double[] { 1, 2.5, 30, 28 }, new double[] { 1, 06, 3, 46 } }; OLS model = new OLS(TestX, TestY); RegResults estimates = model.Fit(); double[] TrueRes = new[] { 1.11242699480196, 0.039030702408277, -0.0119325883353133, 0.114322210670513 }; ApproxEqual EqualApproximately = TestUtils.ApproximatelyEqual; estimates.Beta.Should().Equal(estimates.Beta, (left, right) => EqualApproximately(left, right, 0.001)); }
public OLS CreateOLS(string offeredService, string serviceId, string labourerId) { tbl_servicedata service = EsServiceQuery.FindById(Convert.ToInt32(serviceId)); tbl_labourerdata labourer = EsLabourerQuery.FindById(Convert.ToInt32(labourerId)); tbl_offeredservicesdata offeredServiceObj = JsonConvert.DeserializeObject <tbl_offeredservicesdata>(offeredService); offeredServiceObj.fld_labourerid = labourer.fld_labourerid; offeredServiceObj.fld_serviceid = service.fld_serviceid; offeredServiceObj.fld_offeredserviceid = MollShopContext.CreateRow(offeredServiceObj, "tbl_offeredservicesdata"); OLS ols = ConstructOLS(service, labourer, offeredServiceObj); //Because ElasticSearch does not support decimal numbers, we must multiply the cost by a 100 ols.fld_cost = ols.fld_cost * 100; EsUpdater <OLS> .InsertDocument(ols, "moll_ols", "OLS", ols.fld_offeredserviceid.ToString()); //return the OfferedLabourerService, so we can later render it into the Datatable on the ManageOLS page //We must divide the cost by a 100 again, to render it correctly ols.fld_cost = ols.fld_cost / 100; return(ols); }
public void Create_OLS() { OLS <string> list = new OLS <string>(); Assert.IsNotNull(list); }
public void ДопустимЯИнициализируюСписок() { list = new OLS <string>(); }