コード例 #1
0
        public void checkClassFeesPaid()
        {
            try
            {
                MysqlConn msc2 = new MysqlConn();
                msc2.query = "select * from escolaya_db.class_fee where month=" + DateTime.Now.ToString("MM") + " and student_id=" + studentId;

                MySqlConnection conn = new MySqlConnection(msc2.con);
                conn.Open();
                msc2.command = new MySqlCommand(msc2.query, conn);
                msc2.mdr     = msc2.command.ExecuteReader();

                while (msc2.mdr.Read())
                {
                    if (msc2.mdr["id"] != DBNull.Value)
                    {
                        return;
                    }
                }
                pictureBox2.Visible = true;
            }
            catch (Exception ex)
            {
            }
        }
コード例 #2
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            Random rnd     = new Random();
            int    barcode = rnd.Next(100000000, 900000000);

            byte[]       imageBt = null;
            FileStream   fStream = new FileStream(picPath, FileMode.Open, FileAccess.Read);
            BinaryReader br      = new BinaryReader(fStream);

            imageBt = br.ReadBytes((int)fStream.Length);


            MysqlConn       sql         = new MysqlConn();
            string          query       = "insert into escolaya_db.student(full_name,dob,address,email,gender,nic,contact_no,parent_contact_no,class,added_date,barcode,image) values('" + txtfname.Text + "','" + dateTimePicker1.Value.ToString("dd-MM-yyyy") + "','" + txtaddress.Text + "','" + txtemail.Text + "','" + gender + "','" + txtnic.Text + "','" + txtcontactno.Text + "','" + txtpcontactno.Text + "','" + comboclass.Text + "','" + DateTime.Now.ToString() + "','" + barcode.ToString() + "',@IMG)";
            MySqlConnection conDatabase = new MySqlConnection(sql.con);
            MySqlCommand    cmdDatabase = new MySqlCommand(query, conDatabase);
            MySqlDataReader myReader;


            //try {

            conDatabase.Open();
            cmdDatabase.Parameters.Add(new MySqlParameter("@IMG", imageBt));
            myReader = cmdDatabase.ExecuteReader();


            PopupNotifier popup = new PopupNotifier();

            popup.HeaderColor  = Color.DarkSlateGray;
            popup.HeaderHeight = 20;
            popup.TitleText    = "Register New Student";

            //popup.TitleFont = new Font(FontFamily.GenericSansSerif, 12.0f,FontStyle.Regular);

            popup.ContentText  = "New user added successfully!!!";
            popup.ContentColor = Color.DarkSlateGray;

            popup.Popup();

            while (myReader.Read())
            {
            }
            FrmAutogenCard card = new FrmAutogenCard(barcode.ToString(), txtfname.Text, barcode.ToString());

            card.Viewcard(txtfname.Text, txtaddress.Text, dateTimePicker1.Value.ToString("dd-MM-yyyy"), picPath);
            card.getClassDetails();
            card.ShowDialog();



            //}

            //catch (Exception ex) {



            //}
        }
コード例 #3
0
        private void txtbarcode_leave(object sender, EventArgs e)
        {
            try
            {
                MysqlConn msc = new MysqlConn();
                msc.query = "select full_name from escolaya_db.student where barcode=" + txtbarcode.Text;

                MySqlConnection conn = new MySqlConnection(msc.con);
                conn.Open();
                msc.command = new MySqlCommand(msc.query, conn);
                msc.mdr     = msc.command.ExecuteReader();

                msc.mdr.Read();

                lblname.Text = msc.mdr.GetString("full_name");
            }
            catch (Exception ex)
            {
            }
        }
コード例 #4
0
        public void getClassDetails()
        {
            try
            {
                MysqlConn msc = new MysqlConn();
                msc.query = "select institute_name,institute_address from escolaya_db.institute_detail";

                MySqlConnection conn = new MySqlConnection(msc.con);
                conn.Open();
                msc.command = new MySqlCommand(msc.query, conn);
                msc.mdr     = msc.command.ExecuteReader();

                while (msc.mdr.Read())
                {
                    lblinstitutename.Text    = msc.mdr.GetString("institute_name");
                    lblinstituteaddress.Text = msc.mdr.GetString("institute_address");
                }

                conn.Close();
            }
            catch (Exception ex)
            {
            }
        }
コード例 #5
0
        public void fillClass()
        {
            try
            {
                MysqlConn msc = new MysqlConn();
                msc.query = "select class_name from escolaya_db.class  ";

                MySqlConnection conn = new MySqlConnection(msc.con);
                conn.Open();
                msc.command = new MySqlCommand(msc.query, conn);
                msc.mdr     = msc.command.ExecuteReader();

                while (msc.mdr.Read())
                {
                    string className = msc.mdr.GetString("class_name");
                    comboclass.Items.Add(className);
                }

                conn.Close();
            }
            catch (Exception ex)
            {
            }
        }