/// <summary> /// 打野 /// </summary> public void Fight_Wild() { int index = Properties.Settings.Default.Matching_Index; Thread.Sleep(3000); Output output = new Output(IntPtr.Zero); Output.GetImgPart(1920 / 2 + 105, 1080 / 2 - 205, 32, 32, true, "打野"); lock (FightWildObj) { Region OldRegion = Region.没查到位置; while (true) { Bitmap bmp = Output.ReadImageFile("打野"); //打野图片 if (Fight_Wild_Role != role.敌方打野) //匹配打野 { if (Fight_WildMatching(bmp)) { Fight_Wild_Role = role.敌方打野; voice.Play("打野完成匹配");//播放匹配成功声音 MessageBox.Show("打野完成匹配"); } else//失败跳出线程 { voice.Play("打野匹配失败");//播放匹配失败声音 break; } } else//进行处理 { Point p = Images.ContainsGetPoint(Images.InitImage(bmp), Images.InitImage(Minimap)); Region region = GetRegion(p); if (p == new Point(-1, -1)) { index++; bmp = Output.GetSetResolutionImg(bmp, index); bmp.Save(System.Windows.Forms.Application.StartupPath + string.Format(@"\ContrastImg\{0}.jpg", "打野", "打野"), ImageFormat.Tiff);//保存打野小图片 } pb1.Image = bmp; pb2.Image = Minimap; /*MessageBox.Show("x:" + p.X + " " + "y:" + p.Y+" "+ region.ToString());*/ if (OldRegion != region) { if (region != Region.没查到位置) { voice.Play(Fight_Wild_Role.ToString() + "在" + region); MessageBox.Show(Fight_Wild_Role.ToString() + "在" + region); } if (region == Region.没查到位置) { region = GetRegion(Fight_Wild_Point); voice.Play(Fight_Wild_Role.ToString() + "消失在" + region); MessageBox.Show(Fight_Wild_Role.ToString() + "消失在" + region); } } Fight_Wild_Point = p; OldRegion = region; } Thread.Sleep(Properties.Settings.Default.Tips_Speed); } } }
public IResult deleteProductByEntity(role role) { throw new NotImplementedException(); }
public IResult updateProduct(role role) { throw new NotImplementedException(); }
partial void Updaterole(role instance);
public string UpdateRole(role r) { return(RoleRepository.UpdateRole(r)); }
public void DropActiveRole(user mUser, session mSession, role mRole) { throw new Exception("This method have not Implement."); }
public void AddRole(role mRole) { mRole.AppID = App.AppID; RoleSrv.CreateNew(mRole); //throw new Exception("This method have not Implement."); }
/// <summary> /// 分页查询 /// </summary> public List <role> queryPage(role record) { return(new RoleDao().queryPage(record)); }
/// <summary> /// 添加 /// </summary> public int add(role record) { return(new RoleDao().add(record)); }
public Applications CreateNewApplication(string AppName, string AppDescription, string AppUrl, string username, string password) { Applications TempApp = GetByName(AppName); if (TempApp != null) { throw new Exception("This Application is exist."); } userService UserSrv = new userService(SessionFactoryConfigPath); roleService RoleSrv = new roleService(SessionFactoryConfigPath); objectService ObjectSrv = new objectService(SessionFactoryConfigPath); operationService OperationSrv = new operationService(SessionFactoryConfigPath); permissionService PermitSrv = new permissionService(SessionFactoryConfigPath); TempApp = new Applications(); TempApp.AppName = AppName; TempApp.Description = AppDescription; TempApp.URL = AppUrl; user TemUser = UserSrv.GetByName(username); if (TemUser != null) { throw new Exception("Root User is Exist in other Applications"); } TemUser = new user(); TemUser.username = username; TemUser.password = password; role TemRole = new role(); TemRole.name = role.RootRole; objectRbac TempObject = new objectRbac(); TempObject.name = objectRbac.Default; operation TempOpe = new operation(); TempOpe.name = operation.Default; TempOpe.canread = true; permission TemPermission = new permission(); TemPermission.name = permission.Default; //begin transaction TempApp = CreateNew(TempApp); TempObject.AppID = TempApp.AppID; TempObject = ObjectSrv.CreateNew(TempObject); TempOpe.AppID = TempApp.AppID; TempOpe = OperationSrv.CreateNew(TempOpe); TemPermission.AppID = TempApp.AppID; TemPermission.ObjectRBAC = TempObject; TemPermission.Operation = TempOpe; TemPermission = PermitSrv.CreateNew(TemPermission); TemRole.Permissions = new List <permission>(); TemRole.Permissions.Add(TemPermission); TemRole.AppID = TempApp.AppID; TemRole = RoleSrv.CreateNew(TemRole); TemUser.ApplicationList = new List <Applications>(); TemUser.ApplicationList.Add(TempApp); TemUser.Roles = new List <role>(); TemUser.Roles.Add(TemRole); TemUser = UserSrv.CreateNew(TemUser); CommitChanges(); return(TempApp); }
public role Get(int id) { role rl = myEntity.roles.Find(id); return(rl); }
public Person(string username, string password, role role) { Username = username; Password = password; Role = role; }
public void CreateUser(string username, string name, string password, string email, string roleName, string passwordQuestion, string passwordAnswer, int MemberID, string EmailType) { role role = GetRole(roleName); if (string.IsNullOrEmpty(username.Trim())) { throw new ArgumentException("The user name provided is invalid. Please check the value and try again."); } if (string.IsNullOrEmpty(name.Trim())) { throw new ArgumentException("The name provided is invalid. Please check the value and try again."); } if (string.IsNullOrEmpty(password.Trim())) { throw new ArgumentException("The password provided is invalid. Please enter a valid password value."); } if (string.IsNullOrEmpty(email.Trim())) { throw new ArgumentException("The e-mail address provided is invalid. Please check the value and try again."); } if (!RoleExists(role)) { throw new ArgumentException("The role selected for this user does not exist! Contact an administrator!"); } if (NumberOfUsers > 0) { if (entities.users.Any(user => user.UserName == username)) { throw new ArgumentException("Username already exists. Please enter a different user name."); } } if (string.IsNullOrEmpty(passwordQuestion.Trim())) { throw new ArgumentException("The Password Question provided is invalid. Please check the value and try again."); } if (string.IsNullOrEmpty(passwordAnswer.Trim())) { throw new ArgumentException("The Password Answer provided is invalid. Please check the value and try again."); } user newUser = new user() { RoleID = role.roleID, Name = name, UserName = username, Password = FormsAuthentication.HashPasswordForStoringInConfigFile(password.Trim(), "md5"), Email = email, PasswordQuestion = passwordQuestion, PasswordAnswer = passwordAnswer, PersonID = MemberID, EmailType = EmailType }; /* * Role newRole = new Role() * { * RoleID = roleID, * Name = name * }; */ try { AddUser(newUser); } catch (ArgumentException ae) { throw ae; } catch (Exception e) { throw new ArgumentException("The authentication provider returned an error. Please verify your entry and try again. " + "If the problem persists, please contact your system administrator."); } // Immediately persist the user data Save(); }
[HttpPost]//添加角色 public Result AddRole(role data) { _roleBll.Add(data); return(Result.Success()); }
public void DeleteInheritance(role r_asc, role r_desc) { throw new Exception("This method have not Implement."); }
/// <summary> /// 更新 /// </summary> public int updateById(role record) { return(new RoleDao().updateById(record)); }
public void AddDescendant(role r_asc, role r_desc) { throw new Exception("This method have not Implement."); }
private void btnsave_Click(object sender, EventArgs e) { if (txt_role.Text == "") { erreorlabelrole.Visible = true; } else { erreorlabelrole.Visible = false; } if (rolestatuscb.SelectedIndex == -1) { errorlabelrolestatus.Visible = true; } else { errorlabelrolestatus.Visible = false; } if (erreorlabelrole.Visible || errorlabelrolestatus.Visible) { Mainclass.ShowMsg("Field with * are mandatory", "Error...", "Error.."); } else { if (edit == 0) { role r = new role(); r.rolename = txt_role.Text; if (rolestatuscb.SelectedIndex == 0) { r.rolestatus = 1; } else { r.rolestatus = 0; } //obj.roles.InsertOnSubmit(r); obj.InsertRole(txt_role.Text, r.rolestatus); obj.SubmitChanges(); Mainclass.ShowMsg(txt_role.Text + " added successfully.", "Success...", "Success"); Mainclass.disable_reset(panel1); loadData(); } else if (edit == 1) { byte stat; if (rolestatuscb.SelectedIndex == 0) { stat = 1; } else { stat = 0; } obj.UpdateRole(txt_role.Text, stat, roleID); obj.SubmitChanges(); Mainclass.ShowMsg(txt_role.Text + " Updated successfully.", "Success...", "Success"); Mainclass.disable_reset(panel2); loadData(); //var data = obj.roles.Single(x => x.rolesID == roleID); //data.rolename = txt_role.Text; //if (rolestatuscb.SelectedIndex== 0) //{ // data.rolestatus = 1; //} //else //{ // data.rolestatus = 0; //} ////obj.roles.InsertOnSubmit(r); //obj.SubmitChanges(); //Mainclass.ShowMsg(txt_role.Text + " Updated successfully.", "Success...", "Success"); //Mainclass.disable_reset(panel1); //loadData(); } } }
public IList <permission> RolePermissions(role mRole) { role TempRole = Mapping(mRole); return(TempRole.Permissions); }
private void button_submit_Click(object sender, RoutedEventArgs e) { if (IsEmpty()) { return; } try { if (isadd) { users u = new users(); u = GetUser(u); u.department = Department.SelectByGuid(u.department).id.ToString(); u.duties = UserDuty.SelectByGuid(u.duties).id.ToString(); role r = this.cbox_role.SelectedItem as role; if (IsExit(u) != null) { if (MessageAlert.Alter("信息已经存在!\n是否跟新")) { u = GetUser(IsExit(u)); if (IsUpdataRepeat(u)) { return; } UpdateUser(u); if (IsUserToRoleExit(u) == null) { SaveUserToRole(new QDDL.Model.UserToRoleModel.usertorole() { role = r.id.ToString(), user = u.id.ToString() }); } else { UpDateUsertoRol(new QDDL.Model.UserToRoleModel.usertorole() { role = r.guid, user = u.guid }); } } else { return; } } else { u.guid = Guid.NewGuid().ToString(); if (IsRepeat(u, 0)) { return; } string id = SaveUser(u); if (id != "-1") { SaveUserToRole(new QDDL.Model.UserToRoleModel.usertorole() { role = r.id.ToString(), user = id }); } } } else { users u = new users(); u = _user; u = GetUser(u); role r = this.cbox_role.SelectedItem as role; if (IsUpdataRepeat(u)) { return; } UpdateUser(u); UpDateUsertoRol(new QDDL.Model.UserToRoleModel.usertorole() { role = r.guid, user = u.guid }); } MessageAlert.Alert("操作成功!"); SetEmpty(); userediter.BindUserModel(this.dataGrid1); } catch { MessageAlert.Alert("添加失败!出现异常请联系管理员"); } }
partial void Insertrole(role instance);
public ActionResult UpdateRole(string roleId, string name, string RoleTypeId) { string results = "OK"; if (ModelState.IsValid && !string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(RoleTypeId) && !string.IsNullOrEmpty(roleId)) { var checkExist = _iroleService.Query.FirstOrDefault(x => x.name.ToUpper() == name.ToUpper()); if (checkExist == null || checkExist.roleid == int.Parse(roleId)) { try { int roleid = int.Parse(roleId); role p = new role(); p = _iroleService.Query.FirstOrDefault(m => m.roleid == roleid); p.AppID = 1; p.name = name.Trim(); List <string> lstPmsChange = new List <string>(); if (Session["ArrayPms"] != null) { lstPmsChange = (List <string>)Session["ArrayPms"]; } foreach (string word in lstPmsChange) { _permission = _ipmsService.GetByName(word, 1); Listpermission.Add(_permission); } p.Permissions = Listpermission; var type = _iTypeRoleService.Query.FirstOrDefault(x => x.ROLE_ID == roleid); _iroleService.BeginTran(); _iroleService.Update(p); if (type != null) { type.TYPE = Int32.Parse(RoleTypeId); } _iTypeRoleService.Update(type); _iLogSystemService.CreateNew(HttpContext.User.Identity.Name, "Cập nhật Phân quyền ", "Thực hiện chức năng cập nhật Phân quyền", Helper.GetIPAddress.GetVisitorIPAddress(), HttpContext.Request.Browser.Browser); _iroleService.CommitTran(); } catch (Exception e) { _iroleService.RolbackTran(); results = e.Message; } } else { results = "ExistName"; } } else { results = "NotOK"; } Session["ArrayPms"] = null; Session["ChangeCheckBoxPms"] = null; return(Content(results, "text/html")); }
partial void Deleterole(role instance);
public override void saveBtn_Click(object sender, EventArgs e) { if (roleTxt.Text == "") { roleErrorLabel.Visible = true; } else { roleErrorLabel.Visible = false; } if (statusDD.SelectedIndex == -1) { statusErrorLabel.Visible = true; } else { statusErrorLabel.Visible = false; } if (roleErrorLabel.Visible || statusErrorLabel.Visible) { MainClass.ShowMSG("Fields with * are mandatory.", "Error...", "Error"); } else { if (edit == 0) // code for SAVE operation { role r = new role(); r.r_name = roleTxt.Text; if (statusDD.SelectedIndex == 0) { r.r_status = 1; } else { r.r_status = 0; } //obj.roles.InsertOnSubmit(r); obj.st_insertRoles(roleTxt.Text, r.r_status); obj.SubmitChanges(); MainClass.ShowMSG(roleTxt.Text + " added successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } else if (edit == 1) // code for UPDATE { byte stat; if (statusDD.SelectedIndex == 0) { stat = 1; } else { stat = 0; } obj.st_updateRoles(roleTxt.Text, stat, roleID); //var data = obj.roles.Single(x => x.r_id == roleID); //data.r_name = roleTxt.Text; //if (statusDD.SelectedIndex == 0) //{ // data.r_status = 1; //} //else //{ // data.r_status = 0; //} //obj.SubmitChanges(); MainClass.ShowMSG(roleTxt.Text + " updated successfully.", "Success...", "Success"); MainClass.disable_reset(panel6); loadData(); } } }