private void LoadListbyClass(int clsid) { EStudent d = new EStudent(); DataSet ds = d.LoadListClass(clsid); if (ds.Tables[0].Rows.Count > 0) { grdList.AutoGenerateColumns = false; grdList.DataSource = ds.Tables[0]; btnEdit.Enabled = true; pnlSearch.Visible = false; } else { MessageBox.Show("Sorry No Record Found", "No Record", MessageBoxButtons.OK, MessageBoxIcon.Information); btnEdit.Enabled = false; grdList.DataSource = null; } }
private void LoadList() { //if (this.btnSelForMrk.Enabled == true) //{ // btnAdd.Enabled = false; // btnDelete.Enabled = false; // btnEdit.Enabled = false; // btnPrint.Enabled = false; //} EStudent d = new EStudent(); DataSet ds = d.GetList(); if (ds.Tables[0].Rows.Count > 0) { grdList.AutoGenerateColumns = false; grdList.DataSource = ds.Tables[0]; btnEdit.Enabled = true; pnlSearch.Visible = false; } }
private void btnSave_Click(object sender, EventArgs e) { EStudent d = new EStudent(); if (!IsValid()) { return; } try { d.AdmNo = Convert.ToInt32(txtAdmNo.Text); d.AdmDate = dtAdmDate.Value; d.SName = txtSName.Text; d.DOB = dtDOB.Value; d.Nationality = txtNationality.Text; d.ClassID = Convert.ToInt32(cbxClass.SelectedValue); d.Section = cbxSection.Text; d.PrevSchool = txtPrevSchool.Text; d.Address = txtAddress.Text; d.Phone = txtPhoneNo.Text; d.Scholarship =Convert.ToInt32( txtScholarship.Text); d.FName = txtFName.Text; d.FMobile = txtFMobile.Text; d.MName = txtMName.Text; d.MMobile = txtMMobile.Text; d.Guardian = txtGuardian.Text; d.FGAddress = txtFGWAddress.Text; d.WPhone = txtWPhone.Text; d.Email = txtEmail.Text; d.AdmStatus = txtAdmStatus.Text; d.Remarks = txtRemarks.Text; if (newimage == true) { FileStream FS = new FileStream(@opf.FileName, FileMode.Open, FileAccess.ReadWrite); //create a file stream object associate to user selected file byte[] img = new byte[FS.Length]; //create a byte array with size of user select file stream length FS.Read(img, 0, Convert.ToInt32(FS.Length)); d.PIC = img; } else { byte[] byteImg = ImageToByteArray(pbStudent.Image); d.PIC = byteImg; } if (dataBoundItem != null) { d.SID = Convert.ToInt32(dataBoundItem["SID"]); d.Update(); } else { d.Insert(); } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { Utility.WriteToLog(ex, this); } }
private void LoadListbyAdmNo(int admno) { EStudent d = new EStudent(); DataSet ds = d.GetArrearsAdmNo(admno); if (ds.Tables[0].Rows.Count > 0) { grdList.AutoGenerateColumns = false; grdList.DataSource = ds.Tables[0]; } else { MessageBox.Show("Sorry No Record Found", "No Record", MessageBoxButtons.OK, MessageBoxIcon.Information); grdList.DataSource = null; } }