public bool UpadteBrandMonitorCategoryInfo(BrandMonitorCategory brandMonitorInfo) { BrandMonitorCategory brandMonitorInfoes = _entities.BrandMonitorCategories.FirstOrDefault(x => x.Id == brandMonitorInfo.Id); if (brandMonitorInfo != null) { if (brandMonitorInfo.Name != null) { if (brandMonitorInfoes != null) { brandMonitorInfoes.Name = brandMonitorInfo.Name; } } if (brandMonitorInfo.Type != null) { if (brandMonitorInfoes != null) { brandMonitorInfoes.Type = brandMonitorInfo.Type; } } if (brandMonitorInfo.Remarks != null) { if (brandMonitorInfoes != null) { brandMonitorInfoes.Remarks = brandMonitorInfo.Remarks; } } if (brandMonitorInfo.Active != null) { if (brandMonitorInfoes != null) { brandMonitorInfoes.Active = brandMonitorInfo.Active; } } if (brandMonitorInfo.EditedDate != null) { if (brandMonitorInfoes != null) { brandMonitorInfoes.EditedDate = brandMonitorInfo.EditedDate; } } if (brandMonitorInfo.DeletedDate != null) { if (brandMonitorInfoes != null) { brandMonitorInfoes.DeletedDate = brandMonitorInfo.DeletedDate; } } _entities.Entry(brandMonitorInfoes).State = EntityState.Modified; _entities.SaveChanges(); } else { return(false); } return(true); }
public JsonResult EditBrandMonitorListById(long id) { var list = new List <BrandMonitorCategory>(); var newlist = new List <BrandMonitorCategory>(); try { list = _brandManager.EditBrandMonitorListById(id).ToList(); foreach (var items in list) { var brandMonitor = new BrandMonitorCategory(); brandMonitor.Id = items.Id; brandMonitor.Type = items.Type; brandMonitor.Name = items.Name; brandMonitor.Remarks = items.Remarks; newlist.Add(brandMonitor); } } catch (Exception ex) { throw ex; } return(Json(newlist.ToArray(), JsonRequestBehavior.AllowGet)); }
public JsonResult GetBrandMonitorList() { var list = new List <BrandMonitorCategory>(); var newlist = new List <BrandMonitorCategory>(); try { list = _brandManager.GetBrandMonitorList(); foreach (var items in list) { var brandMonitor = new BrandMonitorCategory(); brandMonitor.Id = items.Id; brandMonitor.Name = items.Name; brandMonitor.Type = items.Type; brandMonitor.Remarks = items.Remarks; newlist.Add(brandMonitor); } } catch (Exception ex) { } return(Json(new { data = newlist }, JsonRequestBehavior.AllowGet)); }
public JsonResult InsertBrandMonitorCategoryInfo(BrandMonitorCategory brandInfo) { var userId = (long)_sessiondictionary[1].Id; var userName = (long)_sessiondictionary[2].Id; var result = new Result(); try { var categoryNameExist = _brandManager.BrandMonitorCategoryNameExist(new BrandMonitorCategory() { Name = brandInfo.Name }); if (categoryNameExist == null) { brandInfo.AddedBy = userId; brandInfo.AddedDate = DateTime.Now; brandInfo.Active = true; result = _brandManager.InsertBrandMonitorCategoryInfo(brandInfo); } else { result.IsSuccess = false; result.Message = "Current Name Already Exists"; } } catch (Exception ex) { } return(Json(result, JsonRequestBehavior.AllowGet)); }
public BrandMonitorCategory BrandMonitorCategoryNameExist(BrandMonitorCategory brandInfo) { try { return(_ibrand.BrandMonitorCategoryNameExist(brandInfo)); } catch (Exception ex) { throw ex; } }
public Result InsertBrandMonitorCategoryInfo(BrandMonitorCategory brandInfo) { var result = new Result(); try { result.IsSuccess = _ibrand.InsertBrandMonitorCategoryInfo(brandInfo); } catch (Exception ex) { throw ex; } return(result); }
//private readonly BrandOutletMonitoringEntities _entities = new BrandOutletMonitoringEntities(); public bool InsertBrandMonitorCategoryInfo(BrandMonitorCategory brandInfo) { try { _entities.BrandMonitorCategories.Add(brandInfo); _entities.SaveChanges(); return(true); } catch (Exception exception) { throw exception; } }
//public BrandMonitorCategory BrandMonitorCategory(BrandMonitorCategory brandInfo) //{ // throw new NotImplementedException(); //} public BrandMonitorCategory BrandMonitorCategoryNameExist(BrandMonitorCategory brandInfo) { BrandMonitorCategory brand; try { DateTime startDate = DateTime.Today; DateTime endDate = startDate.AddDays(1).AddTicks(-1); brand = _entities.BrandMonitorCategories.FirstOrDefault(a => a.Name == brandInfo.Name); } catch (Exception ex) { throw ex; } return(brand); }
public JsonResult UpadteBrandMonitorCategoryInfo(BrandMonitorCategory brandMonitorInfo, string type) { var result = new Result(); if (type == "E") { //brandMonitorInfo.EditedBy = Id; brandMonitorInfo.EditedDate = DateTime.Now; result = _brandManager.UpadteBrandMonitorCategoryInfo(brandMonitorInfo); } else { brandMonitorInfo.DeletedDate = DateTime.Now; result = _brandManager.UpadteBrandMonitorCategoryInfo(brandMonitorInfo); } return(Json(result)); }