public IEnumerable<StringTest> smart_split_tests() { System.Collections.Generic.List<StringTest> result = new System.Collections.Generic.List<StringTest>(); result.Add(new StringTest("smart split-01", @"This is ""a person\'s"" test.", new string[] { "This", "is", @"""a person\'s""", "test." } )); result.Add(new StringTest("smart split-02", @"Another 'person\'s' test.", new string[] { "Another", @"'person's'", "test." } )); result.Add(new StringTest("smart split-03", "A \"\\\"funky\\\" style\" test.", new string[] { "A", "\"\"funky\" style\"", "test." } )); result.Add(new StringTest("smart split-04", @"A '\'funky\' style' test.", new string[] { "A", @"''funky' style'", "test." } )); return result; }
public System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel> GetGroupedRelatedItems(AccountItem itemCompareTo, bool searchingOnlyCurrentMonthData = true, System.Action<AccountItem> itemAdded = null) { System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel> list = new System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel>(); IOrderedEnumerable<AccountItem> source = from p in this.GetRelatedItems(itemCompareTo, searchingOnlyCurrentMonthData) orderby p.CreateTime descending select p; if (itemAdded == null) { itemAdded = delegate(AccountItem ai) { }; } var dates = (from p in source select p.CreateTime.Date).Distinct<System.DateTime>(); foreach (var item in dates) { GroupByCreateTimeAccountItemViewModel agvm = new GroupByCreateTimeAccountItemViewModel(item); source.Where(p => p.CreateTime.Date == item.Date).ToList<AccountItem>().ForEach(delegate(AccountItem x) { agvm.Add(x); itemAdded(x); }); list.Add(agvm); } return list; }
public override ObjectWithId SaveChanges(bool updateTree) { DebtActionStatusContent content = new DebtActionStatusContent(); System.Collections.Generic.List<FasetItem> list = (System.Collections.Generic.List<FasetItem>) this.bsAllActionStatusContents.get_DataSource(); System.Collections.Generic.List<FasetItem> list2 = (System.Collections.Generic.List<FasetItem>) this.bsAvailableActionStatusContents.get_DataSource(); System.Collections.Generic.List<FasetItem> list3 = new System.Collections.Generic.List<FasetItem>(); this.fillStatusContent(); foreach (FasetItem item in this.availableStatusContent) { foreach (FasetItem item2 in list2) { if (item.Id == item2.Id) { list3.Add(item); } } } foreach (FasetItem item3 in this.availableStatusContent) { list.Remove(item3); } foreach (FasetItem item4 in list) { content.DebtActionStatusId = (int) ((int) this.status.Id); content.StatusId = item4.Id; content.Created = System.DateTime.Now; content.Insert(); } foreach (FasetItem item5 in list3) { content.Id = content.FindByDebtActionStatusIdAndDebtActionStatusId((int) ((int) this.status.Id), item5.Id).Id; content.Delete(); } return content; }
public void GetAllForProduct_should_return_active_stockItems_for_product() { Func<int, string, string, StockItem> createStockItem = (id, size, product) => StockItem.Create(product, size, new DateTime(2011, 2, 20), "*****@*****.**").SetId(id); var stockItems = new System.Collections.Generic.List<StockItem> { createStockItem(1, "-", "Widget"), createStockItem(2, "Error", "Widget"), createStockItem(3, "s", "Widget"), createStockItem(4, "m", "Widget"), createStockItem(5, "l", "Widget"), createStockItem(6, "-", "Gadget"), createStockItem(7, "Large", "Gadget"), }; stockItems[0].Deactivate(new DateTime(2011, 2, 20), "mike"); stockItems[1].Deactivate(new DateTime(2011, 2, 20), "mike"); stockItemRepository.GetAllDelegate = () => stockItems.AsQueryable(); var returnedItems = stockItemService.GetAllForProduct("Widget"); returnedItems.Count().ShouldEqual(3); returnedItems.First().ShouldBeTheSameAs(stockItems[2]); returnedItems.Last().ShouldBeTheSameAs(stockItems[4]); }
public void Notify(params object[] args) { if (args != null && args.Length != 0 && args[0] is EntityEvent) { BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey; if (!(key == null)) { Customer customer = key.GetEntity() as Customer; if (PubHelper.IsOrg_Customer2DMS(customer)) { bool flag = PubHelper.IsUsedDMSAPI(); if (flag) { //if ((customer.CustomerCategoryKey != null && (customer.CustomerCategory.Code == "101007" || customer.CustomerCategory.Code == "101006")) // || (customer.CustomerCategory != null // && customer.CustomerCategory.DescFlexField != null // && customer.CustomerCategory.DescFlexField.PrivateDescSeg1.GetBool() // ) // ) if( PubHelper.IsUpdateDMS(customer) ) { try { SI08ImplService service = new SI08ImplService(); // service.Url = PubHelper.GetAddress(service.Url); System.Collections.Generic.List<dealerInfoDto> list = new System.Collections.Generic.List<dealerInfoDto>(); dealerInfoDto dto = new dealerInfoDto(); dto.dealerCode = customer.Code; dto.dealerName = customer.Name; dto.dealerShortName = customer.ShortName; dto.companyCode = customer.Code; dto.companyName = customer.Name; dto.companyShortName = customer.ShortName; if (customer.CustomerCategoryKey != null) { dto.dealerType = int.Parse(customer.CustomerCategory.Code); } dto.actionType = 3; // status 100201 有效 100202 无效 dto.status = (customer.Effective != null && customer.Effective.IsEffective) ? "100201" : "100202"; list.Add(dto); dealerInfoDto d = service.Do(list.ToArray()); if (d != null && d.flag == 0) { throw new System.ApplicationException(d.errMsg); } } catch (System.Exception e) { throw new System.ApplicationException("调用DMS接口错误:" + e.Message); } } } } } } }
public ActionResult Index() { var clients = new System.Collections.Generic.List<Client> { new Client { Id = 1, Name = "Julio Avellaneda", Email = "*****@*****.**" }, new Client { Id = 2, Name = "Juan Torres", Email = "*****@*****.**" }, new Client { Id = 3, Name = "Oscar Camacho", Email = "*****@*****.**" }, new Client { Id = 4, Name = "Gina Urrego", Email = "*****@*****.**" }, new Client { Id = 5, Name = "Nathalia Ramirez", Email = "*****@*****.**" }, new Client { Id = 6, Name = "Raul Rodriguez", Email = "*****@*****.**" }, new Client { Id = 7, Name = "Johana Espitia", Email = "*****@*****.**" }, new Client { Id = 11, Name = "Julio Avellaneda", Email = "*****@*****.**" }, new Client { Id = 22, Name = "Juan Torres", Email = "*****@*****.**" }, new Client { Id = 33, Name = "Oscar Camacho", Email = "*****@*****.**" }, new Client { Id = 42, Name = "Gina Urrego", Email = "*****@*****.**" }, new Client { Id = 50, Name = "Nathalia Ramirez", Email = "*****@*****.**" }, new Client { Id = 62121, Name = "Raul Rodriguez", Email = "*****@*****.**" }, new Client { Id = 721, Name = "Johana Espitia", Email = "*****@*****.**" }, new Client { Id = 121, Name = "Julio Avellaneda", Email = "*****@*****.**" }, new Client { Id = 221, Name = "Juan Torres", Email = "*****@*****.**" }, new Client { Id = 321, Name = "Oscar Camacho", Email = "*****@*****.**" }, new Client { Id = 421, Name = "Gina Urrego", Email = "*****@*****.**" }, new Client { Id = 521, Name = "Nathalia Ramirez", Email = "*****@*****.**" }, new Client { Id = 621, Name = "Raul Rodriguez", Email = "*****@*****.**" }, new Client { Id = 72, Name = "Johana Espitia", Email = "*****@*****.**" } }; return View(clients); }
public RendererUniversal(Sprite sprite) : base(sprite) { verts = new System.Collections.Generic.List<float>(); colors = new System.Collections.Generic.List<float>(); uvs = new System.Collections.Generic.List<float>(); }
public System.Collections.Generic.List<SearchNodeStaff> SearchStaffNode(string value) { System.Collections.Generic.List<SearchNodeStaff> result; try { if (!string.IsNullOrEmpty(value)) { System.Collections.Generic.List<Staff> staffList = this.IndexOfStaff(value); System.Collections.Generic.List<SearchNodeStaff> nodes = null; if (staffList != null && staffList.Count > 0) { nodes = new System.Collections.Generic.List<SearchNodeStaff>(); foreach (Staff staff in staffList) { SearchNodeStaff node = new SearchNodeStaff(staff); if (node != null) { nodes.Add(node); } } } result = nodes; return result; } } catch (System.Exception e) { this.logger.Error(e.ToString()); } result = null; return result; }
public ListFileDlg(EnvDTE80.DTE2 dte,RecordHandler rec) { InitializeComponent(); //�����ļ���ַ txt_FilePath.Text = RecordHandler.GetValueFromRegistry(); _manuallySettingSelection = false; _dte = dte; _fileNames = new System.Collections.Generic.List<ProjectItemInfo>(); foreach (EnvDTE.Project project in _dte.Solution.Projects) { WalkProject(project.ProjectItems); } LogTimer.Interval = 2000; LogTimer.Tick += new EventHandler(LogTimer_Tick); RecordTable = initRecordTable(); initProjectSelector(); btn_ReadRecordCurProject_Click(null, null); de_begin.DateTime = DateTime.Today; de_end.DateTime = DateTime.Today; recHandler = rec; }
public override void Init () { finished = false; Winners = new System.Collections.Generic.List<PlayerID>(); inGameFirePlaces = new List<Fireplace>(); inGameLogs = new List<GameObject>(); int numPlayers = GameManager.instance.AllPlayers.Count; if(GameManager.instance.CharacterToPlayer.ContainsKey(Assets.Scripts.Util.Enums.Characters.Opochtli)) { inGameFirePlaces.Add(((GameObject)GameObject.Instantiate(firePlaces[0], new Vector2(-5,1), Quaternion.identity)).GetComponent<Fireplace>()); } if(GameManager.instance.CharacterToPlayer.ContainsKey(Assets.Scripts.Util.Enums.Characters.Zolin)) { inGameFirePlaces.Add(((GameObject)GameObject.Instantiate(firePlaces[1], new Vector2(-5,-3), Quaternion.identity)).GetComponent<Fireplace>()); } if(GameManager.instance.CharacterToPlayer.ContainsKey(Assets.Scripts.Util.Enums.Characters.Yaotl)) { inGameFirePlaces.Add(((GameObject)GameObject.Instantiate(firePlaces[2], new Vector2(5,1), Quaternion.identity)).GetComponent<Fireplace>()); } if(GameManager.instance.CharacterToPlayer.ContainsKey(Assets.Scripts.Util.Enums.Characters.Coatl)) { inGameFirePlaces.Add(((GameObject)GameObject.Instantiate(firePlaces[3], new Vector2(5,-3), Quaternion.identity)).GetComponent<Fireplace>()); } for(int i = 0; i < 20; i++) { inGameLogs.Add((GameObject)GameObject.Instantiate(logs, new Vector2(Random.Range(-3,3), Random.Range(1f,-4f)), Quaternion.identity)); } for(int i = 0; i < GameManager.instance.AllPlayers.Count; i++) { GameManager.instance.AllPlayers[i].LifeComponent.Health = 100; GameManager.instance.AllPlayers[i].Anim.SetBool("Stay Dead", false); GameManager.instance.AllPlayers[i].Active = true; } }
private void Generate3dObject() { double[] frontLeftBottom = new double[] {0,0,0 }; double[] frontRightBottom = new double[] {1,0,0 }; double[] frontLeftTop = new double[] {0,0,1 }; double[] frontRightTop = new double[] { 1,0,1}; double[] backLeftBottom = new double[] { 0,1,0}; double[] backRightBottom = new double[] { 1,1,0}; double[] backLeftTop = new double[] {0,1,1 }; double[] backRightTop = new double[] { 1,1,1}; System.Collections.Generic.List<line> ls = new System.Collections.Generic.List<line>(); ls.Add(new line(frontLeftBottom, frontRightBottom)); ls.Add(new line(frontLeftBottom, frontLeftTop)); ls.Add(new line(frontLeftTop, frontRightTop)); ls.Add(new line(frontRightBottom, frontRightTop)); double[] cameraPosition = new double[] { 0.5, -1, 0.5 }; double cameraRotation = 0.0; double[][] cameraMatrixx = MatrixExtensions.UnityMatrix(3); double[] point = frontLeftBottom; double[] vec = MatrixExtensions.VectorSubtract(point, cameraPosition); double[] newPoint = MatrixExtensions.MatrixProduct(cameraMatrixx, vec); bmp = new System.Drawing.Bitmap(100, 100); using (System.Drawing.Graphics gfx = System.Drawing.Graphics.FromImage(bmp)) { gfx.DrawRectangle(System.Drawing.Pens.Red, 10, 10, 50, 50); } this.pictureBox1.Image = bmp; }
public void TestCase() { IList<string> list = new System.Collections.Generic.List<string> { "First", "Second", "Third" }; var enumerator = list.GetLoopedTwoWayEnumerator (); Assert.AreEqual (null, enumerator.Current); Assert.IsTrue (enumerator.MoveNext ()); Assert.AreEqual ("First", enumerator.Current); Assert.IsTrue (enumerator.MoveNext ()); Assert.AreEqual ("Second", enumerator.Current); Assert.IsTrue (enumerator.MoveNext ()); Assert.AreEqual ("Third", enumerator.Current); Assert.IsTrue (enumerator.MoveNext ()); Assert.AreEqual ("First", enumerator.Current); Assert.IsTrue (enumerator.MoveNext ()); Assert.AreEqual ("Second", enumerator.Current); // обратный ход Assert.IsTrue (enumerator.MovePrevious ()); Assert.AreEqual ("First", enumerator.Current); Assert.IsTrue (enumerator.MovePrevious ()); Assert.AreEqual ("Third", enumerator.Current); Assert.IsTrue (enumerator.MovePrevious ()); Assert.AreEqual ("Second", enumerator.Current); Assert.IsTrue (enumerator.MovePrevious ()); Assert.AreEqual ("First", enumerator.Current); Assert.IsTrue (enumerator.MovePrevious ()); Assert.AreEqual ("Third", enumerator.Current); Assert.IsTrue (enumerator.MoveNext ()); Assert.AreEqual ("First", enumerator.Current); }
public IEnumerable<StringTest> split_token_tests() { System.Collections.Generic.List<StringTest> result = new System.Collections.Generic.List<StringTest>(); result.Add(new StringTest("split token-01", @"This is _(""a person\'s"") test.", new string[] { "This", "is", @"_(""a person\'s"")", "test." } )); result.Add(new StringTest("split token-02", @"Another 'person\'s' test.", new string[] { "Another", @"'person's'", "test." } )); result.Add(new StringTest("split token-03", "A \"\\\"funky\\\" style\" test.", new string[] { "A", "\"\"funky\" style\"", "test." } )); /* result.Add(new StringTest("split token-04", "This is _(\"a person's\" test).", new string[] { "This", "is", "\"a person's\" test)." } )); // */ return result; }
/// <summary> /// GPS DOP and active satellites and parses an NMEA sentence /// </summary> /// <param name="NMEAsentence"></param> public GPGSA(string NMEAsentence) { _pRNInSolution = new List<string>(); try { if (NMEAsentence.IndexOf('*') > 0) NMEAsentence = NMEAsentence.Substring(0, NMEAsentence.IndexOf('*')); //Split into an array of strings. string[] split = NMEAsentence.Split(new Char[] { ',' }); if (split[1].Length > 0) _mode = split[1][0]; else _mode = ' '; if (split[2].Length > 0) { switch (split[2]) { case "2": _fixMode = GSAFixModeEnum._2D; break; case "3": _fixMode = GSAFixModeEnum._3D; break; default: _fixMode = GSAFixModeEnum.FixNotAvailable; break; } } _pRNInSolution.Clear(); for (int i = 0; i <= 11; i++) if(split[i + 3]!="") _pRNInSolution.Add(split[i + 3]); GPSHandler.dblTryParse(split[15], out _pdop); GPSHandler.dblTryParse(split[16], out _hdop); GPSHandler.dblTryParse(split[17], out _vdop); } catch { } }
public System.Collections.Generic.IEnumerable<GroupByCreateTimeAccountItemViewModel> GetGroupedRelatedItems(TallySchedule itemCompareTo, bool searchingOnlyCurrentMonthData = true, System.Action<AccountItem> itemAdded = null) { System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel> list = new System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel>(); IOrderedEnumerable<AccountItem> source = from p in this.GetRelatedItems(itemCompareTo, searchingOnlyCurrentMonthData) orderby p.CreateTime descending select p; if (itemAdded == null) { itemAdded = (ai) => { }; } foreach (var item in (from p in source select p.CreateTime.Date).Distinct<System.DateTime>()) { GroupByCreateTimeAccountItemViewModel agvm = new GroupByCreateTimeAccountItemViewModel(item); (from p in source.Where<AccountItem>(p => p.CreateTime.Date == item.Date) orderby p.Money select p) .ToList<AccountItem>() .ForEach((x) => { agvm.Add(x); itemAdded(x); }); list.Add(agvm); } this.HasLoadAssociatedItemsForCurrentViewAccount = true; return list; }
public void ChromeOptions_add_one_extension() { string[] expected = { "SePSX.dll" }; AddSeChromeExtensionCommand cmdlet = //new AddSeChromeExtensionCommandTestFixture(); WebDriverFactory.Container.Resolve<AddSeChromeExtensionCommand>(); //AddSeChromeExtensionCommand.UnitTestMode = true; cmdlet.InputObject = //WebDriverFactory.GetChromeOptions(); // resolve ChromeOptions WebDriverFactory.Container.Resolve<ChromeOptions>(); cmdlet.ExtensionList = expected; SeAddChromeExtensionCommand command = new SeAddChromeExtensionCommand(cmdlet); command.Execute(); System.Collections.Generic.List<string> listOfArguments = new System.Collections.Generic.List<string>(); listOfArguments.Add(expected[0]); ReadOnlyCollection<string> expectedList = new ReadOnlyCollection<string>(listOfArguments); //Assert.AreEqual(expectedList, (SePSX.CommonCmdletBase.UnitTestOutput[0] as ChromeOptions).Extensions); Assert.AreEqual( expectedList, ((ChromeOptions)(object)PSTestLib.UnitTestOutput.LastOutput[0]).Extensions); }
public System.Collections.Generic.List<DataFeed> GetDataFeed(PricingLibrary.FinancialProducts.IOption option, System.DateTime fromDate) { System.Collections.Generic.List<DataFeed> result = new System.Collections.Generic.List<DataFeed>() ; using (DataBaseDataContext mtdc = new DataBaseDataContext()) { var result1 = (from s in mtdc.HistoricalShareValues where ((option.UnderlyingShareIds.Contains(s.id)) && (s.date >= fromDate)&&(s.date<=option.Maturity)) select s).OrderByDescending(d => d.date).ToList(); System.DateTime curentdate = result1[result1.Count() - 1].date; System.Collections.Generic.Dictionary<String, decimal> priceList = new System.Collections.Generic.Dictionary<String, decimal>(); for (int i = result1.Count() - 1; i >= 0 ; i--) { if (result1[i].date==curentdate) { priceList.Add(result1[i].id.Trim(), result1[i].value); } else { DataFeed datafeed = new DataFeed(curentdate, priceList); result.Add(datafeed); curentdate = result1[i].date; priceList = new System.Collections.Generic.Dictionary<String, decimal>(); priceList.Add(result1[i].id.Trim(), result1[i].value); } if (i == 0) { DataFeed datafeedOut = new DataFeed(curentdate, priceList); result.Add(datafeedOut); } } return result; } }
/// <summary> /// Start the console server. /// </summary> /// <param name="args">These are optional arguments.Pass the local ip address of the server as the first argument and the local port as the second argument.</param> public VsServer() { vsClients = new List<ClientManager>(); vsAppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase.Remove(0,8)); vsSettingsFile = Path.Combine(vsAppPath, "server.config"); }
public void TestMercator_1SP_Projection() { CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); System.Collections.Generic.List<ProjectionParameter> parameters = new System.Collections.Generic.List<ProjectionParameter>(5); parameters.Add(new ProjectionParameter("latitude_of_origin", 0)); parameters.Add(new ProjectionParameter("central_meridian", 110)); parameters.Add(new ProjectionParameter("scale_factor", 0.997)); parameters.Add(new ProjectionParameter("false_easting", 3900000)); parameters.Add(new ProjectionParameter("false_northing", 900000)); IProjection projection = cFac.CreateProjection("Mercator_1SP", "Mercator_1SP", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Makassar / NEIEZ", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); double[] pGeo = new double[] { 120, -3 }; double[] pUtm = trans.MathTransform.Transform(pGeo); double[] pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); double[] expected = new double[] { 5009726.58, 569150.82 }; Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), String.Format("Mercator_1SP forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString())); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Mercator_1SP reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString())); }
protected void Display_ViewAll() { CatalogEntry CatalogManager = new CatalogEntry(m_refContentApi.RequestInformationRef); System.Collections.Generic.List<EntryData> entryList = new System.Collections.Generic.List<EntryData>(); Ektron.Cms.Common.Criteria<EntryProperty> entryCriteria = new Ektron.Cms.Common.Criteria<EntryProperty>(); entryCriteria.PagingInfo.RecordsPerPage = m_refContentApi.RequestInformationRef.PagingSize; entryCriteria.PagingInfo.CurrentPage = _currentPageNumber; entryCriteria.AddFilter(EntryProperty.CatalogId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_iID); entryCriteria.AddFilter(EntryProperty.LanguageId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_refContentApi.RequestInformationRef.ContentLanguage); entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, false); entryCriteria.AddFilter(EntryProperty.IsPublished, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, true); entryCriteria.OrderByDirection = Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending; entryCriteria.OrderByField = Util_GetSortColumn(); switch (m_sPageAction) { case "browsecrosssell": case "browseupsell": case "couponselect": // If m_sPageAction = "couponselect" Then entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, CatalogEntryType.SubscriptionProduct) entryList = CatalogManager.GetList(entryCriteria); break; case "browse": long[] IdList = new long[3]; IdList[0] = Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product); // IdList(1) = Ektron.Cms.Common.EkEnumeration.CatalogEntryType.ComplexProduct entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.In, IdList); if (excludeId > 0) { entryCriteria.AddFilter(EntryProperty.Id, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, excludeId); } entryList = CatalogManager.GetList(entryCriteria); break; default: pnl_catalogs.Visible = true; pnl_viewall.Visible = false; System.Collections.Generic.List<CatalogData> catalogList = new System.Collections.Generic.List<CatalogData>(); catalogList = CatalogManager.GetCatalogList(1, 1); Util_ShowCatalogs(catalogList); break; } TotalPagesNumber = System.Convert.ToInt32(entryCriteria.PagingInfo.TotalPages); if (TotalPagesNumber > 1) { SetPagingUI(); } Populate_ViewCatalogGrid(entryList); }
/// <summary> /// This method sorts the items in a listbox. /// </summary> /// <param name="items">The list control.</param> /// <param name="Descending">Whether to sort the list box descending. </param> public static void SortListItems(this ListItemCollection items, bool Descending) { System.Collections.Generic.List<ListItem> list = new System.Collections.Generic.List<ListItem>(); foreach (ListItem i in items) { list.Add(i); } if (Descending) { IEnumerable<ListItem> itemEnum = from item in list orderby item.Text descending select item; items.Clear(); items.AddRange(itemEnum.ToArray()); // anonymous delegate list.Sort(delegate(ListItem x, ListItem y) { return y.Text.CompareTo(x.Text); }); } else { IEnumerable<ListItem> itemEnum = from item in list orderby item.Text ascending select item; items.Clear(); items.AddRange(itemEnum.ToArray()); //list.Sort(delegate(ListItem x, ListItem y) { return x.Text.CompareTo(y.Text); }); } }
public void TestAlbersProjection() { CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory(); IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Clarke 1866", 6378206.4, 294.9786982138982, LinearUnit.USSurveyFoot); IHorizontalDatum datum = cFac.CreateHorizontalDatum("Clarke 1866", DatumType.HD_Geocentric, ellipsoid, null); IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Clarke 1866", AngularUnit.Degrees, datum, PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East), new AxisInfo("Lat", AxisOrientationEnum.North)); System.Collections.Generic.List<ProjectionParameter> parameters = new System.Collections.Generic.List<ProjectionParameter>(5); parameters.Add(new ProjectionParameter("central_meridian", -96)); parameters.Add(new ProjectionParameter("latitude_of_center", 23)); parameters.Add(new ProjectionParameter("standard_parallel_1", 29.5)); parameters.Add(new ProjectionParameter("standard_parallel_2", 45.5)); parameters.Add(new ProjectionParameter("false_easting", 0)); parameters.Add(new ProjectionParameter("false_northing", 0)); IProjection projection = cFac.CreateProjection("Albers Conical Equal Area", "albers", parameters); IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Albers Conical Equal Area", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North)); ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys); double[] pGeo = new double[] { -75, 35 }; double[] pUtm = trans.MathTransform.Transform(pGeo); double[] pGeo2 = trans.MathTransform.Inverse().Transform(pUtm); double[] expected = new double[] { 1885472.7, 1535925 }; Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.05), String.Format("Albers forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString())); Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Albers reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString())); }
public void RandomTest() { RingBuffer<int> TestObject = new RingBuffer<int>(10); Utilities.Random.Random Rand = new Utilities.Random.Random(); int Value = 0; for (int x = 0; x < 10; ++x) { Value = Rand.Next(); TestObject.Add(Value); Assert.Equal(1, TestObject.Count); Assert.Equal(Value, TestObject.Remove()); } Assert.Equal(0, TestObject.Count); System.Collections.Generic.List<int> Values=new System.Collections.Generic.List<int>(); for (int x = 0; x < 10; ++x) { Values.Add(Rand.Next()); } TestObject.Add(Values); Assert.Equal(Values.ToArray(), TestObject.ToArray()); for (int x = 0; x < 10; ++x) { Assert.Throws<IndexOutOfRangeException>(() => TestObject.Add(Rand.Next())); Assert.Equal(10, TestObject.Count); } }
public ICancelaResponse CancelaCFDI(string user, string password, string rfc, string[] uuid, byte[] pfx, string pfxPassword) { //return this.cancelaCFDi(user, password, rfc, uuid, pfx, pfxPassword); CancelaResponse response = this.cancelaCFDi(user, password, rfc, uuid, pfx, pfxPassword); CancelaResponseBase responseBase = new CancelaResponseBase(); responseBase.Ack = response.ack; responseBase.Text = response.text; System.Collections.Generic.List<string> uuidsList = new System.Collections.Generic.List<string>(); foreach (string uuidItem in response.uuids) { uuidsList.Add(uuidItem); } responseBase.UUIDs = uuidsList.ToArray(); System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(response.GetType()); MemoryStream ms = new MemoryStream(); XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = new UTF8Encoding(); XmlWriter xmlWriter = XmlWriter.Create(ms, settings); x.Serialize(xmlWriter, response); string xmlContent = Encoding.UTF8.GetString(ms.GetBuffer()); responseBase.XmlResponse = xmlContent; return responseBase; }
protected void Display_All() { System.Collections.Generic.List<TaxClassData> TaxClassList = new System.Collections.Generic.List<TaxClassData>(); Ektron.Cms.Common.Criteria<TaxClassProperty> criteria = new Ektron.Cms.Common.Criteria<TaxClassProperty>(TaxClassProperty.Name, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending); criteria.PagingInfo.RecordsPerPage = m_refContentApi.RequestInformationRef.PagingSize; criteria.PagingInfo.CurrentPage = _currentPageNumber; TaxClassList = m_refTaxClass.GetList(criteria); TotalPagesNumber = System.Convert.ToInt32(criteria.PagingInfo.TotalPages); TotalPages.ToolTip = TotalPagesNumber.ToString(); if (TotalPagesNumber <= 1) { TotalPages.Visible = false; CurrentPage.Visible = false; lnkBtnPreviousPage.Visible = false; NextPage.Visible = false; LastPage.Visible = false; FirstPage.Visible = false; PageLabel.Visible = false; OfLabel.Visible = false; } else { lnkBtnPreviousPage.Enabled = true; FirstPage.Enabled = true; LastPage.Enabled = true; NextPage.Enabled = true; TotalPages.Visible = true; CurrentPage.Visible = true; lnkBtnPreviousPage.Visible = true; NextPage.Visible = true; LastPage.Visible = true; FirstPage.Visible = true; PageLabel.Visible = true; OfLabel.Visible = true; TotalPages.Text = (System.Math.Ceiling(Convert.ToDecimal(TotalPagesNumber))).ToString(); CurrentPage.Text = _currentPageNumber.ToString(); CurrentPage.ToolTip = CurrentPage.Text; if (_currentPageNumber == 1) { lnkBtnPreviousPage.Enabled = false; FirstPage.Enabled = false; } else if (_currentPageNumber == TotalPagesNumber) { NextPage.Enabled = false; LastPage.Enabled = false; } } dg_viewall.DataSource = TaxClassList; dg_viewall.Columns[0].HeaderText = this.GetMessage("generic id"); dg_viewall.Columns[1].HeaderText = this.GetMessage("generic name"); dg_viewall.DataBind(); }
//Sets the exit of the start tile (selecting a random one inside the bounds). public int startExit (Coordinate coordinate) { int res = 0; List<int> allExits = new System.Collections.Generic.List<int> (); for (int i =1; i<7; i++) { allExits.Add (i); } while (res == 0) { int randomVal = (int)Mathf.Floor (Random.Range (0, allExits.Count)); int possibleExit = allExits [randomVal]; Coordinate possibleFirstTile = getCoordinateFromExit (coordinate, possibleExit); if (isOnBounds (possibleFirstTile)) { res = possibleExit; } else { allExits.RemoveAt (randomVal); } } return res; }
public TheTVDB(FileInfo loadFrom, FileInfo cacheFile, CommandLineArgs args) { Args = args; System.Diagnostics.Debug.Assert(cacheFile != null); this.CacheFile = cacheFile; this.LastError = ""; // this.WhoHasLock = new List<String>(); this.Connected = false; this.ExtraEpisodes = new System.Collections.Generic.List<ExtraEp>(); this.LanguageList = new System.Collections.Generic.Dictionary<string, string>(); this.LanguageList["en"] = "English"; this.XMLMirror = "http://thetvdb.com"; this.BannerMirror = "http://thetvdb.com"; this.ZIPMirror = "http://thetvdb.com"; this.Series = new System.Collections.Generic.Dictionary<int, SeriesInfo>(); this.New_Srv_Time = this.Srv_Time = 0; this.LoadOK = (loadFrom == null) || this.LoadCache(loadFrom); this.ForceReloadOn = new System.Collections.Generic.List<int>(); }
/// <summary> /// Gets searchable elements as specified by search source enumeration. /// </summary> /// <param name="store">Store.</param> /// <param name="source">Search source.</param> /// <returns>List of searchable elements.</returns> public virtual List<ModelElement> GetSearchableElements(DomainModelStore store, SearchSourceEnum source) { System.Collections.Generic.List<ModelElement> elements = new System.Collections.Generic.List<ModelElement>(); if( source == SearchSourceEnum.Elements || source == SearchSourceEnum.ElementsAndReferenceRelationships ) { foreach (DomainModelElement modelElement in store.ElementDirectory.FindElements<DomainModelElement>()) { if (IsElementIncludedInDomainTree(store, modelElement.GetDomainClassId())) elements.Add(modelElement); } } if (source == SearchSourceEnum.ReferenceRelationships || source == SearchSourceEnum.ElementsAndReferenceRelationships) { foreach (DomainModelLink modelElement in store.ElementDirectory.FindElements<DomainModelLink>()) { if (modelElement.IsEmbedding) continue; DomainClassInfo info = modelElement.GetDomainClass(); if (IsLinkIncludedInDomainTree(store, info.Id)) elements.Add(modelElement); } } return elements; }
public static OpenXmlPowerToolsDocument Insert(OpenXmlPowerToolsDocument doc, IEnumerable<string> certificateList) { using (OpenXmlMemoryStreamDocument streamDoc = new OpenXmlMemoryStreamDocument(doc)) { using (Package package = streamDoc.GetPackage()) { foreach (string digitalCertificate in certificateList) { X509Certificate x509Certificate = X509Certificate2.CreateFromCertFile(digitalCertificate); PackageDigitalSignatureManager digitalSigntaureManager = new PackageDigitalSignatureManager(package); digitalSigntaureManager.CertificateOption = CertificateEmbeddingOption.InSignaturePart; System.Collections.Generic.List<Uri> partsToSign = new System.Collections.Generic.List<Uri>(); //Adds each part to the list, except relationships parts. foreach (PackagePart openPackagePart in package.GetParts()) { if (!PackUriHelper.IsRelationshipPartUri(openPackagePart.Uri)) partsToSign.Add(openPackagePart.Uri); } List<PackageRelationshipSelector> relationshipSelectors = new List<PackageRelationshipSelector>(); //Creates one selector for each package-level relationship, based on id foreach (PackageRelationship relationship in package.GetRelationships()) { PackageRelationshipSelector relationshipSelector = new PackageRelationshipSelector(relationship.SourceUri, PackageRelationshipSelectorType.Id, relationship.Id); relationshipSelectors.Add(relationshipSelector); } digitalSigntaureManager.Sign(partsToSign, x509Certificate, relationshipSelectors); } } return streamDoc.GetModifiedDocument(); } }
public static void Build(ref GMapOverlay OverlayOut) { // Here loop through defined sectors and display them on the map foreach (SystemAdaptationDataSet.SectorBorder Sector in SystemAdaptationDataSet.SectorBorderDataSet) { System.Collections.Generic.List<PointLatLng> SectorPointList = new System.Collections.Generic.List<PointLatLng>(); foreach (GeoCordSystemDegMinSecUtilities.LatLongClass SectorPoint in Sector.SectorBorderPoints) { SectorPointList.Add(new PointLatLng(SectorPoint.GetLatLongDecimal().LatitudeDecimal, SectorPoint.GetLatLongDecimal().LongitudeDecimal)); } // Get sector border display attributes DisplayAttributes.DisplayAttributesType SectorBorderDisplayAttribute = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.SectorBorder); GMapPolygon SectorPolygon = new GMapPolygon(SectorPointList, Sector.SectorName); SectorPolygon.Stroke = new Pen(SectorBorderDisplayAttribute.LineColor, SectorBorderDisplayAttribute.LineWidth); Type brushType = typeof(Brushes); Brush myBrush = (Brush)brushType.InvokeMember(SectorBorderDisplayAttribute.AreaPolygonColor.Name, BindingFlags.Public | BindingFlags.Static | BindingFlags.GetProperty, null, null, new object[] { }); SectorPolygon.Fill = myBrush; OverlayOut.Polygons.Add(SectorPolygon); } }
/// <summary> /// Gets a collection Address objects. /// </summary> /// <param name="orderBy">order by</param> /// <param name="where">where</param> /// <param name=parameters">parameters</param> /// <param name="startRowIndex">Start Row Index</param> /// <param name="pageSize">PageSize</param> /// <param name="totalRows">Total rows</param> /// <returns>The retrieved collection of Address objects.</returns> protected static EntityList <ViewChequeTax> GetViewChequeTaxes(string orderBy, string where, System.Collections.Generic.List <SqlParameter> parameters, int startRowIndex, int pageSize, out long totalRows) { return(GetList <ViewChequeTax>(SelectFieldList, "FROM [dbo].[ViewChequeTax] " + where, parameters, orderBy, startRowIndex, pageSize, out totalRows)); }
/// <summary> /// Gets a collection ViewChequeTax objects by custom where clause and order by. /// </summary> /// <param name="prefix">The prefix clause allows you to inject a distinct or top clause.</param> /// <param name="where">The where clause to use for the query. Should be parameterized and start with "where"</param> /// <param name="parameters">The parameters that are listed in the where clause</param> /// <param name="orderBy">the order by clause. Shoudl start with "order by"</param> /// <returns>The retrieved collection of ViewChequeTax objects.</returns> protected static EntityList <ViewChequeTax> GetViewChequeTaxes(string prefix, string where, System.Collections.Generic.List <SqlParameter> parameters, string orderBy) { string commandText = @"SELECT " + prefix + "" + ViewChequeTax.SelectFieldList + "FROM [dbo].[ViewChequeTax] " + where + " " + orderBy; using (SqlHelper helper = new SqlHelper()) { using (IDataReader reader = helper.ExecuteDataReader(commandText, CommandType.Text, parameters)) { return(EntityBase.InitializeList <ViewChequeTax>(reader)); } } }
public void UpdateTable(string connectionString, object obj, string tableName = "fromObjectName", Dictionary <string, string> replacements = null, System.Collections.Generic.List <string> ignoreList = null) { var db = new StoreProcdureManagement(); if (tableName == "fromObjectName") { tableName = obj.GetType().Name; } var sqlCommandString = "Select TOP 1 * FROM " + tableName; var dataset = db.RunQuery(connectionString, sqlCommandString); var table = dataset.Tables[0]; var dic = obj.ToDictionary(); if (replacements != null) { foreach (var newName in replacements) { if (dic.Keys.Contains(newName.Key)) { dic.Add(newName.Value, dic[newName.Key]); dic.Remove(newName.Key); } } } sqlCommandString = "UPDATE " + tableName + " SET "; var fields = ""; //var values = ""; var valueList = new List <string>(); var counter = 0; //var sqlParameter = new List<SqlParameter>(); var primaryKeys = GetPrimaryKeys(connectionString, tableName); var param = ""; foreach (var record in dic) { if ((ignoreList == null || !ignoreList.Contains(record.Key)) && primaryKeys.All(r => r != record.Key)) { if (!table.Columns.Contains(record.Key)) { throw new Exception("فیلد '" + record.Key + "' در جدول وجود ندارد"); } if (fields != "") { fields += ", "; //values += ","; } param = "@param" + counter; fields += record.Key + " = " + param; db.AddParameter(param, record.Value); counter++; } } sqlCommandString += fields; var whereCondition = ""; lock (_filters) { foreach (var f in _filters) { if (whereCondition != "") { whereCondition += " AND "; } param = "@param" + counter; counter++; whereCondition += f.ColumnName + " " + GetOprand(f.WhereFilter) + " " + param; db.AddParameter(param, f.Value); } _filters.Clear(); } if (whereCondition != "") { whereCondition = " WHERE " + whereCondition; } sqlCommandString += whereCondition; db.RunQuery(connectionString, sqlCommandString); }
public static eProvisionalBookingResponseModel ProvisionalBooking(TG_ProvisionalBookingRequestModel bookingModel) { try { #region New Modified Code Envelope objEnvelope = new Envelope(); objEnvelope.S = "http://schemas.xmlsoap.org/soap/envelope/"; Body objBody = new Body(); objBody.Xsd = "http://www.w3.org/2001/XMLSchema"; objBody.Xsi = "http://www.w3.org/2001/XMLSchema-instance"; OTA_HotelResRQ objOTA_HotelResRQ = new OTA_HotelResRQ(); POS objPOS = new POS(); Source objSource = new Source(); objSource.ISOCurrency = bookingModel.Currency; RequestorID objRequestorID = new RequestorID(); objRequestorID.ID = bookingModel.API_Credential_PropertyId; objRequestorID.MessagePassword = bookingModel.API_Credential_Password; CompanyName objCompanyName = new CompanyName(); objCompanyName.Code = bookingModel.API_Credential_UserName; objRequestorID.CompanyName = objCompanyName; objSource.RequestorID = objRequestorID; objPOS.Source = objSource; UniqueID objUniqueID = new UniqueID(); objUniqueID.ID = bookingModel.UniqueId; objUniqueID.Type = bookingModel.UniqueIdType; //==> Hotel Reservaltions HotelReservations objHotelReservations = new HotelReservations(); HotelReservation objHotelReservation = new HotelReservation(); RoomStays objRoomStays = new RoomStays(); RoomStay objRoomStay = new RoomStay(); RoomTypes objRoomTypes = new RoomTypes(); RoomType objRoomType = new RoomType(); objRoomType.RoomTypeCode = bookingModel.RoomTypeCode; objRoomType.NumberOfUnits = bookingModel.NumberOfRooms; objRoomTypes.RoomType = objRoomType; RatePlans objRatePlans = new RatePlans(); RatePlan objRatePlan = new RatePlan(); objRatePlan.RatePlanCode = bookingModel.RatePlanCode; objRatePlans.RatePlan = objRatePlan; GuestCounts objGuestCounts = new GuestCounts(); List <GuestCount> objGuestCountArr = new System.Collections.Generic.List <GuestCount>(); foreach (var room in bookingModel.RoomData) { GuestCount objAdultCount = new GuestCount(); objAdultCount.Count = room.adult.ToString(); objAdultCount.AgeQualifyingCode = "10"; objGuestCountArr.Add(objAdultCount); foreach (var item in room.ChildAge) { GuestCount objChildCount = new GuestCount(); objChildCount.Count = "1"; objChildCount.AgeQualifyingCode = "8"; objChildCount.Age = item.Age; objGuestCountArr.Add(objChildCount); } } objGuestCounts.GuestCount = objGuestCountArr; TimeSpan objTimeSpan = new TimeSpan(); objTimeSpan.End = bookingModel.CheckOut; objTimeSpan.Start = bookingModel.CheckIn; Total objTotal = new Total(); objTotal.CurrencyCode = bookingModel.Currency; objTotal.AmountBeforeTax = bookingModel.AmountBeforeTax; Taxes objTaxes = new Taxes(); objTaxes.CurrencyCode = bookingModel.Currency; objTaxes.Amount = bookingModel.TaxAmount; objTotal.Taxes = objTaxes; BasicPropertyInfo objBasicPropertyInfo = new BasicPropertyInfo(); objBasicPropertyInfo.HotelCode = bookingModel.HotelCode; Comments objComments = new Comments(); Comment objComment = new Comment(); objComment.Text = bookingModel.CustomerComment; objComments.Comment = objComment; objRoomStay.RoomTypes = objRoomTypes; objRoomStay.RatePlans = objRatePlans; objRoomStay.GuestCounts = objGuestCounts; objRoomStay.TimeSpan = objTimeSpan; objRoomStay.Total = objTotal; objRoomStay.BasicPropertyInfo = objBasicPropertyInfo; objRoomStay.Comments = objComments; objRoomStays.RoomStay = objRoomStay; ResGuests objResGuests = new ResGuests(); ResGuest objResGuest = new ResGuest(); Profiles objProfiles = new Profiles(); ProfileInfo objProfileInfo = new ProfileInfo(); Profile objProfile = new Profile(); objProfile.ProfileType = bookingModel.ProfileType; Customer objCustomer = new Customer(); PersonName objPersonName = new PersonName(); objPersonName.GivenName = bookingModel.CustomerGivenName; objPersonName.Surname = bookingModel.CustomerSurname; Telephone objTelephone = new Telephone(); objTelephone.PhoneTechType = bookingModel.PhoneTechType; objTelephone.PhoneNumber = bookingModel.PhoneNumber; objTelephone.CountryAccessCode = bookingModel.CountryAccessCode; Address objAddress = new Address(); objAddress.AddressLine = bookingModel.AddressLine; objAddress.CityName = bookingModel.CityName; objAddress.PostalCode = bookingModel.PostalCode; StateProv objStateProv = new StateProv(); objStateProv.StateCode = bookingModel.StateCode; objStateProv.Text = bookingModel.StateName; CountryName objCountryName = new CountryName(); objCountryName.Code = bookingModel.CountryCode; objCountryName.Text = bookingModel.CountryName; objAddress.StateProv = objStateProv; objAddress.CountryName = objCountryName; objCustomer.PersonName = objPersonName; objCustomer.Telephone = objTelephone; objCustomer.Email = bookingModel.CustomerEmail; objCustomer.Address = objAddress; objProfile.Customer = objCustomer; objProfileInfo.Profile = objProfile; objProfiles.ProfileInfo = objProfileInfo; objResGuest.Profiles = objProfiles; objResGuests.ResGuest = objResGuest; ResGlobalInfo objResGlobalInfo = new ResGlobalInfo(); Guarantee objGuarantee = new Guarantee(); objGuarantee.GuaranteeType = bookingModel.GuaranteeType; objResGlobalInfo.Guarantee = objGuarantee; objHotelReservation.RoomStays = objRoomStays; objHotelReservation.ResGuests = objResGuests; objHotelReservation.ResGlobalInfo = objResGlobalInfo; objHotelReservations.HotelReservation = objHotelReservation; objOTA_HotelResRQ.POS = objPOS; objOTA_HotelResRQ.UniqueID = objUniqueID; objOTA_HotelResRQ.HotelReservations = objHotelReservations; objOTA_HotelResRQ.Xmlns = "http://www.w3.org/2001/XMLSchema"; objOTA_HotelResRQ.Version = "0"; objOTA_HotelResRQ.CorrelationID = bookingModel.CorrelationID; objBody.OTA_HotelResRQ = objOTA_HotelResRQ; objEnvelope.Body = objBody; #endregion New Modified Code #region PreviousCode //Envelope objEnvelope = new Envelope(); //objEnvelope.S = "http://schemas.xmlsoap.org/soap/envelope/"; //Body objBody = new Body(); //objBody.Xsd = "http://www.w3.org/2001/XMLSchema"; //objBody.Xsi = "http://www.w3.org/2001/XMLSchema-instance"; //OTA_HotelResRQ objOTA_HotelResRQ = new OTA_HotelResRQ(); ////==> POS //POS objPOS = new POS(); //Source objSource = new Source(); //objSource.ISOCurrency = "INR"; //RequestorID objRequestorID = new RequestorID(); //objRequestorID.ID = "1300001224"; //objRequestorID.MessagePassword = "******"; //CompanyName objCompanyName = new CompanyName(); //objCompanyName.Code = "samaara"; //objRequestorID.CompanyName = objCompanyName; //objSource.RequestorID = objRequestorID; //objPOS.Source = objSource; ////==> End ////==> UniqueId //UniqueID objUniqueID = new UniqueID(); //objUniqueID.ID = ""; //objUniqueID.Type = ""; ////==> End ////==> Hotel Reservaltions //HotelReservations objHotelReservations = new HotelReservations(); //HotelReservation objHotelReservation = new HotelReservation(); //RoomStays objRoomStays = new RoomStays(); //RoomStay objRoomStay = new RoomStay(); //RoomTypes objRoomTypes = new RoomTypes(); //RoomType objRoomType = new RoomType(); //objRoomType.RoomTypeCode = "0000116417"; //objRoomType.NumberOfUnits = "1"; //objRoomTypes.RoomType = objRoomType; //RatePlans objRatePlans = new RatePlans(); //RatePlan objRatePlan = new RatePlan(); //objRatePlan.RatePlanCode = "0000432031"; //objRatePlans.RatePlan = objRatePlan; //GuestCounts objGuestCounts = new GuestCounts(); //List<GuestCount> objGuestCountArr = new System.Collections.Generic.List<GuestCount>(); //GuestCount objGuestCount = new GuestCount(); //objGuestCount.Count = "1"; //objGuestCount.AgeQualifyingCode = "10"; //GuestCount objGuestCount2 = new GuestCount(); //objGuestCount2.Count = "1"; //objGuestCount2.AgeQualifyingCode = "8"; //objGuestCount2.Age = "10"; //objGuestCountArr.Add(objGuestCount); //objGuestCountArr.Add(objGuestCount2); //objGuestCounts.GuestCount = objGuestCountArr; //TimeSpan objTimeSpan = new TimeSpan(); //objTimeSpan.Start = "2016-12-12"; //objTimeSpan.End = "2016-12-15"; //Total objTotal = new Total(); //objTotal.CurrencyCode = "INR"; //objTotal.AmountBeforeTax = "3400.0"; //Taxes objTaxes = new Taxes(); //objTaxes.CurrencyCode = "INR"; //objTaxes.Amount = "888.31"; //objTotal.Taxes = objTaxes; //BasicPropertyInfo objBasicPropertyInfo = new BasicPropertyInfo(); //objBasicPropertyInfo.HotelCode = "00019853"; //Comments objComments = new Comments(); //Comment objComment = new Comment(); //objComment.Text = "non-smoking room requested;king bed"; //objComments.Comment = objComment; //objRoomStay.RoomTypes = objRoomTypes; //objRoomStay.RatePlans = objRatePlans; //objRoomStay.GuestCounts = objGuestCounts; //objRoomStay.TimeSpan = objTimeSpan; //objRoomStay.Total = objTotal; //objRoomStay.BasicPropertyInfo = objBasicPropertyInfo; //objRoomStay.Comments = objComments; //objRoomStays.RoomStay = objRoomStay; //ResGuests objResGuests = new ResGuests(); //ResGuest objResGuest = new ResGuest(); //Profiles objProfiles = new Profiles(); //ProfileInfo objProfileInfo = new ProfileInfo(); //Profile objProfile = new Profile(); //objProfile.ProfileType = "1"; //Customer objCustomer = new Customer(); //PersonName objPersonName = new PersonName(); //objPersonName.GivenName = "Desiya"; //objPersonName.Surname = "Test"; //Telephone objTelephone = new Telephone(); //objTelephone.PhoneTechType = "1"; //objTelephone.PhoneNumber = "1234567890"; //objTelephone.CountryAccessCode = "91"; //Address objAddress = new Address(); //List<string> AddressLine = new System.Collections.Generic.List<string> { "Desia", "Malad" }; //objAddress.AddressLine = AddressLine; //objAddress.CityName = "Mumbai"; //objAddress.PostalCode = "400064"; //StateProv objStateProv = new StateProv(); //objStateProv.StateCode = "MH"; //objStateProv.Text = "Maharastra"; //CountryName objCountryName = new CountryName(); //objCountryName.Code = "IN"; //objCountryName.Text = "IN"; //objAddress.StateProv = objStateProv; //objAddress.CountryName = objCountryName; //objCustomer.PersonName = objPersonName; //objCustomer.Telephone = objTelephone; //objCustomer.Email = "*****@*****.**"; //objCustomer.Address = objAddress; //objProfile.Customer = objCustomer; //objProfileInfo.Profile = objProfile; //objProfiles.ProfileInfo = objProfileInfo; //objResGuest.Profiles = objProfiles; //objResGuests.ResGuest = objResGuest; //ResGlobalInfo objResGlobalInfo = new ResGlobalInfo(); //Guarantee objGuarantee = new Guarantee(); //objGuarantee.GuaranteeType = "PrePay"; //objResGlobalInfo.Guarantee = objGuarantee; //objHotelReservation.RoomStays = objRoomStays; //objHotelReservation.ResGuests = objResGuests; //objHotelReservation.ResGlobalInfo = objResGlobalInfo; //objHotelReservations.HotelReservation = objHotelReservation; ////==> End //objOTA_HotelResRQ.POS = objPOS; //objOTA_HotelResRQ.UniqueID = objUniqueID; //objOTA_HotelResRQ.HotelReservations = objHotelReservations; //objOTA_HotelResRQ.Xmlns = "http://www.w3.org/2001/XMLSchema"; //objOTA_HotelResRQ.Version = "0"; //objOTA_HotelResRQ.CorrelationID = "1234587345"; //objBody.OTA_HotelResRQ = objOTA_HotelResRQ; //objEnvelope.Body = objBody; //#region ////string xmlString = ""; ////XmlSerializer xsSubmit = new XmlSerializer(typeof(Envelope)); ////XmlWriterSettings settings = new XmlWriterSettings(); ////settings.Encoding = new UnicodeEncoding(false, false); // no BOM in a .NET string ////settings.Indent = true; ////settings.OmitXmlDeclaration = true; ////XmlSerializerNamespaces ns = new XmlSerializerNamespaces(); ////// exclude xsi and xsd namespaces by adding the following: ////ns.Add(string.Empty, string.Empty); ////using (StringWriter textWriter = new StringWriter()) ////{ //// using (XmlWriter xmlWriter = XmlWriter.Create(textWriter, settings)) //// { //// xsSubmit.Serialize(xmlWriter, objEnvelope, ns); //// } //// xmlString = textWriter.ToString(); //This is the output as a string ////} ////#endregion #endregion Previous Code string xmlRequestBody = clsTravelGuruApi.ConvertToXmlString(objEnvelope); string status = clsTravelGuruApi.FetchBookingTravelGuruApi(xmlRequestBody); EnvelopePBRes objEnvelopeSHRes = clsTravelGuruApi.FromXml <EnvelopePBRes>(status); eProvisionalBookingResponseModel response = new eProvisionalBookingResponseModel(); var apiResponse = objEnvelopeSHRes.Body.OTA_HotelResRS; if (apiResponse.Errors.Error != null) { var error = apiResponse.Errors.Error; // For Temperory booking Issue fix , Need to change once price mismatch issue will fix. //if (error.Code == "083") //{ // var amountAfterTax = Convert.ToDecimal(apiResponse.HotelReservations.HotelReservation.RoomStays.RoomStay.Total.AmountAfterTax); // var taxAmount = Convert.ToDecimal(objTaxes.Amount); // objTotal.AmountBeforeTax = (amountAfterTax - taxAmount).ToString(); // string xmlRequestBodyTemp = clsTravelGuruApi.ConvertToXmlString(objEnvelope); // string statusTemp = clsTravelGuruApi.FetchBookingTravelGuruApi(xmlRequestBodyTemp); // EnvelopePBRes objEnvelopeSHResTemp = clsTravelGuruApi.FromXml<EnvelopePBRes>(statusTemp); // eProvisionalBookingResponseModel responseTemp = new eProvisionalBookingResponseModel(); // var tempResponse= objEnvelopeSHResTemp.Body.OTA_HotelResRS; // if (tempResponse != null) // { // var tempError = tempResponse.Errors.Error; // responseTemp.IsSuccedded = false; // responseTemp.ErrorCode = tempError.Code; // responseTemp.ErrorMessage = tempError.Text; // } // return responseTemp; //} response.IsSuccedded = false; response.ErrorCode = error.Code; response.ErrorMessage = error.Text ?? "An unknown error has happen!"; } else { response.IsSuccedded = true; response.CorrelationID = apiResponse.CorrelationID; response.UniqueId = apiResponse.HotelReservations.HotelReservation.UniqueID.ID; response.UniqueIdType = apiResponse.HotelReservations.HotelReservation.UniqueID.Type; } return(response); } catch (Exception ex) { throw ex; } }
public static void Initialize() { try { serv.servData.SteamID = 0L; serv.servData.Username = "******"; serv.servData.Flags = UserFlags.admin; serv.servData.FirstConnectIP = "127.0.0.1"; serv.servData.LastConnectIP = "127.0.0.1"; Core.RootPath = Directory.GetCurrentDirectory(); Core.DataPath = Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetCallingAssembly().Location)); Core.SavePath = Path.GetDirectoryName(ServerSaveManager.autoSavePath); Core.LogsPath = Path.Combine(Core.SavePath, Core.LogsPath); if (!Directory.Exists(Core.DataPath)) { Directory.CreateDirectory(Core.DataPath); } if (!Directory.Exists(Core.SavePath)) { Directory.CreateDirectory(Core.SavePath); } if (!Directory.Exists(Core.LogsPath)) { Directory.CreateDirectory(Core.LogsPath); } Helper.Log("The Server Will Start.", true); Helper.Initialize(); Core.ServerIP = NetCull.config.localIP; if ((Core.ServerIP == "127.0.0.1") || (Core.ExternalIP == "127.0.0.1")) { throw new ArgumentException(Helper.ServerDenyToStarted); } if ((NetCull.config.localIP != "") && (NetCull.config.localIP != Core.ServerIP)) { throw new ArgumentException(Helper.ServerDenyToStarted); } if (!Core.BetaVersion) { Helper.Log("RustExtended Version " + Core.Version.ToString() + " (RELEASE)", true); } else { Helper.LogWarning("RustExtended Version " + Core.Version.ToString() + " (BETA)", true); } Core.AssemblyVerifed = Helper.AssemblyVerify(); if (!Core.AssemblyVerifed) { throw new ArgumentException(Helper.AssemblyNotVerified); } Helper.Log("All assembly versions has successfully verified.", true); Config.Initialize(); if (Environment.CommandLine.Contains("-debug")) { Core.Debug = true; } Singleton = new GameObject(typeof(Bootstrap).FullName); Singleton.AddComponent <Bootstrap>(); Singleton.AddComponent <Bootstrap>(); Bootstrap.Singleton = new GameObject(typeof(Bootstrap).FullName); Bootstrap.Singleton.AddComponent <Bootstrap>(); Bootstrap.Singleton.AddComponent <Events>(); Bootstrap.Singleton.AddComponent <Magma.Bootstrap>(); Main.Init(); Main.Call("ServerStart", null); OutputLogFile = CommandLine.GetSwitch("-logfile", Path.Combine(Core.DataPath, OutputLogFile)); OutputLogStream = File.Open(OutputLogFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); if (Core.DatabaseType.Equals("MYSQL")) { if (!MySQL.Initialize()) { throw new ArgumentException("MYSQL ERROR: Version " + MySQL.Version + " of library \"libmysql.dll\" is not supported."); } Helper.LogSQL("Client library version " + MySQL.Version, true); if (Core.MySQL_UTF8) { MySQL.Charset = "utf8"; } else { MySQL.Charset = "windows-1251"; } if (!MySQL.Connect(Core.MySQL_Host, Core.MySQL_Username, Core.MySQL_Password, Core.MySQL_Database, Core.MySQL_Port, null, (MySQL.ClientFlags) 0L)) { throw new ArgumentException("MYSQL ERROR: " + MySQL.Error()); } Helper.LogSQL(string.Format("Connected to \"{0}\" on port {1}, version: {2}", Core.MySQL_Host, Core.MySQL_Port, MySQL.ServerVersion), true); System.Collections.Generic.List <string> list = MySQL.Databases(null); if (list == null) { throw new ArgumentException("MYSQL ERROR: Cannot receive list of database."); } if (!list.Contains(Core.MySQL_Database)) { throw new ArgumentException("MYSQL ERROR: Database \"" + Core.MySQL_Database + "\" not exists."); } MySQL.Update(string.Format(Core.SQL_SERVER_SET, "time_startup", MySQL.QuoteString(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")))); } } catch (Exception exception) { ConsoleSystem.LogError(exception.Message.ToString()); Thread.Sleep(0x1388); Process.GetCurrentProcess().Kill(); } }
/// <summary> /// Gets a collection Address objects. /// </summary> /// <param name="orderBy">order by</param> /// <param name="where">where</param> /// <param name=parameters">parameters</param> /// <param name="startRowIndex">Start Row Index</param> /// <param name="pageSize">PageSize</param> /// <param name="totalRows">Total rows</param> /// <returns>The retrieved collection of Address objects.</returns> protected static EntityList <CustomerServiceChuli_Attach> GetCustomerServiceChuli_Attaches(string orderBy, string where, System.Collections.Generic.List <SqlParameter> parameters, int startRowIndex, int pageSize, out long totalRows) { return(GetList <CustomerServiceChuli_Attach>(SelectFieldList, "FROM [dbo].[CustomerServiceChuli_Attach] " + where, parameters, orderBy, startRowIndex, pageSize, out totalRows)); }
/// <summary> /// 分类下商品排序 /// </summary> /// <param name="categoryId">分类id</param> /// <param name="commodityIdList">商品id列表</param> /// <param name="commoditySortList">商品序号列表</param> /// <returns></returns> public Jinher.AMP.BTP.Deploy.CustomDTO.ResultDTO ReOrderCommodityInCategory(System.Guid categoryId, System.Collections.Generic.List <System.Guid> commodityIdList, System.Collections.Generic.List <int> commoditySortList) { base.Do(); return(this.Command.ReOrderCommodityInCategory(categoryId, commodityIdList, commoditySortList)); }
/// <summary> /// Gets a collection CustomerServiceChuli_Attach objects by custom where clause. /// </summary> /// <param name="prefix">The prefix clause allows you to inject a distinct or top clause.</param> /// <param name="where">The where clause to use for the query. Should be parameterized and start with "where"</param> /// <param name="parameters">The parameters that are listed in the where clause</param> /// <returns>The retrieved collection of CustomerServiceChuli_Attach objects.</returns> protected static EntityList <CustomerServiceChuli_Attach> GetCustomerServiceChuli_Attaches(string prefix, string where, System.Collections.Generic.List <SqlParameter> parameters) { return(GetCustomerServiceChuli_Attaches(prefix, where, parameters, CustomerServiceChuli_Attach.DefaultSortOrder)); }
private void btnUpdateProductTags_Click(object sender, System.EventArgs e) { string text = base.Request.Form["CheckBoxGroup"]; if (string.IsNullOrEmpty(text)) { this.ShowMsg("请先选择要关联的商品", false); return; } System.Collections.Generic.IList <int> list = new System.Collections.Generic.List <int>(); System.Collections.Generic.IList <int> list2 = new System.Collections.Generic.List <int>(); if (!string.IsNullOrEmpty(this.txtProductTag.Text.Trim())) { string text2 = this.txtProductTag.Text.Trim(); string[] array; if (text2.Contains(",")) { array = text2.Split(new char[] { ',' }); } else { array = new string[] { text2 }; } string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string value = array2[i]; list2.Add(System.Convert.ToInt32(value)); } } string[] array3; if (text.Contains(",")) { array3 = text.Split(new char[] { ',' }); } else { array3 = new string[] { text }; } int num = 0; string[] array4 = array3; for (int j = 0; j < array4.Length; j++) { string value2 = array4[j]; ProductHelper.DeleteProductTags(System.Convert.ToInt32(value2), null); if (list.Count > 0 && ProductHelper.AddProductTags(System.Convert.ToInt32(value2), list, null)) { num++; } } if (num > 0) { this.ShowMsg(string.Format("已成功修改了{0}件商品的商品标签", num), true); } else { this.ShowMsg("已成功取消了商品的关联商品标签", true); } this.txtProductTag.Text = ""; this.BindProducts(); }
/// <summary>Gets the list of Eo operations to override.</summary> /// <returns>The list of Eo operations to be overload.</returns> public override System.Collections.Generic.List <Efl_Op_Description> GetEoOps(System.Type type) { var descs = new System.Collections.Generic.List <Efl_Op_Description>(); var methods = Efl.Eo.Globals.GetUserMethods(type); if (efl_ui_widget_factory_item_class_get_static_delegate == null) { efl_ui_widget_factory_item_class_get_static_delegate = new efl_ui_widget_factory_item_class_get_delegate(item_class_get); } if (methods.FirstOrDefault(m => m.Name == "GetItemClass") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_widget_factory_item_class_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_widget_factory_item_class_get_static_delegate) }); } if (efl_ui_widget_factory_item_class_set_static_delegate == null) { efl_ui_widget_factory_item_class_set_static_delegate = new efl_ui_widget_factory_item_class_set_delegate(item_class_set); } if (methods.FirstOrDefault(m => m.Name == "SetItemClass") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_widget_factory_item_class_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_widget_factory_item_class_set_static_delegate) }); } if (efl_part_get_static_delegate == null) { efl_part_get_static_delegate = new efl_part_get_delegate(part_get); } if (methods.FirstOrDefault(m => m.Name == "GetPart") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_part_get"), func = Marshal.GetFunctionPointerForDelegate(efl_part_get_static_delegate) }); } if (efl_ui_factory_create_static_delegate == null) { efl_ui_factory_create_static_delegate = new efl_ui_factory_create_delegate(create); } if (methods.FirstOrDefault(m => m.Name == "Create") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_factory_create"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_factory_create_static_delegate) }); } if (efl_ui_factory_release_static_delegate == null) { efl_ui_factory_release_static_delegate = new efl_ui_factory_release_delegate(release); } if (methods.FirstOrDefault(m => m.Name == "Release") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_factory_release"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_factory_release_static_delegate) }); } if (efl_ui_factory_building_static_delegate == null) { efl_ui_factory_building_static_delegate = new efl_ui_factory_building_delegate(building); } if (methods.FirstOrDefault(m => m.Name == "Building") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_factory_building"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_factory_building_static_delegate) }); } if (efl_ui_factory_bind_static_delegate == null) { efl_ui_factory_bind_static_delegate = new efl_ui_factory_bind_delegate(factory_bind); } if (methods.FirstOrDefault(m => m.Name == "FactoryBind") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_factory_bind"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_factory_bind_static_delegate) }); } if (efl_ui_property_bind_static_delegate == null) { efl_ui_property_bind_static_delegate = new efl_ui_property_bind_delegate(property_bind); } if (methods.FirstOrDefault(m => m.Name == "PropertyBind") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_property_bind"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_property_bind_static_delegate) }); } descs.AddRange(base.GetEoOps(type)); return(descs); }
/// <summary> /// Updates a Contract_Divide into the data store based on the primitive properties. This can be used as the /// update method for an ObjectDataSource. /// </summary> /// <param name="iD">iD</param> /// <param name="contractID">contractID</param> /// <param name="rentName">rentName</param> /// <param name="writeDate">writeDate</param> /// <param name="startTime">startTime</param> /// <param name="endTime">endTime</param> /// <param name="divideType">divideType</param> /// <param name="remark">remark</param> /// <param name="sellCost">sellCost</param> /// <param name="addTime">addTime</param> /// <param name="chargeStatus">chargeStatus</param> /// <param name="chargeID">chargeID</param> /// <param name="helper">helper</param> internal static void UpdateContract_Divide(int @iD, int @contractID, string @rentName, DateTime @writeDate, DateTime @startTime, DateTime @endTime, string @divideType, string @remark, decimal @sellCost, DateTime @addTime, int @chargeStatus, int @chargeID, SqlHelper @helper) { string commandText = @" DECLARE @table TABLE( [ID] int, [ContractID] int, [RentName] nvarchar(100), [WriteDate] datetime, [StartTime] datetime, [EndTime] datetime, [DivideType] nvarchar(100), [Remark] ntext, [SellCost] decimal(18, 2), [AddTime] datetime, [ChargeStatus] int, [ChargeID] int ); UPDATE [dbo].[Contract_Divide] SET [Contract_Divide].[ContractID] = @ContractID, [Contract_Divide].[RentName] = @RentName, [Contract_Divide].[WriteDate] = @WriteDate, [Contract_Divide].[StartTime] = @StartTime, [Contract_Divide].[EndTime] = @EndTime, [Contract_Divide].[DivideType] = @DivideType, [Contract_Divide].[Remark] = @Remark, [Contract_Divide].[SellCost] = @SellCost, [Contract_Divide].[AddTime] = @AddTime, [Contract_Divide].[ChargeStatus] = @ChargeStatus, [Contract_Divide].[ChargeID] = @ChargeID output INSERTED.[ID], INSERTED.[ContractID], INSERTED.[RentName], INSERTED.[WriteDate], INSERTED.[StartTime], INSERTED.[EndTime], INSERTED.[DivideType], INSERTED.[Remark], INSERTED.[SellCost], INSERTED.[AddTime], INSERTED.[ChargeStatus], INSERTED.[ChargeID] into @table WHERE [Contract_Divide].[ID] = @ID SELECT [ID], [ContractID], [RentName], [WriteDate], [StartTime], [EndTime], [DivideType], [Remark], [SellCost], [AddTime], [ChargeStatus], [ChargeID] FROM @table; "; System.Collections.Generic.List <SqlParameter> parameters = new System.Collections.Generic.List <SqlParameter>(); parameters.Add(new SqlParameter("@ID", EntityBase.GetDatabaseValue(@iD))); parameters.Add(new SqlParameter("@ContractID", EntityBase.GetDatabaseValue(@contractID))); parameters.Add(new SqlParameter("@RentName", EntityBase.GetDatabaseValue(@rentName))); parameters.Add(new SqlParameter("@WriteDate", EntityBase.GetDatabaseValue(@writeDate))); parameters.Add(new SqlParameter("@StartTime", EntityBase.GetDatabaseValue(@startTime))); parameters.Add(new SqlParameter("@EndTime", EntityBase.GetDatabaseValue(@endTime))); parameters.Add(new SqlParameter("@DivideType", EntityBase.GetDatabaseValue(@divideType))); parameters.Add(new SqlParameter("@Remark", EntityBase.GetDatabaseValue(@remark))); parameters.Add(new SqlParameter("@SellCost", EntityBase.GetDatabaseValue(@sellCost))); parameters.Add(new SqlParameter("@AddTime", EntityBase.GetDatabaseValue(@addTime))); parameters.Add(new SqlParameter("@ChargeStatus", EntityBase.GetDatabaseValue(@chargeStatus))); parameters.Add(new SqlParameter("@ChargeID", EntityBase.GetDatabaseValue(@chargeID))); @helper.Execute(commandText, CommandType.Text, parameters); }
public void IdentifySubpanels() { // get the link into a subpanel and make the counts are as expected _TestSingleTon.Instance._SetupForLayoutPanelTests(); // _SetupForLayoutPanelTests (); FAKE_LayoutPanel panel = new FAKE_LayoutPanel(CoreUtilities.Constants.BLANK, false); //NOTE: For now remember that htis ADDS 1 Extra notes panel.NewLayout("mynewpanel", true, null); NoteDataXML basicNote = new NoteDataXML(); basicNote.GuidForNote = "thisguid1"; basicNote.Caption = "note1"; panel.AddNote(basicNote); basicNote.CreateParent(panel); panel.SaveLayout(); FAKE_NoteDataXML_Panel panelA = new FAKE_NoteDataXML_Panel(); panelA.Caption = "PanelA"; panelA.GuidForNote = "panela"; panel.AddNote(panelA); panelA.CreateParent(panel); panel.SaveLayout(); System.Collections.Generic.List <string> linkstome = MasterOfLayouts.ReciprocalLinks("mynewpanel"); Assert.AreEqual(0, linkstome.Count); NoteDataXML_LinkNote link = new NoteDataXML_LinkNote(); panelA.AddNote(link); link.CreateParent(panelA.GetPanelsLayout()); link.SetLink("mynewpanel.thisguid1"); panel.SaveLayout(); linkstome = MasterOfLayouts.ReciprocalLinks("mynewpanel"); Assert.AreEqual(true, MasterOfLayouts.ExistsByGUID("panela"), "1"); Assert.AreEqual(true, MasterOfLayouts.IsSubpanel("panela"), "2"); Assert.AreEqual(true, MasterOfLayouts.ExistsByGUID("mynewpanel"), "3"); Assert.AreEqual(false, MasterOfLayouts.IsSubpanel("mynewpanel"), "4"); System.Collections.Generic.List <string> children = MasterOfLayouts.GetListOfChildren("mynewpanel"); Assert.AreEqual(1, children.Count); FAKE_NoteDataXML_Panel panelB = new FAKE_NoteDataXML_Panel(); panelB.Caption = "PanelB"; panelB.GuidForNote = "panelB"; panel.AddNote(panelB); panelB.CreateParent(panel); panel.SaveLayout(); children = MasterOfLayouts.GetListOfChildren("mynewpanel"); Assert.AreEqual(2, children.Count); Assert.AreEqual("panela", children[0]); Assert.AreEqual("panelB", children[1]); }
/// <summary> /// Gets a collection Contract_Divide objects by custom where clause. /// </summary> /// <param name="prefix">The prefix clause allows you to inject a distinct or top clause.</param> /// <param name="where">The where clause to use for the query. Should be parameterized and start with "where"</param> /// <param name="parameters">The parameters that are listed in the where clause</param> /// <returns>The retrieved collection of Contract_Divide objects.</returns> protected static EntityList <Contract_Divide> GetContract_Divides(string prefix, string where, System.Collections.Generic.List <SqlParameter> parameters) { return(GetContract_Divides(prefix, where, parameters, Contract_Divide.DefaultSortOrder)); }
/// <summary> /// Gets a collection Address objects. /// </summary> /// <param name="orderBy">order by</param> /// <param name="where">where</param> /// <param name=parameters">parameters</param> /// <param name="startRowIndex">Start Row Index</param> /// <param name="pageSize">PageSize</param> /// <param name="totalRows">Total rows</param> /// <returns>The retrieved collection of Address objects.</returns> protected static EntityList <Contract_Divide> GetContract_Divides(string orderBy, string where, System.Collections.Generic.List <SqlParameter> parameters, int startRowIndex, int pageSize, out long totalRows) { return(GetList <Contract_Divide>(SelectFieldList, "FROM [dbo].[Contract_Divide] " + where, parameters, orderBy, startRowIndex, pageSize, out totalRows)); }
/// <summary> /// Gets a collection RoomPhoneRelation_Family objects by custom where clause. /// </summary> /// <param name="prefix">The prefix clause allows you to inject a distinct or top clause.</param> /// <param name="where">The where clause to use for the query. Should be parameterized and start with "where"</param> /// <param name="parameters">The parameters that are listed in the where clause</param> /// <returns>The retrieved collection of RoomPhoneRelation_Family objects.</returns> protected static EntityList <RoomPhoneRelation_Family> GetRoomPhoneRelation_Families(string prefix, string where, System.Collections.Generic.List <SqlParameter> parameters) { return(GetRoomPhoneRelation_Families(prefix, where, parameters, RoomPhoneRelation_Family.DefaultSortOrder)); }
/// <summary> /// Gets a collection Address objects. /// </summary> /// <param name="orderBy">order by</param> /// <param name="where">where</param> /// <param name=parameters">parameters</param> /// <param name="startRowIndex">Start Row Index</param> /// <param name="pageSize">PageSize</param> /// <param name="totalRows">Total rows</param> /// <returns>The retrieved collection of Address objects.</returns> protected static EntityList <RoomPhoneRelation_Family> GetRoomPhoneRelation_Families(string orderBy, string where, System.Collections.Generic.List <SqlParameter> parameters, int startRowIndex, int pageSize, out long totalRows) { return(GetList <RoomPhoneRelation_Family>(SelectFieldList, "FROM [dbo].[RoomPhoneRelation_Family] " + where, parameters, orderBy, startRowIndex, pageSize, out totalRows)); }
/// <summary> /// Updates a Mall_BusinessDiscountRequest into the data store based on the primitive properties. This can be used as the /// update method for an ObjectDataSource. /// </summary> /// <param name="iD">iD</param> /// <param name="businessID">businessID</param> /// <param name="userID">userID</param> /// <param name="requestContent">requestContent</param> /// <param name="addTime">addTime</param> /// <param name="addUserMan">addUserMan</param> /// <param name="status">status</param> /// <param name="approveUserMan">approveUserMan</param> /// <param name="approveTime">approveTime</param> /// <param name="approveRemark">approveRemark</param> /// <param name="startTime">startTime</param> /// <param name="endTime">endTime</param> /// <param name="isActive">isActive</param> /// <param name="helper">helper</param> internal static void UpdateMall_BusinessDiscountRequest(int @iD, int @businessID, int @userID, string @requestContent, DateTime @addTime, string @addUserMan, int @status, string @approveUserMan, DateTime @approveTime, string @approveRemark, DateTime @startTime, DateTime @endTime, bool @isActive, SqlHelper @helper) { string commandText = @" DECLARE @table TABLE( [ID] int, [BusinessID] int, [UserID] int, [RequestContent] nvarchar(1000), [AddTime] datetime, [AddUserMan] nvarchar(100), [Status] int, [ApproveUserMan] nvarchar(200), [ApproveTime] datetime, [ApproveRemark] nvarchar(1000), [StartTime] datetime, [EndTime] datetime, [IsActive] bit ); UPDATE [dbo].[Mall_BusinessDiscountRequest] SET [Mall_BusinessDiscountRequest].[BusinessID] = @BusinessID, [Mall_BusinessDiscountRequest].[UserID] = @UserID, [Mall_BusinessDiscountRequest].[RequestContent] = @RequestContent, [Mall_BusinessDiscountRequest].[AddTime] = @AddTime, [Mall_BusinessDiscountRequest].[AddUserMan] = @AddUserMan, [Mall_BusinessDiscountRequest].[Status] = @Status, [Mall_BusinessDiscountRequest].[ApproveUserMan] = @ApproveUserMan, [Mall_BusinessDiscountRequest].[ApproveTime] = @ApproveTime, [Mall_BusinessDiscountRequest].[ApproveRemark] = @ApproveRemark, [Mall_BusinessDiscountRequest].[StartTime] = @StartTime, [Mall_BusinessDiscountRequest].[EndTime] = @EndTime, [Mall_BusinessDiscountRequest].[IsActive] = @IsActive output INSERTED.[ID], INSERTED.[BusinessID], INSERTED.[UserID], INSERTED.[RequestContent], INSERTED.[AddTime], INSERTED.[AddUserMan], INSERTED.[Status], INSERTED.[ApproveUserMan], INSERTED.[ApproveTime], INSERTED.[ApproveRemark], INSERTED.[StartTime], INSERTED.[EndTime], INSERTED.[IsActive] into @table WHERE [Mall_BusinessDiscountRequest].[ID] = @ID SELECT [ID], [BusinessID], [UserID], [RequestContent], [AddTime], [AddUserMan], [Status], [ApproveUserMan], [ApproveTime], [ApproveRemark], [StartTime], [EndTime], [IsActive] FROM @table; "; System.Collections.Generic.List <SqlParameter> parameters = new System.Collections.Generic.List <SqlParameter>(); parameters.Add(new SqlParameter("@ID", EntityBase.GetDatabaseValue(@iD))); parameters.Add(new SqlParameter("@BusinessID", EntityBase.GetDatabaseValue(@businessID))); parameters.Add(new SqlParameter("@UserID", EntityBase.GetDatabaseValue(@userID))); parameters.Add(new SqlParameter("@RequestContent", EntityBase.GetDatabaseValue(@requestContent))); parameters.Add(new SqlParameter("@AddTime", EntityBase.GetDatabaseValue(@addTime))); parameters.Add(new SqlParameter("@AddUserMan", EntityBase.GetDatabaseValue(@addUserMan))); parameters.Add(new SqlParameter("@Status", EntityBase.GetDatabaseValue(@status))); parameters.Add(new SqlParameter("@ApproveUserMan", EntityBase.GetDatabaseValue(@approveUserMan))); parameters.Add(new SqlParameter("@ApproveTime", EntityBase.GetDatabaseValue(@approveTime))); parameters.Add(new SqlParameter("@ApproveRemark", EntityBase.GetDatabaseValue(@approveRemark))); parameters.Add(new SqlParameter("@StartTime", EntityBase.GetDatabaseValue(@startTime))); parameters.Add(new SqlParameter("@EndTime", EntityBase.GetDatabaseValue(@endTime))); parameters.Add(new SqlParameter("@IsActive", @isActive)); @helper.Execute(commandText, CommandType.Text, parameters); }
public Activity(string _name, string _className, System.Collections.Generic.List <string> _inHand, System.Collections.Generic.List <string> _actedOn) { name = _name; className = _className; inHand = _inHand; actedOn = _actedOn; }
/// <summary> /// Gets a collection Mall_BusinessDiscountRequest objects by custom where clause. /// </summary> /// <param name="prefix">The prefix clause allows you to inject a distinct or top clause.</param> /// <param name="where">The where clause to use for the query. Should be parameterized and start with "where"</param> /// <param name="parameters">The parameters that are listed in the where clause</param> /// <returns>The retrieved collection of Mall_BusinessDiscountRequest objects.</returns> protected static EntityList <Mall_BusinessDiscountRequest> GetMall_BusinessDiscountRequests(string prefix, string where, System.Collections.Generic.List <SqlParameter> parameters) { return(GetMall_BusinessDiscountRequests(prefix, where, parameters, Mall_BusinessDiscountRequest.DefaultSortOrder)); }
/// <summary> /// Gets a collection Address objects. /// </summary> /// <param name="orderBy">order by</param> /// <param name="where">where</param> /// <param name=parameters">parameters</param> /// <param name="startRowIndex">Start Row Index</param> /// <param name="pageSize">PageSize</param> /// <param name="totalRows">Total rows</param> /// <returns>The retrieved collection of Address objects.</returns> protected static EntityList <Mall_BusinessDiscountRequest> GetMall_BusinessDiscountRequests(string orderBy, string where, System.Collections.Generic.List <SqlParameter> parameters, int startRowIndex, int pageSize, out long totalRows) { return(GetList <Mall_BusinessDiscountRequest>(SelectFieldList, "FROM [dbo].[Mall_BusinessDiscountRequest] " + where, parameters, orderBy, startRowIndex, pageSize, out totalRows)); }
public override System.Collections.Generic.List <Efl_Op_Description> GetEoOps(System.Type type) { var descs = new System.Collections.Generic.List <Efl_Op_Description>(); var methods = Efl.Eo.Globals.GetUserMethods(type); if (efl_ui_datepicker_min_get_static_delegate == null) { efl_ui_datepicker_min_get_static_delegate = new efl_ui_datepicker_min_get_delegate(min_get); } if (methods.FirstOrDefault(m => m.Name == "GetMin") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_ui_datepicker_min_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_min_get_static_delegate) }); } if (efl_ui_datepicker_min_set_static_delegate == null) { efl_ui_datepicker_min_set_static_delegate = new efl_ui_datepicker_min_set_delegate(min_set); } if (methods.FirstOrDefault(m => m.Name == "SetMin") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_ui_datepicker_min_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_min_set_static_delegate) }); } if (efl_ui_datepicker_max_get_static_delegate == null) { efl_ui_datepicker_max_get_static_delegate = new efl_ui_datepicker_max_get_delegate(max_get); } if (methods.FirstOrDefault(m => m.Name == "GetMax") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_ui_datepicker_max_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_max_get_static_delegate) }); } if (efl_ui_datepicker_max_set_static_delegate == null) { efl_ui_datepicker_max_set_static_delegate = new efl_ui_datepicker_max_set_delegate(max_set); } if (methods.FirstOrDefault(m => m.Name == "SetMax") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_ui_datepicker_max_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_max_set_static_delegate) }); } if (efl_ui_datepicker_date_get_static_delegate == null) { efl_ui_datepicker_date_get_static_delegate = new efl_ui_datepicker_date_get_delegate(date_get); } if (methods.FirstOrDefault(m => m.Name == "GetDate") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_ui_datepicker_date_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_date_get_static_delegate) }); } if (efl_ui_datepicker_date_set_static_delegate == null) { efl_ui_datepicker_date_set_static_delegate = new efl_ui_datepicker_date_set_delegate(date_set); } if (methods.FirstOrDefault(m => m.Name == "SetDate") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_ui_datepicker_date_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_date_set_static_delegate) }); } descs.AddRange(base.GetEoOps(type)); return(descs); }
/// <summary>Gets the list of Eo operations to override.</summary> /// <returns>The list of Eo operations to be overload.</returns> public override System.Collections.Generic.List <Efl_Op_Description> GetEoOps(System.Type type) { var descs = new System.Collections.Generic.List <Efl_Op_Description>(); var methods = Efl.Eo.Globals.GetUserMethods(type); if (efl_gesture_touch_start_point_get_static_delegate == null) { efl_gesture_touch_start_point_get_static_delegate = new efl_gesture_touch_start_point_get_delegate(start_point_get); } if (methods.FirstOrDefault(m => m.Name == "GetStartPoint") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gesture_touch_start_point_get"), func = Marshal.GetFunctionPointerForDelegate(efl_gesture_touch_start_point_get_static_delegate) }); } if (efl_gesture_touch_multi_touch_get_static_delegate == null) { efl_gesture_touch_multi_touch_get_static_delegate = new efl_gesture_touch_multi_touch_get_delegate(multi_touch_get); } if (methods.FirstOrDefault(m => m.Name == "GetMultiTouch") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gesture_touch_multi_touch_get"), func = Marshal.GetFunctionPointerForDelegate(efl_gesture_touch_multi_touch_get_static_delegate) }); } if (efl_gesture_touch_state_get_static_delegate == null) { efl_gesture_touch_state_get_static_delegate = new efl_gesture_touch_state_get_delegate(state_get); } if (methods.FirstOrDefault(m => m.Name == "GetState") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gesture_touch_state_get"), func = Marshal.GetFunctionPointerForDelegate(efl_gesture_touch_state_get_static_delegate) }); } if (efl_gesture_touch_point_record_static_delegate == null) { efl_gesture_touch_point_record_static_delegate = new efl_gesture_touch_point_record_delegate(point_record); } if (methods.FirstOrDefault(m => m.Name == "PointRecord") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gesture_touch_point_record"), func = Marshal.GetFunctionPointerForDelegate(efl_gesture_touch_point_record_static_delegate) }); } if (efl_gesture_touch_delta_static_delegate == null) { efl_gesture_touch_delta_static_delegate = new efl_gesture_touch_delta_delegate(delta); } if (methods.FirstOrDefault(m => m.Name == "Delta") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gesture_touch_delta"), func = Marshal.GetFunctionPointerForDelegate(efl_gesture_touch_delta_static_delegate) }); } if (efl_gesture_touch_distance_static_delegate == null) { efl_gesture_touch_distance_static_delegate = new efl_gesture_touch_distance_delegate(distance); } if (methods.FirstOrDefault(m => m.Name == "Distance") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_gesture_touch_distance"), func = Marshal.GetFunctionPointerForDelegate(efl_gesture_touch_distance_static_delegate) }); } descs.AddRange(base.GetEoOps(type)); return(descs); }
public List <string> GetUserIDList(System.Collections.Generic.List <ActivityAuth> auth) { return(new List <string> { "1", "2" }); }
/// <summary> /// 执行多条SQL语句,实现数据库事务。 /// </summary> /// <param name="SQLStringList">SQL语句的哈希表(key为sql语句,value是该语句的SqlParameter[])</param> public static int ExecuteSqlTran(System.Collections.Generic.List <CommandInfo> cmdList) { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); using (SqlTransaction trans = conn.BeginTransaction()) { SqlCommand cmd = new SqlCommand(); try { int count = 0; //循环 foreach (CommandInfo myDE in cmdList) { string cmdText = myDE.CommandText; SqlParameter[] cmdParms = (SqlParameter[])myDE.Parameters; PrepareCommand(cmd, conn, trans, cmdText, cmdParms); if (myDE.EffentNextType == EffentNextType.WhenHaveContine || myDE.EffentNextType == EffentNextType.WhenNoHaveContine) { if (myDE.CommandText.ToLower().IndexOf("count(") == -1) { trans.Rollback(); return(0); } object obj = cmd.ExecuteScalar(); bool isHave = false; if (obj == null && obj == DBNull.Value) { isHave = false; } isHave = Convert.ToInt32(obj) > 0; if (myDE.EffentNextType == EffentNextType.WhenHaveContine && !isHave) { trans.Rollback(); return(0); } if (myDE.EffentNextType == EffentNextType.WhenNoHaveContine && isHave) { trans.Rollback(); return(0); } continue; } int val = cmd.ExecuteNonQuery(); count += val; if (myDE.EffentNextType == EffentNextType.ExcuteEffectRows && val == 0) { trans.Rollback(); return(0); } cmd.Parameters.Clear(); } trans.Commit(); return(count); } catch { trans.Rollback(); throw; } } } }
/// <summary>Gets the list of Eo operations to override.</summary> /// <returns>The list of Eo operations to be overload.</returns> public override System.Collections.Generic.List <Efl_Op_Description> GetEoOps(System.Type type) { var descs = new System.Collections.Generic.List <Efl_Op_Description>(); var methods = Efl.Eo.Globals.GetUserMethods(type); if (efl_content_get_static_delegate == null) { efl_content_get_static_delegate = new efl_content_get_delegate(content_get); } if (methods.FirstOrDefault(m => m.Name == "GetContent") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_content_get"), func = Marshal.GetFunctionPointerForDelegate(efl_content_get_static_delegate) }); } if (efl_content_set_static_delegate == null) { efl_content_set_static_delegate = new efl_content_set_delegate(content_set); } if (methods.FirstOrDefault(m => m.Name == "SetContent") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_content_set"), func = Marshal.GetFunctionPointerForDelegate(efl_content_set_static_delegate) }); } if (efl_content_unset_static_delegate == null) { efl_content_unset_static_delegate = new efl_content_unset_delegate(content_unset); } if (methods.FirstOrDefault(m => m.Name == "UnsetContent") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_content_unset"), func = Marshal.GetFunctionPointerForDelegate(efl_content_unset_static_delegate) }); } if (efl_text_get_static_delegate == null) { efl_text_get_static_delegate = new efl_text_get_delegate(text_get); } if (methods.FirstOrDefault(m => m.Name == "GetText") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_text_get"), func = Marshal.GetFunctionPointerForDelegate(efl_text_get_static_delegate) }); } if (efl_text_set_static_delegate == null) { efl_text_set_static_delegate = new efl_text_set_delegate(text_set); } if (methods.FirstOrDefault(m => m.Name == "SetText") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_text_set"), func = Marshal.GetFunctionPointerForDelegate(efl_text_set_static_delegate) }); } if (efl_text_markup_get_static_delegate == null) { efl_text_markup_get_static_delegate = new efl_text_markup_get_delegate(markup_get); } if (methods.FirstOrDefault(m => m.Name == "GetMarkup") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_text_markup_get"), func = Marshal.GetFunctionPointerForDelegate(efl_text_markup_get_static_delegate) }); } if (efl_text_markup_set_static_delegate == null) { efl_text_markup_set_static_delegate = new efl_text_markup_set_delegate(markup_set); } if (methods.FirstOrDefault(m => m.Name == "SetMarkup") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_text_markup_set"), func = Marshal.GetFunctionPointerForDelegate(efl_text_markup_set_static_delegate) }); } if (efl_ui_l10n_text_get_static_delegate == null) { efl_ui_l10n_text_get_static_delegate = new efl_ui_l10n_text_get_delegate(l10n_text_get); } if (methods.FirstOrDefault(m => m.Name == "GetL10nText") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_l10n_text_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_l10n_text_get_static_delegate) }); } if (efl_ui_l10n_text_set_static_delegate == null) { efl_ui_l10n_text_set_static_delegate = new efl_ui_l10n_text_set_delegate(l10n_text_set); } if (methods.FirstOrDefault(m => m.Name == "SetL10nText") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_l10n_text_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_l10n_text_set_static_delegate) }); } if (efl_ui_l10n_translation_update_static_delegate == null) { efl_ui_l10n_translation_update_static_delegate = new efl_ui_l10n_translation_update_delegate(translation_update); } if (methods.FirstOrDefault(m => m.Name == "UpdateTranslation") != null) { descs.Add(new Efl_Op_Description() { api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_l10n_translation_update"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_l10n_translation_update_static_delegate) }); } descs.AddRange(base.GetEoOps(type)); return(descs); }
public void Remove(Func <K, T, bool> predicate, Action <K, T> removedEvent, int lockedSize) { var removeList = new System.Collections.Generic.List <KeyValuePair <K, T> >(dictionary.Count / 2); var removed = (removedEvent != null) ? new bool[lockedSize] : null; try { sync.EnterReadLock(); foreach (var pair in dictionary) { if (predicate(pair.Key, pair.Value)) { removeList.Add(pair); } } } finally { sync.ExitReadLock(); } for (int j = 0; j < removeList.Count; j++) { int start2 = j * lockedSize; int count2 = start2 + lockedSize; if (count2 > removeList.Count) { count2 = removeList.Count; } try { sync.EnterWriteLock(); for (int i = start2; i < count2; i++) { var current = removeList[i]; bool reallyRemoved = false; if (predicate(current.Key, current.Value)) { reallyRemoved = dictionary.Remove(current); } if (removed != null) { removed[i] = reallyRemoved; } } } finally { sync.ExitWriteLock(); } if (removedEvent != null) { for (int i = start2; i < count2; i++) { if (removed[i]) { removedEvent(removeList[i].Key, removeList[i].Value); } } } } }
/// <summary>Gets the list of Eo operations to override.</summary> /// <returns>The list of Eo operations to be overload.</returns> public override System.Collections.Generic.List <Efl_Op_Description> GetEoOps(System.Type type) { var descs = new System.Collections.Generic.List <Efl_Op_Description>(); return(descs); }
/// <summary> /// Gets a collection ViewChequeTax objects by custom where clause. /// </summary> /// <param name="prefix">The prefix clause allows you to inject a distinct or top clause.</param> /// <param name="where">The where clause to use for the query. Should be parameterized and start with "where"</param> /// <param name="parameters">The parameters that are listed in the where clause</param> /// <returns>The retrieved collection of ViewChequeTax objects.</returns> protected static EntityList <ViewChequeTax> GetViewChequeTaxes(string prefix, string where, System.Collections.Generic.List <SqlParameter> parameters) { return(GetViewChequeTaxes(prefix, where, parameters, ViewChequeTax.DefaultSortOrder)); }
/// <summary> /// Gets a collection CustomerServiceChuli_Attach objects by custom where clause and order by. /// </summary> /// <param name="prefix">The prefix clause allows you to inject a distinct or top clause.</param> /// <param name="where">The where clause to use for the query. Should be parameterized and start with "where"</param> /// <param name="parameters">The parameters that are listed in the where clause</param> /// <param name="orderBy">the order by clause. Shoudl start with "order by"</param> /// <returns>The retrieved collection of CustomerServiceChuli_Attach objects.</returns> protected static EntityList <CustomerServiceChuli_Attach> GetCustomerServiceChuli_Attaches(string prefix, string where, System.Collections.Generic.List <SqlParameter> parameters, string orderBy) { string commandText = @"SELECT " + prefix + "" + CustomerServiceChuli_Attach.SelectFieldList + "FROM [dbo].[CustomerServiceChuli_Attach] " + where + " " + orderBy; using (SqlHelper helper = new SqlHelper()) { using (IDataReader reader = helper.ExecuteDataReader(commandText, CommandType.Text, parameters)) { return(EntityBase.InitializeList <CustomerServiceChuli_Attach>(reader)); } } }
public void InsertToTable(string connectionString, object obj, string tableName = "fromObjectName", Dictionary <string, string> replacements = null, System.Collections.Generic.List <string> ignoreList = null) { var db = new StoreProcdureManagement(); if (tableName == "fromObjectName") { tableName = obj.GetType().Name; } var sqlCommandString = "Select TOP 1 * FROM " + tableName; var dataset = db.RunQuery(connectionString, sqlCommandString); var table = dataset.Tables[0]; var dic = obj.ToDictionary(); if (replacements != null) { foreach (var newName in replacements) { if (dic.Keys.Contains(newName.Key)) { dic.Add(newName.Value, dic[newName.Key]); dic.Remove(newName.Key); } } } sqlCommandString = "INSERT INTO " + tableName; var fields = ""; var values = ""; var valueList = new List <string>(); var counter = 0; var sqlParameter = new List <SqlParameter>(); foreach (var record in dic) { if (ignoreList == null || !ignoreList.Contains(record.Key)) { if (!table.Columns.Contains(record.Key)) { throw new Exception("فیلد '" + record.Key + "' در جدول وجود ندارد"); } if (fields != "") { fields += ", "; values += ","; } fields += record.Key; var param = "@param" + counter; values += param; db.AddParameter(param, record.Value); counter++; } } sqlCommandString += " (" + fields + ") VALUES(" + values + ")"; db.RunQuery(connectionString, sqlCommandString); }