private void  除申请ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listview.SelectedItems.Count <= 0 || listview.SelectedItems[0].SubItems[1].Text == "")
     {
         MessageBox.Show("未选中任何一条服务!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         if (listview.SelectedItems[0].SubItems[5].Text == "已受理" || listview.SelectedItems[0].SubItems[5].Text == "已完成")
         {
             MessageBox.Show("该记录处于受理或完成状态,无法进行删除动作!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             if (DialogResult.OK == MessageBox.Show("确定删除([" + listview.SelectedItems[0].SubItems[1].Text + "]" + listview.SelectedItems[0].SubItems[2].Text + ")的所有信息吗?", "询问", MessageBoxButtons.OKCancel, MessageBoxIcon.Question))
             {
                 //确认删除数据
                 SQLClass.getsqlcom("delete from fuwu where id = '" + listview.SelectedItems[0].SubItems[1].Text + "'");
                 treeview_AfterSelect(sender, e);
                 SQLClass.con_close();       //关闭数据库连接,释放资源
                 MessageBox.Show("删除服务申请成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("操作已取消!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
     }
 }
        private void btn_ok_Click(object sender, EventArgs e)
        {
            if (txt_gongsi.Text != "" && txt_fuzeren.Text != "" && (txt_lianxi.Text != "" && Input_Regex.IsPhoneNum(txt_lianxi.Text)) && Convert.ToBoolean(txt_dizhi.Text.Count()))
            {
                switch (Form_Type)
                {
                case 0:
                    SqlDataReader dr    = SQLClass.getcom("select id from kaifashang where gongsi = '" + txt_gongsi.Text.ToString().Trim() + "'");
                    bool          ifcom = dr.Read();
                    if (ifcom)
                    {
                        MessageBox.Show("该开发商已存在,不能重复添加!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    SQLClass.getsqlcom("insert into kaifashang values ('" + txt_gongsi.Text.ToString().Trim() + "','" + txt_dizhi.Text.ToString().Trim() + "','" + txt_lianxi.Text.ToString().Trim() + "','" + txt_fuzeren.Text.ToString().Trim() + "')");
                    Form_OK = 1;            //操作完成
                    break;

                case 1:
                    SQLClass.getsqlcom("update kaifashang set gongsi = '" + txt_gongsi.Text.ToString().Trim() + "', fuzeren = '" + txt_fuzeren.Text.ToString().Trim() + "', lianxi = '" + txt_lianxi.Text.ToString().Trim() + "', dizhi = '" + txt_dizhi.Text.ToString().Trim() + "' where id = '" + kfsid + "'");
                    Form_OK = 1;
                    break;

                case 2:
                    Form_OK = 0;            //没有执行相关操作
                    break;
                }
                SQLClass.con_close();
                this.Close();
            }
            else
            {
                lab_message.Text = "操作失败,请检查你的输入是否正确!";
            }
        }
        private void btn_ok_Click(object sender, EventArgs e)
        {
            if (txt_jianzu.Text != "" && txt_dizhi.Text != "")
            {
                switch (Form_Type)
                {
                case 0:
                    SqlDataReader dr    = SQLClass.getcom("select id from fangchan where jianzu = '" + txt_jianzu.Text.ToString().Trim() + "'");
                    bool          ifcom = dr.Read();
                    if (ifcom)
                    {
                        MessageBox.Show("该楼房已存在,不能重复添加!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    SQLClass.getsqlcom("insert into fangchan values ('" + txt_jianzu.Text.ToString().Trim() + "','" + txt_dizhi.Text.ToString().Trim() + "','" + zhuangtai.KaifashangName(combox_kfs.SelectedItem.ToString(), false) + "','" + datetime_riqi.Text + "','" + txt_beizhu.Text.ToString().Trim() + "')");
                    Form_OK = 1;            //操作完成
                    break;

                case 1:
                    SQLClass.getsqlcom("update fangchan set jianzu = '" + txt_jianzu.Text.ToString().Trim() + "', dizhi = '" + txt_dizhi.Text.ToString().Trim() + "', kaifashangid = '" + zhuangtai.KaifashangName(combox_kfs.SelectedItem.ToString(), false) + "', shijian = '" + datetime_riqi.Text.ToString() + "', beizhu = '" + txt_beizhu.Text.ToString().Trim() + "' where id = '" + fcid + "'");
                    Form_OK = 1;
                    break;

                case 2:
                    Form_OK = 0;
                    break;
                }
                SQLClass.con_close();
                this.Close();
            }
            else
            {
                lab_messgae.Text = "操作失败,请检查你的输入是否正确!";
            }
        }
        public string KaifashangName(string num, bool isname)
        {
            string kaifashang;

            if (isname)
            {
                DataSet   DSet = SQLClass.getDataSet("select gongsi from kaifashang where id = '" + num + "'", "开发商信息表");
                DataTable dt   = DSet.Tables["开发商信息表"];
                if (dt.Rows.Count > 0)
                {
                    kaifashang = dt.Rows[0][0].ToString();
                }
                else
                {
                    kaifashang = null;
                }
            }
            else
            {
                DataSet   DSet = SQLClass.getDataSet("select id from kaifashang where gongsi = '" + num + "'", "开发商信息表");
                DataTable dt   = DSet.Tables["开发商信息表"];
                if (dt.Rows.Count > 0)
                {
                    kaifashang = dt.Rows[0][0].ToString();
                }
                else
                {
                    kaifashang = null;
                }
            }
            SQLClass.con_close();
            return(kaifashang);
        }
        private void btn_ok_Click(object sender, EventArgs e)
        {
            if ((txt_louceng.Tag.ToString() == "1") && (txt_peizhi.Tag.ToString() == "1") && (txt_yezhu.Tag.ToString() == "1") && (txt_shoufei.Tag.ToString() == "1"))
            {
                string zhufangzt;
                if (rad_wei.Checked)
                {
                    zhufangzt = "0";
                }
                else
                {
                    zhufangzt = "1";
                }
                switch (Form_Type)
                {
                case 0:
                    SQLClass.getsqlcom("insert into zhufang values ('" + txt_louceng.Text.ToString().Trim() + "','" + txt_peizhi.Text.ToString().Trim() + "','" + zhuangtai.YezhuName(txt_yezhu.Text.ToString().Trim(), false) + "','" + zhufangzt + "','" + zhuangtai.FangchanName(combox_fc.SelectedItem.ToString(), false) + "','" + txt_shoufei.Text.ToString().Trim() + "')");
                    Form_OK = 1;            //操作完成
                    break;

                case 1:
                    SQLClass.getsqlcom("update zhufang set louceng = '" + txt_louceng.Text.ToString().Trim() + "', peizhi = '" + txt_peizhi.Text.ToString().Trim() + "', yezhuid = '" + zhuangtai.YezhuName(txt_yezhu.Text.ToString().Trim(), false) + "', fangchanid = '" + zhuangtai.FangchanName(combox_fc.SelectedItem.ToString(), false) + "', shoufei = '" + txt_shoufei.Text.ToString().Trim() + "' where id = '" + zfid + "'");
                    Form_OK = 1;
                    break;

                case 2:
                    Form_OK = 0;
                    break;

                case 3:
                    if (txt_yezhu.Text == "")
                    {
                        lab_message.Text = "操作失败,请检查你的输入是否正确!";
                        return;
                    }
                    SQLClass.getsqlcom("update zhufang set yezhuid = '" + txt_yezhu.Text.ToString().Trim() + "', zhuangtai = '" + zhufangzt + "' where id = '" + zfid + "'");
                    yzfy += Convert.ToInt32(txt_shoufei.Text);
                    SQLClass.getsqlcom("update yezhu set feiyong = '" + yzfy + "' where id = '" + txt_yezhu.Text.ToString().Trim() + "'");
                    Form_OK = 1;
                    break;

                case 4:
                    SQLClass.getsqlcom("update zhufang set louceng = '" + txt_louceng.Text.ToString().Trim() + "', peizhi = '" + txt_peizhi.Text.ToString().Trim() + "', yezhuid = '" + zhuangtai.YezhuName(txt_yezhu.Text.ToString().Trim(), false) + "', zhuangtai = '" + zhufangzt + "', fangchanid = '" + zhuangtai.FangchanName(combox_fc.SelectedItem.ToString(), false) + "', shoufei = '" + txt_shoufei.Text.ToString().Trim() + "' where id = '" + zfid + "'");
                    Form_OK = 1;
                    break;
                }
                SQLClass.con_close();
                this.Close();
            }
            else
            {
                lab_message.Text = "操作失败,请检查你的输入是否正确!";
            }
        }
        private void btn_ok_Click(object sender, EventArgs e)
        {
            if (txt_gangwei.Tag.ToString() == "1" && txt_fuzeren.Tag.ToString() == "1" && combox_bm.Tag.ToString() == "1")
            {
                switch (Form_Type)
                {
                case 0:
                    SqlDataReader sdr   = SQLClass.getcom("select id from gangwei where bumen = '" + combox_bm.Text.ToString() + "' and gangwei = '" + txt_gangwei.Text.Trim() + "'");
                    bool          ifcom = sdr.Read();
                    if (ifcom)
                    {
                        lab_message.Text = "你输入的岗位已存在,请重新修改后提交!";
                        return;
                    }
                    else
                    {
                        SQLClass.getsqlcom("insert into gangwei values ('" + combox_bm.Text.ToString() + "', '" + txt_gangwei.Text.ToString().Trim() + "', '" + txt_fuzeren.Text.ToString().Trim() + "')");
                        Form_OK = 1;            //操作完成
                    }
                    break;

                case 1:
                    DataSet   gwDSet = SQLClass.getDataSet("select id from gangwei where bumen = '" + combox_bm.Text.ToString() + "' and gangwei = '" + txt_gangwei.Text.Trim() + "'", "岗位信息表");
                    DataTable gwdt   = gwDSet.Tables["岗位信息表"];
                    if (gwdt.Rows.Count > 0)
                    {
                        if (gwdt.Rows[0][0].ToString() != gwid)
                        {
                            lab_message.Text = "你修改的信息在已存在,请修改后再试!";
                            return;
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                    }
                    SQLClass.getsqlcom("update gangwei set bumen = '" + combox_bm.Text.ToString() + "', gangwei = '" + txt_gangwei.Text.Trim() + "', yuangongid = '" + txt_fuzeren.Text.Trim() + "' where id = '" + gwid + "'");
                    Form_OK = 1;
                    break;

                case 2:
                    Form_OK = 0;
                    break;
                }
                SQLClass.con_close();
                this.Close();
            }
            else
            {
                lab_message.Text = "操作失败,请检查你的输入是否正确!";
            }
        }
 private void btn_ok_Click(object sender, EventArgs e)
 {
     if (txt_bumen.Text == "")
     {
         MessageBox.Show("部门名称不能为空!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         SQLClass.getsqlcom("update gangwei set bumen = '" + txt_bumen.Text + "' where bumen = '" + bmname + "'");
     }
     SQLClass.con_close();
     Form_OK = 1;
     this.Close();
 }
        private void btn_ok_Click(object sender, EventArgs e)
        {
            if (txt_xingming.Tag.ToString() == "1" && txt_lianxi.Tag.ToString() == "1" && txt_zhuzhi.Tag.ToString() == "1" && txt_username.Tag.ToString() == "1" && txt_password1.Tag.ToString() == "1" && txt_password2.Tag.ToString() == "1")
            {
                if (rad_nan.Checked == true)
                {
                    rad_nan.Tag = "男";
                }
                else
                {
                    rad_nan.Tag = "女";
                }
                DataSet   okDSet = SQLClass.getDataSet("select id from gangwei where gangwei = '" + combox_gw.SelectedItem.ToString() + "' and bumen = '" + combox_bm.SelectedItem.ToString() + "'", "岗位信息表");
                DataTable okdt   = okDSet.Tables["岗位信息表"];
                switch (Form_Type)
                {
                case 0:
                    SQLClass.getsqlcom("insert into yuangong values ('" + txt_xingming.Text.Trim() + "', '" + rad_nan.Tag.ToString() + "', '" + okdt.Rows[0][0].ToString() + "', '" + txt_lianxi.Text.Trim() + "', '" + txt_zhuzhi.Text.Trim() + "', '0', '" + txt_username.Text.Trim() + "', '" + txt_password1.Text.Trim() + "')");
                    Form_OK = 1;
                    break;

                case 1:
                    if (txt_password1.Text == txt_password2.Text && txt_password1.Text == "" && txt_password2.Text == "")
                    {
                        SQLClass.getsqlcom("update yuangong set xingming = '" + txt_xingming.Text.Trim() + "', xingbie = '" + rad_nan.Tag.ToString() + "', gangweiid = '" + okdt.Rows[0][0].ToString() + "', lianxi = '" + txt_lianxi.Text.Trim() + "', dizhi = '" + txt_zhuzhi.Text.Trim() + "', username = '******' where id = '" + ygid + "'");
                    }
                    else
                    {
                        SQLClass.getsqlcom("update yuangong set xingming = '" + txt_xingming.Text.Trim() + "', xingbie = '" + rad_nan.Tag.ToString() + "', gangweiid = '" + okdt.Rows[0][0].ToString() + "', lianxi = '" + txt_lianxi.Text.Trim() + "', dizhi = '" + txt_zhuzhi.Text.Trim() + "', username = '******', password = '******' where id = '" + ygid + "'");
                    }
                    Form_OK = 1;
                    break;

                case 2:
                    Form_OK = 0;
                    break;
                }
                SQLClass.con_close();
                this.Close();
            }
            else
            {
                lab_message.Text = "操作失败,请检查你的输入是否正确!";
            }
        }
        private void btn_ok_Click(object sender, EventArgs e)
        {
            if (txt_shixiang.Tag.ToString() == "1" && txt_yuangong.Tag.ToString() == "1")
            {
                switch (Form_Type)
                {
                case 0:
                    SQLClass.getcom("insert into richang values ('" + txt_shixiang.Text.Trim() + "', '" + date_shijian.Text.ToString() + "', '0', '" + txt_yuangong.Text.Trim() + "', '" + txt_beizhu.Text.Trim() + "')");
                    Form_OK = 1;
                    break;

                case 1:
                    SQLClass.getcom("update richang set shixiang = '" + txt_shixiang.Text.Trim() + "',shijian = '" + date_shijian.ToString() + "', yuangongid = '" + txt_yuangong.Text.Trim() + ", beizhu = '" + txt_beizhu.Text.Trim() + "' where id = '" + rcid + "'");
                    Form_OK = 1;
                    break;

                case 2:
                    break;
                }
                SQLClass.con_close();
                this.Close();
            }
        }
        private void btn_ok_Click(object sender, EventArgs e)
        {
            switch (Form_Type)
            {
            case 0:
                if (txt_shixiang.Tag.ToString() == "1" && txt_jine.Tag.ToString() == "1" && txt_yezhu.Tag.ToString() == "1")
                {
                    //DataSet yzDSet = SQLClass.getDataSet("select feiyong from yezhu where id = '" + txt_yezhu.Text.Trim() + "'", "业主信息表");
                    //DataTable yzdt = yzDSet.Tables["业主信息表"];
                    //sfje = Convert.ToInt32(yzdt.Rows[0][0].ToString()) + Convert.ToInt32(txt_jine.Text.Trim());
                    //SQLClass.getsqlcom("update yezhu set feiyong = '" + sfje + "' where id = '" + txt_yezhu.Text.Trim() + "'");
                    SQLClass.getsqlcom("insert into shoufei values ('" + txt_shixiang.Text + "', '" + txt_jine.Text.Trim() + "', '0', '', '" + txt_yezhu.Text + "', '', '" + txt_beizhu.Text + "')");
                    Form_OK = 1;
                }
                else
                {
                    lab_message.Text = "操作失败,请检查后再试!";
                    return;
                }
                break;

            case 1:
                if (txt_shixiang.Tag.ToString() == "1" && txt_jine.Tag.ToString() == "1" && txt_yezhu.Tag.ToString() == "1")
                {
                    SQLClass.getsqlcom("update shoufei set shixiang = '" + txt_shixiang.Text + "', jine = '" + txt_jine.Text.Trim() + "', yezhuid = '" + txt_yezhu.Text.Trim() + "', beizhu = '" + txt_beizhu.Text + "' where id = '" + sfid + "'");
                    Form_OK = 1;
                }
                else
                {
                    lab_message.Text = "操作失败,请检查后再试!";
                    return;
                }
                break;

            case 2:

                break;

            case 3:
                if (txt_yuangong.Tag.ToString() == "1")
                {
                    DataSet   yzDSet = SQLClass.getDataSet("select feiyong from yezhu where id = '" + txt_yezhu.Text.Trim() + "'", "业主信息表");
                    DataTable yzdt   = yzDSet.Tables["业主信息表"];
                    if (yzdt.Rows.Count > 0)
                    {
                        sfje = Convert.ToInt32(yzdt.Rows[0][0].ToString()) - Convert.ToInt32(txt_jine.Text);
                    }
                    SQLClass.getsqlcom("update shoufei set shijian = '" + date_shijian.Text.ToString() + "', yuangongid = '" + txt_yuangong.Text.Trim() + "', leixing = '1' where id = '" + sfid + "'");
                    SQLClass.getsqlcom("update yezhu set feiyong = '" + sfje + "' where id = '" + txt_yezhu.Text.Trim() + "'");
                    Form_OK = 1;
                }
                else
                {
                    lab_message.Text = "操作失败,请检查后再试!";
                    return;
                }
                break;
            }
            SQLClass.con_close();
            this.Close();
        }
        private void btn_ok_Click(object sender, EventArgs e)
        {
            switch (Form_Type)
            {
            case 0:
                if (txt_shixiang.Tag.ToString() == "1" && txt_yezhu.Tag.ToString() == "1")
                {
                    SQLClass.getsqlcom("insert into fuwu values ('" + txt_shixiang.Text.Trim() + "', '" + txt_yezhu.Text.Trim() + "', '" + DateTime.Now.Date.ToShortDateString() + "', '0', '', '', '', '')");
                }
                else
                {
                    lab_message.Text = "操作失败,请检查你的输入!";
                    return;
                }
                Form_OK = 1;
                break;

            case 1:
                if (txt_shixiang.Tag.ToString() == "1" && txt_yezhu.Tag.ToString() == "1")
                {
                    SQLClass.getsqlcom("update fuwu set shixiang = '" + txt_shixiang.Text.Trim() + "', yezhuid = '" + txt_yezhu.Text.Trim() + "', shenqing = '" + DateTime.Now.Date.ToShortDateString() + "' where id = '" + fwid + "'");
                }
                else
                {
                    lab_message.Text = "操作失败,请检查你的输入!";
                    return;
                }
                Form_OK = 1;
                break;

            case 2:
                if (txt_yuangong.Tag.ToString() == "1")
                {
                    SQLClass.getsqlcom("update fuwu set yuangongid = '" + txt_yuangong.Text.Trim() + "', queren = '" + DateTime.Now.Date.ToShortDateString() + "', zhuangtai = '1' where id = '" + fwid + "'");
                }
                else
                {
                    lab_message.Text = "操作失败,请检查你的输入!";
                    return;
                }
                Form_OK = 1;
                break;

            case 3:
                if (txt_shoufei.Tag.ToString() == "1")
                {
                    DataSet   yzDSet = SQLClass.getDataSet("select feiyong from yezhu where id = '" + txt_yezhu.Text.Trim() + "'", "业主信息表");
                    DataTable yzdt   = yzDSet.Tables["业主信息表"];
                    if (yzdt.Rows.Count > 0)
                    {
                        sfje = Convert.ToInt32(yzdt.Rows[0][0].ToString()) + Convert.ToInt32(txt_shoufei.Text.Trim());
                    }
                    SQLClass.getsqlcom("update yezhu set feiyong = '" + sfje + "' where id = '" + txt_yezhu.Text.Trim() + "'");
                    SQLClass.getsqlcom("update fuwu set shoufei = '" + txt_shoufei.Text.Trim() + "', zhuangtai = '2', wancheng = '" + DateTime.Now.Date.ToShortDateString() + "' where id = '" + fwid + "'");
                }
                else
                {
                    lab_message.Text = "操作失败,请检查你的输入!";
                    return;
                }
                Form_OK = 1;
                break;

            case 4:
                if (txt_shixiang.Tag.ToString() == "1")
                {
                    SQLClass.getsqlcom("insert into fuwu values ('" + txt_shixiang.Text.Trim() + "', '" + txt_yezhu.Text.Trim() + "', '" + DateTime.Now.Date.ToShortDateString() + "', '0', '', '', '', '')");
                }
                else
                {
                    lab_message.Text = "操作失败,请检查你的输入!";
                    return;
                }
                Form_OK = 1;
                break;

            case 5:
                if (txt_shixiang.Tag.ToString() == "1")
                {
                    SQLClass.getsqlcom("update fuwu set shixiang = '" + txt_shixiang.Text.Trim() + "', shenqing = '" + DateTime.Now.Date.ToShortDateString() + "' where id = '" + fwid + "'");
                }
                else
                {
                    lab_message.Text = "操作失败,请检查你的输入!";
                    return;
                }
                Form_OK = 1;
                break;
            }
            SQLClass.con_close();
            this.Close();
        }