public ActionResult EditAsset(string tag) { AssetProcess assetProcess = new AssetProcess(); GenericProcess <Location> locationProcess = new GenericProcess <Location>(); GenericProcess <Issuer> issuerProcess = new GenericProcess <Issuer>(); GenericProcess <AssetType> typeProcess = new GenericProcess <AssetType>(); GenericProcess <AssetStatu> statusProcess = new GenericProcess <AssetStatu>(); GenericProcess <AssetClass> classProcess = new GenericProcess <AssetClass>(); string assetTag = tag; vwFixAssetList assetToEdit = assetProcess.GetFixAssetByAssetTag(assetTag); FixAssetViewModel assetView = new FixAssetViewModel(); assetView.AssetTag = assetToEdit.AssetTag; assetView.FixAssetID = assetToEdit.FixAssetID; assetView.SerialNumber = assetToEdit.SerialNumber; assetView.Model = assetToEdit.Model; assetView.Brand = assetToEdit.Brand; assetView.AssetClassID = assetToEdit.AssetClassID; assetView.AssetStatusID = assetToEdit.AssetStatusID; assetView.AssetTypeID = assetToEdit.AssetTypeID; assetView.IssuerID = assetToEdit.IssuerID; assetView.LocationID = assetToEdit.LocationID; assetView.Remarks = assetToEdit.Remarks; if (assetToEdit.AcquisitionDate != null) { assetView.AcquisitionDate = assetToEdit.AcquisitionDate; } if (assetToEdit.ExpiryDate != null) { assetView.ExpiryDate = assetToEdit.ExpiryDate; } ViewBag.Location = locationProcess.GetAll().ToList(); ViewBag.Issuer = issuerProcess.GetAll().ToList(); ViewBag.AssetType = typeProcess.GetAll().ToList(); ViewBag.AssetStatus = statusProcess.GetAll().ToList(); ViewBag.AssetClass = classProcess.GetAll().ToList(); return(View(assetView)); }
public void FixAssetReport(vwFixAssetList fixAsset) { ReportsProcess reportsProcess = new ReportsProcess(); List <vwFixAssetList> AssetLists = new List <vwFixAssetList>(); AssetLists = reportsProcess.GetFixAssetListByClassTypeStatus(fixAsset); WebGrid grid = new WebGrid(source: AssetLists, canPage: false, canSort: false); string gridHtml = grid.GetHtml( // tableStyle: "table table-striped table-hover", //mode: WebGridPagerModes.All, //firstText: "First", //previousText: "Prev", //nextText: "Next", //lastText: "Last", //htmlAttributes: new //{ // id = "grid" //}, columns: grid.Columns( grid.Column("FixAssetID", "Fix Asset ID"), grid.Column("Model", "Model"), grid.Column("SerialNumber", "Serial #"), grid.Column("AssetTag", "Asset Tag"), grid.Column("Brand", "Brand"), grid.Column("Remarks", "Remarks"), grid.Column("AcquisitionDate", "Acquisition Date"), grid.Column("ExpiryDate", "Expiry Date"), grid.Column("IssuerName", "Issuer Name"), grid.Column("IssuerType", "Issuer Type"), grid.Column("LocationName", "Location"), grid.Column("Country", "Country"), grid.Column("TypeDescription", "Type"), grid.Column("ClassDescription", "Class"), grid.Column("StatusDescription", "Asset Status") ) ).ToString(); Response.ClearContent(); Response.AddHeader("content-disposition", "attachment; filename=ListOfAssets.xls"); Response.ContentType = "application/xls"; Response.Write(gridHtml); Response.End(); }
public static Dictionary <string, int> GetNextStatus(ActionType action, int assetID, int assignmentID = 0) { BO.AssetProcess assetProcess = new BO.AssetProcess(); BO.AssignmentProcess assignProcess = new BO.AssignmentProcess(); Dictionary <string, int> result = new Dictionary <string, int>(); vwFixAssetList asset = assetProcess.GetAssetByID(assetID); AssetAssignment assignment = new AssetAssignment(); if (assignmentID > 0) { assignment = assignProcess.GetAssignmentbyID(assignmentID); } //FA - FixAsset Status; //AA - Current Assignment Status ( for transafer, this is for the requestor) //NAA - Next Assignment Status ( only for transfer, this is for the receipient) switch (action) { case ActionType.ASSET_NEW: result.Clear(); result.Add("FA", Constants.ASSET_STATUS_FORASSIGNMENT); return(result); case ActionType.ASSET_TRANSFER: result.Clear(); result.Add("FA", Constants.ASSET_STATUS_FORTRANSFER); result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_APPROVAL); return(result); case ActionType.ASSET_TRANSFER_WOAPPROVAL: case ActionType.ASSET_TRANSFER_APPROVED: result.Clear(); if (asset.AssetStatusID == Constants.ASSET_STATUS_WITH_MIS) { result.Add("FA", Constants.ASSET_STATUS_ASSIGNED); result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_ACCEPTANCE); } else { result.Add("FA", Constants.ASSET_STATUS_ASSIGNED); result.Add("AA", Constants.ASSIGNMENT_STATUS_RELEASED); result.Add("NAA", Constants.ASSIGNMENT_STATUS_WT_ACCEPTANCE); } return(result); case ActionType.ASSET_TRANSFER_DENIED: case ActionType.ASSET_RELEASE_DENIED: result.Clear(); result.Add("FA", Constants.ASSET_STATUS_ASSIGNED); result.Add("AA", Constants.ASSIGNMENT_STATUS_ACCEPTED); return(result); case ActionType.ASSET_RELEASE: result.Clear(); result.Add("FA", Constants.ASSET_STATUS_FORRELEASE); result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_APPROVAL); return(result); case ActionType.ASSET_RELEASE_WOAPPROVAL: case ActionType.ASSET_RELEASE_APPROVED: result.Clear(); result.Add("FA", Constants.ASSET_STATUS_RELEASED); result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_ACCEPTANCE); return(result); case ActionType.ASSIGNMENT_MIS: result.Clear(); result.Add("FA", Constants.ASSET_STATUS_WITH_MIS); result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_ACCEPTANCE); return(result); case ActionType.ASSIGNMENT_EMPLOYEE: result.Clear(); result.Add("FA", Constants.ASSET_STATUS_ASSIGNED); result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_ACCEPTANCE); return(result); case ActionType.ASSET_RELEASE_ACCEPTED: case ActionType.ASSIGNMENT_ACCEPTED: result.Clear(); result.Add("FA", asset.AssetStatusID); result.Add("AA", Constants.ASSIGNMENT_STATUS_ACCEPTED); return(result); case ActionType.ASSET_RELEASE_REJECTED: result.Clear(); result.Add("FA", Constants.ASSIGNMENT_STATUS_RELEASED); result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_APPROVAL); return(result); case ActionType.ASSIGNMENT_REJECTED: result.Clear(); switch (asset.AssetStatusID) { case Constants.ASSET_STATUS_WITH_MIS: result.Add("FA", Constants.ASSET_STATUS_FORRELEASE); result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_APPROVAL); break; case Constants.ASSET_STATUS_ASSIGNED: result.Add("FA", Constants.ASSET_STATUS_FORRELEASE); result.Add("AA", Constants.ASSIGNMENT_STATUS_WT_APPROVAL); break; case Constants.ASSET_STATUS_FORRELEASE: result.Add("FA", asset.AssetStatusID); result.Add("AA", assignment.AssignmentStatusID); break; } return(result); } return(result); }
public List <vwFixAssetList> GetFixAssetListByClassTypeStatus(vwFixAssetList fixAsset) { List <vwFixAssetList> assets = new List <vwFixAssetList>(); if (fixAsset.AssetClassID != 0 && fixAsset.AssetTypeID != 0 && fixAsset.AssetStatusID != 0) { assets = (from fixAssetList in FastDB.vwFixAssetLists where fixAssetList.AssetClassID == fixAsset.AssetClassID && fixAssetList.AssetTypeID == fixAsset.AssetTypeID && fixAssetList.AssetStatusID == fixAsset.AssetStatusID select fixAssetList).ToList(); } else if (fixAsset.AssetClassID != 0 && fixAsset.AssetTypeID != 0 && fixAsset.AssetStatusID == 0) { assets = (from fixAssetList in FastDB.vwFixAssetLists where fixAssetList.AssetClassID == fixAsset.AssetClassID && fixAssetList.AssetTypeID == fixAsset.AssetTypeID && fixAssetList.AssetStatusID != fixAsset.AssetStatusID select fixAssetList).ToList(); } else if (fixAsset.AssetClassID != 0 && fixAsset.AssetTypeID == 0 && fixAsset.AssetStatusID != 0) { assets = (from fixAssetList in FastDB.vwFixAssetLists where fixAssetList.AssetClassID == fixAsset.AssetClassID && fixAssetList.AssetTypeID != fixAsset.AssetTypeID && fixAssetList.AssetStatusID == fixAsset.AssetStatusID select fixAssetList).ToList(); } else if (fixAsset.AssetClassID == 0 && fixAsset.AssetTypeID != 0 && fixAsset.AssetStatusID != 0) { assets = (from fixAssetList in FastDB.vwFixAssetLists where fixAssetList.AssetClassID != fixAsset.AssetClassID && fixAssetList.AssetTypeID == fixAsset.AssetTypeID && fixAssetList.AssetStatusID == fixAsset.AssetStatusID select fixAssetList).ToList(); } else if (fixAsset.AssetClassID != 0 && fixAsset.AssetTypeID == 0 && fixAsset.AssetStatusID == 0) { assets = (from fixAssetList in FastDB.vwFixAssetLists where fixAssetList.AssetClassID == fixAsset.AssetClassID && fixAssetList.AssetTypeID != fixAsset.AssetTypeID && fixAssetList.AssetStatusID != fixAsset.AssetStatusID select fixAssetList).ToList(); } else if (fixAsset.AssetClassID == 0 && fixAsset.AssetTypeID != 0 && fixAsset.AssetStatusID == 0) { assets = (from fixAssetList in FastDB.vwFixAssetLists where fixAssetList.AssetClassID != fixAsset.AssetClassID && fixAssetList.AssetTypeID == fixAsset.AssetTypeID && fixAssetList.AssetStatusID != fixAsset.AssetStatusID select fixAssetList).ToList(); } else if (fixAsset.AssetClassID == 0 && fixAsset.AssetTypeID == 0 && fixAsset.AssetStatusID != 0) { assets = (from fixAssetList in FastDB.vwFixAssetLists where fixAssetList.AssetClassID != fixAsset.AssetClassID && fixAssetList.AssetTypeID != fixAsset.AssetTypeID && fixAssetList.AssetStatusID == fixAsset.AssetStatusID select fixAssetList).ToList(); } else { assets = GetFixAssetList(); } return(assets); }