private void btnOKClick( object sender, RunWorkerCompletedEventArgs e) { if (this.U_Passwd.Text != this.U_Passwd2.Text) { MessageBox.Show("两次密码输入不匹配,请重新输入"); return; } UserHandleNsTalk talk = new UserHandleNsTalk(); string name = this.U_Name.Text; string passwd = this.U_Passwd.Text; string authority = this.O_Names.Text; Protocol pro = talk.Update_User_Info(ClientInfo.session, name, passwd, authority); if (pro.protoType == ProtoType.SUCCESS) { parentForm.updateData(); this.Close(); } else if (pro.protoType == ProtoType.OUT_OF_TIME) { MessageBox.Show("系统超时,请重新登录"); this.parentForm.Hide(); this.Hide(); } else if (pro.protoType == ProtoType.ERROR) { MessageBox.Show("获取信息错误,请重新获取"); } }
public void updateData() { UserHandleNsTalk talk = new UserHandleNsTalk(); Protocol pro = talk.Get_All_User_Info(ClientInfo.session); if (pro.protoType == ProtoType.SUCCESS) { List<string> columnName = new List<string>(); columnName.Add("用户名"); columnName.Add("权限"); this.userDataGridView.DataSource = TableDataUtil.convertListListDataToDataTable(columnName, pro.data); if (canEdit) { foreach (DataGridViewRow row in this.userDataGridView.Rows) { row.ContextMenuStrip = this.contextMenuStrip1; } } } }
private void btnOK( object sender, RunWorkerCompletedEventArgs e) { if (this.U_Passwd_Box.Text != this.U_Passwd_Box2.Text) { MessageBox.Show("俩次密码输入不一致,请重新输入"); this.U_Passwd_Box.Text = ""; this.U_Passwd_Box2.Text = ""; return; } UserHandleNsTalk talk = new UserHandleNsTalk(); Protocol pro = talk.Register_User_Info(ClientInfo.session, this.U_Name_Box.Text, this.U_Passwd_Box.Text, this.L_Name_Box.Text); if (pro.protoType == ProtoType.SUCCESS) { this.Close(); } else if (pro.protoType == ProtoType.USER_EXISTS) { MessageBox.Show("用户名已经存在,添加失败"); this.U_Name_Box.Text = ""; this.U_Passwd_Box.Text = this.U_Passwd_Box2.Text = ""; this.L_Name_Box.SelectedIndex = 1; } else if (pro.protoType == ProtoType.OUT_OF_TIME) { MessageBox.Show("系统超时,请重新登录"); } else if (pro.protoType == ProtoType.ERROR) { MessageBox.Show("获取信息错误,请重新获取"); } }
private void DeleteToolStripMenuItem_Click(object sender, EventArgs e) { if (this.userDataGridView.SelectedRows.Count > 0) { DataGridViewRow row = (DataGridViewRow)this.userDataGridView.SelectedRows[0]; string name = (string)row.Cells[0].Value; UserHandleNsTalk talk = new UserHandleNsTalk(); Protocol pro = talk.Delete_User_Info(ClientInfo.session, name); if (pro.protoType == ProtoType.SUCCESS) { this.updateData(); } else if (pro.protoType == ProtoType.OUT_OF_TIME) { MessageBox.Show("系统超时,请重新登录"); } else if (pro.protoType == ProtoType.ERROR) { MessageBox.Show("获取信息错误,请重新获取"); } } }
private void U_Register_BackgroundWorker( object sender, RunWorkerCompletedEventArgs e) { UserHandleNsTalk talk = new UserHandleNsTalk(); Protocol pro = talk.Fetch_Authority_Lists(ClientInfo.session); if (pro.protoType == ProtoType.SUCCESS) { U_Register_Form rf = new U_Register_Form(); this.AddOwnedForm(rf); List<string> source = new List<string>(); foreach (List<string> ls in pro.data) { source.Add(ls[0]); } rf.L_Name_Box.DataSource = source; rf.Show(); } else if (pro.protoType == ProtoType.OUT_OF_TIME) { MessageBox.Show("系统超时,请重新登录"); LoginForm lg = new LoginForm(); lg.Show(); this.Hide(); } else if (pro.protoType == ProtoType.ERROR) { MessageBox.Show("获取信息错误,请重新获取"); } }
private void U_Modify_BackgroundWorker( object sender, RunWorkerCompletedEventArgs e) { UserHandleNsTalk talk = new UserHandleNsTalk(); Protocol pro = talk.Get_All_User_Info(ClientInfo.session); if (pro.protoType == ProtoType.SUCCESS) { OpenUShowForm(pro, true); } else if (pro.protoType == ProtoType.OUT_OF_TIME) { MessageBox.Show("系统超时,请重新登录"); LoginForm lg = new LoginForm(); lg.Show(); this.Hide(); } else if (pro.protoType == ProtoType.ERROR) { MessageBox.Show("获取信息错误,请重新获取"); } }
private void modifyUserInfo() { if (this.userDataGridView.SelectedRows.Count > 0) { DataGridViewRow row = (DataGridViewRow)this.userDataGridView.SelectedRows[0]; string name = (string)row.Cells[0].Value; UserHandleNsTalk talk = new UserHandleNsTalk(); Protocol pro = talk.Get_Modifying_User_Info(ClientInfo.session, name); if (pro.protoType == ProtoType.SUCCESS) { List<List<List<string>>> mutilData = pro.mutilData; U_Modify_Form um = new U_Modify_Form(this); um.U_Name.Text = (string)mutilData[0][0][0]; um.U_Passwd.Text = um.U_Passwd2.Text = (string)mutilData[0][0][1]; List<string> datasource = new List<string>(); foreach (List<string> ls in mutilData[1]) { datasource.Add(ls[0]); } um.O_Names.DataSource = datasource; um.O_Names.SelectedIndex = datasource.IndexOf(mutilData[0][0][2]); this.AddOwnedForm(um); um.Show(); } else if (pro.protoType == ProtoType.OUT_OF_TIME) { MessageBox.Show("系统超时,请重新登录"); } else if (pro.protoType == ProtoType.ERROR) { MessageBox.Show("获取信息错误,请重新获取"); } } }