public void InitializeComplex(string complexCode, UserInfos[] users, int nbjoueurs) { int i; RoomType[,] comp = new RoomType[5, 5]; string[] lines = complexCode.Split(':'); for (i = 0; i < 5; i++) { string[] rooms = lines[i].Split(','); for(int j = 0; j < 5; j++) { int room = int.Parse(rooms[j]); print("salle actuelle : " + room); comp[i, j] = (RoomType)room; } } InstantiateComplex(); LoadComplex(comp); for (i = 0; i < nbjoueurs; i++) { players[i] = InstantiateCharacter(users[i]); } nbplayers = nbjoueurs; ReplaceAllPlayers(2, 2); }
public void AddUser(string ip, int id, string name) { players[id] = new UserInfos(ip, name); nbJoueurs++; settingsManager.playerListPanel.SetText(id, ip, name); }
public static UserInfos getUserInfos(string username) { UserInfos userinfos = new UserInfos(); MembershipUser User = Membership.Providers["PortalProvider"].GetUser(username, false); // MembershipUser User = Membership.GetUser(username); if (User != null) { SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString); SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["AdditionalInformation"].ConnectionString); connection.Open(); SqlCommand cmd = new SqlCommand( "select * from UsersInformation where UserId='" + User.ProviderUserKey + "'", connection); using (SqlDataReader rdr = cmd.ExecuteReader()) { if (rdr.Read()) { userinfos.FirstName = rdr["FirstName"].ToString(); userinfos.LastName = rdr["LastName"].ToString(); userinfos.UserCod = rdr["UserCod"].ToString(); userinfos.IsAsoc = Convert.ToBoolean(rdr["IsAsoc"].ToString()); userinfos.AsocId = Convert.ToInt32(rdr["AsocId"].ToString()); } rdr.Close(); connection.Close(); } if (userinfos.UserCod != null && userinfos.UserCod.Trim().Length > 0) { conn.Open(); SqlCommand cmdf = new SqlCommand(); cmdf.Connection = conn; // cmdf.CommandText = "select Nume as NumeFerma from Ferme_CCL where Cod='" + userinfos.UserCod + "'"; cmdf.CommandText = "select Ferme_CCL.Nume as NumeFerma,Fabrici.Nume as NumeAsoc from Ferme_CCL,Fabrici where Ferme_CCL.FabricaID = Fabrici.ID AND ferme_CCL.Cod='" + userinfos.UserCod + "'"; using (SqlDataReader rdr = cmdf.ExecuteReader()) { if (rdr.Read()) { userinfos.NumeFerma = rdr["NumeFerma"].ToString(); userinfos.NumeAsoc = rdr["NumeAsoc"].ToString(); } rdr.Close(); conn.Close(); } } } return userinfos; }
public void AddPlayer(UserInfos ui, bool mainPlayer) { GameObject newPanel; if(mainPlayer) newPanel = Instantiate(mainPlayerPanelPrefab) as GameObject; else newPanel = Instantiate(otherPlayerPanelPrefab) as GameObject; PlayerInfosPanelScript pips = newPanel.GetComponent<PlayerInfosPanelScript>(); pips.LoadInfos(ui); pips.rect.parent = (RectTransform)this.transform; pips.rect.anchoredPosition = GetPositionFor(playersPanel.Count); playersPanel.Add(pips); }
/// <summary> /// 编辑指纹 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEditor_Click(object sender, RoutedEventArgs e) { if (!AppHelper.CheckAppState(ModelResponsible.Instance.ParentWindow)) { return; } //if (LoginValidate(PermissionConfig.FingerprintCollect)) //{ // return; //} UserInfos userInfo = GetUser(sender); WindowsHelper.ShowDialogWindow <EditorFingerWindow>(ModelResponsible.Instance.ParentWindow, userInfo); }
protected internal override void Execute(int eventCode, object message) { switch (eventCode) { case UIEvent.MENU_PANEL_VIEW: MenuInfo menuInfo = message as MenuInfo; if (menuInfo != null) { Dispatch(AreaCode.NET, ReqEventType.invest_info, true); CacheData.Instance().RedState = (bool)menuInfo.messages; //********更新红点状态******// gameobjectRed.SetActive(CacheData.Instance().RedState); InitInfo(menuInfo); Dispatch(AreaCode.UI, UIEvent.Security_Updata, true); } break; case UIEvent.MENU_UPDATE_VIEW: //********更新红点状态******// gameobjectRed.SetActive(CacheData.Instance().RedState); txtMt.text = CacheData.Instance().Mt.ToString("#0.00"); txtUsdt.text = CacheData.Instance().Usdt.ToString("#0.00"); break; case UIEvent.PlayerMenu_Panel: UserInfos user = message as UserInfos; if (user != null) { homePanel.SetActive(false); textNickName.text = user.nick; textLv.text = string.IsNullOrEmpty(user.grade)?"Lv0":"Lv" + user.grade; btnHome.gameObject.SetActive(true); } else { textNickName.text = CacheData.Instance().nick; textLv.text = CacheData.Instance().CommerceLevel.ToString(); homePanel.SetActive(true); } break; default: break; } }
protected internal override void Execute(int eventCode, object message) { switch (eventCode) { case UIEvent.SQUARE_LIST_PANEL_ACTIVE: setPanelActive((bool)message); if ((bool)message == false) { for (int i = 0; i < list_InformationBox.Count; i++) { RePreObj(list_InformationBox[i]); } list_InformationBox.Clear(); pageNum = 0; } break; case UIEvent.SQUARE_LIST_PANEL_VIEW: if (message == null) { return; } squareuser = message as SquareUser; //在此防止重复生成 if (pageNum >= squareuser.pageNum) { return; } pageNum = squareuser.pageNum; squareData = squareuser.list; UpdateSquareList(); break; case UIEvent.SEARCH_PANEL_VIEW: if (message == null) { list_InformationBox.Clear(); break; } UserInfos t1 = message as UserInfos; SearchSquareUser(t1); break; default: break; } }
public ActionResult Insert(HttpPostedFileBase Photo, UserInfos userInfo, List <int> roles) { //-----添加图片 //判断图片是否为空 if (Photo != null) { //判断图片大小 if (Photo.ContentLength > 0 && Photo.ContentLength < 4194304) { //获取上传路径 string FileName = Path.GetFileName(Photo.FileName); //获取文件后缀名 string suff = FileName.Substring(FileName.IndexOf(".") + 1); //判断格式 if (suff == "jpg" || suff == "png" || suff == "gif") { //图片存储位置 Photo.SaveAs(Server.MapPath("~/images/users/" + Photo.FileName)); userInfo.Photo = Photo.FileName; } } } else { return(Content("<script>alert('未获取到上传的文件')</script>")); } //-----添加用户信息 db.UserInfos.Add(userInfo); db.SaveChanges(); //-----添加用户与角色的关系 //遍历所选中的角色 foreach (var item in roles) { //new 一个新的 R_User_Roles对象,将角色ID 与 RoleID 组成一个新的对象添加 R_User_Roles UR = new R_User_Roles() { UserID = userInfo.ID, RoleID = item }; db.R_User_Roles.Add(UR); } db.SaveChanges(); return(RedirectToAction("Index")); }
private async void OnAddInfo(object args) { if (AddInfoName == null || string.IsNullOrWhiteSpace(AddInfoName)) { Errors.Add(new Error { Message = "Specify the name of the channel you want to create.", Verbose = "Specify the name of the channel you want to create." }); return; } try { var info = ServerInfos.FirstOrDefault(i => i.Name.Equals(AddInfoName)); if (info == null) { var channelInfo = new ChannelInfo { Name = AddInfoName }; info = InfoFactory.GetInfo(channelInfo); ServerInfos.Add(info); } UserInfos.Add(info); SelectedInfo = (InfoDecorator)info; if (info is Channel) { var clientMessage = new Message { SenderConnectionId = User.Name, Data = AddInfoName, MessageType = MessageType.SubscribeToChannel }; await dipSocketClient.SendMessageAsync(clientMessage); } } catch (Exception ex) { Errors.Add(new Error { Message = ex.Message, Verbose = ex.ToString() }); } finally { AddInfoName = string.Empty; } }
public string UserFileLink(UserInfos userinfos, int year) { string downloadLink = ""; string filepath = ConfigurationManager.AppSettings["filepath"] + userinfos.AsocId + "\\" + year + "\\"; //"D:\\portal\\Downloads\\113\\"; string fermaname = replace_special_car_null(userinfos.NumeFerma); string raport_excel = userinfos.UserCod + "_" + fermaname + ".xls"; string excel_file = filepath + raport_excel; if (File.Exists(excel_file)) { // string httppath = ConfigurationManager.AppSettings["httppath"] + userinfos.AsocId + "/"; // downloadLink = "http://" + Request.ServerVariables.Get("HTTP_HOST") + "/" + httppath + "/"+ raport_excel; downloadLink = raport_excel; } return(downloadLink); }
/// <summary> /// 删除 /// </summary> /// <param name="UserID"></param> /// <returns></returns> public ActionResult Remove(int UserID) { //查出用户角色关系表 var rURList = db.R_User_Roles.Where(p => p.UserID == UserID).ToList(); if (rURList.Count > 0) { return(Content("<script>alert('该用户有角色不能删除');history.go(-1)</script>")); } else { UserInfos user = db.UserInfos.Find(UserID); db.UserInfos.Remove(user); db.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult SetRoles(int UserID) { //通过用户ID查到用户信息,并存ViewBag中 UserInfos user = db.UserInfos.Find(UserID); ViewBag.User = user; //通过用户ID查到用户对应的角色关系,并存ViewBag中 List <R_User_Roles> rURList = db.R_User_Roles.Where(p => p.UserID == UserID).ToList(); ViewBag.rURList = rURList; //获得所有的角色,并存ViewBag中 List <Roles> rList = db.Roles.ToList(); ViewBag.rList = rList; return(View()); }
public ActionResult Edit(UserInfos user, HttpPostedFileBase EPhoto, int[] roles) { //处理图片 if (EPhoto != null) { if (EPhoto.ContentLength > 0 && EPhoto.ContentLength < 4194304) { string fileName = Path.GetFileName(EPhoto.FileName); //string suffix = fileName.Substring(fileName.LastIndexOf(".") + 1); if (fileName.EndsWith("gif") || fileName.EndsWith("jpg") || fileName.EndsWith("png")) { EPhoto.SaveAs(Server.MapPath("~/Content/images/images/users/" + fileName)); user.Photo = fileName; } } } //修改用户信息 db.Entry(user).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); //用户与角色的关系 var r = db.R_User_Roles.Where(p => p.UserID == user.ID); foreach (var item in r) { db.R_User_Roles.Remove(item); } db.SaveChanges(); if (roles != null) { //添加新的角色关系 foreach (var roleID in roles) { //角色ID和用户ID组成新的R_User_Roles对象 R_User_Roles rur = new R_User_Roles() { UserID = user.ID, RoleID = roleID }; db.R_User_Roles.Add(rur); } db.SaveChanges(); } return(RedirectToAction("Index")); }
public void GetFilesAndFolders(UserInfos userinfos, int year) { DirectoryInfo dirInfo = new DirectoryInfo(ConfigurationManager.AppSettings["filepath"] + userinfos.AsocId +"\\" + year +"\\"); FileInfo[] fileInfo = dirInfo.GetFiles("*.xls*", SearchOption.AllDirectories); List<FileInfos> fileInfos = new List<FileInfos>(); foreach (FileInfo fi in fileInfo) { FileInfos f = new FileInfos(); f.Name = fi.Name; f.DownloadLink = "~/Download.ashx?file="+ f.Name; fileInfos.Add(f); } xlsLinks.DataSource = fileInfos; xlsLinks.DataBind(); }
public ActionResult Edit(UserInfos user, HttpPostedFileBase EPhoto, int[] roles) { //一、如果EPhoto不为空就处理图片,替换user里的原来的图片,否则就不处理图片保留原来的图片 if (EPhoto != null) { //1、获得文件的名称 string fileName = Path.GetFileName(EPhoto.FileName); //2、判断文件是否是图片 if (fileName.EndsWith("jpg") || fileName.EndsWith("png") || fileName.EndsWith("gif") || fileName.EndsWith("jpeg")) { //3、保存图片到项目文件夹当中 EPhoto.SaveAs(Server.MapPath("~/Content/images/users/" + fileName)); //4、将图片文件名,绑定到该用户的photo字段中 user.Photo = fileName; } } //二、修改用户信息,该用户的各项属性的值已标记为已被修改,则全部进行修改 db.Entry(user).State = System.Data.Entity.EntityState.Modified; db.SaveChanges();//保存到数据库中 //三、修改用户与角色的关系 //先通过用户ID去清除所有与该用户相关的角色关系 var rURList = db.R_User_Roles.Where(p => p.UserID == user.ID); foreach (var rUR in rURList) { db.R_User_Roles.Remove(rUR); } db.SaveChanges(); //添加新的角色关系 foreach (var roleID in roles) { //角色ID和用户ID组成新的R_User_Roles对象,添加到上下文对应R_User_Roles的集合中 R_User_Roles rur = new R_User_Roles() { UserID = user.ID, RoleID = roleID }; db.R_User_Roles.Add(rur); } //保存到数据库中 db.SaveChanges(); return(RedirectToAction("Index")); }
private void OnServerInfo(Message message) { dispatcher.Invoke( () => { lock (serverInfosLock) { var serverInfo = JsonConvert.DeserializeObject <ServerInfo>(message.Data); var allServerInfos = serverInfo.Channels.Cast <IInfo>() .Union(serverInfo.Connections.Where(c => !c.Name.Equals(User.Name)).Cast <IInfo>()) .OrderBy(c => c.Name).ToList(); var removals = ServerInfos.Where(c => !allServerInfos.Any(nc => nc.Name.Equals(c.Name))).ToList(); foreach (var removal in removals) { ServerInfos.Remove(removal); var removeUserInfo = UserInfos.FirstOrDefault(i => i.Name.Equals(removal.Name)); if (removeUserInfo != null) { UserInfos.Remove(removeUserInfo); } } var updates = (from c in ServerInfos.OfType <Channel>() join ci in allServerInfos.OfType <ChannelInfo>() on c.Name equals ci.Name select c.UpdateConnections(ci)).ToList(); var additions = allServerInfos.Where(a => !ServerInfos.Any(c => c.Name.Equals(a.Name))).ToList(); if (additions.Any()) { foreach (var addition in additions) { dispatcher.Invoke( () => { var info = InfoFactory.GetInfo(addition); ServerInfos.Add(info); }); } } } }); }
public int Update(UserInfos userInfos) { int res = UserInfos.Update(userInfos); Orders ord = new Orders() { Order_Id = userInfos.orderid, Room_State = userInfos.state }; int res1 = Orders.Update(ord); if (res == res1 && res == 1) { return(1); } else { return(0); } }
public UserInfosViewModel GetDetails(string Username) { UserInfos details = userDal.GetUserDetails(Username); UserInfosViewModel userInfoView = new UserInfosViewModel(); if (details != null) { userInfoView.UserId = details.UserId; userInfoView.Username = details.Username; userInfoView.Password = details.Password; userInfoView.Firstname = details.Firstname; userInfoView.Lastname = details.Lastname; return(userInfoView); } else { return(null); } }
/// <summary> /// 添加角色 ---多表查询 /// </summary> /// <param name="ID"></param> /// <returns></returns> public ActionResult setRole(int UserID) { //通过用户id查到--用户信息,并存ViewBag中 UserInfos user = db.UserInfos.Find(UserID); ViewBag.User = user; //通过用户id查到--对应的角色关系。并存ViewBag 中 List <R_User_Roles> UserRole = db.R_User_Roles.Where(p => p.UserID == UserID).ToList(); ViewBag.UserRole = UserRole; //获得所有的角色,并存ViewBag中 List <Roles> Role = db.Roles.ToList(); ViewBag.role = Role; return(View()); }
/// <summary> /// 根据用户信息是否清楚缓存数据 /// </summary> public void UpdateSearchData() { if (!AppConfigInfos.LimitsUserInfos.UserCode.Equals(CurrentUserInfo.UserCode)) { CurrentUserInfo = AppConfigInfos.LimitsUserInfos; ModelResponsible.Instance.ClearPicturePlayMediaList(); ModelResponsible.Instance.ClearVideoPlayMediaList(); ModelResponsible.Instance.ClearVoicePlayMediaList(); ModelResponsible.Instance.ClearHisPlayMediaList(); ModelResponsible.Instance.ClearAlarmLogs(); ModelResponsible.Instance.ClearCameraLogs(); ModelResponsible.Instance.ClearCollectLogs(); ModelResponsible.Instance.ClearMediaList(); LogHelper.Instance.WirteLog(string.Format("SearchManager: UserCode:{0} UpdateSearchData ClearAll", AppConfigInfos.CurrentUserInfos.UserCode), LogLevel.LogDebug); SearchManager.GetInstance().MediaLogsSerach.PageIndex = 1; SearchManager.GetInstance().MediaLogsSerach.IsAdvanced = false; SearchManager.GetInstance().MediaLogsSerach.SearchTime = DateTime.Now.AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss"); SearchManager.GetInstance().SearchMediaLogCount(SearchManager.GetInstance().MediaLogsSerach); SearchManager.GetInstance().SearchMediaLogDetail(SearchManager.GetInstance().MediaLogsSerach, false); LogHelper.Instance.WirteLog(string.Format("SearchManager: UserCode:{0} UpdateSearchData MediaLogsSerach", AppConfigInfos.CurrentUserInfos.UserCode), LogLevel.LogDebug); SearchManager.GetInstance().CollectLogsSerach.PageIndex = 1; SearchManager.GetInstance().CollectLogsSerach.LogType = "1"; SearchManager.GetInstance().CollectLogsSerach.IsAdvanced = false; SearchManager.GetInstance().SearchCollectLogCount(SearchManager.GetInstance().CollectLogsSerach); SearchManager.GetInstance().SearchCollectLogDetail(SearchManager.GetInstance().CollectLogsSerach, false); LogHelper.Instance.WirteLog(string.Format("SearchManager: UserCode:{0} UpdateSearchData CollectLogsSerach", AppConfigInfos.CurrentUserInfos.UserCode), LogLevel.LogDebug); SearchManager.GetInstance().CameraLogsSerach.PageIndex = 1; SearchManager.GetInstance().CameraLogsSerach.LogType = "2"; SearchManager.GetInstance().CameraLogsSerach.IsAdvanced = false; SearchManager.GetInstance().SearchCameraLogCount(SearchManager.GetInstance().CameraLogsSerach); SearchManager.GetInstance().SearchCameraLogDetail(SearchManager.GetInstance().CameraLogsSerach, false); LogHelper.Instance.WirteLog(string.Format("SearchManager: UserCode:{0} UpdateSearchData CameraLogsSerach", AppConfigInfos.CurrentUserInfos.UserCode), LogLevel.LogDebug); SearchManager.GetInstance().AlarmLogsSearch.PageIndex = 1; SearchManager.GetInstance().AlarmLogsSearch.IsAdvanced = false; SearchManager.GetInstance().SearchAlarmLogCount(SearchManager.GetInstance().AlarmLogsSearch); SearchManager.GetInstance().SearchAlarmLogDetail(SearchManager.GetInstance().AlarmLogsSearch, false); LogHelper.Instance.WirteLog(string.Format("SearchManager: UserCode:{0} UpdateSearchData AlarmLogsSearch", AppConfigInfos.CurrentUserInfos.UserCode), LogLevel.LogDebug); } }
public ActionResult AddUser(UserInfos user, HttpPostedFileBase Photo, int[] roles) { //处理图片 if (Photo != null) { //1、获得文件的名称 string fileName = Path.GetFileName(Photo.FileName); //2、判断文件是否是图片 //string hz = Path.GetExtension(fileName); //.jpg if (fileName.EndsWith("jpg") || fileName.EndsWith("png") || fileName.EndsWith("gif") || fileName.EndsWith("jpeg")) { //3、保存图片到项目文件夹当中 Photo.SaveAs(Server.MapPath("~/Content/images/users/" + fileName)); //4、将图片文件名,绑定到该用户的photo字段中 user.Photo = fileName; } else { return(Content("<script>alert('上传的文件必须是图片!')</script>")); } } else { return(Content("<script>alert('未获取上传的文件')</script>")); } //添加用户 db.UserInfos.Add(user); db.SaveChanges(); //添加用户与角色的关系 foreach (var roleID in roles) { R_User_Roles rur = new R_User_Roles(); rur.RoleID = roleID; rur.UserID = user.ID; db.R_User_Roles.Add(rur); } db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// 编辑结果修改 /// </summary> /// <param name="fingerResult"></param> public static void EditorFingerPrintByUserID(FingerResult fingerResult) { UserInfos userInfo = PoliceInfos.Find(p => p.UserID.Equals(fingerResult.UserID)); if (userInfo == null) { return; } if (!string.IsNullOrEmpty(fingerResult.FingersEditor)) { string[] fingers = fingerResult.FingersEditor.Split(','); foreach (var item in fingers) { string[] fingerInfo = item.Split(':'); if (fingerInfo.Length != 2) { continue; } Finger finger = userInfo.Fingers.Find(p => p.FingerID.Equals(fingerInfo[0])); if (finger != null) { finger.FingerName = fingerInfo[1]; } } } if (!string.IsNullOrEmpty(fingerResult.FingersDelete)) { string[] fingerIds = fingerResult.FingersDelete.Split(','); foreach (var item in fingerIds) { Finger finger = userInfo.Fingers.Find(p => p.FingerID.Equals(item)); if (finger != null) { userInfo.Fingers.Remove(finger); } } userInfo.FingerNumber = userInfo.Fingers.Count; } }
public void GetFilesAndFolders(UserInfos userinfos, int year) { DirectoryInfo dirInfo = new DirectoryInfo(ConfigurationManager.AppSettings["filepath"] + userinfos.AsocId + "\\" + year + "\\"); FileInfo[] fileInfo = dirInfo.GetFiles("*.xls*", SearchOption.AllDirectories); List <FileInfos> fileInfos = new List <FileInfos>(); foreach (FileInfo fi in fileInfo) { FileInfos f = new FileInfos(); f.Name = fi.Name; f.DownloadLink = "~/Download.ashx?file=" + f.Name; fileInfos.Add(f); } xlsLinks.DataSource = fileInfos; xlsLinks.DataBind(); }
public ActionResult Add(UserInfos user, HttpPostedFileBase Photo, int[] roles) { if (ModelState.IsValid) { foreach (var item in roles) { R_User_Roles rur = new R_User_Roles(); rur.RoleID = item; rur.UserID = user.ID; db.R_User_Roles.Add(rur); } if (Photo != null) { if (Photo.ContentLength > 0 && Photo.ContentLength < 4194304) { string fileName = Path.GetFileName(Photo.FileName); //string suffix = fileName.Substring(fileName.LastIndexOf(".") + 1); if (fileName.EndsWith("gif") || fileName.EndsWith("jpg") || fileName.EndsWith("png")) { Photo.SaveAs(Server.MapPath("~/Content/images/images/users/" + fileName)); user.Photo = fileName; } } else { return(Content("<script>alert('上传的文件必须是图片')</script>")); } } else { return(Content("<script>alert('未获取上传的文件')</script>")); } db.UserInfos.Add(user); db.SaveChanges(); return(RedirectToAction("Index")); } else { ViewBag.dlist = db.Departments.ToList(); ViewBag.list = db.Roles.ToList(); return(View()); } }
private void Form1_Load(object sender, EventArgs e) { splitContainer1.SplitterDistance = Settings.Default.TreeViewWidth; using (var db = new NnmContext()) { (from t in db.Torrents group t by t.Category into g select new { Category = g.Key, Count = g.Count(), Likes = g.Sum(t => t.Likes) } ).ToList().ForEach(c => { CatInfos.Add(c.Category, new Stats { Count = c.Count, Likes = c.Likes }); }); (from t in db.Torrents group t by t.User into g select new { User = g.Key, Count = g.Count(), Likes = g.Sum(u => u.Likes) } ).ToList().ForEach(c => { UserInfos.Add(c.User, new Stats { Count = c.Count, Likes = c.Likes }); }); } }
private void btnEdit_Click(object sender, EventArgs e) { if (lsvUserInfo.SelectedItems.Count < 1) { SpMessageBox.Show("请先选择一个用户,再进行编辑.", "用户管理"); return; } if (UserInfos.GetRoleByUser(Login.UserName) == (byte)LoginAuthority.Operator) { SpMessageBox.Show("您没有添加用户的权限!", "用户管理"); return; } combo_Authority.Enabled = true; //超级管理员用户才能编辑其他用户的权限 txt_UserName.Enabled = true; //could not change name txt_Password.Enabled = true; txt_PasswordConfirm.Enabled = true; txt_UserName.Text = lsvUserInfo.SelectedItems[0].SubItems[0].Text.Trim(); combo_Authority.SelectedIndex = ((lsvUserInfo.SelectedItems[0].SubItems[1].Text.Trim() == "管理员") ? 1 : ((combo_Authority.Text.Trim() == "超级管理员") ? 2 : ((combo_Authority.Text.Trim() == "操作员") ? 0 : -1)));; txt_Password.Text = ""; txt_PasswordConfirm.Text = ""; btnAdd.Enabled = false; //add btnEdit.Enabled = false; //edit btnConfirm.Enabled = true; //confirm btnCancel.Enabled = true; //cancel btnRemove.Enabled = false; //delete btnAdd.BackgroundImage = Properties.Resources._5_add_disable; btnEdit.BackgroundImage = Properties.Resources._5_edit_disable; btnConfirm.BackgroundImage = Properties.Resources._5_ok; btnCancel.BackgroundImage = Properties.Resources._5_cancel; btnRemove.BackgroundImage = Properties.Resources._5_delete_disable; _opMode = Operation.Edit; lsvUserInfo.Enabled = false; }
/// <summary> /// 1,3,15,16 [1,3,15,16] /// </summary> /// <returns></returns> public ActionResult deleteAll() { ArrayList arr = new ArrayList(); string rkeyStr = ""; StringBuilder sb = new StringBuilder(); if (Request["delItems"] != null && Request["delItems"].ToString() != "") { rkeyStr = Request["delItems"].ToString(); string[] rkeyArr = rkeyStr.Split(','); int count = 0; for (int i = 0; i < rkeyArr.Length; i++) { int value = int.Parse(rkeyArr[i]); var R_user = db.R_User_Roles.Where(p => p.UserID == value).ToList(); if (R_user.Count > 0) { string str = "该用户已设置角色,不可删除,如果想删除该用户请清除该用户的角色设置!"; return(Content(str)); } else { UserInfos user = db.UserInfos.Find(int.Parse(rkeyArr[i])); db.UserInfos.Remove(user); } } count = db.SaveChanges(); if (count > 0) { string str = "批量删除成功!"; return(Content(str)); } } else { rkeyStr = ""; string str = "批量删除失败!"; return(Content(str)); } return(null); }
private void AddGroupUser(GroupInfo item, UserPrincipal user) { var userInfo = new UserInfo { Comment = Helpers.DistinguishedName(user.DistinguishedName), DisplayName = user.DisplayName, Enabled = (bool)user.Enabled, Family = user.Surname, IsDanger = false, //(bool)user.Enabled && item.IsDanger, IsSelected = false, Name = user.GivenName, UserName = user.SamAccountName, UserPrincipal = user }; if (!UserInfos.Contains(userInfo)) { UserInfos.Add(userInfo); } }
private void btnClear_Click(object sender, EventArgs e) { DialogResult diaresult = SpMessageBox.Show("确定要清空当前订单信息吗?", "清空信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (diaresult == DialogResult.OK) { if (UserInfos.GetRoleByUser(Login.UserName) == (byte)LoginAuthority.SuperAdmin || UserInfos.GetRoleByUser(Login.UserName) == (byte)LoginAuthority.Administrator) { this.listView_NewOrder.Items.Clear(); this.txtNewOrderNo.Clear(); this.textNewOrderCount.Clear(); this.textProdNo.Clear(); this.comboBox_Prepare.SelectedIndex = -1; } else { SpMessageBox.Show("当前用户没有权限执行清空操作,请联系 Administrator.", "清空信息"); } } }
public ActionResult Index(string Account, string Pwd) { //根据账号和密码查找用户表中唯一用户 UserInfos user = db.UserInfos.Where(p => p.Account == Account && p.Pwd == Pwd).SingleOrDefault(); if (user != null) { //存在,即将查找的账号存入到Session对象中 Session["user"] = user; //将视图作为查询对象v_User_Role_Menu,过滤,根据当前用户的ID,Distinct去除集合中的重复行 List <v_User_Role_Menu> list = db.v_User_Role_Menu.Where(p => p.UserID == user.ID).Distinct().ToList(); Session["v_User_Role_Menu"] = list; return(RedirectToAction("Page")); } else { //不存在,返回登录界面 return(Content("<script>alert('账号或密码不正确!');history.go(-1)</script>")); } }
private void btnCancel_Click(object sender, EventArgs e)//button 'cancel 取消' { //clear testbox; txt_UserName.Text = String.Empty; txt_Password.Text = String.Empty; txt_PasswordConfirm.Text = String.Empty; combo_Authority.SelectedIndex = -1; //reset the signal from button 'edit' click. _opMode = Operation.None; combo_Authority.Enabled = false; btnAdd.Enabled = (UserInfos.GetRoleByUser(Login.UserName) != (byte)LoginAuthority.Operator && UserInfos.GetRoleByUser(Login.UserName) != (byte)LoginAuthority.Unkown); btnEdit.Enabled = true; //edit btnConfirm.Enabled = true; //confirm btnCancel.Enabled = true; //cancel btnRemove.Enabled = true; //delete combo_Authority.Enabled = true; lsvUserInfo.Enabled = true; lsvUserInfo.SelectedItems.Clear(); btnAdd.BackgroundImage = Properties.Resources._5_add; btnEdit.BackgroundImage = Properties.Resources._4_edit; btnConfirm.BackgroundImage = Properties.Resources._5_ok; btnCancel.BackgroundImage = Properties.Resources._5_cancel; btnRemove.BackgroundImage = Properties.Resources._5_delete; // if (lsvUser.SelectedItems.Count == 1) // { // btnEdit.Enabled = lsvUser.SelectedItems[0].SubItems[0].Text == Login.UserName;//edit // btnDel.Enabled = Login.Authority != LoginAuthority.Operator; // } // else // { // btnEdit.Enabled = false;//edit // btnDel.Enabled = false;//delete // } }
private void User_Refresh() { if (UserInfos.GetRoleByUser(Login.UserName) != (byte)LoginAuthority.SuperAdmin && UserInfos.GetRoleByUser(Login.UserName) != (byte)LoginAuthority.Administrator) { btnAdd.Enabled = false; btnEdit.Enabled = false; //edit btnConfirm.Enabled = false; //confirm btnCancel.Enabled = false; //cancel btnRemove.Enabled = false; //delete btnAdd.BackgroundImage = Properties.Resources._5_add_disable; btnEdit.BackgroundImage = Properties.Resources._5_edit_disable; btnConfirm.BackgroundImage = Properties.Resources._5_ok_disable; btnCancel.BackgroundImage = Properties.Resources._5_cancel_disable; btnRemove.BackgroundImage = Properties.Resources._5_delete_disable; txt_UserName.Enabled = false; txt_Password.Enabled = false; txt_PasswordConfirm.Enabled = false; combo_Authority.Enabled = false; } else { btnAdd.Enabled = true; btnEdit.Enabled = true; //edit btnConfirm.Enabled = true; //confirm btnCancel.Enabled = true; //cancel btnRemove.Enabled = true; //delete btnAdd.BackgroundImage = Properties.Resources._5_add; btnEdit.BackgroundImage = Properties.Resources._4_edit; btnConfirm.BackgroundImage = Properties.Resources._5_ok; btnCancel.BackgroundImage = Properties.Resources._5_cancel; btnRemove.BackgroundImage = Properties.Resources._5_delete; txt_UserName.Enabled = true; txt_Password.Enabled = true; txt_PasswordConfirm.Enabled = true; combo_Authority.Enabled = true; } }
public void Update(UserInfos user) { using (SqlCommand commander = new SqlCommand("SP_Update_UserInfos", connection)) { commander.CommandType = CommandType.StoredProcedure; commander.Parameters.AddWithValue("UserID", user.UserID); commander.Parameters.AddWithValue("LastName", user.LastName); commander.Parameters.AddWithValue("FirstName", user.FirstName); commander.Parameters.AddWithValue("Email", user.Email); commander.Parameters.AddWithValue("Rue", user.Rue); commander.Parameters.AddWithValue("Numero", user.Numero); commander.Parameters.AddWithValue("CodePostal", user.CodePostal); commander.Parameters.AddWithValue("Ville", user.Ville); commander.Parameters.AddWithValue("Pays", user.Pays); commander.Parameters.AddWithValue("Gsm", user.Gsm); commander.Parameters.AddWithValue("Phone", user.Phone); commander.ExecuteNonQuery(); } }
/// <summary> /// 注册 /// </summary> /// <param name="m"></param> /// <returns></returns> public (Status status, string jwt) Register(UserInfos m) { if (AnyNullOrWhiteSpace(m.Uid, m.Name, m.Pwd)) { return(Status.InputIllegal, null); } if (!Regex.IsMatch(m.Uid, _opt.UidRegex)) { return(Status.UidIllegal, null); } if (!Regex.IsMatch(m.Pwd, _opt.PwdRegex)) { return(Status.PwdIllegal, null); } if (_db.Find(m.Uid) != null) { return(Status.UidHasExist, null); } _db.Add(new AppUser(m)); return(Status.Ok, MakeJwt(m.Uid, RoleTypes.Vistor)); }
public void SetGroupSelected() { if (_inAction) { return; } _inAction = true; UserInfos.Clear(); foreach (var item in GroupInfos) { if (item.IsSelected) { AddGroupUsers(item); } } _inAction = false; }
/// <summary> /// Populates the fields for multiple objects from the columns found in an open reader. /// </summary> /// /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param> /// /// <returns>Object of UserInfos</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 2/15/2012 12:52:22 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static UserInfos PopulateObjectsFromReaderWithCheckingReader(IDataReader rdr, DatabaseHelper oDatabaseHelper, string ConnectionString) { UserInfos list = new UserInfos(); if (rdr.Read()) { UserInfo obj = new UserInfo(ConnectionString); PopulateObjectFromReader(obj, rdr); list.Add(obj); while (rdr.Read()) { obj = new UserInfo(ConnectionString); PopulateObjectFromReader(obj, rdr); list.Add(obj); } oDatabaseHelper.Dispose(); return list; } else { oDatabaseHelper.Dispose(); return null; } }
/// <summary> /// Populates the fields for multiple objects from the columns found in an open reader. /// </summary> /// /// <param name="rdr" type="IDataReader">An object that implements the IDataReader interface</param> /// /// <returns>Object of UserInfos</returns> /// /// <remarks> /// /// <RevisionHistory> /// Author Date Description /// DLGenerator 2/15/2012 12:52:22 PM Created function /// /// </RevisionHistory> /// /// </remarks> /// internal static UserInfos PopulateObjectsFromReader(IDataReader rdr, string ConnectionString) { UserInfos list = new UserInfos(); while (rdr.Read()) { UserInfo obj = new UserInfo(ConnectionString); PopulateObjectFromReader(obj,rdr); list.Add(obj); } return list; }
public string UserFileLink(UserInfos userinfos, int year) { string downloadLink = ""; string filepath = ConfigurationManager.AppSettings["filepath"] + userinfos.AsocId + "\\"+ year +"\\"; //"D:\\portal\\Downloads\\113\\"; string fermaname = replace_special_car_null(userinfos.NumeFerma); string raport_excel = userinfos.UserCod + "_" + fermaname + ".xls"; string excel_file = filepath + raport_excel; if (File.Exists(excel_file)) { // string httppath = ConfigurationManager.AppSettings["httppath"] + userinfos.AsocId + "/"; // downloadLink = "http://" + Request.ServerVariables.Get("HTTP_HOST") + "/" + httppath + "/"+ raport_excel; downloadLink = raport_excel; } return downloadLink; }
private PlayerScript InstantiateCharacter(UserInfos user) { GameObject character = Instantiate(characterPrefab) as GameObject; PlayerScript ps = character.GetComponent<PlayerScript>(); ps.Initialize(user); ps.x = 2; ps.y = 2; Vector2 pos = GetRoomPositionInScene(2, 2); ps.transform.position = new Vector3(pos.x, pos.y, -2); ps.transform.parent = complex[2, 2].transform; return ps; }
public void LoadInfos(UserInfos ui) { infos = ui; UpdateVisual(); }
public void Initialize(UserInfos infos) { this.character = infos.Type; this.infos = infos; UpdateVisual(); }