private void txt_yuangong_Leave(object sender, EventArgs e)
 {
     txt_yuangong.Tag = "0";
     if (txt_yuangong.Text == "")
     {
         lab_m_yuangong.Text      = "输入的日常事项名称不能为空!";
         lab_m_yuangong.ForeColor = Color.Red;
     }
     else
     {
         DataSet   DSet = SQLClass.getDataSet("select xingming from yuangong where id = '" + txt_yuangong.Text.Trim() + "'", "员工信息表");
         DataTable dt   = DSet.Tables["员工信息表"];
         if (dt.Rows.Count > 0)
         {
             lab_m_yuangong.Text      = "该ID的员工姓名为:" + dt.Rows[0][0].ToString();
             lab_m_yuangong.ForeColor = Color.Black;
             txt_yuangong.Tag         = "1";
         }
         else
         {
             lab_m_yuangong.Text      = "输入员工ID不存在!";
             lab_m_yuangong.ForeColor = Color.Red;
         }
     }
 }
        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);
        }
        public void LoadInfo()
        {
            DataSet   DSet = SQLClass.getDataSet("select * from gangwei where id = '" + gwid + "'", "岗位信息表");
            DataTable dt   = DSet.Tables["岗位信息表"];

            if (dt.Rows.Count > 0)
            {
                txt_fuzeren.Text = dt.Rows[0][3].ToString();
                txt_gangwei.Text = dt.Rows[0][2].ToString();
            }
        }
        public void LoadInfo()
        {
            DataSet   DSet = SQLClass.getDataSet("select shixiang,yezhuid,yuangongid,shoufei from fuwu where id = '" + fwid + "'", "服务信息表");
            DataTable dt   = DSet.Tables["服务信息表"];

            if (dt.Rows.Count > 0)
            {
                txt_shixiang.Text = dt.Rows[0][0].ToString();
                txt_yezhu.Text    = dt.Rows[0][1].ToString();
                txt_yuangong.Text = dt.Rows[0][2].ToString();
                txt_shoufei.Text  = dt.Rows[0][3].ToString();
            }
        }
        public void LoadInfo()
        {
            DataSet   DSet = SQLClass.getDataSet("select * from shoufei where id = '" + sfid + "'", "收费信息表");
            DataTable dt   = DSet.Tables["收费信息表"];

            if (dt.Rows.Count > 0)
            {
                txt_shixiang.Text = dt.Rows[0][1].ToString();
                txt_jine.Text     = dt.Rows[0][2].ToString();
                date_shijian.Text = dt.Rows[0][4].ToString();
                txt_yezhu.Text    = dt.Rows[0][5].ToString();
                txt_yuangong.Text = dt.Rows[0][6].ToString();
                txt_beizhu.Text   = dt.Rows[0][7].ToString();
            }
        }
