protected void gvEducation_RowCommand(object sender, GridViewCommandEventArgs e) { try { Controls objControls = new Controls(); StudentPreEducationDetailTBL objPreEducationBL = new StudentPreEducationDetailTBL(); ApplicationResult objResults = new ApplicationResult(); if (e.CommandName.ToString() == "Edit1") { ViewState["StudentEducationDetailTID"] = Convert.ToInt32(e.CommandArgument.ToString()); //Convert.ToInt32(ViewState["StudentMID"].ToString()) objResults = objPreEducationBL.StudentPreEducationDetailT_Select(Convert.ToInt32(ViewState["StudentEducationDetailTID"].ToString())); if (objResults != null) { if (objResults.resultDT.Rows.Count > 0) { txtSchoolName.Text = objResults.resultDT.Rows[0][StudentPreEducationDetailTBO.STUDENTPASTEDUCATIONDETAILT_SCHOOLNAME].ToString(); txtSchoolAddress.Text = objResults.resultDT.Rows[0][StudentPreEducationDetailTBO.STUDENTPASTEDUCATIONDETAILT_ADDRESS].ToString(); txtMediumName.Text = objResults.resultDT.Rows[0][StudentPreEducationDetailTBO.STUDENTPASTEDUCATIONDETAILT_MEDIUMNAME].ToString(); txtPassedExam.Text = objResults.resultDT.Rows[0][StudentPreEducationDetailTBO.STUDENTPASTEDUCATIONDETAILT_PASSEDEXAM].ToString(); txtBoardName.Text = objResults.resultDT.Rows[0][StudentPreEducationDetailTBO.STUDENTPASTEDUCATIONDETAILT_BOARDNAME].ToString(); ddlPassingYear.SelectedValue = objResults.resultDT.Rows[0][StudentPreEducationDetailTBO.STUDENTPASTEDUCATIONDETAILT_PASSINGYEAR].ToString(); txtState.Text = objResults.resultDT.Rows[0][StudentPreEducationDetailTBO.STUDENTPASTEDUCATIONDETAILT_STATE].ToString(); txtDistrict.Text = objResults.resultDT.Rows[0][StudentPreEducationDetailTBO.STUDENTPASTEDUCATIONDETAILT_DISTRICT].ToString(); txtTaluka.Text = objResults.resultDT.Rows[0][StudentPreEducationDetailTBO.STUDENTPASTEDUCATIONDETAILT_TALUKA].ToString(); txtTown.Text = objResults.resultDT.Rows[0][StudentPreEducationDetailTBO.STUDENTPASTEDUCATIONDETAILT_TOWN].ToString(); ViewState["Mode"] = "Edit"; } } } else if (e.CommandName.ToString() == "Delete1") { ApplicationResult objResultsDelete = new ApplicationResult(); objResultsDelete = objPreEducationBL.StudentPreEducationDetailT_Delete(Convert.ToInt32(e.CommandArgument.ToString())); if (objResultsDelete.status == ApplicationResult.CommonStatusType.SUCCESS) { ClearAll(); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Student Education Details deleted successfully.');</script>"); GridDataBind(); } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
private void GridDataBind() { try { ApplicationResult objResult = new ApplicationResult(); StudentPreEducationDetailTBL ObjPreEducationBL = new StudentPreEducationDetailTBL(); objResult = ObjPreEducationBL.StudentPreEducationDetailT_SelectAll(Convert.ToInt32(ViewState["StudentMID"].ToString())); if (objResult != null) { gvEducation.DataSource = objResult.resultDT; gvEducation.DataBind(); if (objResult.resultDT.Rows.Count > 0) { } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
protected void btnSave_Click(object sender, EventArgs e) { try { ApplicationResult objResults = new ApplicationResult(); StudentPreEducationDetailTBL objPreEducationBL = new StudentPreEducationDetailTBL(); StudentPreEducationDetailTBO objPreEducationBO = new StudentPreEducationDetailTBO(); objPreEducationBO.SchoolMID = Convert.ToInt32(Session[ApplicationSession.SCHOOLID].ToString()); objPreEducationBO.StudentMID = Convert.ToInt32(ViewState["StudentMID"].ToString()); objPreEducationBO.SchoolName = txtSchoolName.Text; objPreEducationBO.Address = txtSchoolAddress.Text; objPreEducationBO.MediumName = txtMediumName.Text; objPreEducationBO.PassedExam = txtPassedExam.Text; objPreEducationBO.BoardName = txtBoardName.Text; objPreEducationBO.PassingYear = ddlPassingYear.SelectedItem.ToString(); objPreEducationBO.LastModifiedDate = DateTime.UtcNow.AddHours(5.5).ToString(); objPreEducationBO.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); objPreEducationBO.Town = txtTown.Text; objPreEducationBO.Taluka = txtTaluka.Text; objPreEducationBO.District = txtDistrict.Text; objPreEducationBO.State = txtState.Text; #region RollBack Transaction Starts DatabaseTransaction.OpenConnectionTransation(); if (ViewState["Mode"].ToString() == "Save") { objResults = objPreEducationBL.StudentPreEducationDetailT_Insert(objPreEducationBO); if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS) { divDetails.Visible = false; ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Student Education Details Saved Successfully.');</script>"); } else { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Passing Exam/ Passing Year is already exists .');</script>"); } } else { objPreEducationBO.StudentEducationDetailTID = Convert.ToInt32(ViewState["StudentEducationDetailTID"].ToString()); objResults = objPreEducationBL.StudentPreEducationDetailT_Update(objPreEducationBO); if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Student Education Details Update Successfully.');</script>"); } else { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Passing Exam/ Passing Year is already exists .');</script>"); } } DatabaseTransaction.CommitTransation(); ClearAll(); GridDataBind(); #endregion } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }