/// <summary> /// Method is used to insert/update observation note details /// </summary> /// <param name="Mode">Mode of operation. Value is Add or Edit</param> public void VET_Ins_Observation_Note(string Mode) { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); if (Mode == "Add") { DataTable dtObservation = new DataTable(); dtObservation = objBLLIndx.VET_Ins_Observation_Note(UDFLib.ConvertToInteger(ViewState["Vetting_ID"].ToString()), UDFLib.ConvertToInteger(ddlQuestion.SelectedValue), UDFLib.ConvertToInteger(ddlType.SelectedValue), txtObsDescription.Text.Trim(), UDFLib.ConvertToInteger(ddlCategory.SelectedValue), UDFLib.ConvertIntegerToNull(ddlRiskLevel.SelectedValue), ddlStatus.SelectedItem.Text.Trim(), UDFLib.ConvertToInteger(Session["USERID"].ToString())); if (dtObservation.Rows.Count > 0) { hdnObservationId.Value = dtObservation.Rows[0]["Observation_ID"].ToString(); hdnQryStrObservationId.Value = dtObservation.Rows[0]["Observation_ID"].ToString(); ViewState["Observation_ID"] = hdnObservationId.Value; } string jsSqlError2 = "alert('Observation saved successfully.');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "jsSqlError2", jsSqlError2, true); } else if (Mode == "Edit") { objBLLIndx.VET_Upd_Observation_Note(UDFLib.ConvertToInteger(ViewState["Observation_ID"].ToString()), UDFLib.ConvertToInteger(ViewState["Vetting_ID"].ToString()), UDFLib.ConvertToInteger(ddlQuestion.SelectedValue), UDFLib.ConvertToInteger(ddlType.SelectedValue), txtObsDescription.Text.Trim(), UDFLib.ConvertToInteger(ddlCategory.SelectedValue), UDFLib.ConvertIntegerToNull(ddlRiskLevel.SelectedValue), ddlStatus.SelectedItem.Text.Trim(), UDFLib.ConvertToInteger(Session["USERID"].ToString())); string jsSqlError2 = "alert('Observation updated successfully.');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "jsSqlError2", jsSqlError2, true); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }