public CreditCardController(Api application, QueryService query_service, ICreditCardPaymentGateway credit_card_payment_gateway) { _queryService = query_service; _credit_card_payment_gateway = credit_card_payment_gateway; _application = application; }
/// <summary> /// Constructor /// </summary> public RecruiterView() { Competences = new List<SelectListItem>(); FromDate = new List<SelectListItem>(); ToDate = new List<SelectListItem>(); DatesOfApplication = new List<SelectListItem>(); Names = new List<SelectListItem>(); Result = new List<Application>(); _Applications = new QueryService<Application>().GetAll((a => a.Availabilities), (a => a.Person), (a => a.CompetenceProfiles)); _Competences = new QueryService<Competence>().GetAll(); _Availabilities = new QueryService<Availability>().GetAll(); }
/// <summary> /// check for customer /// </summary> /// <param name="syncObjects"></param> /// <param name="service"></param> /// <returns></returns> public Syncdto IsCustSync(Syncdto syncObjects, SyncService service) { Dictionary<string, bool> isSync = new Dictionary<string, bool>(); var custDataInDb = service.GetDatafromDBCustomer(syncObjects); if (custDataInDb.CustomerList.Count > 0) { custDataInDb.IsCustomerNodata = false; for (int i = 0; i < custDataInDb.CustomerList.Count; i++) { string EXISTING_CUSTOMER_QUERY = string.Format("select * from customer where active = true and givenName = '{0}' and familyName = '{1}'", custDataInDb.CustomerList[i].GivenName.Trim(), custDataInDb.CustomerList[i].FamilyName.Trim()); QueryService<Customer> queryService = new QueryService<Customer>(service.ServiceContext); Customer resultFound = queryService.ExecuteIdsQuery(EXISTING_CUSTOMER_QUERY).FirstOrDefault<Customer>(); if (resultFound != null) { custDataInDb.CustomerList[i].Id = resultFound.Id; isSync.Add(custDataInDb.CustomerList[i].GivenName, true); } else { isSync.Add(custDataInDb.CustomerList[i].GivenName, false); } } if (isSync.Where(x => x.Value == false).Any()) { custDataInDb.IsCustomerSync = false; } else { custDataInDb.IsCustomerSync = true; } } else { custDataInDb.IsCustomerNodata = true; custDataInDb.IsCustomerSync = false; } return custDataInDb; }
/// <summary> /// Sync the customer in to QBO /// </summary> /// <param name="controller"></param> /// <param name="syncObjects"></param> /// <returns></returns> internal Syncdto SyncCustomer(object controller, Syncdto syncObjects) { try { for (int i = 0; i < syncObjects.CustomerList.Count; i++) { string EXISTING_CUSTOMER_QUERY = string.Format("select * from customer where active = true and givenName = '{0}' and familyName = '{1}'", syncObjects.CustomerList[i].GivenName.Trim(), syncObjects.CustomerList[i].FamilyName.Trim()); QueryService<Customer> queryService = new QueryService<Customer>(dataserviceFactory.getServiceContext); Customer resultFound = queryService.ExecuteIdsQuery(EXISTING_CUSTOMER_QUERY).FirstOrDefault<Customer>(); if (resultFound == null) { Customer entity = dataService.Add<Customer>(syncObjects.CustomerList[i]); syncObjects.CustomerList[i] = entity; syncObjects.IsCustomerSync = true; } else { syncObjects.CustomerList[i] = resultFound; } } syncObjects = syncRepository.Save(controller, syncObjects); return syncObjects; } catch (Intuit.Ipp.Exception.FaultException ex) { throw ex; } catch (Intuit.Ipp.Exception.InvalidTokenException ex) { throw ex; } catch (Intuit.Ipp.Exception.SdkException ex) { throw ex; } }
public HomeController(QueryService queryService) { _queryService = queryService; }
public void registerProductType() { if ( proxy == null) { // Instatiate the embedded space proxy = GigaSpacesFactory.FindSpace("/./xapTutorialSpace");; spaceUtility = new SpaceUtility (proxy); userUtil = new UserUtil(proxy); queryService = new QueryService(proxy); service = new CRUDService(proxy); // Register the Space Document } // Create a user userUtil.loadUsers(); service.registerProductType(); service.createDocumemt(); }
public static List<Customer> getCustomerList(RestProfile profile) { ServiceContext serviceContext = getServiceContext(profile); QueryService<Customer> customerQueryService = new QueryService<Customer>(serviceContext); return customerQueryService.Select(c => c).ToList(); }
public BasketController(Api application, QueryService query_service, IClientStorage client_storage) { _application = application; _query_service = query_service; _client_storage = client_storage; }
public void TestExecuteQuery() { List<KeyValuePair<Query, QueryResult>> queryTestData = GetExecuteTestCases.ToList(); foreach (KeyValuePair<Query, QueryResult> keyValuePair in queryTestData) { QueryService queryService = new QueryService(new MockDataService(), new MockQueryTcpClient(), new MockQueryTcpServer()); QueryResult queryResult = queryService.ExecuteQuery(keyValuePair.Key); Assert.AreEqual(keyValuePair.Value.ResultMessage, queryResult.ResultMessage); } }
// POST api/userapi/post public HttpResponseMessage Post([FromBody] string value) { string username = UtilFunction.GetCookie("uname"); string userid = UtilFunction.GetCookie("uid"); var list = Newtonsoft.Json.Linq.JObject.Parse(value.Replace("{admin}", username).Replace("{1}", userid)); Dictionary <string, JArray> dict = new Dictionary <string, JArray>(); try { FileLog.WriteLog("InfoApiTime:" + DateTime.Now.ToString() + ",调用:Angel.ControllersApi/ControllerApi/DownloadListManagerApiController/Post([FromBody]string value)方法"); string serverName = ""; Newtonsoft.Json.Linq.JArray jArray = new JArray(); if (list != null && list.Count > 0) { foreach (var arry in list) { switch (arry.Key) { case "insert": serverName = "insertDownloadList"; break; case "delete7daysBefore": serverName = "delete7daysBefore"; break; default: break; } jArray = arry.Value as JArray; } } if (serverName == "delete7daysBefore") { string selectSql = "SELECT username, filename FROM angel_downloadlist where datediff('" + value.Split('"')[7] + "', createtime)>=" + value.Split('"')[4].Split(':')[1].Split(',')[0] + " and username = '******'"')[11] + "';"; DataTable dt = MySqlHelpers.GetDataTable(selectSql); string uname = string.Empty, filename = string.Empty, filepath = string.Empty; if (dt != null && dt.Rows.Count != 0) { foreach (DataRow row in dt.Rows) { uname = row["username"].ToString(); filename = row["filename"].ToString(); //从磁盘上删除文件 filepath = AppDomain.CurrentDomain.BaseDirectory + "DownFile\\import\\" + uname + "\\" + filename; File.Delete(filepath); } } else { return(GetJSONMessage("{\"code\": {\"id\":-1,\"msg\":\"数据库不存在要删除的数据!\"}}")); } } return(GetJSONMessage(QueryService.InsertBatchCheck(jArray, serverName))); } catch (Exception er) { FileLog.WriteLog("Error:调用 Angel.ControllersApi/ControllerApi/DownloadListManagerApiController/Post([FromBody]string value)方法," + er.ToString()); return(GetJSONMessage("")); } }
/// <summary> /// Create Billable expense /// </summary> /// <param name="context"></param> /// <param name="customer"></param> /// <returns>purchase</returns> public static Purchase BillableExpenseCreate(DataService dataService, QueryService <Account> queryService, Customer customer) { Account account = QueryOrAddAccount(dataService, queryService, "select * from account where AccountSubType='Checking'", AccountTypeEnum.Bank, AccountClassificationEnum.Asset, AccountSubTypeEnum.Checking); Account expenseAccount = QueryOrAddAccount(dataService, queryService, "select * from account where AccountType='Expense'", AccountTypeEnum.Expense, AccountClassificationEnum.Expense, AccountSubTypeEnum.AdvertisingPromotional); Vendor vendor = VendorCreate(dataService); Item item = ItemCreate(dataService, queryService); Purchase purchase = new Purchase { PaymentType = PaymentTypeEnum.Cash, PaymentTypeSpecified = true, AccountRef = new ReferenceType { name = account.Name, Value = account.Id }, EntityRef = new ReferenceType { type = EntityTypeEnum.Vendor.ToString(), name = vendor.DisplayName, Value = vendor.Id } }; Line itemLine = new Line { Description = "Item based expense line detail.", DetailType = LineDetailTypeEnum.ItemBasedExpenseLineDetail, DetailTypeSpecified = true }; MarkupInfo markupInfo = new MarkupInfo { PercentBased = true, PercentBasedSpecified = true, PercentSpecified = true, Percent = new Decimal(50) }; ItemBasedExpenseLineDetail itemLineDetail = new ItemBasedExpenseLineDetail { CustomerRef = new ReferenceType { name = customer.DisplayName, Value = customer.Id }, BillableStatus = BillableStatusEnum.Billable, BillableStatusSpecified = true, ItemRef = new ReferenceType { name = item.Name, Value = item.Id }, MarkupInfo = markupInfo, }; itemLine.AnyIntuitObject = itemLineDetail; if (item.UnitPrice > 0) { itemLine.Amount = item.UnitPrice; } else { itemLine.Amount = new Decimal(100); } itemLine.AmountSpecified = true; Line accountLine = new Line { Description = "Account based expense line detail.", DetailType = LineDetailTypeEnum.AccountBasedExpenseLineDetail, DetailTypeSpecified = true }; AccountBasedExpenseLineDetail accountLineDetail = new AccountBasedExpenseLineDetail { CustomerRef = new ReferenceType { name = customer.DisplayName, Value = customer.Id }, AccountRef = new ReferenceType { name = expenseAccount.Name, Value = expenseAccount.Id }, BillableStatus = BillableStatusEnum.Billable, BillableStatusSpecified = true, MarkupInfo = markupInfo, }; accountLine.AnyIntuitObject = accountLineDetail; accountLine.Amount = new Decimal(100); accountLine.AmountSpecified = true; Line[] lines = { itemLine, accountLine }; purchase.Line = lines; // Add created purchase in QBO Purchase apiResponse = dataService.Add(purchase); return(apiResponse); }
public static List<Employee> getEmployeeList(IppRealmOAuthProfile profile) { ServiceContext serviceContext = getServiceContext(profile); QueryService<Employee> employeeQueryService = new QueryService<Employee>(serviceContext); return employeeQueryService.Select(c => c).ToList(); }
/// <summary> /// Sync the employees in to QBO. /// </summary> /// <param name="controller"></param> /// <param name="syncObjects"></param> /// <returns></returns> public Syncdto SyncEmployees(object controller, Syncdto syncObjects) { try { for (int i = 0; i < syncObjects.EmployeeList.Count; i++) { string EXISTING_EMPLOYEE_QUERY = string.Format("select * from employee where active = true and givenName = '{0}' and familyName = '{1}'", syncObjects.EmployeeList[i].GivenName.Trim(), syncObjects.EmployeeList[i].FamilyName.Trim()); QueryService<Employee> queryService = new QueryService<Employee>(dataserviceFactory.getServiceContext); Employee resultFound = queryService.ExecuteIdsQuery(EXISTING_EMPLOYEE_QUERY).FirstOrDefault<Employee>(); if (resultFound == null) { Employee entity = dataService.Add<Employee>(syncObjects.EmployeeList[i]); syncObjects.EmployeeList[i] = entity; syncObjects.IsEmployeeSync = true; } else { syncObjects.EmployeeList[i] = resultFound; } } syncObjects = syncRepository.Save(controller, syncObjects); return syncObjects; } catch (Intuit.Ipp.Exception.FaultException ex) { throw ex; } catch (Intuit.Ipp.Exception.InvalidTokenException ex) { throw ex; } catch (Intuit.Ipp.Exception.SdkException ex) { throw ex; } }
/// <summary> /// Check for service item. /// </summary> /// <param name="syncObjects"></param> /// <param name="service"></param> /// <returns></returns> public Syncdto IsServiceItemSync(Syncdto syncObjects, SyncService service) { Dictionary<string, bool> isSync = new Dictionary<string, bool>(); var itemDataInDb = service.GetDatafromDBItem(syncObjects); if (itemDataInDb.ItemList.Count>0) { itemDataInDb.IsServiceItemNodata = false; for (int i = 0; i < itemDataInDb.ItemList.Count; i++) { string EXISTING_ITEM_QUERY = string.Format("select * from Item where active = true and name = '{0}'", itemDataInDb.ItemList[i].Name.Trim()); QueryService<Item> queryService = new QueryService<Item>(service.ServiceContext); Item resultFound = queryService.ExecuteIdsQuery(EXISTING_ITEM_QUERY).FirstOrDefault<Item>(); if (resultFound != null) { itemDataInDb.ItemList[i].Id = resultFound.Id; isSync.Add(itemDataInDb.ItemList[i].Name, true); } else { isSync.Add(itemDataInDb.ItemList[i].Name, false); } } if (isSync.Where(x => x.Value == false).Any()) { itemDataInDb.IsServiceItemSync = false; } else { itemDataInDb.IsServiceItemSync = true; } } else { itemDataInDb.IsServiceItemNodata = true; itemDataInDb.IsServiceItemSync = false; } return itemDataInDb; }
/// <summary> /// check for employees /// </summary> /// <param name="syncObjects"></param> /// <param name="service"></param> /// <returns></returns> public Syncdto IsEmpSync(Syncdto syncObjects, SyncService service) { Dictionary<string, bool> isSync = new Dictionary<string, bool>(); var empDataInDb = service.GetDatafromDBEmployee(syncObjects); if (empDataInDb.EmployeeList.Count > 0) { empDataInDb.IsEmployeeNoData = false; for (int i = 0; i < empDataInDb.EmployeeList.Count; i++) { string EXISTING_EMPLOYEE_QUERY = string.Format("select * from employee where active = true and givenName='{0}' and familyName= '{1}'", empDataInDb.EmployeeList[i].GivenName.Trim(), empDataInDb.EmployeeList[i].FamilyName.Trim()); QueryService<Employee> queryService = new QueryService<Employee>(service.ServiceContext); Employee resultFound = queryService.ExecuteIdsQuery(EXISTING_EMPLOYEE_QUERY).FirstOrDefault<Employee>(); if (resultFound != null) { empDataInDb.EmployeeList[i].Id = resultFound.Id; //indexIterator = i+1; isSync.Add(empDataInDb.EmployeeList[i].GivenName, true); } else { isSync.Add(empDataInDb.EmployeeList[i].GivenName, false); } } if (isSync.Where(x => x.Value == false).Any()) { empDataInDb.IsEmployeeSync = false; } else { empDataInDb.IsEmployeeSync = true; } } else { empDataInDb.IsEmployeeNoData = true; empDataInDb.IsEmployeeSync = false; } return empDataInDb; }
/// <summary> /// Return the customer id from timeactivity. /// </summary> /// <param name="invoicedto"></param> /// <returns></returns> private TimeActivity GetCustomerId(Invoicedto invoicedto) { string EXISTING_TimeActive_QUERY = string.Format("select * from timeactivity where Id = '{0}'", invoicedto.timeQboId); QueryService<TimeActivity> queryService = new QueryService<TimeActivity>(dataserviceFactory.getServiceContext); TimeActivity resultFound = queryService.ExecuteIdsQuery(EXISTING_TimeActive_QUERY).FirstOrDefault<TimeActivity>(); return resultFound; }
/// <summary> /// Default constructor, initializes query service objects for database access. /// </summary> public RecruiterController() { _applicationQueryService = new QueryService<Application>(); }
public void CreateRepository() { sut = new QueryService(dbContext); }
/// <summary> /// Sync the items in to QBO. /// </summary> /// <param name="controller"></param> /// <param name="syncObjects"></param> /// <returns></returns> internal Syncdto SyncServiceItems(object controller, Syncdto syncObjects) { try { foreach (Item ItemItem in syncObjects.ItemList) { string EXISTING_ITEM_QUERY = string.Format("select * from Item where active = true and name = '{0}'", ItemItem.Name.Trim()); QueryService<Item> queryService = new QueryService<Item>(dataserviceFactory.getServiceContext); Item resultFound = queryService.ExecuteIdsQuery(EXISTING_ITEM_QUERY).FirstOrDefault<Item>(); if (resultFound == null) { Item entity = dataService.Add<Item>(ItemItem); syncObjects.QboId = entity.Id; syncObjects.IsServiceItemSync = true; } } syncObjects = syncRepository.Save(controller, syncObjects); return syncObjects; } catch (Intuit.Ipp.Exception.FaultException ex) { throw ex; } catch (Intuit.Ipp.Exception.InvalidTokenException ex) { throw ex; } catch (Intuit.Ipp.Exception.SdkException ex) { throw ex; } }
private void displayCustomers() { string consumerKey = ConfigurationSettings.AppSettings["consumerKey"]; string consumerSecret = ConfigurationSettings.AppSettings["consumerSecret"]; OAuthRequestValidator oauthRequestValidator = new OAuthRequestValidator(_ippRealmOAuthProfile.accessToken, _ippRealmOAuthProfile.accessSecret, consumerKey, consumerSecret); ServiceContext serviceContext = new ServiceContext(_ippRealmOAuthProfile.realmId, IntuitServicesType.QBO, oauthRequestValidator); DataService dataService = new DataService(serviceContext); QueryService<Customer> customerQueryService = new QueryService<Customer>(serviceContext); dataGridView1.DataSource = customerQueryService.ExecuteIdsQuery("Select * From Customer MaxResults 50").ToList(); }
public PayPalController(Api application, QueryService query_service) { _queryService = query_service; _application = application; }
public void TestConstructQuery() { QueryService queryService = new QueryService(); foreach(KeyValuePair<string, Query> kvp in GetConstructTestCases) { Query query = queryService.ConstructQuery(kvp.Key); Assert.AreEqual(kvp.Value.Command, query.Command); Assert.AreEqual(kvp.Value.Argument, query.Argument); Assert.AreEqual(kvp.Value.Key, query.Key); } }
public RootViewModel(IViewModelFactory viewModelFactory, DialogManager dialogManager, SettingsService settingsService, UpdateService updateService, QueryService queryService, DownloadService downloadService) { _viewModelFactory = viewModelFactory; _dialogManager = dialogManager; _settingsService = settingsService; _updateService = updateService; _queryService = queryService; _downloadService = downloadService; // Title var version = Assembly.GetExecutingAssembly().GetName().Version.ToString(3); DisplayName = $"YoutubeDownloader v{version}"; // Update busy state when progress manager changes ProgressManager.Bind(o => o.IsActive, (sender, args) => IsProgressIndeterminate = ProgressManager.IsActive && ProgressManager.Progress.IsEither(0, 1)); ProgressManager.Bind(o => o.Progress, (sender, args) => IsProgressIndeterminate = ProgressManager.IsActive && ProgressManager.Progress.IsEither(0, 1)); }