public static AdminModel GetLoginAdmin(int AdminId) { AdminModel model = null; try { if (model == null) { AdminBLL ab = new AdminBLL(); List <AdminModel> list = new List <AdminModel>(); int count = 0; ab.GetAdminList(1, 1, AdminId, null, null, null, null, null, out count, out list); if (list.Count == 1) { model = list[0]; } } } catch (Exception ex) { throw ex; } return(model); }
public static AdminModel GetLoginAdmin(HttpContext context) { AdminModel model = null; if (context.User.Identity.IsAuthenticated) { if (context.Session != null && context.Session["admin"] != null) { model = (AdminModel)context.Session["admin"]; } try { if (model == null) { AdminBLL ab = new AdminBLL(); List <AdminModel> list = new List <AdminModel>(); int count = 0; ab.GetAdminList(1, 1, Convert.ToInt32(context.User.Identity.Name), null, null, null, null, null, out count, out list); //ab.GetAdminList(1, 1, 1, null, null, null, null, null, out count, out list); if (list.Count == 1) { model = list[0]; context.Session["admin"] = model; } } } catch (Exception ex) { throw ex; } } return(model); }
public AdminPresenter(IWorkerView workerView, AdminModel userModel) { _userModel = userModel; _workerView = workerView; _workerView.createAdminView(); workerView.show(); }
public JsonResult AddItemSubType([FromBody] AdminModel addItemSubType) { /*if (ModelState.IsValid) * {*/ try { var addModel = new ItemTypeSub { ItemType = addItemSubType.ItemSubType.ItemType, SubTypeName = addItemSubType.ItemSubType.SubTypeName }; var add = _products.AddItemSubType(addModel); return(Json(addItemSubType.Message = "Item Sub Type added!")); } catch { return(Json(addItemSubType.Message = "Adding Item Sub Type Failed!")); } /* } * * else { return Json(addItemSubType.Message = "Something went wrong!"); }*/ /* return Json(addItemSubType);*/ }
public async Task <IActionResult> Index() { if (await CheckRole() == false) { return(NotFound()); } var images = _imageService.GetAll(); var g = images.GroupBy(x => x.Album.Category.Name).Select(x => new ChartDataModel { Key = x.Key, Value = x.Count() }).OrderByDescending(x => x.Value); var users = _userService.GetAll(); var g2 = users.GroupBy(x => new DateTime(x.DateCreated.Value.Year, x.DateCreated.Value.Month, 1)).Select( x => new { x.Key, Value = x.Count() }).OrderByDescending(x => x.Key).Select(x => new ChartDataModel { Key = x.Key.ToString("Y"), Value = x.Value }); var model = new AdminModel { ImagesChartData = g.Take(10).ToList(), UsersChartData = g2.Take(10).ToList() }; return(View(model)); }
public override string[] GetRolesForUser(string username) { var adminobj = new AdminModel(); var roleName = adminobj.GetRole(username); return(new[] { roleName }); }
public JsonResult AddItem([FromBody] AdminModel addItem) { /* if(ModelState.IsValid) * {*/ try { var list = new List <string>(); list = addItem.ImageUrls.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList(); List <ImageUrls> imgUrl = new List <ImageUrls>(); foreach (var var in list) { imgUrl.Add(new ImageUrls { Url = var }); } var item = new Items { Availability = addItem.Availibility, Price = addItem.Price, Discount = addItem.Discount, ManuModel = addItem.Manufacturer, Model = addItem.Model, ImageUrls = imgUrl, Color = addItem.Color, ItemTypeSub = new ItemTypeSub { Id = addItem.ItemSubType.Id } }; var model = new Model { ItemDepartment = addItem.ItemDepartment, Name = addItem.ModelName, SpecsId = addItem.Specs, TypeId = addItem.ItemType }; var spec = new Specs { Description = addItem.Specs.Description, Specification = addItem.Specs.Specification }; var addItems = _products.AddItem(item, spec, model); return(Json(addItem.Message = "Item added!"));; } catch { return(Json(addItem.Message = "Adding item failed!")); } /*} * * else { return Json(addItem.Message = "Something went wrong!"); }*/ /* return Json(addItem);*/ }
public List <AdminModel> GetEventType(string query = "") { var getAllEventsList = new List <AdminModel>(); try { if (String.IsNullOrEmpty(query)) { var geteventsObj = (from e in g.EventTypes select new { e.EventTypes, e.EventTypeID, }).ToList(); foreach (var item in geteventsObj) { var searchModelObj = new AdminModel(); searchModelObj.EventType = item.EventTypes; searchModelObj.EventTypeID = item.EventTypeID; getAllEventsList.Add(searchModelObj); } } else { var geteventsObj = (from e in g.EventTypes .Where(et => et.EventTypes.Contains(query)) select new { e.EventTypes, e.EventTypeID, }).ToList(); foreach (var item in geteventsObj) { var searchModelObj = new AdminModel(); searchModelObj.EventType = item.EventTypes; searchModelObj.EventTypeID = item.EventTypeID; getAllEventsList.Add(searchModelObj); } } } catch (Exception ex) { string d = ex.Message; } return(getAllEventsList); }
public void InsertData(AdminModel admin) { if (admin != null) { db.AdminModels.Add(admin); db.SaveChanges(); } }
public AdminModel Login(string name, string password) { Admin admin = serviceAdmin.CheckPassword(name, password); AdminModel adminModel = Mapper.Map <Admin, AdminModel>(admin); adminModel.RequestModels = GetRequests(); return(adminModel); }
public AdminModel GetAdminInfo() { AdminModel model = new AdminModel(); model = GlobalConfig.Connection.GetAdmin_ByUserId(User.Id); model.User = User; return(model); }
public AdminController(IPersonalService personalService, ICorporateService corporateService, IPetService petService, IMainPageOptionsService mainPageOptionsService) { _personalService = personalService; _corporateService = corporateService; _petService = petService; _mainPageOptionsService = mainPageOptionsService; model = new AdminModel(); }
public ActionResult Home() { AdminModel AdminModel = (AdminModel)TempData["admin"]; AdminModel.DashboardModel = new DashboardModel(); DBConnection.GetTonsPeriod(AdminModel.DashboardModel); return(View("~/Views/Administrator/AdminHome/AdminHome.cshtml", AdminModel)); }
public JsonResult GetUsersexpectadmin() { var model = new AdminModel(); var res = model.GetAllUsers(); var product = res.Where(item => (item.role_id.role_name != "Administrator" && item.role_id.role_name != "Manager")); return(Json(product, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteConfirmed(int id) { AdminModel adminModel = db.Admins.Find(id); db.Admins.Remove(adminModel); db.SaveChanges(); return(RedirectToAction("Index")); }
public IActionResult Reopen(String id) { var model = new AdminModel(); model.ReopenAccount(id); return(RedirectToAction("Index")); }
public ActionResult Subject(AdminModel m) { if (DataAdminController.CheckUser(Session, m)) //没有用户信息就跳转到登陆 { return(RedirectToAction("Index")); } return(View(m)); }
/// <summary> /// Get page of configuration values of the TCS (second tab). /// </summary> /// <returns></returns> public ActionResult TCSValueConfiguration() { AdminModel AdminModel = (AdminModel)TempData["admin"]; AdminModel.ConfigurationModel = new ConfigurationViewModel(); DBConnection.GetBenefitsValue(AdminModel.ConfigurationModel); return(View("~/Views/Administrator/Configuration/TEColonesConfig.cshtml", AdminModel)); }
public JsonResult GetReviews([FromBody] AdminModel item) { var reviews = _products.GetReveiwsByModelName(item.ModelName); GetReview.Reviews = reviews; return(Json(GetReview.Reviews)); }
public ActionResult Admin() { ViewBag.Ad = LoginName; AdminModel model = new AdminModel(); model.Users = users.GetAll(); return(View(model)); }
public ActionResult AddNoun(AdminModel model) { if(!String.IsNullOrEmpty(model.NewNoun)) { _adminService.InsertNoun(new Noun {Word = model.NewNoun}); } return RedirectToAction("Index"); }
public string InsertAdmin(AdminModel admin) { if (admin != null) { data.InsertData(admin); } return("Data Inserted Successfully"); }
public IActionResult Enable(String id) { var model = new AdminModel(); model.EnableCategory(id); return(RedirectToAction("Index")); }
public ActionResult AddAdjective(AdminModel model) { if (!String.IsNullOrEmpty(model.NewAdjective)) { _adminService.InsertAdjective(new Adjective { Word = model.NewAdjective }); } return RedirectToAction("Index"); }
public AdminViewModel(AdminModel adminModel, ProviderAdmin providerAdmin) { this.adminModel = adminModel; this.providerAdmin = providerAdmin; BlockedAdminCommandModel = new BlockedAdminCommand(this); UnBlockedAdminCommandModel = new UnBlockedAdminCommand(this); }
/// <summary> /// Gets the page of creating new combo promotions. /// </summary> /// <returns></returns> public ActionResult CreateComboPromotion() { AdminModel AdminModel = (AdminModel)TempData["admin"]; AdminModel.PromotionModel = new PromotionViewModel(); DBConnection.GetMaterialType(AdminModel.PromotionModel); return(View("~/Views/Administrator/Promotion/CreateComboPromotion.cshtml", AdminModel)); }
protected void Page_Load(object sender, EventArgs e) { user = Common.GetLoginAdmin(HttpContext.Current); // this.LoadReport(); this.LoadPromo(); this.LoadNews(); this.LoadFeedback(); }
/// <summary> /// Gets the page of viewing all the combo promotions created, retrieved from the database. /// </summary> /// <returns></returns> public ActionResult ViewComboPromotion() { AdminModel AdminModel = (AdminModel)TempData["admin"]; AdminModel.PromotionModel = new PromotionViewModel(); DBConnection.GetPromotion(AdminModel.PromotionModel, "combo"); return(View("~/Views/Administrator/Promotion/ViewComboPromotion.cshtml", AdminModel)); }
public ActionResult ListOrder() { AdminModel model = new AdminModel(); var bookTableList = entity.OrderTables.ToList(); model.BookTableList = bookTableList; return(View("ListOrder", model)); }
public JsonResult GetAuthentication(string adminName, string adminPassword) { AdminModel admin = new AdminModel { Password = adminPassword, UserName = adminName }; return(Json(queries.Authenticated(admin), JsonRequestBehavior.AllowGet)); }
/// <summary> /// 更新数据 /// </summary> /// <param name="model">数据实体</param> /// <returns></returns> public bool Update(AdminModel model) { var db = base.DB; var cmd = db.GetSqlStringCommand(UpdateSql); BindParameters(db, cmd, model); return(db.ExecuteNonQuery(cmd) > 0 ? true : false); }
//"Sede:CA Tonelada:120/Sede:CA Tonelada:150/Sede:CA Tonelada:180/Sede:CA Tonelada:190" #region MainViewTabsMethods /// <summary> /// Get page of configuration values of the materials. /// </summary> /// <returns></returns> public ActionResult MaterialValueConfiguration() { AdminModel AdminModel = (AdminModel)TempData["admin"]; AdminModel.ConfigurationModel = new ConfigurationViewModel(); DBConnection.GetMaterialTCSValue(AdminModel.ConfigurationModel); return(View("~/Views/Administrator/Configuration/MaterialConfig.cshtml", AdminModel)); }
public IActionResult Delete(String id) { var model = new AdminModel(); model.DeleteAccount(id); return(RedirectToAction("Index")); }
public int DeleteAdmin(AdminModel am) { int result = DaoUtilities.NO_CHANGES; ADMIN a = db.ADMIN.Find(am.UserId); if (a != null) { db.ADMIN.Remove(a); try { int saveResult = db.SaveChanges(); if (saveResult == 1) result = DaoUtilities.SAVE_SUCCESSFUL; } catch (DbUpdateConcurrencyException e) { Console.WriteLine(e.GetBaseException().ToString()); result = DaoUtilities.UPDATE_CONCURRENCY_EXCEPTION; } catch (DbUpdateException e) { Console.WriteLine(e.GetBaseException().ToString()); result = DaoUtilities.UPDATE_EXCEPTION; } catch (DbEntityValidationException e) { Console.WriteLine(e.GetBaseException().ToString()); result = DaoUtilities.ENTITY_VALIDATION_EXCEPTION; } catch (NotSupportedException e) { Console.WriteLine(e.GetBaseException().ToString()); result = DaoUtilities.UNSUPPORTED_EXCEPTION; } catch (ObjectDisposedException e) { Console.WriteLine(e.GetBaseException().ToString()); result = DaoUtilities.DISPOSED_EXCEPTION; } catch (InvalidOperationException e) { Console.WriteLine(e.GetBaseException().ToString()); result = DaoUtilities.INVALID_OPERATION_EXCEPTION; } } return result; }
public ActionResult AddAdministrator(AdminModel model) { if (ModelState.IsValid) { try { _accounts.CreateUser(model.NewUser.FirstName, model.NewUser.LastName, model.NewUser.Email, model.NewUser.Password, false); return RedirectToAction("Index"); } catch(ArgumentException e) { ModelState.AddModelError("", e.Message); } } return View("Index", model); }
private void defineUser() { switch (_authModel.CurrentUserType) { case UserTypes.Admin: { _userModel = new AdminModel(); _authPresenter.showMessage("Вы вошли как админ епт"); _authPresenter.hide(); _userPresenter = new AdminPresenter(_workerView,_userModel); break; } default: { _authPresenter.showMessage("Ошибка авторизации!"); break; } } }
/// <summary> /// Convert an admin from the database to an AdminModel /// </summary> /// <param name="a"></param> /// <returns></returns> public AdminModel ConvertAdminToAdminModel(ADMIN a) { USER1 u = db.USER1.Find(a.ADMIN_ID); AdminModel am = new AdminModel(); if (a != null && u != null) { am.UserId = u.USER_ID; am.Password = u.USER_PASSWORD; am.FirstName = u.USER_FIRSTNAME; am.LastName = u.USER_LASTNAME; am.Adress1 = u.USER_ADR1; am.Adress2 = u.USER_ADR2; am.PC = u.USER_PC; am.Town = u.USER_TOWN; am.Phone = u.USER_PHONE; am.Mail = u.USER_MAIL; } else am = null; return am; }
public AdminModel Build() { var model = new AdminModel(); model.menu = BuildMenu(); return model; }