/// <summary> /// Method is used to bind Questionire dropdown /// </summary> public void FillQuestionaireDropdown(int VesselID, int Vetting_Type_ID) { try { DataTable dtQuestionaire = new DataTable(); BLL_VET_Index objIndex = new BLL_VET_Index(); dtQuestionaire = objIndex.VET_GET_Published_QuestionnireList(VesselID, Vetting_Type_ID); ddlQuestionaire.ClearSelection(); if (dtQuestionaire.Rows.Count > 0) { ddlQuestionaire.Items.Clear(); ddlQuestionaire.DataSource = dtQuestionaire; ddlQuestionaire.DataTextField = "Name"; ddlQuestionaire.DataValueField = "Questionnaire_ID"; ddlQuestionaire.DataBind(); ddlQuestionaire.Items.Insert(0, new ListItem("-SELECT-", "0")); } else { ddlQuestionaire.Items.Clear(); ddlQuestionaire.DataSource = null; ddlQuestionaire.DataBind(); ddlQuestionaire.Items.Insert(0, new ListItem("-SELECT-", "0")); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void btnconfirm_Click(object sender, EventArgs e) { try { BLL_VET_Index objIndex = new BLL_VET_Index(); string sPath = Server.MapPath("\\" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "\\uploads\\Vetting\\ImportedObservation\\"); DataSet ds = new DataSet(); ds.ReadXml(sPath + ViewState["AttachPath"].ToString()); ImportObservation objImportObs = new ImportObservation(); if (string.IsNullOrWhiteSpace(objImportObs.SaveImportObservation(ds, ddlQuestionaire.SelectedValue, Convert.ToInt32(ViewState["Vetting_ID"])))) { objIndex.VET_Ins_AttatmentImport(Convert.ToInt32(ViewState["Vetting_ID"]), Path.GetFileName(FileUpXMLReport.PostedFile.FileName), AttachPath, GetSessionUserID()); objIndex.VET_Upd_PerformVettingDetails(UDFLib.ConvertToInteger(ViewState["Vetting_ID"].ToString()), txtVettingName.Text, UDFLib.ConvertToDate(txtDate.Text), UDFLib.ConvertToInteger(ddlType.SelectedValue), ddlType.SelectedItem.Text, UDFLib.ConvertToInteger(ddlInspector.SelectedValue), UDFLib.ConvertIntegerToNull(ddlOilMajor.SelectedValue), UDFLib.ConvertToInteger(ddlPort.SelectedValues.Rows[0][0]), UDFLib.ConvertIntegerToNull(hdfPorCallID.Value), UDFLib.ConvertToInteger(txtDays.Text), UDFLib.ConvertToDate(txtResponseDate.Text), GetSessionUserID()); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", "alert('Perform Vetting saved successfully');", true); ClearFields(); Session["VET_ImportDataset" + GUIDSession.Value.ToString()] = null; string js = "parent.UpdatePageAfterSave(" + ViewState["Vetting_ID"].ToString() + ");"; ScriptManager.RegisterStartupScript(this, this.GetType(), "js", js, true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", "alert('Invalid file.');", true); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
/// <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); } }
/// <summary> /// Method is used to bind vetting details when mode is perform vetting /// </summary> /// <param name="Vetting_ID">selected Vetting id</param> protected void BindPerformVetting(int Vetting_ID) { try { BLL_VET_Index objIndex = new BLL_VET_Index(); DataTable dtVetting = objIndex.VET_Get_Perform_Vetting_Detail(Vetting_ID); if (dtVetting.Rows.Count > 0) { ddlVessel.SelectedValue = dtVetting.Rows[0]["Vessel_ID"].ToString(); txtVettingName.Text = dtVetting.Rows[0]["Vetting_Name"].ToString(); FillVettingTypeDropdown(UDFLib.ConvertToInteger(ddlVessel.SelectedValue)); ddlType.SelectedValue = dtVetting.Rows[0]["Vetting_Type_ID"].ToString(); if (ddlType.SelectedItem.Text == "SIRE") { trImportXML.Visible = true; } txtDate.Text = UDFLib.ConvertUserDateFormat(dtVetting.Rows[0]["Vetting_Date"].ToString()); txtDays.Text = dtVetting.Rows[0]["No_Of_Days"].ToString(); ddlOilMajor.SelectedValue = dtVetting.Rows[0]["Oil_Major_ID"].ToString(); AddInspectorImg(); FillInspectorDropdown(UDFLib.ConvertToInteger(ddlType.SelectedValue)); ddlInspector.SelectedValue = dtVetting.Rows[0]["Inspector_ID"].ToString(); ddlPort.Select(dtVetting.Rows[0]["Port_ID"].ToString()); hdfPorCallID.Value = dtVetting.Rows[0]["Port_Call_ID"].ToString(); FillQuestionaireDropdown(UDFLib.ConvertToInteger(ddlVessel.SelectedValue), UDFLib.ConvertToInteger(ddlType.SelectedValue)); ddlQuestionaire.SelectedValue = dtVetting.Rows[0]["Questionnaire_ID"].ToString(); hdnQuestionnaireID.Value = dtVetting.Rows[0]["Questionnaire_ID"].ToString(); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
/// <summary> /// Method is used to get observation details for display /// </summary> public void VET_Get_Observation() { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); DataTable dtObs = objBLLIndx.VET_Get_Observation(UDFLib.ConvertToInteger(ViewState["Vetting_ID"].ToString()), UDFLib.ConvertToInteger(ViewState["Question_ID"].ToString()), UDFLib.ConvertToInteger(ViewState["Observation_ID"].ToString())); if (dtObs.Rows.Count > 0) { if (Convert.ToString(dtObs.Rows[0]["Section_No"]) != "") { ddlSection.ClearSelection(); ddlSection.Items.FindByText(Convert.ToString(dtObs.Rows[0]["Section_No"])).Selected = true; } if (Convert.ToString(dtObs.Rows[0]["Question_No"]) != "") { VET_Get_QuestionByVettingId_SectionNo(); ddlQuestion.ClearSelection(); ddlQuestion.Items.FindByText(Convert.ToString(dtObs.Rows[0]["Question_No"])).Selected = true; } if (Convert.ToString(dtObs.Rows[0]["Category"]) != "") { ddlCategory.ClearSelection(); ddlCategory.Items.FindByText(Convert.ToString(dtObs.Rows[0]["Category"])).Selected = true; } if (Convert.ToString(dtObs.Rows[0]["Risk_Level"]) != "") { ddlRiskLevel.ClearSelection(); ddlRiskLevel.Items.FindByText(Convert.ToString(dtObs.Rows[0]["Risk_Level"])).Selected = true; } if (Convert.ToString(dtObs.Rows[0]["Status"]) != "") { ddlStatus.ClearSelection(); ddlStatus.Items.FindByText(Convert.ToString(dtObs.Rows[0]["Status"])).Selected = true; } if (Convert.ToString(dtObs.Rows[0]["ObsType"]) != "") { ddlType.ClearSelection(); ddlType.Items.FindByText(Convert.ToString(dtObs.Rows[0]["ObsType"])).Selected = true; } if (Convert.ToString(dtObs.Rows[0]["ObsDescription"]) != "") { txtObsDescription.Text = dtObs.Rows[0]["ObsDescription"].ToString(); } if (Convert.ToString(dtObs.Rows[0]["Question"]) != "") { lblQuestion.Text = dtObs.Rows[0]["Question"].ToString(); } } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
public void VET_Get_QuestionByVettingId_SectionNo() { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); ddlQuestion.DataSource = objBLLIndx.VET_Get_QuestionByVettingId_SectionNo(UDFLib.ConvertToInteger(ViewState["Vetting_ID"].ToString()), UDFLib.ConvertToInteger(ddlSection.SelectedValue), ViewState["Mode"].ToString()); ddlQuestion.DataTextField = "Question_No"; ddlQuestion.DataValueField = "ID"; ddlQuestion.DataBind(); ddlQuestion.Items.Insert(0, new ListItem("-Select-", "0")); }
protected void gvRelatedJob_RowCommand(object sender, GridViewCommandEventArgs e) { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); int OBSJobID = UDFLib.ConvertToInteger(e.CommandArgument.ToString()); int res = objBLLIndx.VET_Upd_UnlinkWorklistJobs(OBSJobID, UDFLib.ConvertToInteger(Session["USERID"].ToString())); VET_Get_ObsRelatedJobs(); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
/// <summary> /// Bind Questionnire list /// </summary> public void VET_GET_QuestionnireList() { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); DataTable dtQuestionnire = objBLLIndx.VET_GET_QuestionnireList(); DDLQuestionnaire.DataSource = dtQuestionnire; DDLQuestionnaire.DataTextField = "Name"; DDLQuestionnaire.DataValueField = "Questionnaire_ID"; DDLQuestionnaire.DataBind(); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Method is used to get Questionnire details of particular question /// </summary> public void VET_Get_QuestionnaireIdByQuestionId() { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); DataTable dtQuestionnire = objBLLIndx.VET_Get_QuestionnaireIdByQuestionId(UDFLib.ConvertToInteger(ViewState["Question_ID"].ToString())); if (dtQuestionnire.Rows.Count > 0) { DDLQuestionnaire.Select(Convert.ToString(dtQuestionnire.Rows[0]["Questionnaire_ID"])); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
protected void onRework(object source, CommandEventArgs e) { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); Vetting_Id = Convert.ToInt32(e.CommandArgument); try { objBLLIndx.VET_Upd_VettingReworkStatus(Vetting_Id, Convert.ToInt32(Session["USERID"])); Bind_VettingIndex(); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Bind observation categories /// </summary> public void VET_Get_ObservationCategories() { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); string Mode = "Edit"; DataTable dt = objBLLIndx.VET_Get_ObservationCategories(Mode); DDLCategories.DataSource = dt; DDLCategories.DataTextField = "OBSCategory_Name"; DDLCategories.DataValueField = "OBSCategory_ID"; DDLCategories.DataBind(); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Bind observation categories /// </summary> public void BindVettingObservationCategories() { try { BLL_VET_Index oVT = new BLL_VET_Index(); DataTable dt = oVT.VET_Get_ObservationCategories("Edit"); lstObservationCategory.DataSource = dt; lstObservationCategory.DataTextField = "OBSCategory_Name"; lstObservationCategory.DataValueField = "OBSCategory_ID"; lstObservationCategory.DataBind(); lstObservationCategory.Items.Insert(0, new ListItem("-SELECT ALL-", "0")); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
public void GetRelatedOpenObservationCount(int QuestionID, int FleetCode) { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); DataTable dtOpenObsCount = objBLLIndx.VET_Get_RelatedOpenObsCount(); string filterpenexpression = filterpenexpression = " Question_ID=" + UDFLib.ConvertToInteger(QuestionID) + " and FleetCode=" + UDFLib.ConvertToInteger(FleetCode); DataRow[] drOpnObsCount = dtOpenObsCount.Select(filterpenexpression); if (drOpnObsCount.Length <= 0) { lnkRelatedObs.Text = "0"; lnkRelatedObs.Enabled = false; } else { lnkRelatedObs.Text = drOpnObsCount[0][0].ToString(); lnkRelatedObs.Enabled = true; } }
/// <summary> /// Method is used to get observation related worklist jobs of particular vetting and observation. /// </summary> public void VET_Get_ObsRelatedJobs() { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); DataSet ds = new DataSet(); ds = objBLLIndx.VET_Get_ObsRelatedJobs(UDFLib.ConvertToInteger(ViewState["Vetting_ID"].ToString()), UDFLib.ConvertToInteger(ViewState["Observation_ID"].ToString())); if (ds != null) { gvRelatedJob.DataSource = ds.Tables[0]; gvRelatedJob.DataBind(); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Method is used to bind port dropdown /// </summary> public void FillPortDropdown() { try { DataTable dtPort = new DataTable(); BLL_VET_Index objIndex = new BLL_VET_Index(); dtPort = objIndex.VET_Get_PortList(); if (dtPort.Rows.Count > 0) { ddlPort.DataSource = dtPort; ddlPort.DataTextField = "PORT_NAME"; ddlPort.DataValueField = "PORT_ID"; ddlPort.DataBind(); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
/// <summary> /// Method is used to bind observation type list /// </summary> public void VET_Get_ObservationTypeList() { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); DataTable dtObsType = objBLLIndx.VET_Get_ObservationTypeList(); ddlType.Items.Clear(); ddlType.DataSource = dtObsType; ddlType.DataTextField = "ObsTypName"; ddlType.DataValueField = "ID"; ddlType.DataBind(); ddlType.Items.FindByText(Convert.ToString(dtObsType.Rows[1]["ObsTypName"])).Selected = true; } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Method is used to bind question no. list by vetting id /// </summary> public void VET_Get_QuestionNoByVettingId() { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); DataTable dtQuestionNo = objBLLIndx.VET_Get_QuestionNoByVettingId(UDFLib.ConvertToInteger(ViewState["Vetting_ID"].ToString()), ViewState["Mode"].ToString()); ddlQuestion.Items.Clear(); ddlQuestion.DataSource = dtQuestionNo; ddlQuestion.DataTextField = "Question_No"; ddlQuestion.DataValueField = "ID"; ddlQuestion.DataBind(); ListItem li = new ListItem("-Select-", "0"); ddlQuestion.Items.Insert(0, li); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Bind Question number by questionnire id /// </summary> public void VET_Get_QuestionNoByQuestionnireId() { try { if (DDLQuestionnaire.SelectedValues.Rows.Count > 0) { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); DataTable dtQuestionNo = objBLLIndx.VET_Get_QuestionNoByQuestionnireId(DDLQuestionnaire.SelectedValues, DDLSection.SelectedValues); DDLQuestion.DataSource = dtQuestionNo; DDLQuestion.DataTextField = "Question_No"; DDLQuestion.DataValueField = "ID"; DDLQuestion.DataBind(); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Methos is used to bind inspector dropdown according to the vetting type /// </summary> /// <param name="Vetting_Type_ID">Selected vetting type</param> public void FillInspectorDropdown(int Vetting_Type_ID) { try { DataTable dtInspector = new DataTable(); BLL_VET_Index objIndex = new BLL_VET_Index(); dtInspector = objIndex.VET_Get_InspectorListByVettingType(Vetting_Type_ID); if (dtInspector.Rows.Count > 0) { ddlInspector.DataSource = dtInspector; ddlInspector.DataTextField = "NAME"; ddlInspector.DataValueField = "UserID"; ddlInspector.DataBind(); ddlInspector.Items.Insert(0, new ListItem("-SELECT-", "0")); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
/// <summary> /// Method is used to bind observation categories /// </summary> public void VET_Get_ObservationCategories() { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); DataTable dtCategory = objBLLIndx.VET_Get_ObservationCategories(ViewState["Mode"].ToString()); ddlCategory.Items.Clear(); ddlCategory.DataSource = dtCategory; ddlCategory.DataTextField = "OBSCategory_Name"; ddlCategory.DataValueField = "OBSCategory_ID"; ddlCategory.DataBind(); ListItem li = new ListItem("-Select-", "0"); ddlCategory.Items.Insert(0, li); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
protected void ddlQuestion_SelectedIndexChanged(object sender, EventArgs e) { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); if (ddlQuestion.SelectedValue != "0") { ViewState["ddlQuestionNo"] = ddlQuestion.SelectedValue; DataTable dtQuestionNo = objBLLIndx.VET_Get_QuestionByQuestionNo(UDFLib.ConvertToInteger(ViewState["ddlQuestionNo"].ToString())); if (dtQuestionNo.Rows.Count > 0) { if (Convert.ToString(dtQuestionNo.Rows[0]["Question"]) != "") { lblQuestion.Text = dtQuestionNo.Rows[0]["Question"].ToString(); } } GetRelatedOpenObservationCount(UDFLib.ConvertToInteger(ddlQuestion.SelectedValue), UDFLib.ConvertToInteger(ViewState["FleetCode"].ToString())); dvbadge.Visible = true; lnkRelatedObs.Enabled = true; lnkRelatedObs.NavigateUrl = "Vetting_ObservationIndex.aspx?Question_ID=" + ddlQuestion.SelectedValue + "&FleetCode=" + ViewState["FleetCode"].ToString() + "&Vetting_Type_ID=" + ViewState["Vetting_Type_ID"].ToString() + "&Status=Open" + "&Parent=AON"; } else { lblQuestion.Text = ""; dvbadge.Visible = false; lnkRelatedObs.Enabled = false; } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Bind all records of vetting /// </summary> public void Bind_VettingIndex() { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); DataSet ds = new DataSet(); int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } int IsValid = 0; DataTable dtEXInspector = new DataTable(); dtEXInspector.Columns.Add("ID"); DataTable dtInspector = new DataTable(); dtInspector.Columns.Add("ID"); foreach (DataRow dr in DDLInspector.SelectedValues.Rows) { if (dr[0].ToString().Split('_')[1] == "In") { dtInspector.Rows.Add(dr[0].ToString().Split('_')[0]); } if (dr[0].ToString().Split('_')[1] == "Ex") { dtEXInspector.Rows.Add(dr[0].ToString().Split('_')[0]); } } DateTime?VetFromDate, VetToDate; VetFromDate = txtLVetFromDate.Text.Trim() == "" ? null : UDFLib.ConvertDateToNull(UDFLib.ConvertToDate(txtLVetFromDate.Text)); VetToDate = txtLVetToDate.Text.Trim() == "" ? null : UDFLib.ConvertDateToNull(UDFLib.ConvertToDate(txtLVetToDate.Text)); if (rbtnValid.Checked == true) { IsValid = 1; } ds = objBLLIndx.VET_Get_VettingIndex(DDLVessel.SelectedValues, DDLVetType.SelectedValues, DDLStatus.SelectedValues, txtDueDays.Text == "0" ? UDFLib.ConvertToInteger(txtDueDays.Text.Trim()) : UDFLib.ConvertIntegerToNull(txtDueDays.Text.Trim()), IsValid, UDFLib.ConvertToInteger(rbtnObservation.SelectedValue), DDLOilMajor.SelectedValues, dtInspector, dtEXInspector, VetFromDate, VetToDate, DDLJobStatus.SelectedValues, txtVessel.Text != "" ? txtVessel.Text.Trim() : null, sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ds.Tables.Count > 0) { ViewState["dtObservationCount"] = ds.Tables[1]; ViewState["dtNotesCount"] = ds.Tables[2]; ViewState["dtResponse"] = ds.Tables[3]; ViewState["dtJobsCount"] = ds.Tables[4]; } if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } gvVettingIndex.DataSource = ds.Tables[0]; gvVettingIndex.DataBind(); if (ds.Tables[0].Rows.Count > 0) { btnExport.Enabled = true; } else { btnExport.Enabled = false; } UpdPnlGrid.Update(); UpdPnlFilter.Update(); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Bind all records of observation index /// </summary> public void Bind_ObservationIndex() { try { BLL_VET_Index objBLLIndx = new BLL_VET_Index(); DataSet ds = new DataSet(); int rowcount = ucCustomPagerItemsObs.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dtInspector = new DataTable(); dtInspector.Columns.Add("ID"); DataTable dtEXInspector = new DataTable(); dtEXInspector.Columns.Add("ID"); foreach (DataRow dr in DDLInspectorObs.SelectedValues.Rows) { if (dr[0].ToString().Split('_')[1] == "In") { dtInspector.Rows.Add(dr[0].ToString().Split('_')[0]); } if (dr[0].ToString().Split('_')[1] == "Ex") { dtEXInspector.Rows.Add(dr[0].ToString().Split('_')[0]); } } DateTime?LObsFromDate, LObsToDate; LObsFromDate = txtLObsFromDate.Text.Trim() == "" ? null : UDFLib.ConvertDateToNull(UDFLib.ConvertToDate(txtLObsFromDate.Text)); LObsToDate = txtLObsToDate.Text.Trim() == "" ? null : UDFLib.ConvertDateToNull(UDFLib.ConvertToDate(txtLObsToDate.Text)); ds = objBLLIndx.VET_Get_ObservationIndex(DDLQuestionnaire.SelectedValues, DDLSection.SelectedValues, DDLQuestion.SelectedValues, UDFLib.ConvertToInteger(rbtnType.SelectedValue), ViewState["Status"].ToString(), UDFLib.ConvertToInteger(DDLFleet.SelectedValue), DDLVesselObs.SelectedValues, DDLOilMajorObs.SelectedValues, dtInspector, dtEXInspector, DDLCategories.SelectedValues, DDLRiskLevel.SelectedValues, txtObservationVessel.Text != "" ? txtObservationVessel.Text.Trim() : null, LObsFromDate, LObsToDate, sortbycoloumn, sortdirection, ucCustomPagerItemsObs.CurrentPageIndex, ucCustomPagerItemsObs.PageSize, ref rowcount); if (ds.Tables.Count > 0) { ViewState["dtObsResponse"] = ds.Tables[1]; ViewState["dtObsJobsCount"] = ds.Tables[2]; ViewState["dtObsvationCount"] = ds.Tables[3]; } if (ucCustomPagerItemsObs.isCountRecord == 1) { ucCustomPagerItemsObs.CountTotalRec = rowcount.ToString(); ucCustomPagerItemsObs.BuildPager(); } gvObservationIndex.DataSource = ds.Tables[0]; gvObservationIndex.DataBind(); if (ds.Tables[0].Rows.Count > 0) { btnObsExport.Enabled = true; } else { btnObsExport.Enabled = false; } UpdPnlGridObs.Update(); UpdPnlFilterObs.Update(); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
protected void btnCreatVetting_Click(object sender, EventArgs e) { try { BLL_VET_Index objIndex = new BLL_VET_Index(); int ddlportID = 0; if (ddlPort.SelectedValues.Rows.Count > 0) { if (ddlPort.SelectedValues.Rows.Count > 1) { ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", "alert('Please select only one port.');", true); return; } else { ddlportID = UDFLib.ConvertToInteger(ddlPort.SelectedValues.Rows[0][0]); } } if (ViewState["Vetting_ID"] != null) { if (txtResponseDate.Text != "") { if (UDFLib.ConvertToDate(txtResponseDate.Text) < UDFLib.ConvertToDate(txtDate.Text)) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", "alert('Response-Next due date is can not be less than vetting date.');", true); return; } } DataTable dtVetting = objIndex.VET_Get_ExistVetting(UDFLib.ConvertToInteger(ddlVessel.SelectedValue), UDFLib.ConvertToDate(txtDate.Text), UDFLib.ConvertToInteger(ddlType.SelectedValue), UDFLib.ConvertToInteger(ViewState["Vetting_ID"].ToString())); if (dtVetting.Rows.Count > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "jsSqlError3", "alert('Vetting already exists with same vessel,same type and same date.');", true); return; } else { if (FileUpXMLReport.HasFile) { int Vetting_ID = Convert.ToInt32(ViewState["Vetting_ID"]); int IsDataInValid = 0; int IsObsExists = 0; var FileExtension = "." + Path.GetExtension(FileUpXMLReport.PostedFile.FileName).Substring(1); if (FileExtension != ".xml") { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", "alert('File type should be only xml.');", true); } else { DataSet ds = new DataSet(); DataTable dt = new DataTable(); string sPath = Server.MapPath("\\" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "\\uploads\\Vetting\\ImportedObservation\\"); if (!Directory.Exists(Server.MapPath("~/uploads/Vetting/ImportedObservation"))) { Directory.CreateDirectory(Server.MapPath("~/uploads/Vetting/ImportedObservation")); } Guid GUID = Guid.NewGuid(); string AttachPath = "VET_ImportObs" + GUID.ToString() + FileExtension; ViewState["AttachPath"] = AttachPath; FileUpXMLReport.SaveAs(sPath + AttachPath); ds.ReadXml(sPath + AttachPath); Session["VET_ImportDataset" + GUIDSession.Value.ToString()] = ds; if (ds.Tables.Count > 0) { ImportObservation objImportObs = new ImportObservation(); if (string.IsNullOrWhiteSpace(objImportObs.ImportValidation(ds, Vetting_ID))) { Dictionary <string, string> objDicResult = objImportObs.ImportValueValidation(ds, ddlQuestionaire.SelectedValue, ddlVessel.SelectedItem.Text, ddlPort.SelectedTexts.Rows[0]["SelectedText"].ToString(), txtDate.Text, Vetting_ID, ref IsDataInValid, ref IsObsExists); if (objDicResult.Keys.Contains("QUESTIONNAIRE")) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", "alert('" + objDicResult["QUESTIONNAIRE"] + "');", true); } else if (string.IsNullOrWhiteSpace(objDicResult["ERRORMESSAGE"])) { if (IsDataInValid == 0 && IsObsExists == 0) { if (string.IsNullOrWhiteSpace(objImportObs.SaveImportObservation(ds, ddlQuestionaire.SelectedValue, Vetting_ID))) { objIndex.VET_Ins_AttatmentImport(Vetting_ID, Path.GetFileName(FileUpXMLReport.PostedFile.FileName), AttachPath, GetSessionUserID()); objIndex.VET_Upd_PerformVettingDetails(UDFLib.ConvertToInteger(ViewState["Vetting_ID"].ToString()), txtVettingName.Text, UDFLib.ConvertToDate(txtDate.Text), UDFLib.ConvertToInteger(ddlType.SelectedValue), ddlType.SelectedItem.Text, UDFLib.ConvertToInteger(ddlInspector.SelectedValue), UDFLib.ConvertToInteger(ddlOilMajor.SelectedValue), UDFLib.ConvertToInteger(ddlPort.SelectedValues.Rows[0][0]), UDFLib.ConvertIntegerToNull(hdfPorCallID.Value), UDFLib.ConvertToInteger(txtDays.Text), UDFLib.ConvertToDate(txtResponseDate.Text), GetSessionUserID()); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", "alert('Perform Vetting saved successfully');", true); ClearFields(); Session["VET_ImportDataset" + GUIDSession.Value.ToString()] = null; string js = "parent.UpdatePageAfterSave(" + ViewState["Vetting_ID"].ToString() + ");"; ScriptManager.RegisterStartupScript(this, this.GetType(), "js", js, true); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", "alert('Error while importing.');", true); } } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "Confirm", "ImportConfirm(" + IsDataInValid + "," + IsObsExists + ",'" + ddlVessel.SelectedItem.Text + "','" + ddlPort.SelectedTexts.Rows[0]["SelectedText"].ToString() + "','" + txtDate.Text + "');", true); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", "alert('Invalid file.');", true); } } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", "alert('Invalid file.');", true); } } } } else { objIndex.VET_Upd_PerformVettingDetails(UDFLib.ConvertToInteger(ViewState["Vetting_ID"].ToString()), txtVettingName.Text, UDFLib.ConvertToDate(txtDate.Text), UDFLib.ConvertToInteger(ddlType.SelectedValue), ddlType.SelectedItem.Text, UDFLib.ConvertToInteger(ddlInspector.SelectedValue), UDFLib.ConvertIntegerToNull(ddlOilMajor.SelectedValue), ddlportID, UDFLib.ConvertIntegerToNull(hdfPorCallID.Value), UDFLib.ConvertToInteger(txtDays.Text), UDFLib.ConvertDateToNull(txtResponseDate.Text), GetSessionUserID()); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", "alert('Perform Vetting saved successfully');", true); ClearFields(); string js = "parent.UpdatePageAfterSave(" + ViewState["Vetting_ID"].ToString() + ");"; ScriptManager.RegisterStartupScript(this, this.GetType(), "js", js, true); } } //} } else { DataTable dtVetting = objIndex.VET_Get_ExistVetting(UDFLib.ConvertToInteger(ddlVessel.SelectedValue), UDFLib.ConvertToDate(txtDate.Text), UDFLib.ConvertToInteger(ddlType.SelectedValue), null); if (dtVetting.Rows.Count > 0) { string jsSqlError3 = "alert('Vetting already exists with same vessel,same type and same date.');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "jsSqlError3", jsSqlError3, true); } else { int Vetting_ID = 0; int ReturnValue = 0; Vetting_ID = objIndex.VET_Ins_Vetting(UDFLib.ConvertToInteger(ddlVessel.SelectedValue), UDFLib.ConvertToDate(txtDate.Text), UDFLib.ConvertToInteger(ddlType.SelectedValue), ddlType.SelectedItem.Text, UDFLib.ConvertToInteger(ddlQuestionaire.SelectedValue), UDFLib.ConvertIntegerToNull(ddlOilMajor.SelectedValue), UDFLib.ConvertToInteger(ddlInspector.SelectedValue), ddlportID, UDFLib.ConvertIntegerToNull(hdfPorCallID.Value), GetSessionUserID(), ref ReturnValue); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", "alert('Vetting saved successfully');", true); ClearFields(); string js = "parent.VettingDetail(" + Vetting_ID + ");"; ScriptManager.RegisterStartupScript(this, this.GetType(), "js", js, true); } } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }