Ejemplo n.º 1
0
 public frmChooseRFID()
 {
     InitializeComponent();
     SelectDevice();
     establishContext();
     DataAccess = new clsData_Access("server=127.0.0.1;user id=root;password=;database=sms_app");
 }
        public frmUserHandler(string id = "")
        {
            InitializeComponent();
            DataAccess = new clsData_Access("server=127.0.0.1;user id=root;password=;database=sms_app");
            if (id != "")
            {
                user_id = id;
                if (!DataAccess.dbConnected)
                {
                    MessageBox.Show(this, "Unable to connect to database.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                DS = DataAccess.executeQuery("select * from tbl_sys_user where user_id='" + user_id + "'");

                tbUn.Text            = DS.Tables[0].Rows[0][1].ToString();
                tbPw.Text            = DS.Tables[0].Rows[0][2].ToString();
                tbFn.Text            = DS.Tables[0].Rows[0][3].ToString();
                tbMn.Text            = DS.Tables[0].Rows[0][4].ToString();
                tbLn.Text            = DS.Tables[0].Rows[0][5].ToString();
                cboRole.SelectedItem = DS.Tables[0].Rows[0][6].ToString();
            }
            else
            {
            }
        }
        private void btnTagSave_Click(object sender, EventArgs e)
        {
            if (tbTagID.Text != "")
            {
                clsData_Access DataAccess = new clsData_Access("server=127.0.0.1;user id=root;password=;database=sms_app");
                DataSet        ds         = new DataSet();
                ds = DataAccess.executeQuery("select * from tbl_rfid_tag where rfid_tag_id ='" + tbTagID.Text + "' and rfid_tag_active=1");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show(this, "Tag is currently existing and active.", "Existing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    tbTagID.Text         = "";
                    tmrTagReader.Enabled = true;
                    return;
                }

                if (DataAccess.dbConnected)
                {
                    //MessageBox.Show(this, "Connection successfully established.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (DataAccess.ExecuteProcedureCommand_Insert_Tag(tbTagID.Text))
                    {
                        MessageBox.Show(this, "Tag successfully saved", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show(this, "Tag not saved", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }



                tbTagID.Text = "";
                //tmrTagReader.Enabled = true;
            }
        }
 public frmHandleSection(ClassSection Section)
 {
     InitializeComponent();
     this.Section    = Section;
     lblTitle.Text   = "Edit Section";
     lblID.Text      = Section.sec_id;
     txtSection.Text = Section.sec_name;
     DataAccess      = new clsData_Access("server=127.0.0.1;user id=root;password=;database=sms_app");
 }
Ejemplo n.º 5
0
        private void frmStudentHandler_FormClosing(object sender, FormClosingEventArgs e)
        {
            pic.Image = null;
            DataAccess.Dispose();
            DataAccess = null;
            pic.Dispose();
            DS.Dispose();
            img = null;

            Dispose(true);
            GC.Collect();
            this.Dispose();
        }
Ejemplo n.º 6
0
        public frmStudentHandler(string id = "")
        {
            InitializeComponent();
            DataAccess           = new clsData_Access("server=127.0.0.1;user id=root;password=;database=sms_app");
            stud_id              = id;
            lblNotification.Text = "";

            DS = DataAccess.executeQuery("select yr_details from tbl_yr where yr_active=1");
            for (int i = 0; i < DS.Tables[0].Rows.Count; i++)
            {
                cboYr.Items.Add(DS.Tables[0].Rows[i][0].ToString());
            }
            cboYr.SelectedIndex = 0;
            DS = DataAccess.executeQuery("select sec_details from tbl_sec where sec_active=1");
            for (int i = 0; i < DS.Tables[0].Rows.Count; i++)
            {
                cboSec.Items.Add(DS.Tables[0].Rows[i][0].ToString());
            }
            cboSec.SelectedIndex = 0;

            if (id != "")
            {
                this.Text     = "Edit Student Information";
                lblTitle.Text = "Edit Student Information";


                DS = DataAccess.executeQuery("select * from view_students_information where stud_id='" + id + "'");

                tbStudIDNumber.Text     = DS.Tables[0].Rows[0][1].ToString();
                tbFn.Text               = DS.Tables[0].Rows[0][2].ToString();
                tbMn.Text               = DS.Tables[0].Rows[0][3].ToString();
                tbLn.Text               = DS.Tables[0].Rows[0][4].ToString();
                tbPCNumber.Text         = DS.Tables[0].Rows[0][5].ToString();
                cboYr.SelectedItem      = DS.Tables[0].Rows[0][6].ToString();
                cboSec.SelectedItem     = DS.Tables[0].Rows[0][7].ToString();
                old_rfid                = DS.Tables[0].Rows[0][8].ToString();
                lblRFID.Text            = DS.Tables[0].Rows[0][8].ToString();
                cboRFTagID.SelectedItem = DS.Tables[0].Rows[0][8].ToString();

                //cboRFTagID.Items.Add(DS.Tables[0].Rows[0][8].ToString());
                try
                {
                    img       = (Byte[])(DS.Tables[0].Rows[0][12]);
                    ms        = new System.IO.MemoryStream(img);
                    pic.Image = Image.FromStream(ms);
                    img       = null;
                }
                catch { }
            }
        }
 public frmHandleSection()
 {
     InitializeComponent();
     lblTitle.Text = "Add Section";
     DataAccess    = new clsData_Access("server=127.0.0.1;user id=root;password=;database=sms_app");
 }