Beispiel #6
0
        public string SearchYezhuName(string name, bool needwhere, string splitcon)
        {
            string    link = "";
            DataSet   DSet = SQLClass.getDataSet("select id from yezhu where xingming like '%" + name + "%'", "业主信息表");
            DataTable dt   = DSet.Tables["业主信息表"];

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    switch (splitcon)
                    {
                    case "yz":
                        if (needwhere)
                        {
                            needwhere = false;
                            link     += " where ( id = '" + dt.Rows[i][0].ToString() + "'";
                        }
                        else
                        {
                            if (i == 0)
                            {
                                link += " and ( id = '" + dt.Rows[i][0].ToString() + "'";
                            }
                            else
                            {
                                link += " or id = '" + dt.Rows[i][0].ToString() + "'";
                            }
                        }
                        break;

                    default:
                        if (needwhere)
                        {
                            needwhere = false;
                            link     += " where ( yezhuid = '" + dt.Rows[i][0].ToString() + "'";
                        }
                        else
                        {
                            if (i == 0)
                            {
                                link += " and ( yezhuid = '" + dt.Rows[i][0].ToString() + "'";
                            }
                            else
                            {
                                link += " or yezhuid = '" + dt.Rows[i][0].ToString() + "'";
                            }
                        }
                        break;
                    }
                }
                link += " )";
            }
            else
            {
                link = "";
            }
            return(link);
        }
        private void LoadInfo()
        {
            //创建一个DataSet对象,并把SQL的查询结果赋值给DSet
            DataSet   Dset = SQLClass.getDataSet("select * from kaifashang where id = '" + kfsid + "'", "开发商信息");
            DataTable dt   = Dset.Tables["开发商信息"];      //创建一个DataTable对象

            txt_gongsi.Text  = dt.Rows[0][1].ToString();
            txt_fuzeren.Text = dt.Rows[0][4].ToString();
            txt_lianxi.Text  = dt.Rows[0][3].ToString();
            txt_dizhi.Text   = dt.Rows[0][2].ToString();
        }
        public void LoadInfo()
        {
            DataSet   DSet = SQLClass.getDataSet("select * from yuangong where id = '" + ygid + "'", "员工信息表");
            DataTable dt   = DSet.Tables["员工信息表"];

            if (dt.Rows.Count > 0)
            {
                txt_xingming.Text = dt.Rows[0][1].ToString();
                if (dt.Rows[0][2].ToString() == "男")
                {
                    rad_nan.Checked = true;
                }
                else
                {
                    rad_nv.Checked = true;
                }
                txt_lianxi.Text   = dt.Rows[0][4].ToString();
                txt_zhuzhi.Text   = dt.Rows[0][5].ToString();
                txt_username.Text = dt.Rows[0][7].ToString();
            }
        }
        public int kfs()
        {
            int num = 0;

            combox_kfs.Items.Clear();
            DataSet   DSet = SQLClass.getDataSet("select gongsi from kaifashang", "开发商信息表");
            DataTable dt   = DSet.Tables["开发商信息表"];

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i][0].ToString() == kfsname)
                    {
                        num = i;
                    }
                    combox_kfs.Items.Add(dt.Rows[i][0].ToString());
                }
            }
            return(num);
        }
        public void LoadInfo()
        {
            DataSet   DSet = SQLClass.getDataSet("select * from zhufang where id = '" + zfid + "'", "住房信息表");
            DataTable dt   = DSet.Tables["住房信息表"];

            if (dt.Rows.Count > 0)
            {
                txt_louceng.Text = dt.Rows[0][1].ToString();
                txt_peizhi.Text  = dt.Rows[0][2].ToString();
                txt_yezhu.Text   = zhuangtai.YezhuName(dt.Rows[0][3].ToString(), true);
                if (zhuangtai.Zhufang(dt.Rows[0][4].ToString()) == "已入住")
                {
                    rad_yi.Checked = true;
                }
                else
                {
                    rad_wei.Checked = true;
                }
                fcname           = zhuangtai.FangchanName(dt.Rows[0][5].ToString(), true);
                txt_shoufei.Text = dt.Rows[0][6].ToString();
            }
        }
        //更新列表--------------------------
        private void UpdateListview(string sql)     //加载listview中的数据,其中sql参数表示传递的SQL的语句
        {
            DataSet   DSet = SQLClass.getDataSet(sql, "服务信息表");
            DataTable dt   = DSet.Tables["服务信息表"];      //创建一个DataTable对象

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string       ygname      = zhuangtai.YuangongName(dt.Rows[i][6].ToString(), true);
                string       fwzhuangtai = zhuangtai.Fuwu(dt.Rows[i][4].ToString());
                string[]     item        = { (i + 1).ToString(), dt.Rows[i][0].ToString(), dt.Rows[i][1].ToString(), yzxm, dt.Rows[i][3].ToString(), fwzhuangtai, dt.Rows[i][5].ToString(), ygname, dt.Rows[i][7].ToString(), dt.Rows[i][8].ToString() + "元" };
                ListViewItem newitem     = new ListViewItem(item);
                newitem.ImageIndex = 9;       //设置数据行的图标
                listview.Items.Add(newitem);
            }
        }
 private void btn_ok_Click(object sender, EventArgs e)
 {
     if (Input_Regex.IsNumAndEnCh(txt_username.Text) && txt_username.Text != "请输入用户名")
     {
         if (txt_password.Text != "请输入密码")
         {
             if (txt_username.Text != null && txt_password.Text != null)
             {
                 lab_message.Text = "正在尝试登陆,请稍后......";
                 if (picbox_header.Tag.ToString() == "yuangong")
                 {
                     DataSet   ygDSet = SQLClass.getDataSet("select * from yuangong where username = '******' and password = '******'", "员工信息表");
                     DataTable ygdt   = ygDSet.Tables["员工信息表"];
                     if (ygdt.Rows.Count > 0)
                     {
                         if (ygdt.Rows[0][6].ToString() == "0")
                         {
                             lab_message.Text = "你不是管理员不能够登录该系统!";
                             return;
                         }
                         else if (ygdt.Rows[0][6].ToString() == "1" || ygdt.Rows[0][6].ToString() == "2")
                         {
                             this.Visible = false;
                             Main_Yuangong_Form mainForm = new Main_Yuangong_Form();
                             DataSet            gwDSet   = SQLClass.getDataSet("select * from gangwei where id = '" + ygdt.Rows[0][3].ToString() + "'", "岗位信息表");
                             DataTable          gwdt     = gwDSet.Tables["岗位信息表"];
                             mainForm.glyid  = Convert.ToInt32(ygdt.Rows[0][0].ToString());
                             mainForm.glyxm  = ygdt.Rows[0][1].ToString();
                             mainForm.glyxb  = ygdt.Rows[0][2].ToString();
                             mainForm.glybm  = gwdt.Rows[0][1].ToString();
                             mainForm.glygw  = gwdt.Rows[0][2].ToString();
                             mainForm.glylx  = ygdt.Rows[0][4].ToString();
                             mainForm.glydz  = ygdt.Rows[0][5].ToString();
                             mainForm.glyqx  = Convert.ToInt32(ygdt.Rows[0][6].ToString());
                             mainForm.glyyhm = ygdt.Rows[0][7].ToString();
                             mainForm.ShowDialog();      //显示主窗体
                             if (mainForm.changeuser)
                             {
                                 txt_username.Text         = "请输入用户名";
                                 txt_password.Text         = "请输入密码";
                                 lab_message.Text          = "";
                                 txt_password.PasswordChar = Convert.ToChar(0);
                                 txt_username.ForeColor    = Color.Gray;
                                 txt_password.ForeColor    = Color.Gray;
                                 btn_ok.Focus();
                                 this.Visible = true;
                             }
                             else
                             {
                                 Application.Exit();
                             }
                         }
                     }
                     else
                     {
                         lab_message.Text = "登录失败,请检查你的用户名或密码是否正确!";
                         return;
                     }
                 }
                 else if (picbox_header.Tag.ToString() == "yezhu")
                 {
                     DataSet   yzDSet = SQLClass.getDataSet("select * from yezhu where username = '******' and password = '******'", "业主信息表");
                     DataTable yzdt   = yzDSet.Tables["业主信息表"];
                     if (yzdt.Rows.Count > 0)
                     {
                         if (yzdt.Rows[0][6].ToString() == "0")
                         {
                             lab_message.Text = "你的账号尚未通过管理员的审核,暂时不能登录!";
                             return;
                         }
                         else if (yzdt.Rows[0][6].ToString() == "1")
                         {
                             this.Visible = false;
                             Main_Yezhu_Form mainForm = new Main_Yezhu_Form();
                             mainForm.yzid  = Convert.ToInt32(yzdt.Rows[0][0].ToString());
                             mainForm.yzxm  = yzdt.Rows[0][1].ToString();
                             mainForm.yzxb  = yzdt.Rows[0][2].ToString();
                             mainForm.yzlx  = yzdt.Rows[0][3].ToString();
                             mainForm.yzzz  = yzdt.Rows[0][4].ToString();
                             mainForm.yzsfz = yzdt.Rows[0][5].ToString();
                             mainForm.yzqx  = Convert.ToInt32(yzdt.Rows[0][6].ToString());
                             mainForm.yzyhm = yzdt.Rows[0][7].ToString();
                             mainForm.yzfy  = Convert.ToInt32(yzdt.Rows[0][9].ToString());
                             mainForm.ShowDialog();
                             if (mainForm.changeuser)
                             {
                                 txt_username.Text         = "请输入用户名";
                                 txt_password.Text         = "请输入密码";
                                 lab_message.Text          = "";
                                 txt_password.PasswordChar = Convert.ToChar(0);
                                 txt_username.ForeColor    = Color.Gray;
                                 txt_password.ForeColor    = Color.Gray;
                                 btn_ok.Focus();
                                 this.Visible = true;
                             }
                             else
                             {
                                 Application.Exit();
                             }
                         }
                         else if (yzdt.Rows[0][6].ToString() == "2")
                         {
                             lab_message.Text = "你的账号处于禁用状态,不能登录!";
                             return;
                         }
                     }
                     else
                     {
                         lab_message.Text = "登录失败,请检查你的用户名或密码是否正确!";
                         return;
                     }
                 }
             }
             else
             {
                 lab_message.Text = "请检查您的用户名是否正确。";
             }
         }
         else
         {
             lab_message.Text = "请输入正确的密码。";
         }
     }
     else
     {
         lab_message.Text = "请输入正确的用户名。";
     }
 }