//public string UniqueDetailsAssets(AssetDetailsFileIdModel assetDetailsModel) //{ // using (var context = new INVENTORYEntities()) // { // AssetID assetID = new AssetID(); // assetID.emp_id = assetDetailsModel._EmpId; // assetID.assetid1 = assetDetailsModel._AssetId;//unique asset id add to ASSETID TABLE // // byte[] uploadedFile = new byte[assetDetailsModel.UploadAgreement.InputStream.Length]; // // assetDetailsModel.UploadAgreement.InputStream.Read(uploadedFile, 0, uploadedFile.Length); // // assetID.ContentType = uploadedFile;//FILE UPLOAD AS VARBINARY MAX IN ASSSETID TABLE // //string fileName = Path.GetFileName(assetDetailsModel.UploadAgreement.FileName); // //assetID.filename1 = fileName;//FILE NAME IN ASSETID TABLE // //string fullpath = "~/Agreement_Files/"; // //assetDetailsModel.FullPath = fullpath + fileName; // //assetID.filePath = assetDetailsModel.FullPath;//FULL PATH ADD IN ASSETID TABLE // context.AssetID.Add(assetID);//ADD TO TABLE // context.SaveChanges();//SAVE CHANGES IN TABLE // return assetID.emp_id; // } //} public string AddNewAsset(AssetDetailsModel assetDetailsModel) { using (var context = new INVENTORYEntities()) { AssetDetails assetNameKey = new AssetDetails(); assetNameKey.emp_id = assetDetailsModel.EmpId; //assetNameKey.asset_id = assetDetailsModel.AssetId; assetNameKey.asset_id_sub = assetDetailsModel.AssetId_unique; assetNameKey.asset_name = assetDetailsModel.AssetName; assetNameKey.serial_no = assetDetailsModel.SerialNo; assetNameKey.ip_address = assetDetailsModel.IpAddress; assetNameKey.mac_address = assetDetailsModel.MacAddress; assetNameKey.Processor = assetDetailsModel.Processor; assetNameKey.hdd = assetDetailsModel.HDD; assetNameKey.ram = assetDetailsModel.RAM; assetNameKey.warranty_start = assetDetailsModel.WarrantyStart; assetNameKey.warranty_end = assetDetailsModel.WarrantyEnd; assetNameKey.Dateofissue = assetDetailsModel.DateOfIssue; context.AssetDetails.Add(assetNameKey); context.SaveChanges(); return(assetNameKey.emp_id); } }
public string AddNewAsset(string url, FileType type) { try { string placeHolder = String.Format("[Kitsune_{0}]", url); AssetDetails cssFileLink = new AssetDetails { LinkUrl = url, PlaceHolder = placeHolder }; AssetDetails asset = new AssetDetails() { LinkUrl = url, PlaceHolder = placeHolder }; Context.FileDownloadQueue.Enqueue(new Tuple <AssetDetails, FileType>(asset, FileType.ASSET)); Context.NewAssetFoundDetailsCallBackMethod(asset, type); Context.Resources.Assets.Add(asset); return(placeHolder); } catch (Exception ex) { return(null); } }
public List <AssetDetails> GetAssetDetailsByEmpcode(string id) { List <AssetDetails> assetCsoList = new List <AssetDetails>(); List <Requests> requestClear = _repo.GetAllCsoRequest(); //getting assets of a particular employee foreach (Requests req in requestClear) { List <Assets> assets = _assetRepo.GetAssetsByCso(req.EmployeeCode); foreach (Assets req1 in assets) { AssetDetails asset = _assetDb.GetAssetByCode(req1.AssetCode); //repo call //setting the details to the view model AssetDetails model = new AssetDetails(); model.AssetId = req1.AssetId; model.AssetCode = req1.AssetCode; model.AssetStatus = req1.AssetStatus; model.ReAssignedTo = req1.ReassignedTo; model.CompanyCode = asset.CompanyCode; model.CapitalisationDate = asset.CapitalisationDate; model.Location = asset.Location; model.Description = asset.Description; assetCsoList.Add(model); //adding to the list to be returned } } return(assetCsoList); }
public static bool SaveInS3AndUpdateDB(string projectId, AssetDetails asset, FileType fileType, Byte[] bytes, string contentType) { try { //update the details var dbResult = MongoHelper.UpdateDownloadDetailsAsync(projectId, asset, fileType); //save the file if (bytes != null) { AmazonS3Helper.SaveTheFileInS3(EnvironmentConstants.ApplicationConfiguration.AWSS3Configuration.AWSAccessKey, EnvironmentConstants.ApplicationConfiguration.AWSS3Configuration.AWSSecretKey, String.Format("{0}{1}", projectId, asset.NewUrl), bytes, EnvironmentConstants.ApplicationConfiguration.AWSBuckets.SourceBucket.Name, contentType); } return(dbResult.Result); } catch (Exception ex) { Log.Error(ex, $"Error saving in s3 for projectId : {projectId} and file : {asset.LinkUrl}"); return(false); } }
private void UpdateDirectoryList() { assetList.Rows.Clear(); pathBox.Text = currentDir.path; List <DataGridViewRow> rows = new List <DataGridViewRow>(); foreach (FSObject obj in currentDir.children) { if (obj is FSDirectory) { DataGridViewRow row = new DataGridViewRow(); row.Height = 32; row.CreateCells(assetList, imageList.Images[(int)AssetIcon.Folder], obj.name, "Folder", "", 0); rows.Add(row); } } foreach (FSObject obj in currentDir.children) { if (obj is FSAsset assetObj) { AssetDetails dets = assetObj.details; object[] details = new object[] { imageList.Images[(int)dets.icon], assetObj.name, dets.type, dets.pointer.pathID, dets.size }; DataGridViewRow row = new DataGridViewRow(); row.Height = 32; row.CreateCells(assetList, details); rows.Add(row); } } assetList.Rows.AddRange(rows.ToArray()); }
private static AssetDetails MapAssetDetails(CatalogItemDetails dataModel, CatalogDetails catalog) { var returnObj = new AssetDetails(); if (dataModel == null || dataModel.CatalogItemInfo == null) { return(returnObj); } returnObj.ID = dataModel.CatalogItemInfo.ItemID; returnObj.AccountItemID = dataModel.CatalogItemInfo.AccountItemID; returnObj.ImageURL = dataModel.CatalogItemInfo.ImageUrl; returnObj.Name = dataModel.CatalogItemInfo.Description; returnObj.DetailURL = dataModel.CatalogItemInfo.DetailUrl; returnObj.DateIntroduced = dataModel.CatalogItemInfo.DateIntroduced; returnObj.DateLastUpdated = dataModel.CatalogItemInfo.LastUpdate; returnObj.Status = dataModel.CatalogItemInfo.Disabled ? "Inactive" : "Active"; returnObj.ExcludedFromRecommendations = dataModel.CatalogItemInfo.ExcludedFromRecommendations; if (catalog != null) { returnObj.CatalogName = catalog.Name; returnObj.CatalogID = catalog.CatalogId; returnObj.CatalogImage = catalog.Icon_FileName; } return(returnObj); }
public void Test_the_return_type_of_the_GetRequestStatus_to_be_listType_when_norequest_is_returned_from_the_database() { //arrange List <Assets> assetList = new List <Assets>(); List <Requests> requestList = new List <Requests>(); AssetDetails asset = new AssetDetails(); assetList.Add(new Assets() { ReassignedTo = "00000069", AssetCode = "0000345630" }); EmployeeDetails emp = new EmployeeDetails() { EmployeeCode = "00059644", EmployeeName = "Monika" }; var mockReq = new Mock <IRequestDetailsRepo>(); var mockAssetRepo = new Mock <IAssetDetailsRepo>(); var mockAssetDbRepo = new Mock <IAssetDbRepo>(); var mockEmpDbRepo = new Mock <IEmployeeDbRepo>(); mockEmpDbRepo.Setup(x => x.GetName(It.IsAny <string>())).Returns(emp); mockReq.Setup(x => x.GetAllRequest()).Returns(requestList); mockAssetRepo.Setup(x => x.GetAssetByEmpCode(It.IsAny <string>())).Returns(assetList); mockAssetDbRepo.Setup(x => x.GetAssetByCode(It.IsAny <string>())).Returns(asset); AssetControllerService obj = new AssetControllerService(mockAssetRepo.Object, mockReq.Object, mockAssetDbRepo.Object, mockEmpDbRepo.Object); //act var result = obj.GetRequestStatus(); //Assert Assert.IsType <List <AssetDetails> >(result); Assert.Empty(result); }
public SessionHostsStartInfo ToSessionHostsStartInfo() { // Clear mount path in process based, otherwise, agent will kick into back-compat mode and try to strip the // mount path from the start game command before running AssetDetail[] assetDetails = AssetDetails?.Select(x => new AssetDetail() { MountPath = RunContainer ? x.MountPath : null, LocalFilePath = x.LocalFilePath }).ToArray(); var startInfo = new SessionHostsStartInfo { AssignmentId = $"{VmConfiguration.GetGuidFromTitleId(TitleIdUlong)}:{BuildId}:{Region}", SessionHostType = RunContainer ? SessionHostType.Container : SessionHostType.Process, PublicIpV4Address = "127.0.0.1", FQDN = "localhost", HostConfigOverrides = GetHostConfig(), ImageDetails = ContainerStartParameters.ImageDetails, AssetDetails = assetDetails, StartGameCommand = RunContainer ? ContainerStartParameters.StartGameCommand : ProcessStartParameters.StartGameCommand, PortMappingsList = PortMappingsList }; return(startInfo); }
public JsonResult EditAssetDetails(AssetDetailsModel_Edit assetDetailsModel) { string message = ""; if (ModelState.IsValid) { using (var context = new INVENTORYEntities()) { AssetDetails assetNameKey = new AssetDetails(); assetNameKey.emp_id = assetDetailsModel.EmpId; assetNameKey.asset_id_sub = assetDetailsModel.AssetId_unique; assetNameKey.asset_name = assetDetailsModel.AssetName; assetNameKey.serial_no = assetDetailsModel.SerialNo; assetNameKey.ip_address = assetDetailsModel.IpAddress; assetNameKey.mac_address = assetDetailsModel.MacAddress; assetNameKey.Processor = assetDetailsModel.Processor; assetNameKey.hdd = assetDetailsModel.HDD; assetNameKey.ram = assetDetailsModel.RAM; assetNameKey.warranty_start = assetDetailsModel.WarrantyStart; assetNameKey.warranty_end = assetDetailsModel.WarrantyEnd; assetNameKey.Dateofissue = assetDetailsModel.DateOfIssue; context.Entry(assetNameKey).State = System.Data.Entity.EntityState.Modified; //context.AssetDetails.Add(assetNameKey); context.SaveChanges(); message = "Asset ID " + "<b>" + assetDetailsModel.AssetId_unique + "</b>" + " Updated Successfully"; } } return(Json(new { message = message }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Adds Include list to the Resources /// </summary> /// <param name="uri"></param> /// <param name="pathsToDownload"></param> public void ProcessIncludeList() { try { if (KrawlContext.Resources.IncludeStaticAssetList != null) { foreach (var path in KrawlContext.Resources.IncludeStaticAssetList) { try { if (String.IsNullOrEmpty(path)) { continue; } Uri absoluteUri = new Uri(KrawlContext.RootUri, path); string placeHolder = KHtmlParser.CheckUrlPresentInAssetOrNot(absoluteUri, KrawlContext.Resources); if (placeHolder == null || placeHolder.Equals("IGNORE", StringComparison.InvariantCultureIgnoreCase)) { placeHolder = String.Format("[kitsune_{0}]", absoluteUri.AbsoluteUri); AssetDetails linkMap = new AssetDetails { PlaceHolder = placeHolder, LinkUrl = absoluteUri.AbsoluteUri }; string fileExtension = Path.GetExtension(path).ToLower(); if (fileExtension == null) { fileExtension = String.Empty; } switch (fileExtension.ToLower()) { case ".css": KrawlContext.Resources.UniqueStylesDictionary.TryAdd(absoluteUri.AbsoluteUri, linkMap); break; case ".js": KrawlContext.Resources.UniqueScriptsDictionary.TryAdd(absoluteUri.AbsoluteUri, linkMap); break; default: KrawlContext.Resources.UniqueAssetsDictionary.TryAdd(absoluteUri.AbsoluteUri, linkMap); break; } } } catch (Exception ex) { //Log Error KrawlContext.ErrorLogMethod(LOGTYPE.ERROR, $"Error Message : Error adding the include_asset_list_file path : {path}", ex); } } } } catch (Exception ex) { } }
public CreateInternalBoardActorEvent(ActorObject ao, int argX, int argY, String filename, AssetDetails argDetails) : this() { actor = ao; x = argX; y = argY; imageName = filename; details = argDetails; }
public AssetData(AssetsFile af, AssetsManagerLegacy am, AssetDetails assetDetails, string rootDir) { InitializeComponent(); this.af = af; this.am = am; this.assetDetails = assetDetails; this.rootDir = rootDir; PopulateTree(); }
public IActionResult Edit(AssetDetails assetDetails) { if (ModelState.IsValid) { _db.Update(assetDetails); _db.SaveChanges(); return(RedirectToAction(nameof(Index))); } return(View(assetDetails)); }
public void CanSetTitle() { const string expectedTitle = "description"; var assetDetail = new AssetDetails { Title = expectedTitle }; Assert.AreEqual(expectedTitle, assetDetail.Title); }
public void CanSetDescription() { const string expectedDescription = "test description"; var assetDetail = new AssetDetails { Description = expectedDescription }; Assert.AreEqual(expectedDescription, assetDetail.Description); }
private void button1_Click(object sender, EventArgs e) { if (startedScanning) { return; } listBox1.Items.Clear(); startedScanning = true; loadingBar.Maximum = details.Count; if (textBox1.Text == "") { return; } long searchNum = long.Parse(textBox1.Text); BackgroundWorker bw = new BackgroundWorker(); bw.WorkerReportsProgress = true; bw.DoWork += delegate(object s, DoWorkEventArgs ev) { for (int i = 0; i < details.Count; i++) { AssetDetails ad = details[i]; if (ad.fileID != 0 && !checkBox1.Checked) { continue; } if (ad.typeName == "GameObject") { AssetTypeInstance gameObjectAti = manager.GetATI(manager.GetStream(ad.fileID), manager.GetInfo(ad.fileID, ad.pathID)); AssetTypeValueField components = gameObjectAti.GetBaseField().Get("m_Component").Get("Array"); for (uint j = 0; j < components.GetValue().AsArray().size; j++) { int fileId = components.Get(j).Get("component").Get("m_FileID").GetValue().AsInt(); long pathId = components.Get(j).Get("component").Get("m_PathID").GetValue().AsInt64(); if (pathId == searchNum) { bw.ReportProgress(i, gameObjectAti.GetBaseField().Get("m_Name").GetValue().AsString() + "(" + ad.fileID + "/" + ad.pathID + ")"); } } bw.ReportProgress(i); } } startedScanning = false; }; bw.ProgressChanged += delegate(object s, ProgressChangedEventArgs ev) { loadingBar.Value = ev.ProgressPercentage; if (ev.UserState != null) { listBox1.Items.Add(ev.UserState); } }; bw.RunWorkerAsync(); }
/// <summary> /// Add new Asset found to DB /// </summary> /// <param name="projectId"></param> /// <param name="asset"></param> /// <param name="type"></param> public static void UpdateNewAssetToDB(string projectId, AssetDetails asset, FileType type) { try { if (_server == null) { InitiateConnection(); } var urlCollection = _kitsuneDB.GetCollection <KitsuneKrawlerStats>(EnvironmentConstants.ApplicationConfiguration.MongoDBCollections.KitsuneKrawlStatsCollection); var projectFilter = Builders <KitsuneKrawlerStats> .Filter.Where(x => x.ProjectId == projectId); var update = Builders <KitsuneKrawlerStats> .Update.Set(x => x.ProjectId, projectId); switch (type) { case FileType.ASSET: update = Builders <KitsuneKrawlerStats> .Update.Push(x => x.Assets, asset) .Inc(x => x.AssetsFound, 1); break; case FileType.SCRIPT: update = Builders <KitsuneKrawlerStats> .Update.Push(x => x.Scripts, asset) .Inc(x => x.ScriptsFound, 1); break; case FileType.STYLE: update = Builders <KitsuneKrawlerStats> .Update.Push(x => x.Styles, asset) .Inc(x => x.StylesFound, 1); break; case FileType.LINK: update = Builders <KitsuneKrawlerStats> .Update.Push(x => x.Links, asset) .Inc(x => x.LinksFound, 1); break; default: return; } urlCollection.UpdateOneAsync(projectFilter, update); } catch (Exception ex) { //TODO: LOG } }
public static void NewAssetFound(string projectId, AssetDetails asset, FileType type) { try { MongoHelper.UpdateNewAssetToDB(projectId, asset, type); } catch (Exception ex) { if (asset != null) { Log.Error(ex, $"Error updating the resources for projectId : {projectId} and asset : {asset.LinkUrl}"); } } }
public void CanSetFile() { var file = new File { ContentType = "application/png", FileName = "image.png", Url = "http://image.com/image.png" }; var assetDetail = new AssetDetails { File = file }; Assert.AreSame(file, assetDetail.File); }
public BoardActor createActor(int x, int y, String filename, AssetDetails argDetails) { BoardActor r = null; if (dispatcher != null) { r = new BoardActor(x, y, filename); r.loadAsset(filename, dispatcher, argDetails); } else { Logger.log("SceneManager: Warning - board actor creation failed, no dispatcher set", LEVEL.WARNING); } return(r); }
public void TestFor_GetAssetDetailsByEmpcode_ThatItReturnsCorrectList() { //Arrange List <AssetDetails> assets = new List <AssetDetails>(); AssetDetails asset = new AssetDetails(); var mockService = new Mock <ICsoService>(); mockService.Setup(m => m.GetAssetDetailsByEmpcode(asset.EmployeeCode)).Returns(assets); CsoController csoObj = new CsoController(mockService.Object); //Act var result = csoObj.GetAssetDetails(asset.EmployeeCode); //Assert Assert.NotNull(result); }
private void viewDataButton_Click(object sender, System.EventArgs e) { if (assetList.SelectedIndices.Count == 0) { return; } AssetDetails details = assetDetails[assetList.SelectedIndices[assetList.SelectedIndices.Count - 1]]; if (details.fileID == 0) { new AssetData(assetsManager.initialFile, assetsManager, details, assetRootDir).ShowDialog(); } else { new AssetData(assetsManager.dependencies[(int)details.fileID - 1].af, assetsManager, details, assetRootDir).ShowDialog(); } }
public void Test_the_return_type_of_the_GetAllDiscrepantRecordsList_to_be_listType_to_be_empty_when_discrepant_records_are_not_encountered() { //arrange AssetDetails asset = new AssetDetails() { AssetCode = "0000345630", EmployeeCode = "00000068" }; List <Assets> assetList = new List <Assets>(); List <Requests> requestList = new List <Requests>(); EmployeeDetails emp = new EmployeeDetails() { EmployeeCode = "00059644", EmployeeName = "Monika" }; List <AssetControllerDiscrepancyReport> discrepancyList = new List <AssetControllerDiscrepancyReport>(); requestList.Add(new Requests() { RequestId = 1, EmployeeCode = "00000068", RequestStatus = RequestStatus.Completed, DateOfCompletionRequest = DateTime.Parse("10/8/2017"), NewPsaCode = "1", NewCcCode = "1", NewPaCode = "1", NewOuCode = "1" }); assetList.Add(new Assets() { ReassignedTo = "00000069", AssetCode = "0000345630" }); discrepancyList.Add(new AssetControllerDiscrepancyReport() { RequestId = 1, RepEmployeeCode = "00000069", SapEmployeeCode = "00000068" }); var mockReq = new Mock <IRequestDetailsRepo>(); var mockAssetRepo = new Mock <IAssetDetailsRepo>(); var mockAssetDbRepo = new Mock <IAssetDbRepo>(); var mockEmpDbRepo = new Mock <IEmployeeDbRepo>(); mockEmpDbRepo.Setup(x => x.GetName(It.IsAny <string>())).Returns(emp); mockReq.Setup(x => x.GetAllClearedRequest()).Returns(requestList); mockAssetRepo.Setup(x => x.GetAssetByEmpCode(It.IsAny <string>())).Returns(assetList); mockAssetDbRepo.Setup(x => x.GetAssetByCode(It.IsAny <string>())).Returns(asset); AssetControllerService obj = new AssetControllerService(mockAssetRepo.Object, mockReq.Object, mockAssetDbRepo.Object, mockEmpDbRepo.Object); //act var result = obj.GetDiscrepantRecords(); //Assert Assert.IsType <List <AssetControllerDiscrepancyReport> >(result); Assert.NotNull(result); }
public string CheckUrlPresentInAssetOrNot(string url) { try { AssetDetails result = Context.Resources.Assets.FirstOrDefault(x => x.LinkUrl.Equals(url)); if (result != null) { return(result.PlaceHolder); } else { return(null); } } catch (Exception ex) { throw new Exception("Error while checking if the url present or not", ex); } }
public void InitializeRegistry() { var transactions = new TransactionList(); transactions.BindTo(Transactions); RegistredControls.Add(transactions); var ad = new AssetDetails(); ad.BindTo(Properties); RegistredControls.Add(ad); var asl = new AssetsList(); asl.BindTo(Assets); RegistredControls.Add(asl); var st = new Stats(); st.BindTo(Statistics); RegistredControls.Add(st); var acd = new AccountDetails(); acd.BindTo(AccountTab); RegistredControls.Add(acd); var dg = new DistributionGraph(); dg.BindTo(Network); RegistredControls.Add(dg); var seq = new Sequence(); seq.BindTo(Sequence); RegistredControls.Add(seq); var ni = new NodeInfoDetails(); ni.BindTo(NodeInfo); RegistredControls.Add(ni); }
private void assetList_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { if (assetDetails.Count != assetList.Items.Count) { return; } AssetDetails details = assetDetails[e.ItemIndex]; nameField.Text = details.name; pathField.Text = details.pathID.ToString(); fileField.Text = details.fileID.ToString(); if (details.type != 0x72) { typeField.Text = $"0x{details.type.ToString("X8")} ({details.typeName})"; } else { //$ just for consistency, if you disagree please tell me typeField.Text = $"0x{(0xFFFF-details.monoType).ToString("X8")}"; } }
public List <AssetDetails> GetMyEmployeeAsset(string empId) { List <AssetDetails> resultAssetlist = new List <AssetDetails>(); //getting connection string cs = _config["ConnectionStrings:NtlniitessConnection"]; SqlConnection con = new SqlConnection(cs); SqlCommand cmd = new SqlCommand(); cmd.Parameters.AddWithValue("p1", empId); cmd.CommandText = "SELECT PERNR AS EmpCode, ANLN1 AS AssetCode, BUKRS AS CompanyCode, TXT50 AS AssetDesc,CASE WHEN AKTIV = '00000000' THEN '' ELSE AKTIV END AS CapitalizationDate,STORT AS Location, STTEXT AS LocationTxt,ORD42TEXT AS StatusTxt FROM ZASSETFORWEB WHERE PERNR = @P1 AND ANLN2 = '0000' "; cmd.Connection = con; try { con.Open(); SqlDataReader sdr = cmd.ExecuteReader(CommandBehavior.SingleResult); while (sdr.Read()) { AssetDetails ass = new AssetDetails(); ass.AssetCode = sdr["AssetCode"].ToString(); ass.EmployeeCode = sdr["EmpCode"].ToString(); ass.CompanyCode = sdr["CompanyCode"].ToString(); ass.Description = sdr["AssetDesc"].ToString(); ass.CapitalisationDate = sdr["CapitalizationDate"].ToString(); string str1 = sdr["Location"].ToString(); string str2 = sdr["LocationTxt"].ToString(); ass.Location = str1 + str2; resultAssetlist.Add(ass); } } catch (SqlException ex) { throw ex; } finally { con.Close(); } return(resultAssetlist); }
public void TestCanSetDetails() { var assetDetails = new AssetDetails(); assetDetails.Description = "Description"; assetDetails.File = new File() { ContentType = "image/png", Details = new {}, FileName = "test.png", Url = "http://test.com/test.png", SystemProperties = new SystemProperties() { Id = "testId" } }; var asset = new Asset { Details = assetDetails }; Assert.AreEqual(assetDetails, asset.Details); }
//Method to get all the discrepant asset records based on the data from the final report generated //and the updated data from the SAP public List <AssetControllerDiscrepancyReport> GetDiscrepantRecords() { List <AssetControllerDiscrepancyReport> discrepancyList = new List <AssetControllerDiscrepancyReport>(); //Repository method to get all the cleared request List <Requests> requestList = _requestrepo.GetAllClearedRequest(); foreach (var req in requestList) { //time difference between the request completion and current date is being checked here DateTime date = DateTime.Today; TimeSpan difference = date.Date - req.DateOfCompletionRequest.Date; if (difference.Days >= 1) { //Repository method to get all the asset associated to a employee List <Assets> assetList = _assetrepo.GetAssetByEmpCode(req.EmployeeCode); foreach (var asset in assetList) { //A call to the niit database is being triggered to get a single asset details AssetDetails assetSAP = _assetDb.GetAssetByCode(asset.AssetCode); string[] empId = asset.ReassignedTo.Split(':'); if (assetSAP.EmployeeCode != empId[0]) { EmployeeDetails emp = _empDb.GetName(empId[0]); EmployeeDetails emp2 = _empDb.GetName(assetSAP.EmployeeCode); //if discrepancy exists then values are being assigned to the view model AssetControllerDiscrepancyReport report = new AssetControllerDiscrepancyReport(); report.RequestId = req.RequestId; report.AssetCode = asset.AssetCode; report.RepEmployeeCode = asset.ReassignedTo; report.RepEmployeeName = emp.EmployeeName; report.SapEmployeeCode = assetSAP.EmployeeCode; report.SapEmployeeName = emp2.EmployeeName; discrepancyList.Add(report); //discrepant record are being added to the list to be returned } } } } return(discrepancyList); }
//Method to get the assets approved by the cso and displaying them to the Asset Contoller as a report public List <AssetDetails> GetRequestStatus() { List <AssetDetails> assetControlList = new List <AssetDetails>(); List <Requests> requestClear = new List <Requests>(); List <Requests> requests = _requestrepo.GetAllRequest(); //repo call foreach (Requests request in requests) { //logic for getting the cleared request if (request.RequestStatus == RequestStatus.Completed && request.PendingWith == PendingWith.Approved) { requestClear.Add(request); } } //getting assets of a particular employee foreach (Requests req in requestClear) { List <Assets> assets = new List <Assets>(); assets = GetAssetDetailsByEmpcode(req.EmployeeCode); //service call foreach (Assets req1 in assets) { AssetDetails asset = _assetDb.GetAssetByCode(req1.AssetCode); //repo call //setting the details to the view model AssetDetails final = new AssetDetails(); final.AssetId = req1.AssetId; final.AssetCode = req1.AssetCode; final.AssetStatus = req1.AssetStatus; final.ReAssignedTo = req1.ReassignedTo; final.CompanyCode = asset.CompanyCode; final.CapitalisationDate = asset.CapitalisationDate; final.Location = asset.Location; final.Description = asset.Description; assetControlList.Add(final); //adding to the list to be returned } } return(assetControlList); }