private void del_bt_Click(object sender, EventArgs e) { int[] aa = manuser.GetSelectedRows(); foreach (int testa in aa) { DataRow drt = manuser.GetDataRow(testa); string id = drt["ID"].ToString(); del_list.Add(Convert.ToInt32(id)); manuser.DeleteRow(testa); } // MessageBox.Show(aa.Length.ToString()); return; DataRow a = manuser.GetDataRow(manuser.FocusedRowHandle); Maticsoft.BLL.username use = new Maticsoft.BLL.username(); use.Delete(Convert.ToInt32(a["id"])); //MessageBox.Show(a["id"].ToString()); MessageBox.Show("删除成功"); Maticsoft.BLL.username usec = new Maticsoft.BLL.username(); DataSet ds = usec.GetAllList(); users_gc.DataSource = ds.Tables[0]; //DataSet ds = use.GetList(" "); //DataTable dt = ds.Tables[0]; //MessageBox.Show(ds.Tables.Count.ToString()); //DataTable dt = ds.Tables[0]; //MessageBox.Show(dt.Rows.Count.ToString()); }
private void query_bt_Click(object sender, EventArgs e) { if (username_tb.Text != "" && time_dtp.Text == "") { Maticsoft.BLL.username use = new Maticsoft.BLL.username(); string aa = string.Format("user = '******'", username_tb.Text); DataSet ds = use.GetList(aa); users_gc.DataSource = ds.Tables[0]; } if (username_tb.Text == "" && time_dtp.Text != "") { Maticsoft.BLL.username use = new Maticsoft.BLL.username(); string aa = string.Format("addtime = '{0}'", time_dtp.Text); DataSet ds = use.GetList(aa); users_gc.DataSource = ds.Tables[0]; } if (username_tb.Text != "" && time_dtp.Text != "") { Maticsoft.BLL.username use = new Maticsoft.BLL.username(); string aa = string.Format("addtime = '{0}'and user='******'", time_dtp.Text, username_tb.Text); DataSet ds = use.GetList(aa); users_gc.DataSource = ds.Tables[0]; } if (username_tb.Text == "" && time_dtp.Text == "") { Maticsoft.BLL.username use = new Maticsoft.BLL.username(); DataSet ds = use.GetAllList(); users_gc.DataSource = ds.Tables[0]; } }
private void buttonX1_Click(object sender, EventArgs e) { Maticsoft.BLL.username use = new Maticsoft.BLL.username(); DataSet ds = use.GetAllList(); users_gc.DataSource = ds.Tables[0]; del_list.Clear(); }
private void buttonX2_Click(object sender, EventArgs e) { Maticsoft.BLL.username use = new Maticsoft.BLL.username(); foreach (int del_index in del_list) { use.Delete(del_index); } DataSet ds = use.GetAllList(); users_gc.DataSource = ds.Tables[0]; }
private void UserManForm_Load(object sender, EventArgs e) { Maticsoft.BLL.username use = new Maticsoft.BLL.username(); DataSet ds = use.GetAllList(); users_gc.DataSource = ds.Tables[0]; //ds.Tables.Add(); //DataTable dt = new DataTable();//创建表 //dt.Columns.Add("username", typeof(String));//添加列 //dt.Columns.Add("Manager", typeof(String)); //dt.Columns.Add("addTime", typeof(DateTime)); //dt.Columns.Add("power", typeof(String)); //dt.Rows.Add(new object[] { "admin", "admin", DateTime.Now ,"管理员"});//添加行 //dt.Rows.Add(new object[] { "李四", "zzzs", DateTime.Now, "普通账户"}); //dt.Rows.Add(new object[] { "王五", "www", DateTime.Now, "普通账户" }); // this.users_gc.DataSource = dt; }