Example #1
0
        //UPdate

        private void btnLecUpdate_Click(object sender, EventArgs e)
        {
            if (IsValidUpdate())
            {
                //get the data from texbox
                c.ID         = int.Parse(txtID.Text);
                c.LecID      = txtLecIdEdit.Text;
                c.Name       = txtLecNameEdit.Text;
                c.Faculty    = cmbLecFacultyEdit.Text;
                c.Department = cmbLecDepartmentEdit.Text;
                c.Building   = cmbLecBuildingEdit.Text;
                c.Center     = cmbLecCenterEdit.Text;
                c.Level      = cmbLecLevelEdit.Text;


                bool success = c.Update(c);
                if (success == true)
                {
                    //Upload Successfully
                    MessageBox.Show("Subject has been Successfully Updated");
                    // LOAD DATA
                    DataTable dt = c.Select();
                    metroGrid1.DataSource = dt;

                    ClearFieldsAfterUpdate();
                }
                else
                {
                    //faild to update
                    MessageBox.Show("ERROR ");
                }
            }
        }