//确认修改员工信息按钮点击事件 private void button1_Click(object sender, EventArgs e) { //非空验证 if (ID.id == "" || name_tb.Text == "" || cbb_sex.Text == "" || age_tb.Text == "" || cbb_section.Text == "" || cbb_post.Text == "" || tb_ID.Text == "" || tb_brithday.Text == "" || tb_address.Text == "" || tb_Salary.Text == "" || tb_Phone.Text == "") { MessageBox.Show("修改的信息不能有空项!", "修改"); return; } //电信手机号码正则 string dianxin = @"^1[35789][01379]\d{8}$"; Regex dReg = new Regex(dianxin); //实例化对象 //联通手机号正则 string liantong = @"^1[345678][01256]\d{8}$"; Regex tReg = new Regex(liantong); //实例化对象 //移动手机号正则 string yidong = @"^(134[012345678]\d{7}|1[34578][012356789]\d{8})$"; Regex yReg = new Regex(yidong); //实例化对象 //判断输入的手机号码格式是否正确 if (!(dReg.IsMatch(tb_Phone.Text) || tReg.IsMatch(tb_Phone.Text) || yReg.IsMatch(tb_Phone.Text))) { MessageBox.Show("手机号格式错误,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //弹框提示 tb_Phone.Text = ""; //如果手机号码格式不正确则输入框变成空 return; } //添加成功后刷新列表 string selectSql = string.Format("update staff_info_table set name='{0}',sex='{1}',age='{2}',bu='{3}',section='{4}',ID_number='{5}',birthday='{6}',address='{7}',Salary='{8}',Phone='{9}' where staffinfo_id='{10}'", name_tb.Text, cbb_sex.Text, age_tb.Text, cbb_section.Text, cbb_post.Text, tb_ID.Text, tb_brithday.Text, tb_address.Text, tb_Salary.Text, tb_Phone.Text, ID.id); if (DBHepler.ExecuteNonQuery(selectSql)) { MessageBox.Show("修改成功!"); Close(); } }
//窗体加载事件 private void Owner_Management_Load(object sender, EventArgs e) { string sql = "select * from owner_info_table"; ds = DBHepler.GetDataSet(sql); dgv_Owner.AutoGenerateColumns = false; //取消自动生成列 dgv_Owner.DataSource = ds.Tables[0]; //绑定数据源 //查询楼盘表 string Sql = "select distinct village_name from property_table"; DataTable dt = DBHepler.GetDataTable(Sql); //遍历输出小区名 for (int i = 0; i < dt.Rows.Count; i++) { this.xqname_cbb.Items.Add(dt.Rows[i][0]); } //查询楼盘表 string SQl = "select distinct building_number from property_table"; DataTable db = DBHepler.GetDataTable(SQl); //遍历输出楼栋名 for (int i = 0; i < db.Rows.Count; i++) { this.ldname_cbb.Items.Add(db.Rows[i][0]); } }
//查询投诉信息按钮点击事件 private void btn_Query_Click(object sender, EventArgs e) { //声明变量存储时间 string date = dateTime.Text; string date_2 = dateTime_and.Text; //判断截止日期是否大于起始日期 DateTime time1 = Convert.ToDateTime(dateTime.Value.Date.ToString("yyyy-MM-dd")); DateTime time2 = Convert.ToDateTime(dateTime_and.Value.Date.ToString("yyyy-MM-dd")); if (!(DateTime.Compare(time1, time2) < 0)) { MessageBox.Show("截止日期应大于起始日期!"); return; } //查询投诉记录SQL语句 string QuerSql = string.Format("select * from complain_register_table crt join complain_state_table cst on crt.complain_name=cst.complain_name where crt.complain_name like '%{0}%' and cst.dispose_status='{3}' and crt.time between '{1}' and '{2}' or crt.number='{0}' ", Key_tb.Text.Trim().ToUpper(), Convert.ToDateTime(date).ToString("yyyy-MM-dd"), Convert.ToDateTime(date_2).ToString("yyyy-MM-dd"), cbb_stata.Text); ds = DBHepler.GetDataSet(QuerSql); //取消自动生成列 info_dgv.AutoGenerateColumns = false; //填充数据集 info_dgv.DataSource = ds.Tables[0]; text2.Text = info_dgv.Rows.Count.ToString(); if (ds.Tables[0].Rows.Count <= 0) { text2.Text = info_dgv.Rows.Count.ToString(); MessageBox.Show("未找到相关信息,请核对!", "提示");//弹框提示 return; } }
//窗体加载事件 private void Staff_Management_Load(object sender, EventArgs e) { //查询职位表信息SQL语句 string SelectSql = "select * from post_info_table"; ds = DBHepler.GetDataSet(SelectSql); dgv_dividion.DataSource = ds.Tables[0]; //查询员工信息表信息SQL语句 string selectSql = "select * from staff_info_table"; ds = DBHepler.GetDataSet(selectSql); staff_dgv.DataSource = ds.Tables[0]; //查询职位表,并遍历所有的部门 string SQL = "select distinct duty from post_info_table"; DataTable dt = DBHepler.GetDataTable(SQL); for (int i = 0; i < dt.Rows.Count; i++) { this.cbb_section.Items.Add(dt.Rows[i][0]); } //查询职位表,并遍历所有的岗位 string SqL = "select distinct department from post_info_table"; DataTable dt_1 = DBHepler.GetDataTable(SqL); for (int i = 0; i < dt_1.Rows.Count; i++) { this.cbb_post.Items.Add(dt_1.Rows[i][0]); } }
//窗体加载事件 private void Main_Load(object sender, EventArgs e) { //Sql语句 string selectSql = string.Format("select * from property_table"); ds = DBHepler.GetDataSet(selectSql); //取消自动生成列 tower_list.AutoGenerateColumns = false; tower_list.DataSource = ds.Tables[0];//绑定数据源 ming_pl.Text = info.num; /*由上至下窗体*/ Win32.AnimateWindow(this.Handle, 300, Win32.AW_VER_POSITIVE); invit(); toer.BackColor = Color.FromArgb(230, 230, 250); //双缓冲 SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景. SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲 this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); if (ming_pl.Text == "Admin") { fanhui.Visible = true; } }
private void btn_update_Click(object sender, EventArgs e) { //非空验证 if (tb_water.Text == "" || cb_water.Text == "" || tb_electric.Text == "" || cb_electric.Text == "" || tb_wuyei.Text == "" || cb_wuyei.Text == "") { MessageBox.Show("输入内容不能为空!"); } else { string sqlupdate1 = string.Format("update watercost_table set water_money='{0}', payment_status1='{1}',time1=getdate() where room_number='{2}'", tb_water.Text, cb_water.Text, roomnum_cb.Text); a = DBHepler.ExecuteNonQuery(sqlupdate1); string sqlupdate2 = string.Format("update electric_cost_table set electric_money='{0}',payment_status2='{1}' where room_number='{2}'", tb_electric.Text, cb_electric.Text, roomnum_cb.Text); b = DBHepler.ExecuteNonQuery(sqlupdate2); string sqlupdate3 = string.Format("update propertyfee_table set proper_money='{0}',payment_status3='{1}' where room_number='{2}'", tb_wuyei.Text, cb_wuyei.Text, roomnum_cb.Text); c = DBHepler.ExecuteNonQuery(sqlupdate3); //判断信息是否修改成功 if (a || b || c) { MessageBox.Show("缴费成功!", "提示"); //修改成功后清空文本框 tb_electric.Text = ""; tb_water.Text = ""; tb_wuyei.Text = ""; } else { MessageBox.Show("缴费失败!", "提示"); } } }
//修改部门信息按钮点击事件 private void btn_amend_Click(object sender, EventArgs e) { int post_id = int.Parse(dgv_dividion.SelectedRows[0].Cells["col_num"].Value.ToString()); //非控验证 if (duty_tb.Text == "" || department_tb.Text == "") { MessageBox.Show("操作失败,请选择需要修改的信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //修改部门信息SQL语句 string updateSql = string.Format("update post_info_table set duty='{0}',department='{1}' where postinfo_id='{2}'", duty_tb.Text, department_tb.Text, post_id); //判断信息是否修改成功 if (DBHepler.ExecuteNonQuery(updateSql)) { MessageBox.Show("修改成功!", "修改"); //修改成功后刷新列表并清空文本框 string SelectSql = "select * from post_info_table"; ds = DBHepler.GetDataSet(SelectSql); dgv_dividion.DataSource = ds.Tables[0]; duty_tb.Text = ""; department_tb.Text = ""; return; } }
//删除按钮点击事件 private void btn_del_Click(object sender, EventArgs e) { int post_id = int.Parse(dgv_dividion.SelectedRows[0].Cells["col_num"].Value.ToString()); //非控验证 if (duty_tb.Text == "" || department_tb.Text == "") { MessageBox.Show("操作失败,请选择需要删除的信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //sahnchu部门信息SQL语句 string delSql = string.Format("delete post_info_table where postinfo_id='{0}'", post_id); //判断信息是否删除成功 if (DBHepler.ExecuteNonQuery(delSql)) { MessageBox.Show("删除成功!", "删除"); //删除成功后刷新列表并清空文本框 string DelSql = "select * from post_info_table"; ds = DBHepler.GetDataSet(DelSql); dgv_dividion.DataSource = ds.Tables[0]; duty_tb.Text = ""; department_tb.Text = ""; return; } }
//private void button1_Click(object sender, EventArgs e) //{ // //实例化对象 // Repair_application repair_Application = new Repair_application(); // repair_Application.ShowDialog(); //} //右键修改办理状态点击事件 private void 修改ToolStripMenuItem_Click(object sender, EventArgs e) { int ID = int.Parse(data_repairs.SelectedRows[0].Cells["col_num"].Value.ToString());//获取状态表的ID string Stat = data_repairs.SelectedRows[0].Cells["col_Stata"].Value.ToString(); if (Stat == "已受理") { MessageBox.Show("状态已经是“已受理”,无法修改!", "提示"); return; } else { DialogResult result = MessageBox.Show("是否将办理状态改为已受理", "提示", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { string gaiSql = string.Format("update repair_record_table set repaircondition='已受理' where repairrecord_id='{0}'", ID); if (DBHepler.ExecuteNonQuery(gaiSql)) { MessageBox.Show("修改成功!", "提示"); //刷新列表 //刷新按钮点击事件 string StarSql = "select * from repair_application_table ret join repair_record_table rrt on ret.proposer_name=rrt.proposer_name"; DS = DBHepler.GetDataSet(StarSql); //取消自动生成列 data_repairs.AutoGenerateColumns = false; data_repairs.DataSource = DS.Tables[0];//绑定数据源 text2.Text = data_repairs.Rows.Count.ToString(); return; } } } }
private void btn_xiu_Click(object sender, EventArgs e) { if (type11_tb.Text == "私有车位") { string xiuSql = string.Format("update carport set Car_name='{0}',Address='{1}',Tell='{2}',Car_num='{3}',Car_type='{4}',tenancy_term='30' where ID='{5}'", Car_name_tb.Text.Trim(), addres_tb.Text.Trim(), tell_ttbb.Text.Trim(), Car_num_tb.Text.Trim(), Car_typeee.Text.Trim(), ID.id); if (DBHepler.ExecuteNonQuery(xiuSql)) { MessageBox.Show("车位信息修改成功!", "提示"); this.Close(); } } if (type11_tb.Text == "公共车位") { string xiuSql = string.Format("update carport set Car_name='{0}',Address='{1}',Tell='{2}',Car_num='{3}',Car_type='{4}' where ID='{5}'", Car_name_tb.Text.Trim(), addres_tb.Text.Trim(), tell_ttbb.Text.Trim(), Car_num_tb.Text.Trim(), Car_typeee.Text.Trim(), ID.id); if (DBHepler.ExecuteNonQuery(xiuSql)) { MessageBox.Show("车位信息修改成功!", "提示"); this.Close(); } } if (type11_tb.Text == "租用车位") { //添加车位信息SQL语句 string inserSQl = string.Format("update carport set Car_name='{0}',Address='{1}',Tell='{2}',Car_num='{3}',Car_type='{4}',tenancy_term='{5}' where ID='{6}'", Car_name_tb.Text.Trim(), addres_tb.Text.Trim(), tell_ttbb.Text.Trim(), Car_num_tb.Text.Trim(), Car_typeee.Text.Trim(), years_tb.Text.Trim(), ID.id); if (DBHepler.ExecuteNonQuery(inserSQl)) { MessageBox.Show("车位信息修改成功!", "提示"); this.Close(); } } }
private void shuju2() { string SQL2 = string.Format("select COUNT(Type) from carport where Type = '租用车位'"); ds = DBHepler.GetDataSet(SQL2); cun2.Text = ds.Tables[0].Rows[0][0].ToString(); }
private void btn_dell_Click(object sender, EventArgs e) { string id = dgv_u.SelectedRows[0].Cells["num"].Value.ToString(); DialogResult reslut = MessageBox.Show("是否要删除该用户?", "提示", MessageBoxButtons.YesNo); if (reslut == DialogResult.Yes) { string delSql = string.Format("delete from Users where UserID='{0}'", id); if (DBHepler.ExecuteNonQuery(delSql)) { MessageBox.Show("删除成功!"); //刷新列表 string Sql = "select * from Users"; ds = DBHepler.GetDataSet(Sql); //取消自动生成列 dgv_u.AutoGenerateColumns = false; dgv_u.DataSource = ds.Tables[0]; // 清空文本框 tb_nyum.Text = ""; tb_pwdd.Text = ""; phone_tbb.Text = ""; return; } } }
//窗体加载事件 private void Form2_Load(object sender, EventArgs e) { /*由左至右窗体*/ Win32.AnimateWindow(this.Handle, 300, Win32.AW_HOR_POSITIVE); //查询职位表,并遍历所有的部门 string SQL = "select distinct duty from post_info_table"; DataTable dt = DBHepler.GetDataTable(SQL); for (int i = 0; i < dt.Rows.Count; i++) { this.cbb_section.Items.Add(dt.Rows[i][0]); } //查询职位表,并遍历所有的岗位 string SqL = "select distinct department from post_info_table"; DataTable dt_1 = DBHepler.GetDataTable(SqL); for (int i = 0; i < dt_1.Rows.Count; i++) { this.cbb_post.Items.Add(dt_1.Rows[i][0]); } string Sql = string.Format("select * from staff_info_table where staffinfo_id='{0}'", ID.id); DataRow dr = DBHepler.GetDataSet(Sql).Tables[0].Rows[0]; this.num_tb.Text = dr[0].ToString(); this.name_tb.Text = dr[1].ToString(); this.cbb_sex.Text = dr[2].ToString(); this.age_tb.Text = dr[3].ToString(); this.cbb_section.Text = dr[4].ToString(); this.cbb_post.Text = dr[5].ToString(); this.tb_ID.Text = dr[6].ToString(); this.tb_brithday.Text = dr[7].ToString(); this.tb_address.Text = dr[8].ToString(); this.tb_Salary.Text = dr[9].ToString(); this.tb_Phone.Text = dr[10].ToString(); }
//添加部门按钮点击事件 private void btn_Add2_Click(object sender, EventArgs e) { //非空验证 if (duty_tb.Text == "" || department_tb.Text == "") { MessageBox.Show("部门或岗位不允许为空!", "添加"); return; } //判断岗位是否已存在 string strSQL = "select * from post_info_table where department='" + this.department_tb.Text.ToString().Trim() + "'"; DataSet db = DBHepler.GetDataSet(strSQL); if (db.Tables.Count == 0 || db.Tables[0].Rows.Count > 0) { MessageBox.Show("添加失败,岗位" + department_tb.Text + "已经存在,请检查!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);//弹框提示 department_tb.Text = ""; return; } //添加部门信息SQL语句 string inserSql = string.Format("insert post_info_table values('{0}','{1}')", duty_tb.Text, department_tb.Text); //判断是否添加成功 if (DBHepler.ExecuteNonQuery(inserSql)) { MessageBox.Show("添加部门信息成功!", "提示", MessageBoxButtons.OK); //添加成功后刷新列表并清空文本框 string SelectSql = "select * from post_info_table"; ds = DBHepler.GetDataSet(SelectSql); dgv_dividion.DataSource = ds.Tables[0]; duty_tb.Text = ""; department_tb.Text = ""; return; } }
//右键删除停车信息点击事件 private void 除ToolStripMenuItem_Click(object sender, EventArgs e) { //获取用户选择某行的ID、车牌号以及缴费状态 id = int.Parse(dgv_stopcar.SelectedRows[0].Cells["stopcar_id"].Value.ToString()); string num = dgv_stopcar.SelectedRows[0].Cells["Colcarnum"].Value.ToString(); string stae = dgv_stopcar.SelectedRows[0].Cells["col_state"].Value.ToString(); //判断车主是否已缴费 if (stae == "未缴费") { MessageBox.Show("删除失败!车牌号为:" + num + " 的车主未缴费!", "提示"); return; } //删除车辆信息SQL语句 string delSql = string.Format("delete stopcar_table where stopcar_id='{0}'", id); //判断是否删除成功 if (DBHepler.ExecuteNonQuery(delSql)) { MessageBox.Show("成功删除\n车牌号:" + num + "\n的停车信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); //弹框提示 //删除成功后刷新列表 DataSet dt = new DataSet(); //实例化DataSet对象 string selectsql = string.Format("select * from stopcar_table "); dt = DBHepler.GetDataSet(selectsql); dgv_stopcar.DataSource = dt.Tables[0]; //绑定数据源 dgv_stopcar.Columns["stopcar_id"].Visible = false; //隐藏ID列 return; } }
private void btn_infoadd_Click(object sender, EventArgs e) { //非空验证 if (text_num.Text == "" || Pwd_text.Text == "" || tell_text.Text == "") { MessageBox.Show("管理员账号信息不允许为空!", "提示"); return; } //电信手机号码正则 string dianxin = @"^1[35789][01379]\d{8}$"; Regex dReg = new Regex(dianxin); //实例化对象 //联通手机号正则 string liantong = @"^1[345678][01256]\d{8}$"; Regex tReg = new Regex(liantong); //实例化对象 //移动手机号正则 string yidong = @"^(134[012345678]\d{7}|1[34578][012356789]\d{8})$"; Regex yReg = new Regex(yidong); //实例化对象 //判断输入的手机号码格式是否正确 if (!(dReg.IsMatch(tell_text.Text) || tReg.IsMatch(tell_text.Text) || yReg.IsMatch(tell_text.Text))) { MessageBox.Show("手机号格式错误,请重新输入!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //弹框提示 tell_text.Text = ""; //如果手机号码格式不正确则输入框变成空 return; } //添加管理员Sql语句 string insertSql = string.Format("insert userinfo_table(account_number,password,user_tel) values('{0}','{1}','{2}')", text_num.Text.Trim(), Pwd_text.Text.Trim(), tell_text.Text.Trim()); if (DBHepler.ExecuteNonQuery(insertSql)) { this.Close(); } }
//查询业主信息查询按钮点击事件 private void btn_cha_Click(object sender, EventArgs e) { string sqlstr = string.Format("select * from owner_info_table where owner_name like '%{0}%' or room_number like '{0}%'", ownername.Text); ds = DBHepler.GetDataSet(sqlstr); dgv_Owner.AutoGenerateColumns = false; //取消自动生成列 dgv_Owner.DataSource = ds.Tables[0]; //绑定数据源 }
private void btn_seclt_Click(object sender, EventArgs e) { string seSQl = string.Format("select * from userinfo_table where account_number like '%{0}%' ", key_tb.Text); ds = DBHepler.GetDataSet(seSQl); Admin_InFo.AutoGenerateColumns = false; Admin_InFo.DataSource = ds.Tables[0]; }
//添加业主信息的按钮点击事件 private void btn_Add_Click(object sender, EventArgs e) { try { //判断方法的结果是否正确 if (Faa() == false) { return; } //添加业主信息SQL语句 string str = string.Format("insert into owner_info_table values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}',getdate())", room_tb.Text, yename_tb.Text, cbb_sex.Text, phone_tb.Text, shenfen_tb.Text, xqname_cbb.Text, ldname_cbb.Text, proportion_tb.Text); //添加水费表中的房间号SQL语句 string waterSQL = string.Format("insert watercost_table( room_number) values('{0}')", room_tb.Text); //添加物业管理费表中的房间号SQL语句 string propertyfeeSQL = string.Format("insert propertyfee_table( room_number) values('{0}')", room_tb.Text); //添加电费表中的房间号SQL语句 string electricSQL = string.Format("insert electric_cost_table( room_number) values('{0}')", room_tb.Text); //查询入住数量 string num = string.Format("select COUNT(Building_name) 人数 from owner_info_table where Village_name='{0}' and Building_name='{1}'", xqname_cbb.Text, ldname_cbb.Text); ds = DBHepler.GetDataSet(num); int number = int.Parse(ds.Tables[0].Rows[0]["人数"].ToString()); //更新入住人数 string upSql = string.Format("update property_table set yezhnum='{0}' where village_name='{1}' and building_number='{2}'", number + 1, xqname_cbb.Text, ldname_cbb.Text); //判断信息是否添加成功 if (DBHepler.ExecuteNonQuery(str) && DBHepler.ExecuteNonQuery(waterSQL) && DBHepler.ExecuteNonQuery(propertyfeeSQL) && DBHepler.ExecuteNonQuery(electricSQL) && DBHepler.ExecuteNonQuery(upSql)) { //查询入住数量 string shu = string.Format("select totality,yezhnum from property_table where village_name='{0}' and building_number='{1}'", xqname_cbb.Text, ldname_cbb.Text); ds = DBHepler.GetDataSet(shu); int one = int.Parse(ds.Tables[0].Rows[0][0].ToString()); int two = int.Parse(ds.Tables[0].Rows[0][1].ToString()); int cha = one - two; string updateSQL = string.Format("update property_table set idle = '{0}' where village_name = '{1}' and building_number = '{2}'", cha, xqname_cbb.Text, ldname_cbb.Text); if (DBHepler.ExecuteNonQuery(updateSQL)) { MessageBox.Show("添加成功,恭喜成为本小区的一员!", "提示"); //添加成功后清空文本框 xqname_cbb.Text = ""; ldname_cbb.Text = ""; room_tb.Text = ""; yename_tb.Text = ""; phone_tb.Text = ""; shenfen_tb.Text = ""; //添加成功后刷新列表 string sql = "select * from owner_info_table"; ds = DBHepler.GetDataSet(sql); dgv_Owner.AutoGenerateColumns = false; //取消自动生成列 dgv_Owner.DataSource = ds.Tables[0]; //绑定数据源 return; } } } catch (Exception) { MessageBox.Show("该房间已经卖出,不可重复添加!"); } }
//查询按钮点击事件 private void btn_select_Click(object sender, EventArgs e) { DataSet dt = new DataSet(); string selectsql = string.Format("select * from stopcar_table where car_number like '%{0}%'", tb_refer.Text); dt = DBHepler.GetDataSet(selectsql); dgv_stopcar.DataSource = dt.Tables[0]; //绑定数据源 dgv_stopcar.Columns["stopcar_id"].Visible = false; //隐藏ID列 }
//查询整张表的方法 public void zhengzhang() { //查询投诉表以及状态表 string selectSql = string.Format("select * from complain_register_table crt join complain_state_table cst on crt.complain_name=cst.complain_name"); ds = DBHepler.GetDataSet(selectSql); //取消自动生成列 info_dgv.AutoGenerateColumns = false; info_dgv.DataSource = ds.Tables[0];//绑定数据源 }
//刷新按钮点击事件 private void refresh_Click_1(object sender, EventArgs e) { string StarSql = "select * from repair_application_table ret join repair_record_table rrt on ret.proposer_name=rrt.proposer_name"; DS = DBHepler.GetDataSet(StarSql); //取消自动生成列 data_repairs.AutoGenerateColumns = false; data_repairs.DataSource = DS.Tables[0];//绑定数据源 text2.Text = data_repairs.Rows.Count.ToString(); }
private void Home_page_Enter_1(object sender, EventArgs e) { //刷新当前表中的数据 string Sql = string.Format("select * from property_table"); ds = DBHepler.GetDataSet(Sql); //取消自动生成列 tower_list.AutoGenerateColumns = false; tower_list.DataSource = ds.Tables[0];//绑定数据源 }
private void btn_c_Click(object sender, EventArgs e) { if (cbb_ty.Text == "已受理") { //查询保修记录SQL语句 string QuerSql = string.Format("select * from repair_application_table ret join repair_record_table rrt on ret.proposer_name=rrt.proposer_name where rrt.repaircondition='{0}' ", cbb_ty.Text); ds = DBHepler.GetDataSet(QuerSql); //取消自动生成列 data_repairs.AutoGenerateColumns = false; //填充数据集 data_repairs.DataSource = ds.Tables[0]; text2.Text = data_repairs.Rows.Count.ToString(); if (ds.Tables[0].Rows.Count <= 0) { text2.Text = data_repairs.Rows.Count.ToString(); MessageBox.Show("未找到相关信息!", "提示"); return; } } if (cbb_ty.Text == "受理中") { //查询关键字为‘受理中’的报修记录SQL语句 string QuerSql2 = string.Format("select * from repair_application_table ret join repair_record_table rrt on ret.proposer_name=rrt.proposer_name where rrt.repaircondition='{0}' ", cbb_ty.Text); ds = DBHepler.GetDataSet(QuerSql2); //取消自动生成列 data_repairs.AutoGenerateColumns = false; //填充数据集 data_repairs.DataSource = ds.Tables[0]; text2.Text = data_repairs.Rows.Count.ToString(); if (ds.Tables[0].Rows.Count <= 0) { text2.Text = data_repairs.Rows.Count.ToString(); MessageBox.Show("未找到相关信息!", "提示"); return; } } if (cbb_ty.Text == "全部") { //查询关键字为‘全部’的报修记录SQL语句 string QuerSql3 = string.Format("select * from repair_application_table ret join repair_record_table rrt on ret.proposer_name=rrt.proposer_name "); ds = DBHepler.GetDataSet(QuerSql3); //取消自动生成列 data_repairs.AutoGenerateColumns = false; //填充数据集 data_repairs.DataSource = ds.Tables[0]; text2.Text = data_repairs.Rows.Count.ToString(); if (ds.Tables[0].Rows.Count <= 0) { text2.Text = data_repairs.Rows.Count.ToString(); MessageBox.Show("未找到相关信息,请核对!", "提示"); return; } } }
private void Truck_space_Load(object sender, EventArgs e) { string sql = "select * from carport"; ds = DBHepler.GetDataSet(sql); dgv_car.AutoGenerateColumns = false; //取消自动生成列 dgv_car.DataSource = ds.Tables[0]; //绑定数据源 shuju(); shuju1(); shuju2(); }
private void Super_Admin_Load(object sender, EventArgs e) { super_lb.Text = info.num; /*由上至下窗体*/ Win32.AnimateWindow(this.Handle, 300, Win32.AW_VER_POSITIVE); string i = string.Format("select * from userinfo_table"); ds = DBHepler.GetDataSet(i); Admin_InFo.AutoGenerateColumns = false; Admin_InFo.DataSource = ds.Tables[0]; }
//刷新页面的方法 public void shuaxin() { //刷新页面 //Sql语句 string selectSql = string.Format("select * from property_table"); ds = DBHepler.GetDataSet(selectSql); //取消自动生成列 tower_list.AutoGenerateColumns = false; tower_list.DataSource = ds.Tables[0];//绑定数据源 }
private void User_Control_Load(object sender, EventArgs e) { //查询业主用户信息表 string Sql1 = "select * from Users"; ds = DBHepler.GetDataSet(Sql1); //取消自动生成列 dgv_u.AutoGenerateColumns = false; dgv_u.DataSource = ds.Tables[0]; //查询管理员信息表 }
//窗体加载事件 private void Repairs_Load(object sender, EventArgs e) { dateTime.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); string StarSql = "select * from repair_application_table ret join repair_record_table rrt on ret.proposer_name=rrt.proposer_name"; DS = DBHepler.GetDataSet(StarSql); //取消自动生成列 data_repairs.AutoGenerateColumns = false; data_repairs.DataSource = DS.Tables[0]; text2.Text = data_repairs.Rows.Count.ToString(); }
//窗体加载事件 private void Charge_Load(object sender, EventArgs e) { //查询水费表 电费表 物业管理费表SQL语句 string selectsql = string.Format("select * from owner_info_table a join electric_cost_table b on a.room_number=b.room_number join propertyfee_table c on a.room_number=c.room_number join watercost_table d on a.room_number=d.room_number"); DataSet dt = new DataSet(); dt = DBHepler.GetDataSet(selectsql); //取消自动生成列 dgv_info.AutoGenerateColumns = false; //绑定数据源 dgv_info.DataSource = dt.Tables[0]; }