protected void btnSavePassportDetails_Click(object sender, EventArgs e) { string msg = ""; try { if (HiddenField_NationalityId.Value != null) { if (txtPassport_No.Text == "" || txtPassport_Place.Text == "" || txtPassport_IssueDate.Text == "" || txtPassport_ExpDate.Text == "") { int Passport_Mandatory = objCrewAdmin.Check_Document_Mandatory(int.Parse(ddlRankAppliedFor.SelectedValue), int.Parse(HiddenField_NationalityId.Value), "PASSPORT"); if (Passport_Mandatory == 1) { msg = "Please enter PASSPORT details"; } } else if (txtSeamanBk_No.Text == "" || txtSeamanBk_Place.Text == "" || txtSeamanBk_IssueDate.Text == "" || txtSeamanBk_ExpDate.Text == "") { int Seaman_Mandatory = objCrewAdmin.Check_Document_Mandatory(int.Parse(ddlRankAppliedFor.SelectedValue), int.Parse(HiddenField_NationalityId.Value), "SEAMAN"); if (Seaman_Mandatory == 1) { msg = "Please enter SEAMAN BOOK details"; } } } if (msg == "") { int result = 0; if (!string.IsNullOrEmpty(txtPassport_No.Text)) { DataRow[] dtPassportRows = objBLLCrew.GetCrewIfCrewExists("", "", "", txtPassport_No.Text).Select("Passport_Number='" + txtPassport_No.Text + "'"); if (dtPassportRows.Count() == 0) { result = objBLLCrew.UPDATE_CrewPassportAndSeamanDetails(GetCrewID(), txtPassport_No.Text, txtPassport_IssueDate.Text, txtPassport_ExpDate.Text, txtPassport_Place.Text, txtSeamanBk_No.Text, txtSeamanBk_IssueDate.Text, txtSeamanBk_ExpDate.Text, txtSeamanBk_Place.Text, GetSessionUserID()); } else { msg = "Passport number already exists for other staff."; } if (lblPassport_No.Text == txtPassport_No.Text) { result = 1; } } else { msg = ""; result = objBLLCrew.UPDATE_CrewPassportAndSeamanDetails(GetCrewID(), txtPassport_No.Text, txtPassport_IssueDate.Text, txtPassport_ExpDate.Text, txtPassport_Place.Text, txtSeamanBk_No.Text, txtSeamanBk_IssueDate.Text, txtSeamanBk_ExpDate.Text, txtSeamanBk_Place.Text, GetSessionUserID()); } if (result == 1) { pnlView_Passport.Visible = true; pnlEdit_Passport.Visible = false; msg = "Passport details updated."; Load_PassportAndSeamanDetails(GetCrewID()); } else { msg += "Unable to update Passport details."; } } if (msg != "") { string js = "alert('" + msg + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "msgPP", js, true); } } catch (Exception ex) { lblMessage.Text = ex.Message; } }