/// <summary> /// 确定创建用户 /// </summary> public void Comfirm() { Logger.Instance.WriteLog("保存新创建的用户信息"); UserBasicDao ubdao = new UserBasicDao(); ubdao.Insert001(IPTAccount.value, IPTPassword.value, IPTRealName.value, IPTTelphone.value, System.DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss"), IPTAddress.value, "正常", IPTMemo.value); ubdao.Select003(IPTAccount.value); UserBasicInfo ubInfo = ubdao.Result [0]; string goupId = "1"; foreach (GroupInfo info in Groups) { if (PPLGroup.value == info.Name) { goupId = info.Id; break; } } UserGroupDao ugpDao = new UserGroupDao(); ugpDao.Insert001(ubInfo.ID, goupId); UserRecordManage.Instance.GetComponent <UserRecordManage> ().ReLoadUserRecord(); Destroy(gameObject); }
public void AddNewUser() { Logger.Instance.WriteLog("保存新创建的用户信息"); UserBasicDao ubdao = new UserBasicDao(); ubdao.Insert001(accountName.value, UIRecord.UBInfo.Password, userName.value, userMobile.value, System.DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss"), userAdd.value, "正常", remark.value); ubdao.Select003(accountName.value); UserBasicInfo ubInfo = ubdao.Result [0]; string goupId = "1"; foreach (UILabel lb in groups) { if (lb.transform.parent.GetComponent <userGroupItem>().selectToggle.value) { goupId = lb.transform.parent.GetComponent <userGroupItem>().info.Id; } } UserGroupDao ugpDao = new UserGroupDao(); ugpDao.Insert001(ubInfo.ID, goupId); ReLoadUserRecord(); newBtn.SetActive(true); updateBtn.SetActive(false); }
/// <summary> /// 提交数据可修改相关信息 /// </summary> public void Confirm() { Logger.Instance.WriteLog("保存修改后的用户信息"); UserBasicDao ubdao = new UserBasicDao(); ubdao.Update003(IPTRealName.text, UIRecord.UBInfo.Password, IPTTelphone.value, IPTAddress.value, IPTMemo.value, UIRecord.UBInfo.ID); GroupDao gpDao = new GroupDao(); gpDao.Select003(); List <GroupInfo> gpInfos = gpDao.Result; foreach (GroupInfo info in gpInfos) { if (PPLRole.value == info.Name) { UserGroupDao ugDao = new UserGroupDao(); ugDao.Update001(info.Id, UIRecord.UBInfo.ID); break; } } UserRecordManage.Instance.GetComponent <UserRecordManage> ().ReLoadUserRecord(); Destroy(gameObject); }
/// <summary> /// 用户登录 /// </summary> public void Login() { Logger.Instance.WriteLog("开始登录"); //检索个人登录信息 UserBasicDao ubdao = new UserBasicDao(); try { ubdao.Select001(UserName.value, Password.value); } catch (Exception ex) { Logger.Instance.WriteLog("数据库连接异常"); Message.text = "数据库连接异常,请查看output_log.txt文件查看错误原因。"; Debug.Log(ex.ToString()); return; } if (ubdao.Result.Count == 1) { if (ubdao.Result[0].Status == "正常") { DataStore.UserInfo = ubdao.Result[0]; //检索用户所属组 GroupDao gDao = new GroupDao(); gDao.Select002(DataStore.UserInfo.ID); DataStore.GPInfo = gDao.Result[0]; //检索用户所属组的权限列表 GroupAuthorityDao gaDao = new GroupAuthorityDao(); gaDao.Select001(DataStore.GPInfo.Id); //检索权限信息 AuthorityDao aDao = new AuthorityDao(); aDao.Select001(); //将用户的权限详细信息保存下来 foreach (GroupAuthorityInfo gaInfo in gaDao.Result) { foreach (AuthorityInfo aInfo in aDao.Result) { if (gaInfo.AuthorityId == aInfo.Id) { DataStore.AuthorityInfos.Add(aInfo); break; } } } Logger.Instance.WriteLog("登录成功"); Message.text = ""; LoadingUI.SetActive(true); LoadingUI.SendMessage("LoadLevel", "EditScene"); } } else { Message.text = "登录失败,用户名或密码错误。"; } }
/// <summary> /// 删除当前用户 /// </summary> public void DeleteUser() { Logger.Instance.WriteLog("删除当前用户"); UserBasicDao ubdao = new UserBasicDao(); ubdao.Delete001(UIRecord.UBInfo.ID); UserGroupDao ugDao = new UserGroupDao(); ugDao.Delete001(UIRecord.UBInfo.ID); UserRecordManage.Instance.GetComponent <UserRecordManage> ().ReLoadUserRecord(); }
/// <summary> /// 加载用户信息 /// </summary> /// <param name="pageSize">Page size.</param> /// <param name="pageIndex">Page index.</param> public void LoadUserRecord(int pageSize, int pageIndex) { Logger.Instance.WriteLog("加载用户信息"); List <UserBasicInfo> ubInfo = new List <UserBasicInfo>(); UserInfoRecord record; UserBasicDao ubDao = new UserBasicDao(pageSize, pageIndex); int ubInfoSize = ubDao.getUserInfoFormDB(ref ubInfo); if (ubInfoSize == -1) { Logger.Instance.error("获取用户组信息失败"); } bool forbidden = false; for (int i = 0; i < ubInfo.Count; i++) { forbidden = false; record = new UserInfoRecord(); record.no = ubInfo[i].ID; record.UBInfo = ubInfo[i]; //根据用户ID获取相关组的信息 GroupDao gDao = new GroupDao(); List <GroupInfo> groups = new List <GroupInfo>(); int groupsSize = gDao.SelectUserGroup(ubInfo[i].ID, ref groups); if (groupsSize < 0) { Logger.Instance.error("通过用户id检索用户组信息失败!!"); return; } if (groups.Count <= 0) { continue; } record.GInfo = groups[0]; if (record.UBInfo.Status == "禁用") { forbidden = true; } GameObject go = Instantiate(RecordItemPrefab) as GameObject; go.GetComponent <UserRecordItem>().SetValue(record, forbidden); if (i == 0) { go.GetComponent <UserRecordItem>().Click(); ShowUserInfo(record); } Records.AddChild(go.transform); go.transform.localScale = new Vector3(1, 1, 1); } }
public void Login() { Logger.Instance.WriteLog("用户登录"); UserBasicDao ubdDao = new UserBasicDao(); if (CurrentPassword.value.Trim() == DataStore.UserInfo.Password || HasJunction == false) { ubdDao.Select001(NewAccount.value.Trim(), NewPassword.value.Trim()); if (ubdDao.Result.Count == 1) { GroupDao gpDao = new GroupDao(); gpDao.Select002(ubdDao.Result[0].ID); if (gpDao.Result.Count == 1) { DataStore.UserInfo = ubdDao.Result[0]; DataStore.GPInfo = gpDao.Result[0]; //检索用户所属组的权限列表 GroupAuthorityDao gaDao = new GroupAuthorityDao(); gaDao.Select001(DataStore.GPInfo.Id); //检索权限信息 AuthorityDao aDao = new AuthorityDao(); aDao.Select001(); DataStore.AuthorityInfos.Clear(); //将用户的权限详细信息保存下来 foreach (GroupAuthorityInfo gaInfo in gaDao.Result) { foreach (AuthorityInfo aInfo in aDao.Result) { if (gaInfo.AuthorityId == aInfo.Id) { DataStore.AuthorityInfos.Add(aInfo); break; } } } Junction.GetComponent <UIButton>().normalSprite = DefaultSprite; HasJunction = true; LoginInfo.GetComponent <LoginInfo>().UpdateInfo(); MainMenuPanel.GetComponent <MainMenuController>().UpdateInfo(); gameObject.SetActive(false); } } } }
/// <summary> /// 禁用用户 /// </summary> public void Forbidden() { Logger.Instance.WriteLog("禁用当前用户"); UserBasicDao ubdao = new UserBasicDao(); if (UIRecord.UBInfo.Status == "禁用") { ubdao.Update002("正常", UIRecord.UBInfo.ID); } else { ubdao.Update002("禁用", UIRecord.UBInfo.ID); } UserRecordManage.Instance.GetComponent <UserRecordManage> ().ReLoadUserRecord(); Destroy(gameObject); }
/// <summary> /// 提交密码修改请求 /// </summary> public void OnConfirm() { Logger.Instance.WriteLog("提交用户密码修改"); if (isOldPasswdOk && isNewPasswdOk && isCfmPasswdOk) { Logger.Instance.WriteLog("保存用户密码修改"); UserBasicDao ubdao = new UserBasicDao(); ubdao.Update001(newPasswd, DataStore.UserInfo.ID); DataStore.UserInfo.Password = newPasswd; UIInput[] inputs = InputArea.GetComponentsInChildren <UIInput> (); foreach (UIInput ipt in inputs) { ipt.value = ""; UILabel label = ipt.GetComponentInChildren <UILabel> (); label.text = ""; } HitArea.SetActive(true); //OldPassword.gameObject.SetActive(false); return; } Logger.Instance.WriteLog("用户密码修改失败"); return; }
public void Confirm() { Logger.Instance.WriteLog("保存修改后的用户信息"); UserRecordItem tempItem = null; if (UIRecord.UBInfo.Status == "新建") { return; } else { UserBasicDao ubdao = new UserBasicDao(); ubdao.Update003(userName.value, UIRecord.UBInfo.Password, userMobile.value, userAdd.value, remark.value, UIRecord.UBInfo.ID); } for (int i = 0; i < Records.transform.childCount; i++) { tempItem = Records.transform.GetChild(i).GetComponent <UserRecordItem>(); if (tempItem.LblAccount.text == UIRecord.UBInfo.UserName) { UIRecord.UBInfo.Telphone = userMobile.value; UIRecord.UBInfo.Address = userAdd.value; UIRecord.UBInfo.RealName = userName.value; UIRecord.UBInfo.Memo = remark.value; break; } } string gstr = string.Empty; foreach (UILabel lab in groups) { if (lab.transform.parent.GetComponent <userGroupItem>().selectToggle.value) { gstr = lab.text; break; } } UIRecord.GInfo.Name = gstr; GroupDao gpDao = new GroupDao(); gpDao.Select003(); List <GroupInfo> gpInfos = gpDao.Result; foreach (GroupInfo info in gpInfos) { if (gstr == info.Name) { UserGroupDao ugDao = new UserGroupDao(); if (UIRecord.UBInfo.Status == "新建") { ugDao.Insert001(UIRecord.UBInfo.ID, info.Id); UIRecord.UBInfo.Status = "正常"; } else { ugDao.Update001(info.Id, UIRecord.UBInfo.ID); break; } } } if (tempItem != null) { tempItem.SetValue(UIRecord); } //ReLoadUserRecord(); }