public CategoryVM(CategoryDM Cat) { ID = Cat.ID; CategoryName = Cat.CategoryName; UnitPrice = Cat.UnitPrice; WorkRate = Cat.WorkRate; }
private CategoryDM Map(CategorySM category) { CategoryDM video = new CategoryDM(); video.CtgyId = category.CtgyId.ToString(); video.Category = category.Category; return(video); }
private CategorySM Map(CategoryDM category) { CategorySM video = new CategorySM(); video.CtgyId = Convert.ToInt32(category.CtgyId); video.Category = category.Category; return(video); }
public CategoryDM MapVM_DM() { GlobalErrors globalErrors = new GlobalErrors(); CategoryDM obj = new CategoryDM(globalErrors); obj.ID = ID; obj.CategoryName = CategoryName; obj.UnitPrice = UnitPrice; obj.WorkRate = WorkRate; return(obj); }
public ActionResult DeleteConfirmed(int id) { CategoryDM category = serviceCategories.GetCategory(Convert.ToInt32(id)); if (serviceCategories.DeleteCategory(category)) { return(RedirectToAction("Index")); } else { return(RedirectToAction("Error", new { id = id })); } }
public void UpdateCategory(CategoryDM categoryDM) { try { UOW.Categories.Update(categoryDM.ToCategory()); UOW.Save(); } catch (Exception ex) { throw new DataException(ex.Message, "Error in updating Category"); } }
public CategoryView(CategoryDM category) { CategoryID = category.CategoryID; Name = category.Name; List <ProductView> products = new List <ProductView>(); if (category.Products != null) { foreach (var p in category.Products) { products.Add(new ProductView(p)); } } Products = products; }
public void Delete(CategoryDM domain) { try { _CategoryRepo.Delete(domain); } catch (Exception ex) { //Errors in this scope indicates system error (not validation errors) //If error exist but not handled, log it and add system error if (!_GlobalErrors.ErrorHandled) { _Logger.Error(ex, "Service Error: Cannot Delete Categories!"); _GlobalErrors.AddSystemError("Service Error: Cannot Delete Categories!"); _GlobalErrors.ErrorHandled = true; } throw; } }
public bool DeleteCategory(CategoryDM categoryDM) { try { Category category = UOW.Categories.Get(categoryDM.CategoryID); if (UOW.Products.Find(p => p.CategoryID == category.CategoryID).Count() == 0) { UOW.Categories.Delete(category.CategoryID); UOW.Save(); return(true); } return(false); } catch (Exception ex) { throw new DataException(ex.Message, "Error in deleting Category"); } }
public MainWindowViewModel() { var connStrBuilder = new SqliteConnectionStringBuilder(); connStrBuilder.DataSource = "../../../../../Krowi_AchievementFilter.db"; var connection = new SqliteConnection(connStrBuilder.ConnectionString); connection.Open(); functionDM = new FunctionDM(connection); uiMapDM = new UIMapDM(connection); eventDM = new EventDM(connection, uiMapDM); achievementDM = new AchievementDM(connection, uiMapDM, eventDM); categoryDM = new CategoryDM(connection, functionDM, achievementDM, uiMapDM, eventDM); petBattleLinksDM = new PetBattleLinksDM(connection); xuFuEncounterDM = new XuFuEncounterDM(connection); LoadCategoriesViewModel(); LoadUIMapViewModel(); LoadEventsViewModel(); LoadImportViewModel(); }
public int Save(CategoryVM inputVM) { long time = DateTime.Now.Ticks; CategoryDM dmEntity = new CategoryDM(); dmEntity.Name = inputVM.Name; dmEntity.Version = time; dmEntity.CreatedUserId = inputVM.CreatedUserId; dmEntity.UpdatedUserId = inputVM.UpdatedUserId; dmEntity.CreatedDate = time; dmEntity.UpdatedDate = time; int result = 0; using (PHOTOLIODBContext context = new PHOTOLIODBContext()) { context.CategoryDMs.Add(dmEntity); result = context.SaveChanges(); } return(result); }
public Category(CategoryDM category) { CategoryID = category.CategoryID; Name = category.Name; }
public QuotationDM GetQuotationForCategory(QuotationDM domainModel) { try { if (domainModel.FromLangID == domainModel.ToLangID) { _GlobalErrors.AddValidationError("", "From language equla Tatrget language"); _GlobalErrors.ErrorHandled = true; throw new Exception(); } CategoryService _CategorySer = new CategoryService(_GlobalErrors); domainModel.StartDate = DateTime.Now; _QuotaionRepo.Add(domainModel); if (domainModel.CategoryID == null) { domainModel.CategoryDMList = _CategorySer.GetAllCategories(); domainModel.QuotaionDetailsList = new List<QuotaionDetailsDM>(); foreach (var item in domainModel.CategoryDMList) { QuotaionDetailsDM obj = new QuotaionDetailsDM(_GlobalErrors); obj.Category = item; obj.Quotaion = domainModel; obj.AddCalculatedQuotation(); _QuotaionRepo.AddDetails(obj); domainModel.QuotaionDetailsList.Add(obj); } } else { CategoryDM CatObj = _CategorySer.GetById(domainModel.CategoryID); domainModel.QuotaionDetailsList = new List<QuotaionDetailsDM>(); QuotaionDetailsDM obj = new QuotaionDetailsDM(_GlobalErrors); obj.Category = CatObj; obj.Quotaion = domainModel; obj.AddCalculatedQuotation(); _QuotaionRepo.AddDetails(obj); domainModel.QuotaionDetailsList.Add(obj); } return domainModel; } catch (Exception ex) { //Errors in this scope indicates system error (not validation errors) //If error exist but not handled, log it and add system error if (!_GlobalErrors.ErrorHandled) { _Logger.Error(ex, "Service Error: Cannot Request Quotation!"); _GlobalErrors.AddSystemError("Service Error: Cannot Request Quotation!"); _GlobalErrors.ErrorHandled = true; } throw; } }
public CategoryService(GlobalErrors globalErrors) : base(globalErrors) { _CategoryRepo = new CategoryRepository(globalErrors); _CategorynDM = new CategoryDM(globalErrors); }
public void AddCategory(CategoryDM categoryDM) { UOW.Categories.Create(categoryDM.ToCategoryNoID()); UOW.Save(); }