コード例 #1
0
ファイル: uc.cs プロジェクト: upc2018-2019-3/Team13Proj
        private void 预约挂号ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            register frm = new register();

            frm.Show();
        }
コード例 #2
0
        private void btncancle_Click(object sender, EventArgs e)    //取消按钮
        {
            this.Dispose();                                         //此窗体隐藏
            register obj = new register();                          //挂号查询窗体出现

            obj.Show();
        }
コード例 #3
0
        private void btnok_Click(object sender, EventArgs e)      //确定按钮
        {
            SqlConnection con = DBhelper.Gethelper();

            con.Open();
            string sid  = Convert.ToString(register.Num);           //声明sid变量获取强转String后的register类的Num变量
            string sid1 = sid + "|";                                //声明sid1变量获取sid和"|"
            int    tem  = 0;                                        //声明int型的tem变量

            if (dataGridView1.SelectedCells.Count == 0)             //判断用户有未选择dataGridView的单元格
            {
                MessageBox.Show("请选择一个医生!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else                                                    //获取当前选中的这一行第一个单元格的值,obj型转为String后强转int型用tem接收
            {
                tem = int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString());
                string     sql1 = "select friend from Friend where id='" + tem + "'"; //查询条件为医生的id
                SqlCommand com  = new SqlCommand(sql1, con);
                try
                {
                    string bianhao = com.ExecuteScalar().ToString();                         //用string型bianhao变量接收返回的值
                    string sidd    = bianhao + sid1;                                         //将bianhao和sid1变量赋给sidd
                    sql1 = "update Friend set friend='" + sidd + "' where id='" + tem + "'"; //将sidd的值更新到条件为该医生id号的行friend的列
                    Getz(sql1);                                                              //调用 Getz方法执行
                    MessageBox.Show("挂号成功!");                                                //成功后返回查询挂号窗体
                    register obj = new register();
                    obj.Show();
                    this.Hide();                                      //该窗体隐藏
                }
                catch (Exception)
                {
                    MessageBox.Show("选择有错", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            con.Close();                                           //关闭连接
        }
コード例 #4
0
        private void land_Click(object sender, EventArgs e)
        {
            try
            {
                //判断用户名,密码,登陆类型不能为空
                if (this.num.Text.Trim() == "")
                {
                    MessageBox.Show("请输入用户名");
                    this.Focus();
                    return;
                }
                else if (this.pwdText.Text.Trim() == "")
                {
                    MessageBox.Show("请输入密码");
                    this.Focus();
                    return;
                }
                else if (this.userType.Text.Trim() == "")
                {
                    MessageBox.Show("用户类型不能为空");
                    this.Focus();
                    return;
                }
            }
            catch
            {
                throw;
            }
            denglu = Convert.ToInt32(this.num.Text.Trim()); //将文本框的值付给静态变量
            //当登陆类型为挂号台时并且获取正确的帐号与密码就跳转挂号台窗体
            if (this.userType.Text == "挂号台")
            {
                string sql = "select count(*) from dbo.login where uid='" + this.num.Text.Trim().ToString() + "'and pwd='" + this.pwdText.Text.Trim().ToString() + "' and type='挂号台'";

                bool yn = loginType(sql);//调用loginType方法
                if (yn == true)
                {
                    register objreg = new register();
                    objreg.Show();
                }
                else
                {
                    MessageBox.Show("帐号或密码错误!");
                    return;
                }
            }
            //当登陆类型为医生时并且获取正确的帐号与密码就跳转到医生窗体
            if (this.userType.Text == "医生")
            {
                string sql = "select count(*) from dbo.login where uid='" + this.num.Text.Trim().ToString() + "'and pwd='" + this.pwdText.Text.Trim().ToString() + "'and type='医生'";

                bool yn = loginType(sql);//调用loginType方法
                if (yn == true)
                {
                    sql = "update [login] set stata='0' where uid='" + denglu + "'";
                    if (Mindoc.Getzsgc(sql))//调用方法执行SQL语句
                    {
                        Mindoc objmin = new Mindoc();
                        objmin.Show();//打开医生窗体
                    }
                }
                else
                {
                    MessageBox.Show("帐号或密码错误!");
                    return;
                }
            }
            this.Hide();//本窗体隐藏
        }