public HomeApiController(IConfiguration configuration) { _configuration = configuration; var connectionString = _configuration.GetConnectionString("StorageAccount"); dataQueries = new DataQueries(connectionString); }
public void CheckRemoveCustomerFriends() { DataQueries.deleteCustomerFriends(1, 2); DataTable dt = DataQueries.GetCustomerFriends(1); Assert.AreEqual(dt.Rows.Count, 0); }
public int Execute() { Console.WriteLine($"{nameof(HelloCommand)} Hello !!!"); var userQ = new DataQueries(); var fUser = userQ.GetUserFirstUser(); Console.WriteLine($"FirstUser: {fUser.FirstName} {fUser.LastName}"); return(0); }
public HomeController(ILogger <HomeController> logger, IConfiguration configuration) { _logger = logger; _configuration = configuration; var connectionString = _configuration.GetConnectionString("StorageAccount"); dataQueries = new DataQueries(connectionString); apiController = new HomeApiController(_configuration); }
public static void SaveErrorToDB(string srcID, string srcType, string errMsg, int spRptID, string rptName) { DataQueries dataAccess = new DataQueries(); string query = "INSERT INTO [dbo].[PDF_GENERATOR_ERROR_LOG] " + "([REPORT_ID],[PDF_REPORT_NAME],[ERROR_MESSAGE],[PDF_SOURCE_ID],[PDF_SOURCE_ID_TYPE],[DATE_CREATED]) " + "VALUES " + "(" + spRptID + ",'" + rptName + "','" + errMsg + "','" + srcID + "','" + srcType + "', GETDATE())"; dataAccess.QryCommand(query, "PDF"); }
public static DataTable GeNARContacts() { DataQueries dataAccess = new DataQueries(); string query = "SELECT FullName,title,IsDisabled,PositionId,PositionIdName,address1_telephone1,internalemailaddress,OrderBy " + "FROM [PDF_RPT_DATA].[dbo].[View_CustomerWeekly_Contacts]"; DataTable dt = dataAccess.ReadDataTable(query, "CRM"); return(dt); }
public IEnumerable <vw_Account> Get(int?pageNo, int?pageSize, string userRole, string roleEntityValue = "", string firstOrLastName = "", string accountNumber = "", string creditorName = "", string accountOriginal = "", string phone = "") { IEnumerable <vw_Account> accounts = null; try { DataQueries query = new DataQueries(); accounts = query.GetAccounts(firstOrLastName, accountNumber, creditorName, accountOriginal, roleEntityValue, phone, pageNo, pageSize, (UserRole)Enum.Parse(typeof(UserRole), userRole)); } catch (Exception ex) { throw ex; } return(accounts); }
/// <summary> /// Check that data is valid. /// </summary> public override void CheckData() { base.CheckData(); DataQueries.CheckNotEmpty("DataQueries"); foreach (WebDataQuery dataQuery in DataQueries) { dataQuery.CheckData(); } if (Operator == DataLogicConditionOperatorId.Not) { if (DataQueries.Count != 1) { throw new ApplicationException("The condition 'Not' requires exactly one sub query!"); } } }
public static DataTable GetDetailsList(string listid) { DataQueries dataAccess = new DataQueries(); string query = "SELECT TOP 1 [list_id] ,[jobno] AS [job_number],[job_name] AS [project_name],[est_completion_date],[job_size] ,[job_type] ,[job_city] ,[job_state],[job_city] + ', ' +[job_state] AS [location] " + " ,[NAR_JobProjectManagerId],[pm_name],[pm_email],[pm_phone],[pm_mobile],[nar_jobasstprojectmanagerid],[apm_name],[apm_email] " + " ,[apm_phone],[apm_mobile],[total_squares],[percent_complete],[squares_installed],[week_ending],[ModifiedOn],[jobGUID] " + " ,[job_type], [job_size] " + " FROM [PDF_RPT_DATA].[dbo].[View_Customer_Weekly_Report_Data] " + " WHERE [list_id] = " + listid + " ORDER BY [ModifiedOn] DESC"; DataTable dt = dataAccess.ReadDataTable(query, "CRM"); return(dt); }
public VMEmployeeWindow(Employee employee, Action action, EmployeeWindow employeeWindow, bool isnNew = false) { IsNew = isnNew; Positions = DataQueries.SelectPositions(); Departments = DataQueries.SelectDepartments(); Salaries = DataQueries.SelectSalaries(); UpdateInfo = action; oldEmployee = employee; NewEmployee = new Employee(); if (!IsNew) { HandlingObjects.CopyValueProperties(NewEmployee, employee); SelectedPosition = Positions.Where(c => c.Id == employee.Position.Id).First(); SelectedDepartment = Departments.Where(c => c.Id == employee.Department.Id).First(); SelectedSalary = Salaries.Where(c => c.Id == employee.Salary.Id).First(); } EmployeeWindow = employeeWindow; }
private void SaveEmployeeMethod(Object obj) { if (obj is Employee) { HandlingObjects.CopyValueProperties <Employee>(oldEmployee, NewEmployee); UpdateInfo?.Invoke(); if (IsNew) { Person person = new Person(); HandlingObjects.CopyValueProperties <Person>(person, (Person)oldEmployee); DataQueries.AddData <Person>(person); oldEmployee.FillPerson(person); oldEmployee.Position_id = oldEmployee.Position.Id; oldEmployee.Department_id = oldEmployee.Department.Id; oldEmployee.Salary_id = oldEmployee.Salary.Id; DataQueries.AddData <Employee>(oldEmployee); } } }
/// <summary> /// This function presents the error message text for the MessageBox Invoked By the SQLErrors. /// </summary> /// <param name="anErrorText"></param> /// <param name="exceptionMessage"></param> /// <returns></returns> public static string ErrorMessageText(DataQueries anErrorText, string exceptionMessage) { string errorText = String.Empty; switch (anErrorText) { case DataQueries.AllOrderData: errorText = Operations.ErrorTexts.AllOverDataDownloadErrorText; break; case DataQueries.CountOfProductAccordingToProductCategory: errorText = Operations.ErrorTexts.CountOfProductAccordingToProductCategoryErrorText; break; case DataQueries.YearlyPersonAllOrderAmount: errorText = Operations.ErrorTexts.YearlyPersonAllOrderAmountDowloadErrorText; break; case DataQueries.AllOrderAmountAccordingToModeAndStatus: errorText = Operations.ErrorTexts.AllOrderAmountAccordingToModeAndStatusDownloadErrorText; break; case DataQueries.AllOrdderAmountAccordingToDay: errorText = Operations.ErrorTexts.AllOrerAmountAccordingToDayDownloadErrorText; break; case DataQueries.CountOfTheProductsAccordingToGender: errorText = Operations.ErrorTexts.CountOfTheProductsAccordingToGenderDownloadErrorText; break; case DataQueries.ProductsWarrantyExpired: errorText = Operations.ErrorTexts.ProductsWarrantyExpriredDownloadErrorText; break; case DataQueries.ProductsOrderMoreThanGivenNumber: errorText = Operations.ErrorTexts.ProductsOrderedMoreThanGivenNumberDowmnloadErrorText; break; case DataQueries.ProductsAreNotOrdered: errorText = Operations.ErrorTexts.ProductsAreNotOrderedDownloadErrorText; break; case DataQueries.AllProductsWithAllData: errorText = Operations.ErrorTexts.AllProductsWithAllDataDownloadErrorText; break; case DataQueries.AllProductCategoryData: errorText = Operations.ErrorTexts.AllProductCategoryDataDownloadErrorText; break; case DataQueries.AllProductData: errorText = Operations.ErrorTexts.AllProductDataDownloadErrorText; break; case DataQueries.AllCustomerData: errorText = Operations.ErrorTexts.AllCustomerDataDownloadErrorText; break; case DataQueries.AllCustomerOrderData: errorText = Operations.ErrorTexts.AllCustomerOrderDataDownloadErrorText; break; case DataQueries.AllOrderedProduct: errorText = Operations.ErrorTexts.AllOrderedProductDownloadErrorText; break; } return(errorText + Environment.NewLine + exceptionMessage); }
public static async Task Run() { var data = new DataService(new HttpClient()); var queries = new DataQueries(await data.GetDataHierarchyAsync()); while (!_isExit) { Console.WriteLine("Запросы: "); Console.WriteLine(" 1 - Получить количество комментов под постами конкретного пользователя (по айди) (список из пост-количество)"); Console.WriteLine(" 2 - Получить список комментов под постами конкретного пользователя (по айди), где body коммента < 50 символов (список из комментов)"); Console.WriteLine(" 3 - Получить список (id, name) из списка todos которые выполнены для конкретного пользователя (по айди)"); Console.WriteLine(" 4 - Получить список пользователей по алфавиту (по возрастанию) с отсортированными todo items по длине name (по убыванию)"); Console.WriteLine(" 5 - Получить структуру пользователя (передать Id пользователя в параметры)"); Console.WriteLine(" 6 - Получить структуру поста (передать Id поста в параметры)"); Console.WriteLine(" 7 - Выход"); Console.Write("Выберите действие: "); int choice = 0; int id; choice = int.Parse(Console.ReadLine()); switch (choice) { case 1: Console.Write("Введите id пользователя: "); id = int.Parse(Console.ReadLine()); var query1Result = queries.GetCommentsUnderUserPosts(id); Console.WriteLine("========================================="); if (query1Result.Count == 0) { Console.WriteLine("Данных нет :("); } else { foreach (var record in query1Result) { Console.WriteLine($"Пост \"{record.Post.Title}\" имеет {record.Comments} коммент"); } } Console.WriteLine("========================================="); Console.WriteLine("Нажмите любую клавишу для продолжения..."); Console.ReadKey(); Console.Clear(); break; case 2: Console.Write("Введите id пользователя: "); id = int.Parse(Console.ReadLine()); var query2Result = queries.GetCommentsWithSmallBody(id); Console.WriteLine("========================================="); if (query2Result.Count == 0) { Console.WriteLine("Данных нет :("); } else { foreach (var record in query2Result) { Console.WriteLine($"Коммент \"{record.Body}\" имеет {record.Body.Length} символов"); } } Console.WriteLine("========================================="); Console.WriteLine("Нажмите любую клавишу для продолжения..."); Console.ReadKey(); Console.Clear(); break; case 3: Console.Write("Введите id пользователя: "); id = int.Parse(Console.ReadLine()); var query3Result = queries.GetCompletedTodos(id); Console.WriteLine("========================================="); if (query3Result.Count == 0) { Console.WriteLine("Данных нет :("); } else { foreach (var record in query3Result) { Console.WriteLine($"Id: {record.Id} | Таска \"{record.Name}\" выполнена"); } } Console.WriteLine("========================================="); Console.WriteLine("Нажмите любую клавишу для продолжения..."); Console.ReadKey(); Console.Clear(); break; case 4: var query4Result = queries.GetUsersAscWithTodosDesc(); Console.WriteLine("========================================="); if (query4Result.Count == 0) { Console.WriteLine("Данных нет :("); } else { foreach (var record in query4Result) { Console.WriteLine($"Имя: {record.Name} \n{GetTodosToShow(record.Todos)}"); } } Console.WriteLine("========================================="); Console.WriteLine("Нажмите любую клавишу для продолжения..."); Console.ReadKey(); Console.Clear(); break; case 5: Console.Write("Введите id пользователя: "); id = int.Parse(Console.ReadLine()); Console.WriteLine("========================================="); try { var query5Result = queries.GetUserStructure(id); Console.WriteLine($"Пользователь: {query5Result.User.Name} \n" + $"Последний пост пользователя (по дате): \"{query5Result.LastPost.Title}\"\n" + $"Количество комментов под последним постом: {query5Result.LastPostCommentsCount} \n" + $"Количество невыполненных тасков для пользователя: {query5Result.UncompletedTodosCount} \n" + $"Самый популярный пост пользователя (там где больше всего комментов с длиной текста больше 80 символов): \"{query5Result.MostPopularPostByComments.Title}\"\n" + $"Самый популярный пост пользователя (там где больше всего лайков): \"{query5Result.MostPopularPostByLikes.Title}\"\n"); } catch (InvalidOperationException) { Console.WriteLine("Данных нет :("); } Console.WriteLine("========================================="); Console.WriteLine("Нажмите любую клавишу для продолжения..."); Console.ReadKey(); Console.Clear(); break; case 6: Console.Write("Введите id поста: "); id = int.Parse(Console.ReadLine()); Console.WriteLine("========================================="); try { var query6Result = queries.GetPostStructure(id); Console.WriteLine($"Пост: \"{query6Result.Post.Title}\"\n" + $"Самый длинный коммент поста: \"{query6Result.LongestComment.Body}\"\n" + $"Самый залайканный коммент поста: \"{query6Result.MostLikedComment.Body}\"\n" + $"Количество комментов под постом где или 0 лайков или длина текста < 80: {query6Result.CommentsCountUnderBadPost}\n"); } catch (InvalidOperationException) { Console.WriteLine("Данных нет :("); } Console.WriteLine("========================================="); Console.WriteLine("Нажмите любую клавишу для продолжения..."); Console.ReadKey(); Console.Clear(); break; case 7: _isExit = true; break; default: Console.Clear(); break; } } }
private void RemoveEmployeeHandler(Object obj) { Employees.Remove(SelectEmployee); DataQueries.RemoveData <Employee>(selectEmployee); }
public VMMainWIndow(MainWindow mainWindow) { MainWindow = mainWindow; this.Employees = DataQueries.SelectEmployes(); }