public AdminWindow(AdminAction action, string language) : this() { this.AdminAction = action; this.Title = AdminAction.ToString(); actionText.Text = AdminAction.ToString(); this.MainLanguage = language; }
public ActionResult AddAction(AdminAction aat) { if (!Request.IsAjaxRequest()) { return(Content("操作失败,你的浏览器禁用了Javascript脚本!")); } ShowResultModel srm = new ShowResultModel(); if (ModelState.IsValid) { try { _adminActionService.AddAction(aat); srm.TipMsg = "新增操作权限块成功!<br/><br/><input type='button' class='box-buttonadd' value='继续添加' onclick='window.document.getElementById("lhgfrm_divaddAction").contentWindow.Goon();'/><input type='button' class='box-buttonclose' value='取消' onclick='window.document.getElementById("lhgfrm_divaddAction").contentWindow.Undo(" + aat.AMID + ");'/>"; srm.IsSuccess = true; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { srm.TipMsg = ex.Message; LoggerHelper.Log("【系统管理员操作权限添加】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (ex.InnerException == null ? ex.Message : ex.InnerException.ToString())); } } else { srm.TipMsg = "数据有效性验证失败!"; } return(Json(srm)); }
public static string[] permission(string menu, int userId) { AdminAction adminAction = new AdminAction(); CIMS.BaseLayer.ActionResult actionResult = new CIMS.BaseLayer.ActionResult(); List <Menus> PermissionList = new List <Menus>(); RoleBase roleBase = new RoleBase(); roleBase.UserId = Convert.ToInt32(userId); roleBase.MenuName = menu; actionResult = adminAction.Menus_LoadByRoleId(roleBase); if (actionResult.IsSuccess) { var permission = CommonMethods.ConvertTo <Menus>(actionResult.dtResult); if (permission[0].PermissionType > 0) { string[] result = { "true", permission[0].PermissionType.ToString() }; return(result); } } string[] failResult = { "false", "0" }; return(failResult); }
/// <summary> /// 获取管理员列表(分页) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonRsp <AdminActionViewModel> GetPageList(int pageIndex, int pageSize) { JsonRsp <AdminActionViewModel> rsp = new JsonRsp <AdminActionViewModel>(); AdminAction action = new AdminAction(); AdminMenu menu = new AdminMenu(); //Select 方法不指定具体要选择的实体类属性,可以推迟到EntityContainer类的MapToList 方法上指定 OQL joinQ = OQL.From(action) .Join(menu).On(action.MenuId, menu.ID) .Select(action.ID, menu.MenuName, action.ActionKey, action.ActionName, action.Status, action.CreateTime) .OrderBy(action.Sort, "desc") .END; joinQ.Limit(pageSize, pageIndex, true); PWMIS.DataProvider.Data.AdoHelper db = PWMIS.DataProvider.Adapter.MyDB.GetDBHelper(); EntityContainer ec = new EntityContainer(joinQ, db); rsp.data = (List <AdminActionViewModel>)ec.MapToList <AdminActionViewModel>(() => new AdminActionViewModel() { ID = action.ID, MenuId = menu.ID, MenuName = menu.MenuName, ActionKey = action.ActionKey, ActionName = action.ActionName, Status = action.Status, CreateTime = action.CreateTime, }); rsp.success = true; rsp.code = 0; rsp.count = joinQ.PageWithAllRecordCount; return(rsp); }
public ActionResult EditAction(AdminAction aat) { if (!Request.IsAjaxRequest()) { return(Content("操作失败,你的浏览器禁用了Javascript脚本!")); } ShowResultModel srm = new ShowResultModel(); if (ModelState.IsValid) { try { _adminActionService.EditAction(aat); srm.TipMsg = "修改操作权限成功!"; srm.IsSuccess = true; } catch (InvalidOperationException ex) { srm.TipMsg = ex.Message; } catch (Exception ex) { LoggerHelper.Log("【系统管理员操作权限修改】出错,系统操作管理员:" + _currentAdmin.AdminInfo.SAName + ",错误原因:" + (ex.InnerException == null ? ex.Message : ex.InnerException.ToString())); srm.TipMsg = ex.Message; } } else { srm.TipMsg = "数据有效性验证失败!"; } return(Json(srm)); }
/// <summary> /// 启用/禁用 /// </summary> /// <param name="accountStatus"></param> /// <returns></returns> public JsonRsp SetStatus(long Id, int status) { AdminAction dbAccount = GetModelById(Id); dbAccount.Status = status; return(Update(dbAccount)); }
public static void run() { #region AdminAction Console.WriteLine("测试AdminAction.AdminLogin..."); string u1 = "lijun", p1 = "lijun"; Console.WriteLine("用户名:" + u1 + "密码:" + p1); if (AdminAction.AdminLogin(u1, p1)) { Console.WriteLine("登陆成功\n"); } else { Console.WriteLine("登陆失败\n"); } Console.WriteLine("测试AdminAction.AdminLogin..."); string u2 = "lijun", p2 = "error"; Console.WriteLine("用户名:" + u2 + "密码:" + p2); if (AdminAction.AdminLogin(u2, p2)) { Console.WriteLine("登陆成功\n"); } else { Console.WriteLine("登陆失败\n"); } #endregion }
/// <summary> /// 删 /// </summary> /// <param name="model"></param> /// <returns></returns> public JsonRsp Remove(AdminAction model) { int returnvalue = EntityQuery <AdminAction> .Instance.Delete(model); return(new JsonRsp { success = returnvalue > 0, code = returnvalue }); }
/// <summary> /// 增 /// </summary> /// <param name="model"></param> /// <returns></returns> public JsonRsp Add(AdminAction model) { int returnvalue = Add <AdminAction>(model); return(new JsonRsp { success = returnvalue > 0, code = returnvalue }); }
/// <summary> /// 改 /// </summary> /// <param name="model"></param> /// <returns></returns> public JsonRsp Update(AdminAction model) { int returnvalue = Update <AdminAction>(model); return(new JsonRsp { success = returnvalue > 0, code = returnvalue }); }
public void ProcessAction(AdminAction action) { switch (action) { case AdminAction.ResetDb: _eventBus.Send(new ResetDbCommand()); break; } }
public ActionResult AddAction(int id) { AdminAction aat = new AdminAction() { AMID = id, Weight = null }; return(View(aat)); }
/// <summary> /// 获取列表(全部) /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public List <AdminAction> GetAllModelList() { AdminAction model = new AdminAction(); OQL q = OQL.From(model) .Select() .OrderBy(model.ID, "asc") .END; return(q.ToList <AdminAction>());//使用OQL扩展 }
public async Task <AdminAction> InsertAdminAction(AdminAction adminAction) { if (adminAction == null) { throw new ServerException("Admin action to insert does not exist"); } return(await database.AdminActionRepository.Insert(adminAction) ? adminAction : throw new DatabaseException()); }
/// <summary> /// 验证某操作功能是否具有权限 /// </summary> /// <param name="ControllerName"></param> /// <param name="ActionName"></param> /// <returns></returns> public bool CheckActionWeight(string ControllerName, string ActionName) { bool result = true; AdminAction adminActionEntity = _adminActionService.GetByCondition(new DirectSpecification <AdminAction>(a => a.ControllerName == ControllerName && a.ActionName == ActionName), true); if (adminActionEntity != null) { result = CheckAction(adminActionEntity); } return(result); }
public DataTable getbackground(string name) { CorporateBase CorporateBase = new CorporateBase(); AdminAction adminAction = new AdminAction(); CorporateBase.Corporate_action = "get"; actionResult = adminAction.Corporate_update(CorporateBase); return(actionResult.dtResult); }
/// <summary> /// save /// </summary> /// <param name="model"></param> /// <returns></returns> public JsonRsp Save(AdminAction model) { if (model.ID == 0) { return(Add(model)); } else { return(Update(model)); } }
public void ProcessAction(AdminAction action) { switch (action) { case AdminAction.ResetDb: _miscRepository.ResetDb(); _matchApplicationService.ProcessAction("WP0001", EventType.Created, "Frogs", "Sharks"); _matchApplicationService.ProcessAction("WP0002", EventType.Created, "Sharks", "Eels"); break; } _liveScoreHubContext.Clients.All.RefreshPage().GetAwaiter(); }
private bool CheckAction(AdminAction adminAction) { int weight = 0; foreach (var adminRole in AdminRoles) { weight = weight | adminRole.AdminRole_Modules.Where(x => x.AMID == adminAction.AMID).Select(x => x.Weights).FirstOrDefault();//某个角色与某个功能模块一一对应 } bool re = (weight & adminAction.Weight) == adminAction.Weight; return(re); }
public void ProcessAction(AdminAction action) { var repository = new MiscRepository(); var matchService = new MatchService(); switch (action) { case AdminAction.ResetDb: repository.ResetDb(); matchService.ProcessAction("WP0001", EventType.Created, "Frogs", "Sharks"); matchService.ProcessAction("WP0002", EventType.Created, "Sharks", "Eels"); break; } LiveScoreHub.Refresh(); }
public bool AdminActionCreate(AdminActionCreate model) { var entity = new AdminAction() { OrderType = model.OrderType, InvestigatorID = model.InvestigatorID, AgentID = model.AgentID, InsurerID = model.InsurerID }; using (var ctx = new ApplicationDbContext()) { ctx.AdminActions.Add(entity); return(ctx.SaveChanges() == 1); } }
private void Button_Click(object sender, RoutedEventArgs e) { string username = this.tb_username.Text; string password = this.tb_password.Password; bool rst = AdminAction.AdminLogin(username, password); if (rst) { MainForm win = new MainForm(this, username); win.Show(); this.Hide(); //this.USER = ; } else { MessageBox.Show("登录失败!"); } }
private void UpdateGroup(AdminAction action) { var group = action.GroupId.GetGroup(Bot); if (!group.Exists) { return; } if (!group.Members.ContainsKey(action.SourceId) || !group.Members.ContainsKey(action.TargetId)) { return; } var userRole = action.Action.ToRole(); group.Members[action.TargetId].UserRole = userRole; }
public void AdminActionHandler(AdminAction action, IPalBot oBot) { var bot = (PalBot)oBot; if (!bot.SubProfiling.Groups.ContainsKey(action.GroupId)) { return; } var group = bot.SubProfiling.Groups[action.GroupId]; if (!group.Members.ContainsKey(action.TargetId)) { return; } group.Members[action.TargetId] = action.Action.ToRole(); broadcast.BroadcastAdminAction(bot, action); }
public void Move(int aaid, bool Flag) { AdminAction oadminaction = _repository.GetByCondition(new DirectSpecification <AdminAction>(oaa => oaa.AAID == aaid));//旧数据 if (oadminaction == null) { throw new InvalidOperationException("未找到要排序的功能菜单"); //无数据 } AdminAction adminaction = null; //根据条件查处的上/下条的数据 if (Flag) { //找上一条(时间刚好比当前数据时间小的数据) var listadminaction = _repository.GetListByTopN(1, new DirectSpecification <AdminAction>(aat => aat.SortFlag < oadminaction.SortFlag && aat.AMID == oadminaction.AMID), x => x.SortFlag, true); if (listadminaction.Count() > 0) { adminaction = listadminaction.FirstOrDefault(); } } else { //找下一条 (时间刚好比当前时间大的数据) var listadminaction = _repository.GetListByTopN(1, new DirectSpecification <AdminAction>(aat => aat.SortFlag > oadminaction.SortFlag && aat.AMID == oadminaction.AMID), x => x.SortFlag, false); if (listadminaction.Count() > 0) { adminaction = listadminaction.FirstOrDefault(); } } string result = Flag == true ? "已经是第一条了" : "已经是最后一条了"; if (adminaction == null) { throw new InvalidOperationException(result);//未找到上/下的数据 } DateTime tsf = oadminaction.SortFlag; oadminaction.SortFlag = adminaction.SortFlag; adminaction.SortFlag = tsf; _repository.Move(oadminaction); _repository.Move(adminaction); }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "") { MessageBox.Show("不允许有空字段!"); return; } if (textBox2.Text != textBox3.Text) { MessageBox.Show("两次输入的密码不一致!"); return; } try { if (AdminAction.ChangePWD(username, textBox1.Text, textBox2.Text) > 0) { MessageBox.Show("修改成功!"); this.Close(); } ; }catch (Exception ex) { MessageBox.Show("修改失败!\n" + ex.Message); } }
public static void SendAdminAction(AdminAction action) { Network.SendPacket(new AdminActionPacket(action)); }
public AdminActionPacket(AdminAction action) { Action = action; }
public bool CheckActionWeight(AdminAction adminAction) { return(CheckAction(adminAction)); }
public ActionResult Action(AdminAction action) { _adminService.ProcessAction(action); return(RedirectToAction("index", "home")); }