public void ExportToJson_Split_Sort_Description() { _startDateTimeString = "01/01/2017"; _endDateTimeString = "30/12/2019"; _sCPartService.PageCount = 10000; _sCPartService.WhereExpression = "WHERE [Part_Type] = 'R' AND [PART_DESC] NOT LIKE '%**%' "; var returnList = GetAll_BaseQuery(); JSON_FileExport.WriteFile(_typePrefix + "00_Ordered_DescCode_Original", returnList, returnList.Count); returnList.ForEach(item => item.Asset_Desc_Code_Split = item.Asset_Desc.ToUpper().Split(' ').ToList() .OrderBy(x => x, new ManufacturerComparer()).ToList()); //returnList.ForEach(item => { // if (TestData.GetManufacturers().Contains() // item.Asset_Desc_Code_New = //}); //.ThenByDescending(x => x, new SemiNumericComparer()) JSON_FileExport.WriteFile(_typePrefix + "00_Ordered_DescCode", returnList, returnList.Count); var returnList_Manu = returnList.Where(x => !string.IsNullOrEmpty(x.Manufacturer)).ToList(); JSON_FileExport.WriteFile(_typePrefix + "00_Ordered_DescCode_Manufacturer", returnList_Manu, returnList_Manu.Count); var returnList_NoManu = returnList.Where(x => string.IsNullOrEmpty(x.Manufacturer)).OrderBy(x => x.Asset_Desc).ToList(); JSON_FileExport.WriteFile(_typePrefix + "00_Ordered_DescCode_No_Manufacturer", returnList_NoManu, returnList_NoManu.Count); }
public void S01_New_Item_In_Esteem() { _startDateTimeString = "01/01/2017"; _endDateTimeString = "30/12/2019"; _sCAuditService.WhereExpression = "WHERE [Part_Type] = 'R' AND [PART_DESC] NOT LIKE '%**%' "; var returnList = GetAll_Audit_BaseQuery(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); var newItemList = _DataCleanseService.Process_SCAuditList( returnList .Where ( item => item.Audit_Part_Num.ToUpper().StartsWith("BNL") && item.Audit_Rem.StartsWith("Added PO") && (item.Audit_Dest_Site_Num.ToUpper().StartsWith("E-") || item.Audit_Dest_Site_Num.ToUpper() == "LTX") ).ToList()); Assert.IsTrue(newItemList.Any(), "Filter Query didn't return any results"); var modelList = newItemList.Where(x => !string.IsNullOrEmpty(x.Model)).ToList(); var noModelList = newItemList.Where(x => string.IsNullOrEmpty(x.Model)).ToList(); var faultyList = newItemList.Where(x => x.Asset_Desc_Code_Split.Any(code => code.ToUpper() == "IPAD") && !string.IsNullOrEmpty(x.Model) && x.Model == "Cables").ToList(); JSON_FileExport.WriteFile(_typePrefix + "S01_New_Item_In_Esteem_All", newItemList, newItemList.Count, "EST_BadData"); JSON_FileExport.WriteFile(_typePrefix + "S01_New_Item_In_Esteem_Model", modelList, modelList.Count, "EST_BadData"); JSON_FileExport.WriteFile(_typePrefix + "S01_New_Item_In_Esteem_NoModel", noModelList, noModelList.Count, "EST_BadData"); JSON_FileExport.WriteFile(_typePrefix + "S01_New_Item_In_Esteem_FaultyiPad", faultyList, faultyList.Count, "EST_BadData"); }
public void LambdaQuery_04_RETURNED_TO_BNL() { _startDateTimeString = "01/01/2017"; _endDateTimeString = "30/12/2019"; // _sCDeployService.WhereExpression = "WHERE ISNULL(Fsrl_Ret_ID, '') <> '' AND [Part_Type] = 'R' AND [PART_DESC] NOT LIKE '%**%' "; var returnList = GetAll_BaseQuery(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); var newItemList = returnList .Where ( item => item.Audit_Ser_Num.StartsWith("BAM") //&& item.Audit_Dest_Site_Num.ToUpper().StartsWith("BNLTEST") // && (item.Audit_Ser_Num.StartsWith("BAM-") // && item.Audit_Ser_Num.Contains("/")) ).ToList(); var count = 0; Assert.IsTrue(newItemList.Any(), "Query didn't return any results"); foreach (var item in newItemList) { count++; Assert.IsTrue(item.Audit_Ser_Num.StartsWith("BAM"), "Item No: " + count.ToString() + " doesn't StartWith either BAM :" + item.Audit_Ser_Num); } JSON_FileExport.WriteFile(_typePrefix + "06_STAGE_E_ANDOR_LTX", newItemList, newItemList.Count); }
private void RunProcess() { try { var _bamService = new BAM_Service(); var returnList = _bamService.ExportDataToBAM(_queryBuilder).Result; //JSON_FileExport.WriteFile(_typePrefix + "ScheduledJob_TimeStamp", returnList.NewItemList, returnList.NewItemList.Count, "ScheduleRepeaterFinal", // _startDateTime, _currentTime); //var countValue = (counter + 1).ToString().PadLeft(6, '0'); //JSON_FileExport.WriteFile(_typePrefix + "_ScheduleRepeater_NewItemList" + countValue, returnList.NewItemList, returnList.NewItemList.Count, "ScheduleRepeaterFinal", // _startDateTime, _currentTime); //JSON_FileExport.WriteFile(_typePrefix + "_ScheduleRepeater_LocationChangeList" + countValue, returnList.LocationChangeList, returnList.LocationChangeList.Count, "ScheduleRepeaterFinal", // _startDateTime, _currentTime); //JSON_FileExport.WriteFile(_typePrefix + "_ScheduleRepeater_AssetTagChangeList" + countValue, returnList.AssetTagChangeList, returnList.AssetTagChangeList.Count, "ScheduleRepeaterFinal", // _startDateTime, _currentTime); //JSON_FileExport.WriteFile(_typePrefix + "_ScheduleRepeater_DeployedToBAMUserList" + countValue, returnList.DeployedToBAMUserList, returnList.DeployedToBAMUserList.Count, "ScheduleRepeaterFinal", // _startDateTime, _currentTime); //JSON_FileExport.WriteFile(_typePrefix + "_ScheduleRepeater_ReturnedFromBAMUserList" + countValue, returnList.ReturnedFromBAMUserList, returnList.ReturnedFromBAMUserList.Count, "ScheduleRepeaterFinal", // _startDateTime, _currentTime); } catch (Exception exp) { JSON_FileExport.WriteFile(_typePrefix + "_ScheduleRepeater_Exception_" + DateTime.Now.ToString("yyMMddhhmm"), exp, 0, "Exception"); } }
public void S05_Returned_from_BAM_User() { _startDateTimeString = "01/01/2017"; _endDateTimeString = "30/12/2019"; _sCDeployService.WhereExpression = "WHERE [Part_Type] = 'R' AND [PART_DESC] NOT LIKE '%**%' "; var returnList = GetAll_Deploy_BaseQuery(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); var newItemList = _DataCleanseService.Process_SCAuditDeployList(returnList .Where ( item => !string.IsNullOrEmpty(item.Audit_Ser_Num_Returned) && item.Audit_Ser_Num.StartsWith("BAM") ).ToList()); Assert.IsTrue(newItemList.Any(), "Filter Query didn't return any results"); var modelList = newItemList.Where(x => !string.IsNullOrEmpty(x.Model)).ToList(); var noModelList = newItemList.Where(x => string.IsNullOrEmpty(x.Model)).ToList(); var faultyList = newItemList.Where(x => x.Asset_Desc_Code_Split.Any(code => code.ToUpper() == "IPAD") && !string.IsNullOrEmpty(x.Model) && x.Model == "Cables").ToList(); JSON_FileExport.WriteFile(_typePrefix + "S05_Returned_from_BAM_User_All", newItemList, newItemList.Count, "EST_BadData"); JSON_FileExport.WriteFile(_typePrefix + "S05_Returned_from_BAM_User_Model", modelList, modelList.Count, "EST_BadData"); JSON_FileExport.WriteFile(_typePrefix + "S05_Returned_from_BAM_User_NoModel", noModelList, noModelList.Count, "EST_BadData"); JSON_FileExport.WriteFile(_typePrefix + "S05_Returned_from_BAM_User_FaultyiPad", faultyList, faultyList.Count, "EST_BadData"); }
public void S01_New_Item_In_Esteem() { _startDateTimeString = "01/01/2017"; _endDateTimeString = "30/12/2019"; _sCAuditService.WhereExpression = "WHERE [Part_Type] = 'R' AND [PART_DESC] NOT LIKE '%**%' "; var returnList = GetAll_Audit_BaseQuery(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); var newItemList = _DataCleanseService.Process_SCAuditList( returnList .Where ( item => item.Audit_Part_Num.ToUpper().StartsWith("BNL") && item.Audit_Rem.StartsWith("Added PO") && (item.Audit_Dest_Site_Num.ToUpper().StartsWith("E-") || item.Audit_Dest_Site_Num.ToUpper() == "LTX") ).ToList()); Assert.IsTrue(newItemList.Any(), "Filter Query didn't return any results"); var count = 0; foreach (var item in newItemList) { count++; Assert.IsTrue(item.Audit_Dest_Site_Num.ToUpper().StartsWith("LTX") || item.Audit_Dest_Site_Num.ToUpper().StartsWith("E-"), "Item No: " + count.ToString() + " doesn't StartWith either LTX or E- :" + item.Audit_Dest_Site_Num); } JSON_FileExport.WriteFile(_typePrefix + "S01_New_Item_In_Esteem", newItemList, newItemList.Count, "BAMReport"); }
private void ExportToJson() { var returnList = _dataCleanseService.Process_SCAuditList(GetAll_BaseQuery()); JSON_FileExport.WriteFile(_typePrefix + "_ScheduleRepeater_" + (counter + 1).ToString().PadLeft(6, '0'), returnList, returnList.Count, "ScheduleRepeaterFullJoin", _startDateTime, _currentTime); }
public List <SCPart> GetAll() { var model = new SCPartModel(); using (var connection = _sqlDbConnection.CreateConnection(_connectionString)) { var command = new SqlCommand(UseQueryBuilder ? QueryBuilder() : QueryString, connection); try { connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { model.SCPartList.Add(new SCPart() { Asset_Part_Num = reader["PART_NO"].ToString(), Asset_Desc = reader["PART_DESC"].ToString(), Asset_Desc_Code = reader["PART_DESC_ALT"].ToString(), Asset_PartType = reader["PART_TYPE"].ToString(), Asset_Last_Update = DateTime.Parse(reader["UPDATE_DATE"].ToString()) }); } Reset(); reader.Close(); } catch (Exception exp) { JSON_FileExport.WriteFile("EntityModel" + "_ScheduleRepeater_Exception_04_" + DateTime.Now.ToString("yyMMddhhmm"), exp, 0, "Exception"); Console.WriteLine(exp.Message); } } return(model.SCPartList); }
public async Task BAM_Template_Classes_Get_List() { var queryResult = _bamClient._client.GetAsync("api/V3/Template/GetAllClasses").Result; Assert.IsTrue(queryResult.IsSuccessStatusCode, "Query Status Code isn't Success: " + queryResult.StatusCode.ToString()); Assert.IsNotNull(queryResult, "queryResult is empty"); var resultSring = queryResult.Content.ReadAsStringAsync().Result; Assert.IsFalse(string.IsNullOrEmpty(resultSring), "Query resultSring is null"); var resultTemp = JsonConvert.DeserializeObject <TemplateClass[]>(resultSring); Assert.IsNotNull(resultTemp, "Query resultTemp is null"); Assert.IsTrue(resultTemp.Any(), "Query resultTemp doesn't contain any items"); var result = new TemplateClassList() { TemplateClasses = resultTemp.ToList() }; //var result = queryResult.Content.ReadAsAsync<ArticleList>().Result; Assert.IsNotNull(result, "Query result is null"); Assert.IsNotNull(result.TemplateClasses, "Articles list is null"); Assert.IsTrue(result.TemplateClasses.Any(), "Articles doesn't contain any items"); JSON_FileExport.WriteFile(_typePrefix + "BAM_Template_Classes_Get_List", result.TemplateClasses, result.TemplateClasses.Count); }
public void S05_Returned_from_BAM_User() { _startDateTimeString = "01/01/2017"; _endDateTimeString = "30/12/2019"; _sCDeployService.WhereExpression = "WHERE [Part_Type] = 'R' AND [PART_DESC] NOT LIKE '%**%' "; var returnList = GetAll_Deploy_BaseQuery(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); var newItemList = _DataCleanseService.Process_SCAuditDeployList(returnList .Where ( item => !string.IsNullOrEmpty(item.Audit_Ser_Num_Returned) && item.Audit_Ser_Num.StartsWith("BAM") ).ToList()); Assert.IsTrue(newItemList.Any(), "Filter Query didn't return any results"); var count = 0; foreach (var item in newItemList) { count++; Assert.IsTrue(item.Audit_Ser_Num.StartsWith("BAM"), "Item No: " + count.ToString() + " doesn't StartWith either BAM :" + item.Audit_Ser_Num); } JSON_FileExport.WriteFile(_typePrefix + "S05_Returned_from_BAM_User", newItemList, newItemList.Count, "BAMReport"); }
private void ExportToJson() { var returnList = Map.Map_Results(GetAll_BaseQuery()); JSON_FileExport.WriteFile(_typePrefix + "_ScheduleRepeater_" + (counter + 1).ToString().PadLeft(6, '0'), returnList, returnList.Count, "ScheduleRepeaterFullJoin", _startDateTime, _currentTime); }
public void B01_ExportData_AssetTag() { var estService = new EST_Service(); var hardwareAssetService = new BAM_HardwareAssetServices(); var apiTemplateList = new List <HardwareTemplate_Full>(); var queryBuilder = new QueryBuilder { StartDateString = "01/01/2017", EndDateString = "30/01/2017", PageCount = 1000 }; // Get Records from Esteem System var dataExport = estService.GetExportData(queryBuilder); dataExport.AssetTagChangeList.ForEach(asset => { var bamAssetList = hardwareAssetService.GetHardwareAsset_Full(asset.SerialNumber).FirstOrDefault(); if (bamAssetList != null) { apiTemplateList.Add(bamAssetList); } }); JSON_FileExport.WriteFile(_typePrefix + "B01_ExportData", apiTemplateList, apiTemplateList.Count); }
public void ExportToJson_Split_HP() { _startDateTimeString = "01/01/2010"; _endDateTimeString = "30/12/2019"; _sCPartService.PageCount = 10000000; _sCPartService.WhereExpression = "WHERE [Part_Type] = 'R' AND [PART_DESC] NOT LIKE '%**%' "; var returnList = GetAll_BaseQuery(); returnList = returnList .Where(x => !x.Asset_Desc.Contains("**")) // .Where(x => x.Asset_Desc_Code_Split.Contains("HP")) // .Where(x => x.Asset_Desc_Code_Suf.Contains("HEW") || x.Asset_Desc_Code_Suf.Contains("HPX")) .OrderBy(x => x.Asset_Desc).ToList(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); JSON_FileExport.WriteFile(_typePrefix + "00_NEWITEM_ALL", returnList, returnList.Count); var returnList_Manu = returnList.Where(x => !string.IsNullOrEmpty(x.Manufacturer)).ToList(); JSON_FileExport.WriteFile(_typePrefix + "00_NEWITEM_ALL_MANU", returnList_Manu, returnList_Manu.Count); var returnList_NoManu = returnList.Where(x => string.IsNullOrEmpty(x.Manufacturer)).ToList(); JSON_FileExport.WriteFile(_typePrefix + "00_NEWITEM_ALL_NO_MANU", returnList_NoManu, returnList_NoManu.Count); }
public void LambdaQuery_06_STAGE_E_andor_LTX_4() { var returnList = GetAll_BaseQuery(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); var newItemList = returnList .Where ( item => item.Audit_Part_Num.ToUpper().StartsWith("BNL") && item.Audit_Rem.StartsWith("Added PO") && (item.Audit_Dest_Site_Num.ToUpper().StartsWith("E-") || item.Audit_Dest_Site_Num.ToUpper() == "LTX") ).ToList(); var count = 0; foreach (var item in newItemList) { count++; Assert.IsTrue(item.Audit_Dest_Site_Num.ToUpper().StartsWith("LTX") || item.Audit_Dest_Site_Num.ToUpper().StartsWith("E-"), "Item No: " + count.ToString() + " doesn't StartWith either LTX or E- :" + item.Audit_Dest_Site_Num); } JSON_FileExport.WriteFile(_typePrefix + "06_STAGE_E_ANDOR_LTX", newItemList, newItemList.Count); }
public void ExportToJson() { var returnList = GetAll_BaseQuery(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); JSON_FileExport.WriteFile(_typePrefix + "00_NEWITEM_ALL", returnList, returnList.Count); }
public List <SCAudit> GetAll() { var scAuditModel = new SCAuditModel(); if (QueryBuilderObject != null) { base.DateRange = QueryBuilderObject.DateRange; base.EndDate = QueryBuilderObject.EndDate; base.EndDateInclusive = QueryBuilderObject.EndDateInclusive; base.EndDateString = QueryBuilderObject.EndDateString; base.LastQueryString = QueryBuilderObject.LastQueryString; base.OrderBy = QueryBuilderObject.OrderBy; base.PageCount = QueryBuilderObject.PageCount; base.SkipCount = QueryBuilderObject.SkipCount; base.StartDate = QueryBuilderObject.StartDate; base.StartDateString = QueryBuilderObject.StartDateString; base.TimeRange = QueryBuilderObject.TimeRange; base.WhereExpression = QueryBuilderObject.WhereExpression; } using (var connection = _sqlDbConnection.CreateConnection(_connectionString)) { var command = new SqlCommand(UseQueryBuilder ? QueryBuilder() : QueryString, connection); try { connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { scAuditModel.SCAuditList.Add(new SCAudit() { Audit_Ser_Num = string.IsNullOrEmpty(reader["SERIAL_NO"]?.ToString()) ? null : reader["SERIAL_NO"]?.ToString().Trim(), Audit_Part_Num = reader["PART_NO"]?.ToString(), Audit_Prod_Desc = reader["PART_DESC"]?.ToString(), Audit_Prod_Desc_Alt = reader["PART_DESC_ALT"]?.ToString(), Audit_Source_Site_Num = reader["SOURCE_SITE_NO"]?.ToString(), Audit_Dest_Site_Num = reader["DESTINATION_SITE_NO"]?.ToString(), Audit_Part_Type = reader["PART_TYPE"]?.ToString(), Audit_Rem = reader["REMARK"]?.ToString(), Audit_User = reader["USER"]?.ToString(), Audit_Move_Date = DateTime.Parse(reader["MOVE_DATE"].ToString()), Audit_Last_Update = DateTime.Parse(reader["UPDATE_DATE"].ToString()) }); } Reset(); reader.Close(); } catch (Exception exp) { JSON_FileExport.WriteFile("EntityModel" + "_ScheduleRepeater_Exception_04_" + DateTime.Now.ToString("yyMMddhhmm"), exp, 0, "Exception"); Console.WriteLine(exp.Message); } } return(scAuditModel.SCAuditList); }
public void ExportToJson() { //_sCDeployService.WhereExpression = "WHERE ISNULL(Fsrl_Ret_ID, '') <> '' "; var returnList = GetAll_BaseQuery(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); JSON_FileExport.WriteFile(_typePrefix + "00_NEWITEM_ALL", returnList, returnList.Count); }
public void B01_ExportData() { var estService = new EST_Service(); var hardwareAssetService = new BAM_HardwareAssetServices(); var apiTemplateList = new List <HardwareTemplate_Full>(); var notExistInBam = new List <SCAuditBsm>(); var queryBuilder = new QueryBuilder { StartDateString = "01/01/2017", EndDateString = "01/01/2018", PageCount = 1000000 }; // Get Records from Esteem System var dataExport = estService.GetExportData(queryBuilder); //dataExport.NewItemList.ForEach(asset => //{ // var bamAssetList = hardwareAssetService.GetHardwareAsset_Full(asset.SerialNumber).FirstOrDefault(); // if (bamAssetList != null) apiTemplateList.Add(bamAssetList); //}); //dataExport.AssetTagChangeList.ForEach(asset => //{ // var bamAssetList = hardwareAssetService.GetHardwareAsset_Full(asset.SerialNumber).FirstOrDefault(); // if (bamAssetList != null) apiTemplateList.Add(bamAssetList); //}); dataExport.LocationChangeList.Take(50).ToList().ForEach(asset => { var bamAssetList = hardwareAssetService.GetHardwareAsset_Full(asset.SerialNumber).FirstOrDefault(); if (bamAssetList != null) { apiTemplateList.Add(bamAssetList); } else { notExistInBam.Add(asset); } }); //dataExport.DeployedToBAMUserList.ForEach(asset => //{ // var bamAssetList = hardwareAssetService.GetHardwareAsset_Full(asset.SerialNumber).FirstOrDefault(); // if (bamAssetList != null) apiTemplateList.Add(bamAssetList); //}); //dataExport.ReturnedFromBAMUserList.ForEach(asset => //{ // var bamAssetList = hardwareAssetService.GetHardwareAsset_Full(asset.SerialNumber).FirstOrDefault(); // if (bamAssetList != null) apiTemplateList.Add(bamAssetList); //}); JSON_FileExport.WriteFile(_typePrefix + "B01_ExportData", apiTemplateList, apiTemplateList.Count); JSON_FileExport.WriteFile(_typePrefix + "B01_ExportData_NotExistBAM", notExistInBam, notExistInBam.Count); }
private void RunProcess() { try { var _bamService = new BAM_Service(); var returnList = _bamService.ExportDataToBAM(_queryBuilder, 4).Result; } catch (Exception exp) { JSON_FileExport.WriteFile(_typePrefix + "_ScheduleRepeater_Exception_04_" + DateTime.Now.ToString("yyMMddhhmm"), exp, 0, "Exception"); } }
public void ExportToJson_TypeR_BNL() { _startDateTimeString = "01/01/2017"; _endDateTimeString = "30/12/2019"; _sCAuditService.WhereExpression = "WHERE [Part_Type] = 'R' AND [PART_DESC] NOT LIKE '%**%' AND [Part_Num] LIKE '%BNL%' "; var returnList = GetAll_BaseQuery(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); JSON_FileExport.WriteFile(_typePrefix + "00_NEWITEM_ALL_TypeR_BNL", returnList, returnList.Count); }
public List <SCAuditDeploy> GetAll() { var scAuditModel = new SCAuditDeployModel(); using (var connection = _sqlDbConnection.CreateConnection(_connectionString)) { var command = new SqlCommand(UseQueryBuilder ? QueryBuilder() : QueryString, connection); try { connection.Open(); SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { scAuditModel.SCAuditDeployList.Add(new SCAuditDeploy() { Audit_Ser_Num = reader["SERIAL_NO"].ToString(), Audit_Ser_Num_Returned = reader["SERIAL_NO_RETURNED"].ToString(), Audit_Part_Num = reader["PART_NO"].ToString(), Audit_Part_Num_Returned = reader["PART_NO_RETURNED"].ToString(), Audit_Prod_Desc = reader["PART_DESC"].ToString(), Audit_Prod_Desc_Returned = reader["PART_DESC_RETURNED"].ToString(), //Audit_Prod_Desc_Alt = reader["PART_DESC_ALT"].ToString(), //Audit_Source_Site_Num = reader["SOURCE_SITE_NO"].ToString(), //Audit_Dest_Site_Num = reader["DESTINATION_SITE_NO"].ToString(), Audit_Part_Type = reader["Part_Type"].ToString(), Audit_Part_Code = reader["Part_Code"].ToString(), Audit_Cost_Code = reader["Cost_Code"].ToString(), //Audit_Rem = reader["REMARK"].ToString(), Audit_User = reader["Call_Contact"].ToString(), Audit_Call_Num = reader["Call_Num"].ToString(), Audit_Call_Ref = reader["Call_Ref"].ToString(), //Audit_Move_Date = DateTime.Parse(reader["MOVE_DATE"].ToString()), Audit_Last_Update = DateTime.Parse(reader["UPDATE_DATE"].ToString()) }); } Reset(); reader.Close(); } catch (Exception exp) { JSON_FileExport.WriteFile("EntityModel" + "_ScheduleRepeater_Exception_04_" + DateTime.Now.ToString("yyMMddhhmm"), exp, 0, "Exception"); Console.WriteLine(exp.Message); } } return(scAuditModel.SCAuditDeployList); }
public void LinqQuery_08_PartDescriptionList_Only_ALL() { _startDateTimeString = "01/01/2016"; _endDateTimeString = "30/12/2019"; var returnList = GetAll_BaseQuery(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); var newItemList = returnList.Where(x => !x.Audit_Prod_Desc.StartsWith("***")) .Select(x => new { x.Audit_Prod_Desc }).OrderBy(x => x.Audit_Prod_Desc) .Distinct() .ToList(); JSON_FileExport.WriteFile(_typePrefix + "08_PROD_DESCRIPTION_ONLY_ALL", newItemList, newItemList.Count); }
public void StoredProcedureTest02() { var operatorIDString = "08921908-EBA0-4A20-B2C7-703A05569338"; var startDateString = "02 jul 2018"; var endDateString = "03 jul 2018"; DateTime.TryParse(startDateString, out var startDate); DateTime.TryParse(endDateString, out var endDate); Guid.TryParse(operatorIDString, out var operatorId); TopDesk577Entities db = new TopDesk577Entities(); var results = db.UTVF_IncidentsMovedToOperator(operatorId, startDate, endDate); Assert.IsNotNull(results, "Stored Proceducre returned no results"); Assert.IsTrue(results.Any(), "Doesn't have any records"); var incident = results.FirstOrDefault(); // Incident number. Assert.IsNotNull(incident, "Incident is null"); Assert.IsFalse(string.IsNullOrEmpty(incident.Incident), "Incident text is empty"); incident incidentItem = db.incidents.Where(x => x.naam == incident.Incident).FirstOrDefault(); Assert.IsNotNull(incidentItem, "Stored Proceducre returned no results"); Assert.IsTrue(incidentItem.naam == incident.Incident, "Incident Records don't match"); var results2 = db.UTVF_IncidentOperatorMovements(incident.Incident); Assert.IsNotNull(results2, "Stored Proceducre returned no results"); Assert.IsTrue(results2.Any(), "Doesn't have any records"); var incident2 = results2.FirstOrDefault(); Assert.IsNotNull(incident.Incident, "Incident is null"); Assert.IsFalse(string.IsNullOrEmpty(incident.Incident), "Incident text is empty"); var currentDate = new DateTime(); results2.ToList().ForEach(item => { Assert.IsTrue(item.Move_Date != null, "Move date is null"); Assert.IsTrue(item.Move_Date > currentDate, "Move Date is not is sequencial order :" + currentDate.ToString() + " " + item.Move_Date.ToString() + " Row " + item.RowNumber); currentDate = (DateTime)item.Move_Date; }); JSON_FileExport.WriteFile("StoredProcedureTest02", results2, results2.Count(), "USP_Functions"); }
public void ExportToJson_All() { //_startDateTimeString = "01/01/2010"; _startDateTimeString = "01/01/2017"; _endDateTimeString = "30/12/2019"; _sCPartService.PageCount = 10000000; var returnList = GetAll_BaseQuery(); returnList = returnList .Where(x => !x.Asset_Desc.Contains("**")) .OrderBy(x => x.Asset_Desc).ToList(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); JSON_FileExport.WriteFile(_typePrefix + "00_NEWITEM_ALL", returnList, returnList.Count); }
public void LinqQuery_07_PartDescriptionList_Only() { _startDateTimeString = "01/01/2016"; _endDateTimeString = "30/12/2019"; var returnList = GetAll_BaseQuery(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); var newItemList = (from item in returnList where item.Audit_Part_Num.ToUpper().StartsWith("BNL") && item.Audit_Rem.StartsWith("Added PO") && (item.Audit_Dest_Site_Num.ToUpper().StartsWith("E-") || item.Audit_Dest_Site_Num.ToUpper() == "LTX") orderby item.Audit_Prod_Desc ascending select new { item.Audit_Prod_Desc }).ToList(); JSON_FileExport.WriteFile(_typePrefix + "07_PROD_DESCRIPTION_ONLY", newItemList, newItemList.Count); }
public void ExportToJson_All_BNL() { //_startDateTimeString = "01/01/2010"; _startDateTimeString = "01/01/2017"; _endDateTimeString = "30/12/2019"; _sCPartService.WhereExpression = "WHERE [Part_Type] = 'R' AND [PART_DESC] NOT LIKE '%**%' AND [Part_Num] LIKE '%BNL%' "; _sCPartService.PageCount = 10000000; var returnList = GetAll_BaseQuery(); returnList = returnList .Where(x => !x.Asset_Desc.Contains("**")) .OrderBy(x => x.Asset_Desc).ToList(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); JSON_FileExport.WriteFile(_typePrefix + "00_NEWITEM_ALL_BNL", returnList, returnList.Count); }
private void RunProcess() { try { var _bamService = new BAM_Service(); var reports = _dbContext.ServiceProgressReport .Where(x => x.ProcessSuccessFlag == false && x.ServiceJobType != 2).ToList(); // && x.ServiceJobType == 3 //&& (x.EsteemExtractDateTime == null || x.BAMExportDateTime == null)); if (reports == null) { return; } var whereStatement = ""; reports.ToList().ForEach(item => { var erroringAssets = _dbContext.BAM_Reporting.Where(x => x.ServiceProgressReportId == item.Id).ToList(); if (erroringAssets != null && erroringAssets.Any()) { erroringAssets.ForEach(errorItem => { whereStatement += " AND [Audit_Ser_Num] LIKE '%" + errorItem.SerialNumber + "%' "; }); } if (!string.IsNullOrEmpty(whereStatement)) { _queryBuilder.StartDate = (DateTime)item.QueryStartParameters; _queryBuilder.EndDate = _queryBuilder.StartDate.AddHours(1); //(DateTime)item.QueryStartParameters == null || (DateTime)item.QueryStartParameters == new DateTime() ? // _queryBuilder.StartDate.AddHours(1) : _queryBuilder.EndDate; _queryBuilder.WhereExpression = whereStatement; var returnList = _bamService.ExportDataToBAM(_queryBuilder, 2).Result; } }); } catch (Exception exp) { Email.SendException(exp.Message); JSON_FileExport.WriteFile(_typePrefix + "_ScheduleRepeater_Exception_02_" + DateTime.Now.ToString("yyMMddhhmm"), exp, 0, "Exception"); } }
public async Task B02_GetAssetItem_Full_Test() { var hardwareAssetTemplateId = "c0c58e7f-7865-55cc-4600-753305b9be64"; var serialNumber = "CNU0183F33"; // "BAM -L-00"; //0852 var serialNumberFull = "CND7506PT8"; // "BAM -L-00"; //0852 var projectionId = "6fd42dd3-81b4-ec8d-14d6-08af1e83f63a"; var projectionIdFullwUser = "******"; serialNumber = serialNumberFull; projectionId = projectionIdFullwUser; var jsonCriteria = "{\"Id\": \"" + projectionId + "\",\"Criteria\": {\"Base\": {" + "\"Expression\": { \"And\": { \"Expression\": [{" + "\"SimpleExpression\": { \"ValueExpressionLeft\": { " + "\"Property\": \"$Context/Property[Type='62f0be9f-ecea-e73c-f00d-3dd78a7422fc']/ObjectStatus$\"}," + "\"Operator\": \"NotEqual\",\"ValueExpressionRight\": {" + "\"Value\": \"47101e64-237f-12c8-e3f5-ec5a665412fb\" }}}, " + "{\"SimpleExpression\": { \"ValueExpressionLeft\": { " + "\"Property\": \"$Context/Property[Type='c0c58e7f-7865-55cc-4600-753305b9be64']/SerialNumber$\"}," + "\"Operator\": \"Like\",\"ValueExpressionRight\": {" + "\"Value\": \"%" + serialNumber + "%\"}}}]}}}}}"; var content = new StringContent(jsonCriteria, Encoding.UTF8, "application/json"); var queryResult_Get = _bamClient._client.PostAsync("api/V3/Projection/GetProjectionByCriteria", content).Result; Assert.IsTrue(queryResult_Get.IsSuccessStatusCode, "Query Status Code isn't Success: " + queryResult_Get.StatusCode.ToString()); Assert.IsNotNull(queryResult_Get, "queryResult is empty"); var resultSring_Get = queryResult_Get.Content.ReadAsStringAsync().Result; Assert.IsFalse(string.IsNullOrEmpty(resultSring_Get), "Query resultSring is null"); var result = new HardwareTemplate_FullList() { BAM_HardwareTemplate_FullList = JsonConvert.DeserializeObject <HardwareTemplate_Full[]>(resultSring_Get).ToList() }; Assert.IsNotNull(result, "Result didn't deserialize to BAM_HardwareTemplate_Full"); Assert.IsTrue(result.BAM_HardwareTemplate_FullList.Any(), "Result didn't any results"); Assert.IsTrue(result.BAM_HardwareTemplate_FullList.First().SerialNumber == serialNumber, "SerialNumbers don't match"); JSON_FileExport.WriteFile(_typePrefix + "B02_GetAssetItem_Full_Test", result.BAM_HardwareTemplate_FullList, result.BAM_HardwareTemplate_FullList.Count); }
public void Specification_01_BNL_and_AddedPO() { var returnList = GetAll_BaseQuery(); Assert.IsTrue(returnList.Any(), "Query didn't return any results"); var SPEC_NEWITEMESTEEM = (BNL_SPEC.SPEC_PART_IS_BNL.AND(BNL_SPEC.SPEC_NEW_PO)); var newItemList = returnList.FindAll(x => SPEC_NEWITEMESTEEM.IsSatisfiedBy(x)); var count = 0; foreach (var item in newItemList) { count++; Assert.IsTrue(item.Audit_Part_Num.StartsWith("BNL"), "Item No: " + count.ToString() + " doesn't StartWith BNL :" + item.Audit_Part_Num); Assert.IsTrue(item.Audit_Rem.StartsWith("Added PO"), "Item No: " + count.ToString() + " doesn't StartWith Added PO :" + item.Audit_Rem); } JSON_FileExport.WriteFile(_typePrefix + "01_BNL_AND_ADDEDPO", newItemList, newItemList.Count); }
public async Task BAM_UserList_Get_List() { var userFilter = ""; var filterByAnalyst = false; var groupsOnly = false; var maxNumberOfResults = 100; var fetchAll = true; var queryFilter = string.Format("?userFilter={0}&filterByAnalyst={1}&groupsOnly={2}&maxNumberOfResults={3}&fetchAll={4}", userFilter, filterByAnalyst, groupsOnly, maxNumberOfResults, fetchAll ); var queryResult = _bamClient._client.GetAsync("api/V3/User/GetUserList" + queryFilter).Result; Assert.IsTrue(queryResult.IsSuccessStatusCode, "Query Status Code isn't Success: " + queryResult.StatusCode.ToString()); Assert.IsNotNull(queryResult, "queryResult is empty"); var resultSring = queryResult.Content.ReadAsStringAsync().Result; Assert.IsFalse(string.IsNullOrEmpty(resultSring), "Query resultSring is null"); var resultTemp = JsonConvert.DeserializeObject <BAM_User[]>(resultSring); Assert.IsNotNull(resultTemp, "Query resultTemp is null"); Assert.IsTrue(resultTemp.Any(), "Query resultTemp doesn't contain any items"); var result = new BAM_UserList() { BAM_Users = resultTemp.ToList() }; //var result = queryResult.Content.ReadAsAsync<ArticleList>().Result; Assert.IsNotNull(result, "Query result is null"); Assert.IsNotNull(result.BAM_Users, "Articles list is null"); Assert.IsTrue(result.BAM_Users.Any(), "Articles doesn't contain any items"); JSON_FileExport.WriteFile(_typePrefix + "BAM_UserList_Get_List", result.BAM_Users, result.BAM_Users.Count); var esteemUser = result.BAM_Users.Where(x => x.Name.Contains("Esteem")).FirstOrDefault(); Assert.IsNotNull(esteemUser, "Esteem User is null"); }