コード例 #1
0
        private void BindData()
        {
            string Data    = "SELECT * From Regstudent";
            var    getdata = new lib.DatabaseConnection();

            dt = new DataTable();
            dt = getdata.getTable(Data);
            foreach (DataRow dr in dt.Rows)
            {
                dataStudentView.Rows.Add();
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["SID"].Value           = dr["Id"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["RollNo"].Value        = dr["RollNo"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["StudentName"].Value   = dr["StudentName"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["Gender"].Value        = dr["Gender"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["Address"].Value       = dr["Address"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["DOB"].Value           = dr["DateOfBirth"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["AdmissionDate"].Value = dr["AdmissionDate"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["PhoneNo"].Value       = dr["PhoneNo"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["Email"].Value         = dr["Email"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["Country"].Value       = dr["Country"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["Shift"].Value         = dr["Shift"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["Course"].Value        = dr["Course"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["Semester"].Value      = dr["Semester"];
                dataStudentView.Rows[dataStudentView.Rows.Count - 1].Cells["StudentPic"].Value    = dr["StudentPic"];
            }
        }
コード例 #2
0
        private void BindGrid(string sql)
        {
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getSearchData(sql);
            if (dt.Rows.Count > 0)
            {
                FeeId = dt.Rows[0]["FeeId"].ToString();
                txtStudentName.Text = dt.Rows[0]["StudentName"].ToString();
                txtRollNo.Text      = dt.Rows[0]["RollNo"].ToString();
                txtCourse.Text      = dt.Rows[0]["Course"].ToString();
                txtSemester.Text    = dt.Rows[0]["Semester"].ToString();
                objGlobal.getPictureFromDatabase(picStudent, dt, 0, "StudentPic");
                foreach (DataRow dr in dt.Rows)
                {
                    dataGridFeeView.Rows.Add();
                    dataGridFeeView.Rows[dataGridFeeView.Rows.Count - 1].Cells["Id"].Value           = dr["FeeId"];
                    dataGridFeeView.Rows[dataGridFeeView.Rows.Count - 1].Cells["CategoryName"].Value = dr["CategoryName"];
                    dataGridFeeView.Rows[dataGridFeeView.Rows.Count - 1].Cells["PaidDate"].Value     = dr["PaidDate"];
                    dataGridFeeView.Rows[dataGridFeeView.Rows.Count - 1].Cells["TotalAmount"].Value  = dr["TotalAmount"];
                    dataGridFeeView.Rows[dataGridFeeView.Rows.Count - 1].Cells["PaidAmount"].Value   = dr["PaidAmount"];
                    dataGridFeeView.Rows[dataGridFeeView.Rows.Count - 1].Cells["DueAmount"].Value    = dr["DueAmount"];
                }
            }
            else
            {
                MessageBox.Show("Không tìm thấy!", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtSearch.Focus();
                txtSearch.SelectAll();
            }
        }
コード例 #3
0
        private bool CheckValidation()
        {
            var  objCon  = new lib.DatabaseConnection();
            bool isValid = true;

            if (txtCourseName.Text == string.Empty)
            {
                MessageBox.Show("Course name is required.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtCourseName.Focus();
                isValid = false;
            }
            else
            if (cmbSemester.Text == string.Empty)
            {
                MessageBox.Show("Semester is not selected.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                cmbSemester.Focus();
                isValid = false;
            }
            else
            if (!string.IsNullOrEmpty(objCon.GetSqlData("Select Semester from Course Where CourseName='" + txtCourseName.Text.Trim() + "' AND Semester='" + cmbSemester.Text.Trim() + "'")))
            {
                MessageBox.Show("A duplicate semester in course.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtCourseName.Focus();
                txtCourseName.SelectAll();
                isValid = false;
            }
            return(isValid);
        }
コード例 #4
0
        private void GetDataBind(string sql)
        {
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getSearchData(sql);
            if (dt.Rows.Count > 0)
            {
                _TeacherId          = dt.Rows[0]["Id"].ToString();
                txtTeacherName.Text = dt.Rows[0]["TeacherName"].ToString();
                if (dt.Rows[0]["Gender"].ToString().Trim().Equals("Male") == true)
                {
                    this.rdMale.Checked = true;
                }
                else
                {
                    this.rdFemale.Checked = true;
                }
                txtAddress.Text       = dt.Rows[0]["Address"].ToString();
                mtxtRegisterDate.Text = dt.Rows[0]["RegisterDate"].ToString();
                txtPhoneNo.Text       = dt.Rows[0]["PhoneNo"].ToString();
                txtEmail.Text         = dt.Rows[0]["Email"].ToString();
                cmbExperience.Text    = dt.Rows[0]["Experience"].ToString();
                ObjGlobal.getPictureFromDatabase(picTeacher, dt, 0, "TPhoto");
            }
            else
            {
                MessageBox.Show("Record not found!", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtSearch.Focus();
                txtSearch.SelectAll();
            }
        }
コード例 #5
0
        private bool CheckValidation()
        {
            var  objCon  = new lib.DatabaseConnection();
            bool isValid = true;

            if (txtCourseName.Text == string.Empty)
            {
                MessageBox.Show("Tên khóa học bắt buộc.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtCourseName.Focus();
                isValid = false;
            }
            else
            if (cmbSemester.Text == string.Empty)
            {
                MessageBox.Show("Học kỳ không được chọn.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                cmbSemester.Focus();
                isValid = false;
            }
            else
            if (!string.IsNullOrEmpty(objCon.GetSqlData("Select Semester from Course Where CourseName='" + txtCourseName.Text.Trim() + "' AND Semester='" + cmbSemester.Text.Trim() + "'")))
            {
                MessageBox.Show("Đã có học kỳ trong khóa học.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtCourseName.Focus();
                txtCourseName.SelectAll();
                isValid = false;
            }
            return(isValid);
        }
コード例 #6
0
        private void BindDataB(string sql)
        {
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getSearchData(sql);
            foreach (DataRow dr in dt.Rows)
            {
                CourseId = Convert.ToInt32(dr["Id"]);
            }
        }
コード例 #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var objCon = new lib.DatabaseConnection();

            if (this.txtCategory.Text == string.Empty)
            {
                MessageBox.Show("Tên danh mục là bắt buộc.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtCategory.Focus();
                return;
            }
            else
            if (txtAmount.Text == string.Empty)
            {
                MessageBox.Show("Số tiền yêu cầu.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtAmount.Focus();
                return;
            }
            else
            {
                try
                {
                    ObjFeeManage.CategoryId   = Convert.ToInt32(FeeCategoryId.ToString());
                    ObjFeeManage.CategoryName = txtCategory.Text;
                    ObjFeeManage.TotalAmount  = Convert.ToInt32(txtAmount.Text);
                    if (this.btnSave.Text == "&Lưu")
                    {
                        if (!string.IsNullOrEmpty(objCon.GetSqlData("Select Category from FeeManage Where Category= '" + txtCategory.Text.Trim() + "'")))
                        {
                            MessageBox.Show("Trùng lặp.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            txtCategory.Focus();
                            txtCategory.SelectAll();
                            return;
                        }
                        ObjFeeManage.AddFeeManage();
                        MessageBox.Show("Lưu thành công.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    if (this.btnSave.Text == "&Cập nhật")
                    {
                        ObjFeeManage.UpdateFeeManage();
                        MessageBox.Show("Cập nhật thành công.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.btnSave.Text      = "&Lưu";
                        this.btnDelete.Enabled = false;
                    }
                    ClearAll();
                    dataGridFeeManage.Rows.Clear();
                    BindData();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #8
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var objCon = new lib.DatabaseConnection();

            if (this.txtCategory.Text == string.Empty)
            {
                MessageBox.Show("Category name is required.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtCategory.Focus();
                return;
            }
            else
            if (txtAmount.Text == string.Empty)
            {
                MessageBox.Show("Amount is required.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtAmount.Focus();
                return;
            }
            else
            {
                try
                {
                    ObjFeeManage.CategoryId   = Convert.ToInt32(FeeCategoryId.ToString());
                    ObjFeeManage.CategoryName = txtCategory.Text;
                    ObjFeeManage.TotalAmount  = Convert.ToInt32(txtAmount.Text);
                    if (this.btnSave.Text == "&Save")
                    {
                        if (!string.IsNullOrEmpty(objCon.GetSqlData("Select Category from FeeManage Where Category= '" + txtCategory.Text.Trim() + "'")))
                        {
                            MessageBox.Show("A duplicate category can not be applied.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            txtCategory.Focus();
                            txtCategory.SelectAll();
                            return;
                        }
                        ObjFeeManage.AddFeeManage();
                        MessageBox.Show("Saved Successfully.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    if (this.btnSave.Text == "&Update")
                    {
                        ObjFeeManage.UpdateFeeManage();
                        MessageBox.Show("Update Successfully.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.btnSave.Text      = "&Save";
                        this.btnDelete.Enabled = false;
                    }
                    ClearAll();
                    dataGridFeeManage.Rows.Clear();
                    BindData();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
コード例 #9
0
        private void BindCategory()
        {
            var       selectQuery = "SELECT * from FeeManage";
            var       sql         = new lib.DatabaseConnection();
            DataTable dt          = new DataTable();

            dt = sql.getData(selectQuery);
            foreach (DataRow dr in dt.Rows)
            {
                this.cmbCategory.Items.Add(dr["Category"]);
            }
        }
コード例 #10
0
        private void TeacherList()
        {
            var       selectQuery = "SELECT TeacherName from TeacherRegister";
            var       sql         = new lib.DatabaseConnection();
            DataTable dt          = new DataTable();

            dt = sql.getData(selectQuery);
            foreach (DataRow dr in dt.Rows)
            {
                this.cmbTeacherName.Items.Add(dr["TeacherName"]);
            }
        }
コード例 #11
0
        private void CourseList()
        {
            var       selectQuery = "SELECT Distinct CourseName from Course";
            var       sql         = new lib.DatabaseConnection();
            DataTable dt          = new DataTable();

            dt = sql.getData(selectQuery);
            foreach (DataRow dr in dt.Rows)
            {
                this.cmbCourse.Items.Add(dr["CourseName"]);
            }
        }
コード例 #12
0
        private void cmbSubjectName_SelectedIndexChanged(object sender, EventArgs e)
        {
            var       sql     = "SELECT * from SubjectDetails Where CourseName='" + cmbCourse.Text + "' AND Semester='" + cmbSemester.Text + "' AND SubjectName='" + cmbSubjectName.Text + "'";
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getSearchData(sql);
            foreach (DataRow dr in dt.Rows)
            {
                this.SubjCode = Convert.ToInt32(dr["Id"]);
            }
        }
コード例 #13
0
        private void cmbSemester_SelectedIndexChanged(object sender, EventArgs e)
        {
            var       sql     = "SELECT * from Course Where CourseName='" + cmbCourse.Text + "' AND Semester='" + cmbSemester.Text + "'";
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getSearchData(sql);
            foreach (DataRow dr in dt.Rows)
            {
                this.CId = dt.Rows[0]["Id"].ToString();
            }
        }
コード例 #14
0
        private void SemesterList()
        {
            var       selectQuery = "SELECT * from Semester";
            var       sql         = new lib.DatabaseConnection();
            DataTable dt          = new DataTable();

            dt = sql.getData(selectQuery);
            foreach (DataRow dr in dt.Rows)
            {
                this.cmbSemester.Items.Add(dr["SemesterId"]);
            }
        }
コード例 #15
0
        private void BindDataA(string sql)
        {
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getSearchData(sql);
            this.cmbSemester.Items.Clear();
            this.cmbSemester.DropDownHeight = 106;
            foreach (DataRow dr in dt.Rows)
            {
                this.cmbSemester.Items.Add(dr["Semester"]);
            }
        }
コード例 #16
0
        private void frmStudentReports_Load(object sender, EventArgs e)
        {
            lib.CourseDetails objCourseDetails = new lib.CourseDetails();
            var       selectQuery = "SELECT Distinct CourseName from Course";
            var       sql         = new lib.DatabaseConnection();
            DataTable dt          = new DataTable();

            dt = sql.getData(selectQuery);
            foreach (DataRow dr in dt.Rows)
            {
                this.comboBox1.Items.Add(dr["CourseName"]);
            }
        }
コード例 #17
0
        private void cmbStudentName_SelectedIndexChanged(object sender, EventArgs e)
        {
            var       sql     = "SELECT * from RegStudent Where StudentName='" + cmbStudentName.Text + "'";
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getSearchData(sql);
            foreach (DataRow dr in dt.Rows)
            {
                this.Sid            = dr["Id"].ToString();
                this.txtRollNo.Text = dr["RollNo"].ToString();
                objGlobal.getPictureFromDatabase(picStudent, dt, 0, "StudentPic");
            }
        }
コード例 #18
0
        private void cmbCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.txtPaidAmount.Clear();
            //this.txtDueAmount.Clear();
            var       selectQuery = "SELECT * from FeeManage Where Category='" + cmbCategory.Text + "'";
            var       sql         = new lib.DatabaseConnection();
            DataTable dt          = new DataTable();

            dt = sql.getData(selectQuery);
            foreach (DataRow dr in dt.Rows)
            {
                this.txtAmount.Text = dr["Amount"].ToString();
            }
        }
コード例 #19
0
        private void cmbTeacherName_SelectedIndexChanged(object sender, EventArgs e)
        {
            picTeacher.Image = null;
            var       sql     = "SELECT * from TeacherRegister Where TeacherName='" + cmbTeacherName.Text + "'";
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getSearchData(sql);
            foreach (DataRow dr in dt.Rows)
            {
                this.TeacherId = Convert.ToInt32(dr["Id"]);
                objGlobal.getPictureFromDatabase(picTeacher, dt, 0, "TPhoto");
            }
        }
コード例 #20
0
        private void lstSemester_SelectedIndexChanged(object sender, EventArgs e)
        {
            var       SelectQuery = "Select * from Semester Where SemesterId='" + lstSemester.Text + "'";
            var       sqlData     = new lib.DatabaseConnection();
            DataTable dt          = new DataTable();

            dt = sqlData.getTable(SelectQuery);
            foreach (DataRow dr in dt.Rows)
            {
                txtSemester.Text = dr["SemesterId"].ToString();
            }

            this.btnAdd.Enabled    = false;
            this.btnDelete.Enabled = true;
        }
コード例 #21
0
        private void BindData()
        {
            string    Data    = "SELECT * From Course";
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getTable(Data);
            foreach (DataRow dr in dt.Rows)
            {
                dataGridCourseDetails.Rows.Add();
                dataGridCourseDetails.Rows[dataGridCourseDetails.Rows.Count - 1].Cells["Id"].Value         = dr["Id"];
                dataGridCourseDetails.Rows[dataGridCourseDetails.Rows.Count - 1].Cells["CourseName"].Value = dr["CourseName"];
                dataGridCourseDetails.Rows[dataGridCourseDetails.Rows.Count - 1].Cells["Semester"].Value   = dr["Semester"];
            }
        }
コード例 #22
0
        private void cmbCourse_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.cmbSemester.Enabled = true;
            var       sql     = "SELECT * from Course Where CourseName='" + cmbCourse.Text + "'";
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getSearchData(sql);
            this.cmbSemester.Items.Clear();
            this.cmbSemester.DropDownHeight = 106;
            foreach (DataRow dr in dt.Rows)
            {
                this.cmbSemester.Items.Add(dr["Semester"]);
            }
        }
コード例 #23
0
        private void BindData()
        {
            string    Data    = "SELECT * From FeeManage";
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getTable(Data);
            foreach (DataRow dr in dt.Rows)
            {
                dataGridFeeManage.Rows.Add();
                dataGridFeeManage.Rows[dataGridFeeManage.Rows.Count - 1].Cells["Id"].Value       = dr["Id"];
                dataGridFeeManage.Rows[dataGridFeeManage.Rows.Count - 1].Cells["Category"].Value = dr["Category"];
                dataGridFeeManage.Rows[dataGridFeeManage.Rows.Count - 1].Cells["Amount"].Value   = dr["Amount"];
            }
        }
コード例 #24
0
        private void cmbSemester_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.cmbSubjectName.ResetText();
            this.cmbSubjectName.Items.Clear();
            this.cmbSubjectName.DropDownHeight = 106;
            BindDataB("SELECT * from Course Where CourseName='" + cmbCourse.Text + "' AND Semester='" + cmbSemester.Text + "'");
            var       sql     = "SELECT * from SubjectDetails Where CourseName='" + cmbCourse.Text + "' AND Semester='" + cmbSemester.Text + "'";
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getSearchData(sql);
            foreach (DataRow dr in dt.Rows)
            {
                this.cmbSubjectName.Items.Add(dr["SubjectName"]);
            }
        }
コード例 #25
0
        private void BindData(string sql)
        {
            dataAttendanceHistory.Rows.Clear();
            var getdata = new lib.DatabaseConnection();

            dt = new DataTable();
            dt = getdata.getTable(sql);
            foreach (DataRow dr in dt.Rows)
            {
                dataAttendanceHistory.Rows.Add();
                dataAttendanceHistory.Rows[dataAttendanceHistory.Rows.Count - 1].Cells["Id"].Value             = dr["Id"];
                dataAttendanceHistory.Rows[dataAttendanceHistory.Rows.Count - 1].Cells["TeacherName"].Value    = dr["TeacherName"];
                dataAttendanceHistory.Rows[dataAttendanceHistory.Rows.Count - 1].Cells["AttendanceDate"].Value = dr["AttendanceDate"];
                dataAttendanceHistory.Rows[dataAttendanceHistory.Rows.Count - 1].Cells["Attendance"].Value     = dr["Attendance"];
            }
        }
コード例 #26
0
ファイル: frmCreateUser.cs プロジェクト: Maiminh-T/test
        private void BindData()
        {
            var       SelectQuery = "Select * From ULogin";
            var       sql         = new lib.DatabaseConnection();
            DataTable dt          = new DataTable();

            dt = sql.getTable(SelectQuery);
            foreach (DataRow dr in dt.Rows)
            {
                dataUsersView.Rows.Add();
                dataUsersView.Rows[dataUsersView.Rows.Count - 1].Cells["UserId"].Value    = dr["UserId"];
                dataUsersView.Rows[dataUsersView.Rows.Count - 1].Cells["UserName"].Value  = dr["UserName"];
                dataUsersView.Rows[dataUsersView.Rows.Count - 1].Cells["LoginName"].Value = dr["LoginName"];
                dataUsersView.Rows[dataUsersView.Rows.Count - 1].Cells["Password"].Value  = dr["Password"];
                dataUsersView.Rows[dataUsersView.Rows.Count - 1].Cells["Role"].Value      = dr["UserType"];
                dataUsersView.Rows[dataUsersView.Rows.Count - 1].Cells["Active"].Value    = dr["Active"];
            }
        }
コード例 #27
0
        private bool CheckValidation()
        {
            var  objCon  = new lib.DatabaseConnection();
            bool isValid = true;

            if (cmbCourse.Text == string.Empty)
            {
                MessageBox.Show("Course name is required.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                cmbCourse.Focus();
                isValid = false;
            }
            else
            if (cmbSemester.Text == string.Empty)
            {
                MessageBox.Show("Semester is required.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                cmbSemester.Focus();
                isValid = false;
            }
            else
            if (txtSubjectName.Text == string.Empty)
            {
                MessageBox.Show("Subject name is required.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                cmbSemester.Focus();
                isValid = false;
            }
            else
            if (!string.IsNullOrEmpty(objCon.GetSqlData("Select SubjectName From SubjectDetails Where CourseName='" + cmbCourse.Text.Trim() + "' and Semester='" + cmbSemester.Text.Trim() + "' and SubjectName='" + txtSubjectName.Text.Trim() + "'")))
            {
                MessageBox.Show("A duplicate subject can not accepted in semester", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtSubjectName.Focus();
                txtSubjectName.SelectAll();
                isValid = false;
            }
            else
            if (txtCredits.Text == string.Empty)
            {
                MessageBox.Show("Credits is required.", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                cmbSemester.Focus();
                isValid = false;
            }
            return(isValid);
        }
コード例 #28
0
        private void GetDataBind(string sql)
        {
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getSearchData(sql);
            if (dt.Rows.Count > 0)
            {
                txtStudentName.Text = dt.Rows[0]["StudentName"].ToString();
                txtRollNo.Text      = dt.Rows[0]["RollNo"].ToString();
                txtCourse.Text      = dt.Rows[0]["Course"].ToString();
                txtSemester.Text    = dt.Rows[0]["Semester"].ToString();
                objGlobal.getPictureFromDatabase(picStudent, dt, 0, "StudentPic");
            }
            else
            {
                MessageBox.Show("Record not found!", Global.Caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txtSearch.Focus();
                txtSearch.SelectAll();
            }
        }
コード例 #29
0
        private void BindData()
        {
            string    Data    = "SELECT * From TeacherRegister";
            var       getdata = new lib.DatabaseConnection();
            DataTable dt      = new DataTable();

            dt = getdata.getTable(Data);
            foreach (DataRow dr in dt.Rows)
            {
                dataStaffView.Rows.Add();
                dataStaffView.Rows[dataStaffView.Rows.Count - 1].Cells["TeacherId"].Value    = dr["Id"];
                dataStaffView.Rows[dataStaffView.Rows.Count - 1].Cells["TeacherName"].Value  = dr["TeacherName"];
                dataStaffView.Rows[dataStaffView.Rows.Count - 1].Cells["Gender"].Value       = dr["Gender"];
                dataStaffView.Rows[dataStaffView.Rows.Count - 1].Cells["Address"].Value      = dr["Address"];
                dataStaffView.Rows[dataStaffView.Rows.Count - 1].Cells["RegisterDate"].Value = dr["RegisterDate"];
                dataStaffView.Rows[dataStaffView.Rows.Count - 1].Cells["PhoneNo"].Value      = dr["PhoneNo"];
                dataStaffView.Rows[dataStaffView.Rows.Count - 1].Cells["Email"].Value        = dr["Email"];
                dataStaffView.Rows[dataStaffView.Rows.Count - 1].Cells["Experience"].Value   = dr["Experience"];
                dataStaffView.Rows[dataStaffView.Rows.Count - 1].Cells["Photo"].Value        = dr["TPhoto"];
            }
        }
コード例 #30
0
        private void BindData(string sql)
        {
            dataTimeScheduleHistory.Rows.Clear();
            var getdata = new lib.DatabaseConnection();

            dt = new DataTable();
            dt = getdata.getTable(sql);
            foreach (DataRow dr in dt.Rows)
            {
                dataTimeScheduleHistory.Rows.Add();
                dataTimeScheduleHistory.Rows[dataTimeScheduleHistory.Rows.Count - 1].Cells["Id"].Value          = dr["Id"];
                dataTimeScheduleHistory.Rows[dataTimeScheduleHistory.Rows.Count - 1].Cells["TeacherName"].Value = dr["TeacherName"];
                dataTimeScheduleHistory.Rows[dataTimeScheduleHistory.Rows.Count - 1].Cells["Course"].Value      = dr["Course"];
                dataTimeScheduleHistory.Rows[dataTimeScheduleHistory.Rows.Count - 1].Cells["Semester"].Value    = dr["Semester"];
                dataTimeScheduleHistory.Rows[dataTimeScheduleHistory.Rows.Count - 1].Cells["SubjectName"].Value = dr["SubjectName"];
                dataTimeScheduleHistory.Rows[dataTimeScheduleHistory.Rows.Count - 1].Cells["Day"].Value         = dr["SDay"];
                dataTimeScheduleHistory.Rows[dataTimeScheduleHistory.Rows.Count - 1].Cells["Shift"].Value       = dr["Shift"];
                dataTimeScheduleHistory.Rows[dataTimeScheduleHistory.Rows.Count - 1].Cells["Time"].Value        = dr["STime"];
                dataTimeScheduleHistory.Rows[dataTimeScheduleHistory.Rows.Count - 1].Cells["Period"].Value      = dr["Period"];
            }
        }