示例#1
0
        private void subEdit_Click(object sender, EventArgs e)
        {
            subjectModel subjectModel = new subjectModel();

            subjectModel.OffYear   = offyear.Text;
            subjectModel.OffSem    = offSem.Text;
            subjectModel.SubName   = subName.Text;
            subjectModel.subCode   = subCode.Text;
            subjectModel.lechours  = lecHrs.Text;
            subjectModel.labHours  = labHrs.Text;
            subjectModel.tuteHours = tuteHrs.Text;
            subjectModel.evalHours = evalHrs.Text;



            subjectController ctrl = new subjectController();

            ctrl.UpdateSubject(subjectModel);

            subTbl.DataSource = ctrl.getSubjectdatatoTable();

            offyear.Text = "";
            offSem.Text  = "";
            subName.Text = "";
            subCode.Text = "";
            lecHrs.Text  = "";
            labHrs.Text  = "";
            tuteHrs.Text = "";
            evalHrs.Text = "";

            subCode.ReadOnly = false;
        }
        private void subEdit_Click(object sender, EventArgs e)
        {
            if (Year.Text != "" && offyear.Text != "" && offSem.Text != "" && subName.Text != "" && subCode.Text != "" && lecHrs.Text != "" && labHrs.Text != "" && tuteHrs.Text != "" && evalHrs.Text != "")
            {
                subjectModel subjectModel = new subjectModel();

                subjectModel.year      = Year.Text;
                subjectModel.OffYear   = offyear.Text;
                subjectModel.OffSem    = offSem.Text;
                subjectModel.SubName   = subName.Text;
                subjectModel.subCode   = subCode.Text;
                subjectModel.lechours  = lecHrs.Text;
                subjectModel.labHours  = labHrs.Text;
                subjectModel.tuteHours = tuteHrs.Text;
                subjectModel.evalHours = evalHrs.Text;

                subAdd.Enabled = true;


                subjectController ctrl = new subjectController();
                ctrl.UpdateSubject(subjectModel);

                subTbl.DataSource = ctrl.getSubjectdatatoTable();

                Year.Text    = "";
                offyear.Text = "";
                offSem.Text  = "";
                subName.Text = "";
                subCode.Text = "";
                lecHrs.Text  = "";
                labHrs.Text  = "";
                tuteHrs.Text = "";
                evalHrs.Text = "";

                subCode.ReadOnly = false;
            }
            else
            {
                MessageBox.Show("Please Fill the all the required fields ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }