Esempio n. 1
0
        public virtual void lbSaff_Click(object sender, EventArgs e)
        {
            ManageSaff saff = new ManageSaff();

            saff.JobNum  = this.JobNum;
            saff.L       = this.L;
            saff.JobName = this.JobName;
            saff.Show();
            this.Dispose();
        }
Esempio n. 2
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            ManageSaff saff = new ManageSaff();

            saff.L       = this.L;
            saff.JobNum  = this.Job;
            saff.JobName = this.JobName;
            saff.Show();
            this.Dispose();
        }
Esempio n. 3
0
        private void lbSaff_Click(object sender, EventArgs e)
        {
            ManageSaff saff = new ManageSaff();

            saff.JobNum     = jobNum;
            saff.L          = l;
            saff.UserStatus = this.UserStatus;
            saff.JobName    = this.JobName;
            saff.Show();
            this.Dispose();
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string name      = this.textName.Text.Trim();
            string number    = this.textNumber.Text.Trim();
            string cardNo    = this.textCardNo.Text.Trim();
            int    sex       = 0;
            int    status    = 0;
            string strSex    = (string)this.comboSex.SelectedItem;
            string strStatus = (string)this.comboStatus.SelectedItem;

            if (strSex == "男")
            {
                sex = (int)Enums.man;
            }
            else
            {
                sex = (int)Enums.woman;
            }

            if (strStatus == "管理员")
            {
                status = (int)Enums.manage;
            }
            else
            {
                status = (int)Enums.staff;
            }

            Random rd        = new Random();
            string jobNum    = rd.Next(10000, 100000).ToString();
            string password  = jobNum;
            string addJobNum = this.Job;
            string endDate   = DateTime.Now.ToString("yyyy-MM-dd");

            if (name != "" && number != "" && cardNo != "" && cardNo.Length <= 18 && number.Length <= 11)
            {
                using (mysql.Conn)
                {
                    mysql.Conn.Open();
                    string sql = string.Format("insert into users(jobNum,name,number,cardNo,sex,status,endDate,addJobNum,password) values('{0}','{1}','{2}','{3}',{4},{5},'{6}','{7}','{8}')",
                                               jobNum, name, number, cardNo, sex, status, endDate, addJobNum, password);
                    mysql.Comd = new MySqlCommand(sql, mysql.Conn);
                    int index = mysql.Comd.ExecuteNonQuery();
                    if (index > 0)
                    {
                        ManageSaff saff = new ManageSaff();
                        saff.L       = this.L;
                        saff.JobNum  = this.Job;
                        saff.JobName = this.JobName;
                        saff.Messge  = "添加成功!";
                        saff.Show();
                        this.Dispose();
                    }
                    else
                    {
                        MessageBox.Show("职工添加失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("必填项不能为空!");
            }
        }