/// <summary> /// Delete asset and update audit log /// </summary> /// <param name="user">The user deleting the asset</param> /// <param name="assetId">The ID of the asset to be deleted</param> public static void DeleteAsset(User user, int assetId) { m_Logger.DebugFormat("DeleteAsset: {0}", assetId); Asset asset = Asset.Get(assetId); if (asset.IsNull) { return; } asset.IsDeleted = true; Asset.Update(asset); m_Logger.Debug(" -Flagged asset as deleted"); // Update the audit log AuditLogManager.LogAssetAction(asset, user, AuditAssetAction.DeleteAsset); AuditLogManager.LogUserAction(user, AuditUserAction.DeleteAsset, string.Format("Deleted Asset with AssetId: {0}", asset.AssetId)); m_Logger.Debug(" -Updated audit log"); // Delete asset files DeleteAssetFiles(asset, asset.AssetFilePath.Path); // Delete asset bitmaps folder AssetBitmapGroupManager.DeleteAssetBitmapsFolder(asset); // Delete all asset categories AssetCategory.DeleteAllByAssetId(assetId); }
private static void SeedAssetCategorys(CapRedV2Context context) { if (context.AssetCategorys.Any()) { return; } string[] assetCategories = { "5410105 Amortization lease improvements", "5410505 Depreciation - furniture & fixtures", "5410330 Firm Moving", "5415610 Art", "5410115 Core and Shell", "5410120 Infrastructure/Personal Property", "5411105 Hardware", "5410310 Repairs & Maintenance", "5410311 Repairs and Maintenance - Contract", "5415610 Consulting Other - TandM", "5415611 Consulting - Fixed Price SOW (stmt of work)", "5411220 Hardware < $25,000 (APAC < $5,000)", "5410610 Furniture and equipment <$25,000 (APAC < $5,000)", "5411115 Capitalization Technology", "5411110 Computer Software", "Software License", "Travel & Expenses" }; for (int i = 0; i < assetCategories.Length; i++) { var assetCategory = new AssetCategory { Id = Guid.NewGuid(), Position = i, Value = assetCategories[i] }; context.AssetCategorys.Add(assetCategory); } }
public void Save(AssetCategory assetCategory) { if(assetCategory.IsValid()) { AssetCategoryRepo.Save(assetCategory); } }
static void getAssets() { Console.Write("ASSETS: "); DataTable rawData = Utility.OpenExcel(sourceData, "Asset"); int N = 0; foreach (DataRow row in rawData.Rows) { string catName = Utility.getString(row, 7); AssetCategory category = context.AssetCategory.FirstOrDefault(x => x.CategoryName == catName); string perName = Utility.getString(row, 8); Person person = context.People.Where(x => x.FirstName == perName).FirstOrDefault(); Asset resource = new Asset() { AssetCategory = category, Name = Utility.getString(row, 1), SerialNumber = Utility.getString(row, 2), Description = Utility.getString(row, 3), Vendor = Utility.getString(row, 4), Price = Utility.getDouble(row, 5), Status = (AssetStatus)Utility.getInteger(row, 6), User = person, Model = "missing", DateOfTrade = DateTime.Today, Type = (AssetType)Utility.getInteger(row, 0) }; N++; context.Assets.Add(resource); } context.SaveChanges(); Console.WriteLine(N); }
public async Task <IActionResult> Edit(int id, [Bind("AssetCategoryId,Code,Name,CreateBy,CreateDate,UpdateBy,UpdateDate,IsActive,IsDelete")] AssetCategory assetCategory) { if (id != assetCategory.AssetCategoryId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(assetCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AssetCategoryExists(assetCategory.AssetCategoryId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(assetCategory)); }
public void Initialize(Asset asset, int assetIndex) { this.asset = asset; Category = asset.custom.category; AssetIndex = assetIndex; ClickableBehaviour.Title = EnumHelper.GetEnumMemberAttributeValue(asset.custom.category); ClickableBehaviour.Text = Formatter.BuildStixDataEntityDescription(asset); ClickableBehaviour.ActionText = "select"; ClickableBehaviour.PrimaryAction = () => { SelectionHelper.DeselectAllMitigations(); var title = EnumHelper.GetEnumMemberAttributeValue(asset.custom.category); var description = Formatter.BuildStixDataEntityDescription(asset, true, false); var selectedActions = new SelectedAction[] { new SelectedAction( ActionType.OpenExternalReferences, () => ReferencesHelper.OpenExternalReferences(asset)) }; HelperObjects.SelectedInfoBar.SelectEntity(title, "Asset", description, selectedActions); }; ClickableBehaviour.HasSecondaryAction = ReferencesHelper.AddReferencesAsAction(asset, ClickableBehaviour); }
/// <summary> /// 反序列化资源包版本资源列表(版本 0)回调函数。 /// </summary> /// <param name="binaryReader">指定流。</param> /// <returns>反序列化的资源包版本资源列表(版本 0)。</returns> public static ResourcePackVersionList ResourcePackVersionListDeserializeCallback_V0(BinaryReader binaryReader) { byte[] encryptBytes = binaryReader.ReadBytes(CachedHashBytesLength); int dataOffset = binaryReader.ReadInt32(); long dataLength = binaryReader.ReadInt64(); int dataHashCode = binaryReader.ReadInt32(); int resourceCount = binaryReader.Read7BitEncodedInt32(); ResourcePackVersionList.Resource[] resources = resourceCount > 0 ? new ResourcePackVersionList.Resource[resourceCount] : null; for (int i = 0; i < resourceCount; i++) { string name = binaryReader.ReadEncryptedString(encryptBytes); string variant = binaryReader.ReadEncryptedString(encryptBytes); string extension = binaryReader.ReadEncryptedString(encryptBytes) ?? DefaultExtension; byte loadType = binaryReader.ReadByte(); long offset = binaryReader.Read7BitEncodedInt64(); int length = binaryReader.Read7BitEncodedInt32(); int hashCode = binaryReader.ReadInt32(); int zipLength = binaryReader.Read7BitEncodedInt32(); int zipHashCode = binaryReader.ReadInt32(); AssetCategory assetCategory = (AssetCategory)binaryReader.ReadByte(); resources[i] = new ResourcePackVersionList.Resource(name, variant, extension, loadType, offset, length, hashCode, zipLength, zipHashCode, assetCategory); } return(new ResourcePackVersionList(dataOffset, dataLength, dataHashCode, resources)); }
private decimal AddAssetCategory(IEnumerable <Holding> holdings, AssetCategory category) { decimal total = 0m; foreach (var holding in holdings) { if (holding.Stock.Category == category) { var stock = new StockViewItem(holding.Stock); var series = new PieSeries() { Title = stock.FormattedCompanyName, Values = new ChartValues <ObservableValue>() { new ObservableValue((double)holding.Value) }, LabelPoint = LabelFormatter }; IndividualStocks.Add(series); total += holding.Value; } } return(total); }
public AssetCategoryModel GetCategoryeModel(int?Id = null) { if (Id.HasValue) { AssetCategory assetCategory = _assetCategoryRepository.GetAssetCategoryByID(Id.Value); if (assetCategory != null) { return(new AssetCategoryModel { ID = assetCategory.ID, Description = assetCategory.Description, Comment = assetCategory.Comment }); } else { throw new EntryPointNotFoundException(); } } else { return(new AssetCategoryModel { }); } }
public ActionResult Update(AssetCategory holiday) { ApiResult <AssetCategory> apiResult; if (ModelState.IsValid) { if (holiday.Id > 0) { apiResult = TryExecute(() => { _assetCategoryRepository.Update(holiday); _unitOfWork.Commit(); return(holiday); }, "Asset Category updated sucessfully"); } else { apiResult = TryExecute(() => { _assetCategoryRepository.Create(holiday); _unitOfWork.Commit(); return(holiday); }, "Asset Category created sucessfully"); } } else { apiResult = ApiResultFromModelErrors <AssetCategory>(); } return(Json(apiResult, JsonRequestBehavior.AllowGet)); }
protected void Page_Load(object sender, EventArgs e) { Response.Cookies["loginreferrer"].Value = "/admin/asset/asset_models_other.aspx"; Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30); if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "") { intProfile = Int32.Parse(Request.Cookies["adminid"].Value); } else { Response.Redirect("/admin/login.aspx"); } oPlatform = new Platforms(intProfile, dsn); oType = new Types(intProfile, dsn); oModel = new Models(intProfile, dsn); oModelsProperties = new ModelsProperties(intProfile, dsn); oAssetCategory = new AssetCategory(intProfile, dsn); oDell = new Dells(intProfile, dsn); if (!IsPostBack) { LoadList(); LoadPlatforms(); btnParent.Attributes.Add("onclick", "return OpenWindow('MODELBROWSER','" + hdnParent.ClientID + "','&control=" + hdnParent.ClientID + "&controltext=" + lblParent.ClientID + "',false,400,600);"); btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');"); btnCancel.Attributes.Add("onclick", "return Cancel();"); } }
private bool CheckAsset(string assetName, AssetCategory assetCategory, out ResourceInfo resourceInfo, out Dictionary <string, AssetCategory> dependencyAssetNames) { resourceInfo = null; dependencyAssetNames = null; if (string.IsNullOrEmpty(assetName)) { return(false); } AssetInfo assetInfo = m_ResourceComponent.GetAssetInfo(assetName, assetCategory); if (assetInfo == null) { return(false); } resourceInfo = m_ResourceComponent.GetResourceInfo(assetInfo.ResourceName, assetCategory); if (resourceInfo == null) { return(false); } dependencyAssetNames = assetInfo.GetDependencyAssetNames(); return(m_ResourceComponent.ResourceMode == ResourceMode.Updatable ? true : resourceInfo.Ready); }
// PUT api/AssetCategory/5 public IHttpActionResult PutAssetCategory(int id, AssetCategory assetCategory, int LastModifiedBy) { if (id != assetCategory.Id) { return(BadRequest()); } assetCategory.LastModifiedOn = System.DateTime.Now; assetCategory.LastModifiedBy = LastModifiedBy; db.Entry(assetCategory).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AssetCategoryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
protected void Page_Load(object sender, EventArgs e) { Response.Cookies["loginreferrer"].Value = "/admin/asset/asset_category_burnin_and_deployment_steps.aspx"; Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30); if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "") { intProfile = Int32.Parse(Request.Cookies["adminid"].Value); } else { Response.Redirect("/admin/login.aspx"); } oAssetCategory = new AssetCategory(intProfile, dsn); oAssetCategoryDeploymentConfig = new AssetCategoryDeploymentConfig(intProfile, dsn); oService = new Services(intProfile, dsn); oStatusLevels = new StatusLevels(intProfile, dsn); if (!IsPostBack) { LoadList(); if (Request.QueryString["AssetCategoryId"] != null && Request.QueryString["AssetCategoryId"] != "") { ddlAssetCategory.SelectedValue = Request.QueryString["AssetCategoryId"].ToString(); } btnUpdate.Attributes.Add("onclick", "return ValidateDropDown('" + ddlAssetCategory.ClientID + "','Please select asset category')" + " && confirm('Are you sure you want to update deployments steps ?')" + ";"); btnService.Attributes.Add("onclick", "return OpenWindow('SERVICEBROWSER','" + hdnServiceId.ClientID + "','&control=" + hdnServiceId.ClientID + "&controltext=" + txtService.ClientID + "',false,400,600);"); btnAddService.Attributes.Add("onclick", "return ValidateHidden0('" + hdnServiceId.ClientID + "','" + btnService.ClientID + "','Please select service');"); PopulateConfigurations(); } }
/// <summary> /// 异步读取数据 /// </summary> /// <param name="dataAssetName">内容资源名称</param> /// <param name="priority">权限</param> /// <param name="assetCategory">资源分类</param> /// <returns></returns> public async CFTask <bool> ReadDataAsync(string dataAssetName, int priority, AssetCategory assetCategory, object userData) { if (m_ResourceManager == null) { throw new Exception("You must set resource manager first."); } if (m_DataProviderHelper == null) { throw new Exception("You must set data provider helper first."); } LoadAssetCallbacks loadAsset = await m_ResourceManager.LoadAsset(dataAssetName, assetCategory, m_LoadAssetCallbacks, priority, userData); if (loadAsset.LoadAssetStatus == LoadAssetStatus.Success) { //loadAsset.InvokeCallbackSuccess(); return(true); } else { //loadAsset.InvokeCallbackFailed(); return(false); } }
/// <summary> /// 读取数据。 /// </summary> /// <param name="dataAssetName">内容资源名称。</param> /// <param name="priority">加载数据资源的优先级。</param> /// <param name="userData">用户自定义数据。</param> public void ReadData(string dataAssetName, int priority, object userData, AssetCategory assetCategory) { if (m_ResourceManager == null) { throw new Exception("You must set resource manager first."); } if (m_DataProviderHelper == null) { throw new Exception("You must set data provider helper first."); } HasAssetResult result = m_ResourceManager.HasAsset(dataAssetName, assetCategory); switch (result) { case HasAssetResult.AssetOnDisk: case HasAssetResult.AssetOnFileSystem: m_ResourceManager.LoadAsset(dataAssetName, assetCategory, m_LoadAssetCallbacks, null, priority, userData); break; case HasAssetResult.BinaryOnDisk: m_ResourceManager.LoadBinary(dataAssetName, m_LoadBinaryCallbacks, userData); break; case HasAssetResult.BinaryOnFileSystem: int dataLength = m_ResourceManager.GetBinaryLength(dataAssetName); EnsureCachedBytesSize(dataLength); if (dataLength != m_ResourceManager.LoadBinaryFromFileSystem(dataAssetName, s_CachedBytes)) { throw new Exception(Utility.Text.Format("Load binary '{0}' from file system with internal error.", dataAssetName)); } try { if (!m_DataProviderHelper.ReadData(m_Owner, dataAssetName, s_CachedBytes, 0, dataLength, userData)) { throw new Exception(Utility.Text.Format("Load data failure in data provider helper, data asset name '{0}'.", dataAssetName)); } //if (m_ReadDataSuccessEventHandler != null) //{ // ReadDataSuccessEventArgs loadDataSuccessEventArgs = ReadDataSuccessEventArgs.Create(dataAssetName, 0f, userData); // m_ReadDataSuccessEventHandler(this, loadDataSuccessEventArgs); // ReferencePool.Release(loadDataSuccessEventArgs); //} } catch (Exception exception) { Log.Error(dataAssetName, exception.ToString()); throw; } break; default: throw new Exception(Utility.Text.Format("Data asset '{0}' is '{1}'.", dataAssetName, result.ToString())); } }
// Adds asset category to the system public static void Add(AssetCategory aCat) { var context = new AssetContext(); context.AssetCategories.Add(aCat); context.SaveChanges(); }
private int AddAssetCategory(AssetCategory assetCategorySource, int parentid, ref string parentStr, int newCompanyId, int originalCategoryId, string assetusingDeptIds) { //1、复制到新城市,最后返回新分类id var newCategoryId = _assetCategoryHelper.InsertCopy(assetCategorySource.id, newCompanyId); WriteLog($"1、复制到新城市,返回新分类【{assetCategorySource.name},{newCategoryId}】"); //2、更新分类parentId,parentStr parentStr += "," + newCategoryId; _assetCategoryHelper.UpdateParent(newCategoryId, parentid, parentStr); WriteLog($"2、更新新分类【parentid={parentid},parentStr={parentStr}】"); //3、更新资产的分类Id if (assetCategorySource.id == originalCategoryId) { var assetRows = _assetHelper.UpdateCategoryId(newCategoryId, assetCategorySource.id, assetusingDeptIds); WriteLog($"3、更新资产的新分类【id={newCategoryId}】,使用部门【usingDeptId={assetusingDeptIds}】,资产数量【{assetRows}】"); } //将新添加分类放入到临时表里,减少数据库查询 assetCategorieAllNewCompany.Add(new AssetCategory { id = newCategoryId, companyId = newCompanyId, name = assetCategorySource.name, code = assetCategorySource.code, btyte = assetCategorySource.btyte, parentId = parentid, parentStr = parentStr, status = 1 }); return(newCategoryId); }
public AssetCategoryMaintenance(AssetCategory aCat) { InitializeComponent(); AsCat = aCat; uxACatName.Text = AsCat.Name; Text = "Edit Asset Category"; }
// Updates provided asset category public static void Update(AssetCategory aCat) { var context = new AssetContext(); var existingACat = context.AssetCategories.SingleOrDefault(ac => ac.Id == aCat.Id); existingACat.Name = aCat.Name; context.SaveChanges(); }
public static LoadSceneTask Create(string sceneAssetName, AssetCategory assetCategory, int priority, ResourceInfo resourceInfo, Dictionary <string, AssetCategory> dependencyAssetNames, LoadSceneCallbacks loadSceneCallbacks, object userData) { LoadSceneTask loadSceneTask = ReferencePool.Acquire <LoadSceneTask>(); loadSceneTask.Initialize(sceneAssetName, assetCategory, null, priority, resourceInfo, dependencyAssetNames, userData); loadSceneTask.m_LoadSceneCallbacks = loadSceneCallbacks; return(loadSceneTask); }
public AssetObject() { m_DependencyAssets = new List <object>(); m_Resource = null; m_ResourceHelper = null; m_ResourceLoader = null; m_AssetCategory = AssetCategory.None; }
public StockPropertiesChangedEvent(Guid entityId, int version, Date changeDate, string asxCode, string name, AssetCategory category) : base(entityId, version) { ChangeDate = changeDate; AsxCode = asxCode; Name = name; Category = category; }
public void MapFromDomainEntity_NullContent_ReturnNull() { //Act var response = AssetCategory.MapFromDomainEntity(null); //Assert Assert.IsNull(response); }
public void OnCategoryChanged(DatabaseBackedObject newSelection) { AssetCategory category = (from cat in context.AssetCategories where cat.ca_id == newSelection.ID select cat).FirstOrDefault(); context.Entry(assetToCreate).Property(x => x.as_caid).CurrentValue = category.ID; }
/// <summary> /// 获取资源分类 /// </summary> /// <param name="filePath"></param> /// <returns></returns> private AssetCategory GetAssetCategory(string filePath) { AssetCategory category = AssetCategory.Audio; if (filePath.IndexOf("Audio") != -1) { category = AssetCategory.Audio; } else if (filePath.IndexOf("CusShaders") != -1) { category = AssetCategory.CusShaders; } else if (filePath.IndexOf("DataTable") != -1) { category = AssetCategory.DataTable; } else if (filePath.IndexOf("EffectSources") != -1) { category = AssetCategory.EffectSources; } else if (filePath.IndexOf("RoleEffectPrefab") != -1) { category = AssetCategory.RoleEffectPrefab; } else if (filePath.IndexOf("UIEffectPrefab") != -1) { category = AssetCategory.UIEffectPrefab; } else if (filePath.IndexOf("RolePrefab") != -1) { category = AssetCategory.RolePrefab; } else if (filePath.IndexOf("RoleSources") != -1) { category = AssetCategory.RoleSources; } else if (filePath.IndexOf("Scenes") != -1) { category = AssetCategory.Scenes; } else if (filePath.IndexOf("UIFont") != -1) { category = AssetCategory.UIFont; } else if (filePath.IndexOf("UIPrefab") != -1) { category = AssetCategory.UIPrefab; } else if (filePath.IndexOf("UIRes") != -1) { category = AssetCategory.UIRes; } else if (filePath.IndexOf("xLuaLogic") != -1) { category = AssetCategory.xLuaLogic; } return(category); }
/// <summary> /// 卸载资源。 /// </summary> /// <param name="asset">要卸载的资源。</param> public void UnloadAsset(AssetCategory assetCategory, object asset) { IObjectPool <AssetObject> assetObjectPools = null; if (m_AssetPools.TryGetValue(assetCategory, out assetObjectPools)) { assetObjectPools.Unspawn(asset); } }
public StockListedEvent(Guid entityId, int version, string asxCode, string name, Date listingDate, AssetCategory category, bool trust) : base(entityId, version) { AsxCode = asxCode; Name = name; ListingDate = listingDate; Trust = trust; Category = category; }
public LocalVersionInfo(string fileSystemName, AssetCategory assetCategory, LoadType loadType, int length, int hashCode) { m_Exist = true; m_FileSystemName = fileSystemName; m_LoadType = loadType; m_Length = length; m_HashCode = hashCode; m_AssetCategory = assetCategory; }
public static AssetCategoryModel ToApiModel(this AssetCategory src) { return(new AssetCategoryModel { Id = src.Id, Name = src.Name, SortOrder = src.SortOrder }); }
private void CategoryListItem_Clicked(object sender, MouseButtonEventArgs e) { ListViewItem selectedItem = sender as ListViewItem; AssetCategory selectedCategory = selectedItem.DataContext as AssetCategory; AddCategoryControl.Visibility = Visibility.Visible; CategoryEditorHeaderText.Text = "Edit Category"; vm.OnCategorySelectedForEdit(selectedCategory.ca_id); }
private bool isDublicateName(AssetCategory objUI) { bool isDublicateName = true; AssetCategory dublicateName = dbContext.AssetCategories.Where(a => a.Name.Equals(objUI.Name) && a.DeleteFlag == false).FirstOrDefault<AssetCategory>(); if (dublicateName == null || dublicateName.ID == objUI.ID) { isDublicateName = false; } return isDublicateName; }
public bool IsInUse(AssetCategory objUI) { AssetPropertyDao assPropDao = new AssetPropertyDao(); AssetMasterDao assMasterDao = new AssetMasterDao(); if (assPropDao.GetByCategoryId(objUI.ID).Count == 0 && assMasterDao.GetListByCategoryId(objUI.ID).Count == 0) return false; return true; }
public static AssetCategory CreateAssetCategory(int categoryID, string name) { AssetCategory assetCategory = new AssetCategory(); assetCategory.CategoryID = categoryID; assetCategory.Name = name; return assetCategory; }
/// <summary> /// Delete by set DeleteFlag = true /// </summary> /// <param name="objUI"></param> private Message Delete(AssetCategory objUI) { Message msg = null; try { if (objUI != null) { AssetCategory objDb = GetById(objUI.ID); if (objDb != null && !IsInUse(objUI)) { List<AssetCategory> listAssertCategory = dbContext.AssetCategories.Where(c => c.ID == objUI.ID).ToList<AssetCategory>(); // Set delete info objDb.DeleteFlag = true; objDb.UpdateDate = DateTime.Now; objDb.UpdatedBy = objUI.UpdatedBy; msg = new Message(MessageConstants.I0001, MessageType.Info, "Asset Category", "deleted"); } else { msg = new Message(MessageConstants.E0006, MessageType.Error, "delete", "it"); } // Submit changes to dbContext dbContext.SubmitChanges(); } } catch { msg = new Message(MessageConstants.E0006, MessageType.Error, "delete", "it"); } return msg; }
/// <summary> /// Check data was changed by another user. /// Return true if data of this item is changed /// </summary> /// <param name="objUI"></param> /// <param name="objDb"></param> /// <returns></returns> private bool IsDBChanged(AssetCategory objUI, AssetCategory objDb) { bool isChannged = true; if (objDb.UpdateDate.ToString() == objUI.UpdateDate.ToString()) { isChannged = false; } return isChannged; }
public void AddToAssetCategories(AssetCategory assetCategory) { base.AddObject("AssetCategories", assetCategory); }
/// <summary> /// Update Asset category /// </summary> /// <param name="objUI"></param> /// <param name="objDb"></param> /// <param name="msg"></param> private void Update(AssetCategory objUI, AssetCategory objDb, ref Message msg) { if (!IsDBChanged(objUI, objDb)) { if (!isDublicateName(objUI)) { objDb.Name = objUI.Name; objDb.Description = objUI.Description; objDb.IsActive = objUI.IsActive; objDb.UpdateDate = DateTime.Now; objDb.UpdatedBy = objUI.UpdatedBy; dbContext.SubmitChanges(); msg = new Message(MessageConstants.I0001, MessageType.Info, "Asset Category '" + objUI.Name + "'", "updated"); } else { msg = new Message(MessageConstants.E0020, MessageType.Error, "'" + objUI.Name + "'", "Asset Category"); } } else { msg = new Message(MessageConstants.E0025, MessageType.Error, "Asset Category'" + objDb.Name + "'"); } }
/// <summary> /// Update asset category /// </summary> /// <param name="objUI"></param> /// <returns></returns> public Message Update(AssetCategory objUI) { Message msg = null; try { AssetCategory objDb = GetById(objUI.ID); if (objDb != null) { Update(objUI, objDb, ref msg); } else { msg = new Message(MessageConstants.E0040, MessageType.Error, "Asset Category '" + objUI.ID + "'"); } } catch (Exception) { msg = new Message(MessageConstants.E0007, MessageType.Error); } return msg; }
/// <summary> /// Insert asset category /// </summary> /// <param name="objUI"></param> /// <returns></returns> public Message Insert(AssetCategory objUI) { Message msg = null; try { if (!isDublicateName(objUI)) { dbContext.AssetCategories.InsertOnSubmit(objUI); dbContext.SubmitChanges(); msg = new Message(MessageConstants.I0001, MessageType.Info, "Asset Category '" + objUI.Name + "'", "added"); } else { msg = new Message(MessageConstants.E0020, MessageType.Error, "Name '" + objUI.Name + "'", "Asset Category"); } } catch (Exception) { msg = new Message(MessageConstants.E0007, MessageType.Error); } return msg; }
public void Delete(AssetCategory assetCategory) { AssetCategoryRepo.Remove(assetCategory); }