public Dictionary <int, string> Groups = new Dictionary <int, string>(); //组名 private void BtnLogin_Click(object sender, EventArgs e) { string username = txtUsername.Text.Trim(); string password = MD5.MD5Encrypt(txtPassword.Text.Trim()); if (!CheckInput()) { return; } //开启一个进程用于获取用于权限菜单信息和新增登陆记录 Thread thread1 = new Thread(new ThreadStart(LoadMenuInfo)); thread1.IsBackground = true; IService client = bc.GetWcfService(); bool result = client.Login(username, password); if (result) { thread1.Start(); MessageBox.Show("登陆成功!"); frmMidTabMain main = new frmMidTabMain(); this.Invoke(new MethodInvoker(delegate() { main.Menus = Menus; main.Groups = Groups; main.userMenu = dtUserMenu; })); main.Show(); this.Hide(); } else { MessageBox.Show("登陆失败!"); } }
private void LoadUserInfo(string username) { IService client = bc.GetWcfService(); DataTable dtData = client.GetUserInfo(username); this.gdcInfo.DataSource = dtData; }
private bool CheckOldPassword() { string password = MD5.MD5Encrypt(this.txtOldPassword.Text.Trim()); IService client = bc.GetWcfService(); return(client.Login(username, password)); }
private void btnSure_Click(object sender, EventArgs e) { try { #region 校验录入 if (String.IsNullOrEmpty(txtmenuname.Text.Trim())) { MessageBox.Show("请输入菜单名称!"); return; } if (String.IsNullOrEmpty(txtmenuname.Text.Trim())) { MessageBox.Show("请输入窗体路径!"); return; } if (String.IsNullOrEmpty(txtmenuname.Text.Trim())) { MessageBox.Show("请选择根菜单!"); return; } #endregion string menuname = txtmenuname.Text.Trim(); string path = txtpath.Text.Trim(); int parentid = String.IsNullOrEmpty(comboxparentno.Text.ToString()) ? 0 : Convert.ToInt32(comboxparentno.SelectedValue);//不填写默认是根节点 int sort = String.IsNullOrEmpty(txtsort.Text.Trim()) ? 0 : Convert.ToInt32(txtsort.Text.Trim()); string image_path = popupGalleryEdit1.Text; IService client = bc.GetWcfService(); if (flag == 0) { if (client.InsertMenuInfo(menuname, path, parentid, sort, username, image_path)) { MessageBox.Show("添加成功!"); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("添加失败!"); } } else { if (client.UpdateMenuInfo(menuid, menuname, path, parentid, sort, username, image_path)) { MessageBox.Show("修改成功!"); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("修改失败!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void SetDeptInfo() { IService client = bc.GetWcfService(); DataTable dt = client.GetAllDeptInfo(string.Empty); comboxdept.DataSource = dt; comboxdept.DisplayMember = "deptname"; comboxdept.ValueMember = "deptno"; }
private void LoadRoleInfo() { IService client = bc.GetWcfService(); DataTable dt = client.GetAllRoleInfo(string.Empty); listBoxControl1.DataSource = dt; listBoxControl1.DisplayMember = "rolename"; listBoxControl1.ValueMember = "roleid"; }
private void LoadRoleInfo(string rolename) { IService client = bc.GetWcfService(); DataTable dtData = client.GetAllRoleInfo(rolename); this.gdcInfo.DataSource = dtData; }
private void LoadDeptInfo(string deptname) { IService client = bc.GetWcfService(); DataTable dtData = client.GetAllDeptInfo(deptname); this.gdcInfo.DataSource = dtData; }
private void LoadMenuInfo(string menuname) { IService client = bc.GetWcfService(); DataTable dt = client.GetAllMenuInfoByName(menuname); this.gdcInfo.DataSource = dt; gdcInfo.KeyFieldName = "menuid"; gdcInfo.ParentFieldName = "parentid"; gdcInfo.Columns[0].Caption = "菜单"; gdcInfo.Columns[1].Caption = "路径"; gdcInfo.Columns[2].Caption = "菜单图标"; gdcInfo.Columns[3].Caption = "父窗体"; gdcInfo.Columns[4].Caption = "创建人"; gdcInfo.Columns[5].Caption = "创建时间"; gdcInfo.Columns[6].Caption = "更新人"; gdcInfo.Columns[7].Caption = "更新时间"; gdcInfo.OptionsView.ShowCheckBoxes = true; ExpandTree(); }
private void btnSure_Click(object sender, EventArgs e) { try { string rolename = this.txtrolename.Text.Trim(); string remark = this.txtremark.Text.Trim(); if (String.IsNullOrEmpty(rolename)) { MessageBox.Show("请输入部门名称!"); return; } IService client = bc.GetWcfService(); if (flag == 0) { if (client.InsertRoleInfo(rolename, remark, username)) { MessageBox.Show("添加成功!"); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("添加失败!"); } } else { if (client.UpdateRoleInfo(roleid, rolename, remark, username)) { MessageBox.Show("修改成功!"); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("修改失败!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void InsertOperateLog(string formname) { IService client = bc.GetWcfService(); client.Operatelog(userMenu.Rows[0]["username"].ToString(), ip, computername, formname); }