/// <summary>
        /// 新增家教信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_add_Click(object sender, EventArgs e)
        {
            string mysql   = "";
            int    tempnum = 0;

            if (dgv_search.SelectedRows.Count > 0)
            {
                dgv_search.SelectedRows[0].Selected = false;
            }
            //重置tutoring1
            tutoring1.reset();
            insertstate = true;



            //数据准备,初始化家长编号和打印编号
            //家长编号+1
            mysql = "select max(parent_num) from tutoring";
            try
            {
                tempnum = int.Parse(mydb.Returnafield(mysql)) + 1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "操作数据库出错!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            tutoring1.parent_num = tempnum.ToString();
            //打印编号+1
            mysql = "select max(print_num) from tutoring";
            try
            {
                tempnum = int.Parse(mydb.Returnafield(mysql)) + 1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "操作数据库出错!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            tutoring1.print_num = tempnum.ToString();
            //初始化缴费、家教状态和性别
            cbo_payment_state.SelectedItem = "无需缴纳";
            tutoring1.payment_state        = "无需缴纳";
            cbo_tutor_state.SelectedItem   = "接入";
            tutoring1.tutor_state          = "接入";
            rdo_man.Checked            = false;
            rdo_woman.Checked          = false;
            tutoring1.grade            = "不限";
            cbo_reception.SelectedItem = null;
            //判断数组非空
            btn_buss.Enabled       = false;
            btn_tutor_info.Enabled = false;
            showtutoring();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新增教员信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_add_Click(object sender, EventArgs e)
        {
            string mysql   = "";
            int    tempnum = 0;

            if (dgv_search.SelectedRows.Count > 0)
            {
                dgv_search.SelectedRows[0].Selected = false;
            }
            //重置tutor1
            tutor1.reset();
            insertstate = true;

            //数据准备,初始化教员编号
            //教员编号+1
            mysql = "select max(tutor_num) from tutor";
            try
            {
                tempnum = int.Parse(mydb.Returnafield(mysql)) + 1;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "操作数据库出错!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            tutor1.tutor_num = tempnum.ToString();

            //初始化学位和性别和是否黑名单
            cbo_degree.SelectedItem = null;
            rdo_man.Checked         = false;
            rdo_woman.Checked       = false;
            cbo_yesno.SelectedItem  = "否";
            //判断数组非空
            showtutor();
        }
Exemplo n.º 3
0
        private void btn_login_Click(object sender, EventArgs e)
        {
            objectclass.userinfo.username = txt_user.Text;
            objectclass.userinfo.password = txt_pwd.Text;
            string mysql = "";

            mysql = string.Format("select * from user where username='******' and password='******'", objectclass.userinfo.username, objectclass.userinfo.password);
            try
            {
                int i = mydb.Rownum(mysql);
                if (i == 0)
                {
                    MessageBox.Show("您输入的用户名或密码错误!请重试", "登录失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    txt_pwd.Text = "";
                    return;
                }
                else
                {
                    mysql = "select degree from user where username='******'";
                    objectclass.userinfo.degree = mydb.Returnafield(mysql);
                    this.Hide();
                    Form myform = new mainform();
                    myform.Show();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "操作数据库出错!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
Exemplo n.º 4
0
        private void mainform_Load(object sender, EventArgs e)
        {
            commondb mydb  = new commondb();
            string   mysql = "";
            string   name  = "";

            mysql = "select name from worker where worker_num='" + username + "'";
            int count = 0;

            try
            {
                count = mydb.Rownum(mysql);
                if (count > 0)
                {
                    name = mydb.Returnafield(mysql);
                    lbl_user_num.Text  = username;
                    lbl_user_name.Text = name;
                    lbl_admin.Visible  = false;
                }
                if (degree == "管理员")
                {
                    lbl_user_num.Text  = username;
                    lbl_user_name.Text = "";
                    lbl_admin.Visible  = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "操作数据库出错!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
        }
Exemplo n.º 5
0
        private void btn_yes_Click(object sender, EventArgs e)
        {
            string inputpwd = txt_pwd.Text.ToString();
            string mysql    = "";

            mysql = "select password from user where username='******'";
            string password = mydb.Returnafield(mysql);

            if (password == inputpwd)
            {
                admincheck(true);
                this.Close();
            }
            else
            {
                admincheck(false);
            }
        }