protected void btnsave_Click(object sender, EventArgs e) { try { clsExam objExam = new clsExam(); if (Request.QueryString["id"] != null) { Exameid = Convert.ToInt32(Request.QueryString["id"].ToString()); objExam.Id = Exameid; } objExam.Name = txtExamName.Text.Trim(); objExam.noofQestion = Convert.ToInt32(txtnoOFQuestion.Text); objExam.Isactive = isActive.Checked; objExam.CoruserId = Convert.ToInt32(ddlCourse.SelectedValue); int result = objBalExam.ExamInsertUpdate(objExam); if (result > 0) { Response.Redirect("ExamList.aspx"); } else { DivError.Visible = true; lblErrorMsg.Text = "Please Try after some Time."; } } catch (Exception ex) { com.Loginsert(HttpContext.Current.Request.Url.AbsolutePath, "btnsave_Click", ex.StackTrace, ex.Message); } }
public int ExamInsertUpdate(clsExam objExam) { try { using (aspccEntities db = new aspccEntities()) { var result = db.ExamInsertUpdate(objExam.Id, objExam.CoruserId, objExam.Name, objExam.noofQestion, objExam.Isactive); return(1); } } catch (Exception ex) { com.Loginsert("DalExamInsertUpdate", "ExamInsertUpdate", ex.StackTrace, ex.Message); return(0); } }