private void btnAny_Click(object sender, EventArgs e) { log.WriteLine("---------------------------------"); bool result = customers.Any(c => c.Country == "Spain"); log.WriteLine(string.Format("Is there any customer from Spain? {0}", result ? "Yes" : "No")); result = customers.Any(c => c.Country == "Monaco"); log.WriteLine(string.Format("Is there any customer from Monaco? {0}", result ? "Yes" : "No")); }
public App() { InitializeComponent(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); //MSSqlServer //string connectionString = MSSqlConnectionProvider.GetConnectionString("YOUR_SERVER_NAME", "sa", "", "XamarinDemo"); //SQLite var filePath = Path.Combine(documentsPath, "xpoXamarinDemo.db"); string connectionString = SQLiteConnectionProvider.GetConnectionString(filePath) + ";Cache=Shared;"; //In-memory data store with saving/loading from the xml file //var filePath = Path.Combine(documentsPath, "xpoXamarinDemo.xml"); //string connectionString = InMemoryDataStore.GetConnectionString(filePath); XpoHelper.InitXpo(connectionString); var uoW = XpoHelper.CreateUnitOfWork(); XPQuery <Item> xPQuery = uoW.Query <Item>(); //Similar to XPCollection XPCollection <Item> ItemsXpCollection = new XPCollection <Item>();//HACK For XPCollection use criteria in constructor or filter //ItemsXpCollection.Filter = new BinaryOperator("", ""); //var queryResult= xPQuery.Where(e => e.Description == "algo"); //Better //var Reuslt = ItemsXpCollection.Where(e => e.Description == "algo"); //Ineficiente load whole collection if (!xPQuery.Any()) { for (int i = 0; i < 1000; i++) { Item Object = new Item(uoW); Object.Description = "Item number:" + i.ToString(); Object.Index = i; } if (uoW.InTransaction) { uoW.CommitChanges(); } } MainPage = new MainPage(); }
public List <MovimentoModel22> GetAll(int pEstabelecimentoId, DateTime pDataInicio, DateTime pDataFim) { var movimentos = new List <MovimentoModel22>(); UtilXpo.WriteLog("GetAll, antes query vwMega."); var vwMega = new XPQuery <ViewMegaNotaModel22>(Session.DefaultSession) .Where(v => v.FIL_IN_CODIGO == pEstabelecimentoId && v.NOT_DT_EMISSAO >= pDataInicio && v.NOT_DT_EMISSAO <= pDataFim) .OrderBy(v => v.NOT_IN_NUMERO) .ToList(); if (!vwMega.Any()) { throw new Exception("Nao existe movimento com os parâmetros informados. Verifique."); } foreach (var linha in vwMega) { movimentos.Add(GetMovimento(linha)); } return(movimentos); }
public void SetCaseInfo(string sCaseNo) { try { var sOurNo = s_OurNo; var sClientNo = string.Empty; var sClientName = string.Empty; var sAppNo = string.Empty; var sAppName = string.Empty; CommonFunction.GetCaseInfo(ref sOurNo, ref sClientNo, ref sClientName, ref sAppNo, ref sAppName); if (string.IsNullOrWhiteSpace(sOurNo)) { return; } s_OurNo = sOurNo; s_ClientNo = sClientNo; s_ClientName = sClientName; s_AppNo = sAppNo; s_AppName = sAppName; var sCaseNoShort = sOurNo.Substring(0, sOurNo.IndexOf("-")); var bIsWriteCase = DbHelperOra.Exists($"select 1 from CASEOTHERINFO where infotype = 'W_case' and caseno = '{_sOurNo}' and info = 'Y'"); //b_IsWriteCase = bIsWriteCase; var sDeptName = DbHelperOra.GetSingle($"select info from CASEOTHERINFO where infotype = 'department' and caseno = '{_sOurNo}'"); if (!string.IsNullOrWhiteSpace(sDeptName?.ToString())) { s_DeptName = sDeptName + "部"; } if (sCaseNoShort.Contains("PI")) { PatentCaseType = EnumsAll.PatentCaseType.中国申请_PCT进国家_发明; } else if (sCaseNoShort.Contains("PU")) { PatentCaseType = EnumsAll.PatentCaseType.中国申请_PCT进国家_实用新型; } else if (sCaseNoShort.Contains("SE")) { PatentCaseType = EnumsAll.PatentCaseType.其他注册申请_保密审查; } else if (sCaseNoShort.Contains("DJ")) { PatentCaseType = EnumsAll.PatentCaseType.其他注册申请_版权登记; } else if (sCaseNoShort.Contains("P")) { PatentCaseType = EnumsAll.PatentCaseType.国外申请_国际申请; } else if (sCaseNoShort.Contains("NI") || sCaseNoShort.Contains("I")) { PatentCaseType = !bIsWriteCase ? EnumsAll.PatentCaseType.中国申请_巴黎公约_发明 : EnumsAll.PatentCaseType.中国申请_撰写_发明; } else if (sCaseNoShort.Contains("NU") || sCaseNoShort.Contains("U")) { PatentCaseType = !bIsWriteCase ? EnumsAll.PatentCaseType.中国申请_巴黎公约_实用新型 : EnumsAll.PatentCaseType.中国申请_撰写_实用新型; } else if (sCaseNoShort.Contains("ND") || sCaseNoShort.Contains("D")) { PatentCaseType = !bIsWriteCase ? EnumsAll.PatentCaseType.中国申请_巴黎公约_外观设计 : EnumsAll.PatentCaseType.中国申请_撰写_外观设计; } if (!string.IsNullOrWhiteSpace(s_AppNo)) { var sCodeCountry = Session.FindObject <Corporation>(CriteriaOperator.Parse("Code = ?", s_AppNo))?.Country?.s_Code; if (!string.IsNullOrWhiteSpace(sCodeCountry)) { if (PatentCaseType.ToString().Contains("中国") && sCodeCountry == "CN") { PatentDirection = EnumsAll.PatentDirection.内到内; } else if (PatentCaseType.ToString().Contains("国外") && sCodeCountry == "CN") { PatentDirection = EnumsAll.PatentDirection.内到外; } else if (PatentCaseType.ToString().Contains("中国") && sCodeCountry != "CN") { PatentDirection = EnumsAll.PatentDirection.外到内; } else if (PatentCaseType.ToString().Contains("国外") && sCodeCountry != "CN") { PatentDirection = EnumsAll.PatentDirection.外到外; } else { if (sCodeCountry == "CN") { PatentDirection = EnumsAll.PatentDirection.内到内; } else { PatentDirection = EnumsAll.PatentDirection.外到内; } PatentDirection = EnumsAll.PatentDirection.外到内; } } } b_IsDivCase = Regex.IsMatch(sCaseNoShort, @"\d{4}(D|d)"); if (InternalInvoice == null) { var tempInvoice = Session.FindObject <InternalInvoice>(CriteriaOperator.Parse("OurNo = ? And PatentSubmitLists.Count = 0", _sOurNo)); if (tempInvoice != null) { InternalInvoice = tempInvoice; if (tempInvoice.PermissionPolicyUser != null) { Handler = tempInvoice.PermissionPolicyUser; } } } if (PatentPayments.Count == 0) { var listPatentPayments = new XPQuery <PatentPayment>(Session).Where(p => p.PatentSubmitList == null && p.s_OurNo == _sOurNo).ToList(); if (listPatentPayments.Count > 0) { PatentPayments.AddRange(listPatentPayments); if (listPatentPayments.Any(p => p.Creator != null)) { Handler = listPatentPayments.First(p => p.Creator != null).Creator; } } } } catch (Exception exception) { throw exception; } }