Example #1
0
        private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            strandEL.Strandid = Convert.ToInt32(dgv.SelectedRows[0].Cells["STRAND ID"].Value);

            if (e.ColumnIndex == 0)
            {
                lblTitle.Text = "EDIT STRAND";
                s             = "EDIT";
                ShowForm(true);

                strandEL = strandBL.Select(strandEL);

                txtStrand.Text      = strandEL.Strand;
                txtDescription.Text = strandEL.Stranddescription;
            }

            if (e.ColumnIndex == 1)
            {
                switch (MessageBox.Show(this, "ARE YOU SURE TO DELETE THIS SELECTED ITEM?", "Deleting", MessageBoxButtons.YesNo))
                {
                case DialogResult.No:
                    break;

                default:
                    ShowResult(strandBL.Delete(strandEL));
                    break;
                }
            }
        }
        public EL.Registrations.strands Select(EL.Registrations.strands strandEL)
        {
            var dt = Helper.executeQuery("select * from strands_view where `STRAND ID` = '" + strandEL.Strandid + "'");

            if (dt.Rows.Count > 0)
            {
                strandEL.Strandid          = Convert.ToInt32(dt.Rows[0]["STRAND ID"].ToString());
                strandEL.Strand            = dt.Rows[0]["STRAND"].ToString();
                strandEL.Stranddescription = dt.Rows[0]["DESCRIPTION"].ToString();
                return(strandEL);
            }
            else
            {
                return(null);
            }
        }
        private void dgv_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            studentEL.Studentid = Convert.ToInt32(dgv.SelectedRows[0].Cells["ID"].Value);

            if (e.ColumnIndex == 0)
            {
                lblTitle.Text = "EDIT STUDENT INFORMATION";
                s             = "EDIT";
                ShowForm(true);

                studentEL         = studentBL.Select(studentEL);
                strandEL.Strandid = studentEL.Strandid;
                strandEL          = strandBL.Select(strandEL);

                txtLRN.Text                     = studentEL.Lrn;
                txtLastName.Text                = studentEL.Lastname;
                txtFirstName.Text               = studentEL.Firstname;
                txtMiddleInitial.Text           = studentEL.Middleinitial;
                cbGender.SelectedIndex          = cbGender.FindString(studentEL.Gender);
                txtAddress.Text                 = studentEL.Address;
                txtParentsOrGuardian.Text       = studentEL.Parentsorguardian;
                txtContactNumber.Text           = studentEL.Contactnumber;
                txtLastSchoolAttended.Text      = studentEL.Lastschoolattended;
                txtSchoolYear.Text              = studentEL.Schoolyear;
                cbPreferredStrand.SelectedIndex = cbPreferredStrand.FindString(strandEL.Strand);
                cbYearLevel.SelectedIndex       = cbYearLevel.FindString(studentEL.Yearlevel);
            }

            if (e.ColumnIndex == 1)
            {
                switch (MessageBox.Show(this, "ARE YOU SURE TO DELETE THIS SELECTED ITEM?", "Deleting", MessageBoxButtons.YesNo))
                {
                case DialogResult.No:
                    break;

                default:
                    ShowResult(studentBL.Delete(studentEL));
                    break;
                }
            }
        }
 public bool Delete(EL.Registrations.strands strandEL)
 {
     return(Helper.executeNonQueryBool("delete from strands where strandid = '" + strandEL.Strandid + "'"));
 }
 public bool Update(EL.Registrations.strands strandEL)
 {
     return(Helper.executeNonQueryBool("update strands set strand = '" + strandEL.Strand + "', stranddescription = '" + strandEL.Stranddescription + "' where strandid = '" + strandEL.Strandid + "'"));
 }
 public long Insert(EL.Registrations.strands strandEL)
 {
     return(Helper.executeNonQueryLong("insert into strands (strand, stranddescription) values ('" + strandEL.Strand + "', '" + strandEL.Stranddescription + "')"));
 }
 public bool Delete(EL.Registrations.strands strandEL)
 {
     return(strandDL.Delete(strandEL));
 }
 public bool Update(EL.Registrations.strands strandEL)
 {
     return(strandDL.Update(strandEL));
 }
 public long Insert(EL.Registrations.strands strandEL)
 {
     return(strandDL.Insert(strandEL));
 }
 public EL.Registrations.strands Select(EL.Registrations.strands strandEL)
 {
     return(strandDL.Select(strandEL));
 }