/// <summary> /// Create New Event for that vessel without port name or add crew to existing event /// </summary> protected void btnAssign_Click(object sender, EventArgs e) { DataTable dtCrewId = new DataTable(); dtCrewId.Columns.Add("CrewId"); DataRow dr1 = dtCrewId.NewRow(); dr1["CrewId"] = OnSignnerCrewId; dtCrewId.Rows.Add(dr1); DataTable dtVesselType = objCrew.CheckVesselTypeForCrew(dtCrewId, VesselId); if (dtVesselType.Rows.Count > 0 && !dtVesselType.Rows[0][0].ToString().Equals("")) { rdbVesselTypeAssignmentList.SelectedValue = "1"; lblConfirmationTitle.Text = dtVesselType.Rows[0]["StaffNames"].ToString() + " does not have the required vessel type assignment.Choose if you want to add " + dtVesselType.Rows[0]["VesselType"].ToString() + " to his vessel type list,or to assign him one time only"; ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", "showModal('divVesselType');", true); } else { Assign(); } }
protected void btnAssign_Click(object sender, EventArgs e) { try { string js = ""; lblMessage.Text = ""; if (ddlJoiningRank.SelectedValue == "0") { js = "alert('Select Joining Rank');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertUser", js, true); } else { int id1 = 0, id2 = 0, SigningOffVesselId = 0; foreach (GridViewRow currentRow in gvUnAssignedCrew.Rows) { RadioButton selectButton = (RadioButton)currentRow.FindControl("RowSelector"); if (selectButton.Checked) { id2 = int.Parse(((Label)currentRow.FindControl("lblSTAFFID")).Text); break; } } if (gvSignOffCrew.SelectedValue != null) { SigningOffVesselId = int.Parse(gvSignOffCrew.DataKeys[gvSignOffCrew.SelectedIndex]["Vessel_ID"].ToString()); id1 = int.Parse(gvSignOffCrew.SelectedValue.ToString()); } if (gvUnAssignedCrew.SelectedValue != null) { id2 = int.Parse(gvUnAssignedCrew.SelectedValue.ToString()); } if (id1 == 0 || id2 == 0) { js = "alert('Select crew for the assignment');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertUser", js, true); } else { if (id1 == id2) { js = "alert('The Unassigned crew which is selected is same who is signing off');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertUser", js, true); } else { foreach (GridViewRow currentRow in gvUnAssignedCrew.Rows) { RadioButton selectButton1 = (RadioButton)currentRow.FindControl("RowSelector"); if (selectButton1.Checked) { id2 = int.Parse(((Label)currentRow.FindControl("lblSTAFFID")).Text); break; } } if (gvSignOffCrew.SelectedValue != null) { SigningOffVesselId = int.Parse(gvSignOffCrew.DataKeys[gvSignOffCrew.SelectedIndex]["Vessel_ID"].ToString()); } DataTable dtVesselType = objCrew.CheckVesselTypeForCrew(id2, SigningOffVesselId); if (dtVesselType.Rows.Count > 0 && dtVesselType.Rows[0][0].ToString() == "-1") { rdbVesselTypeAssignmentList.SelectedValue = "1"; lblConfirmationTitle.Text = dtVesselType.Rows[0]["StaffName"].ToString() + " does not have the required vessel type assignment.Choose if you want to add " + dtVesselType.Rows[0]["VesselType"].ToString() + " to his vessel type list,or to assign him one time only"; ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", "showVesselType();", true); } else { if (js == "") { Assign(id2); } } } } } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void btnSavePersonalDetails_Click(object sender, EventArgs e) { Boolean Valid = ValidatePersonalDetails(); string response = ""; CrewProperties objCrw = new CrewProperties(); try { if (Valid == true) { //Vessel Type int i = 1; DataTable dtVesselTypes = new DataTable(); dtVesselTypes.Columns.Add("PID"); dtVesselTypes.Columns.Add("VALUE"); foreach (DataRow dr in ddlVesselType.SelectedValues.Rows) { DataRow dr1 = dtVesselTypes.NewRow(); dr1["PID"] = i; dr1["VALUE"] = dr[0]; dtVesselTypes.Rows.Add(dr1); i++; } int VesselTypeId = 0, isOnboard = 0; if (!lblCode.Text.Equals("") && dtVesselTypes.Rows.Count == 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Select at least one Vessel Type!');", true); } else { if (dtVesselTypes.Rows.Count > 0) { DataTable dtSavedVesselType = objBLLCrew.GET_VesselTypeForCrew(int.Parse(CID)); DataTable dtVesselType = objBLLCrew.CheckVesselTypeForCrew(int.Parse(CID), 0); if (dtSavedVesselType != dtVesselType) { if (dtVesselType.Rows.Count > 0) { if (dtVesselType.Rows[0][0].ToString() != "-1") //Crew has no open assignment { VesselTypeId = int.Parse(dtVesselType.Rows[0][0].ToString()); isOnboard = int.Parse(dtVesselType.Rows[0]["Onboard"].ToString()); dtVesselTypes.DefaultView.RowFilter = "VALUE = " + VesselTypeId; if (dtVesselTypes.DefaultView.Count == 0) { if (isOnboard == 1) { response = dtVesselType.Rows[0]["StaffName"].ToString() + " is currently onboard on " + dtVesselType.Rows[0]["VesselName"].ToString() + " having " + dtVesselType.Rows[0]["VesselTypeName"].ToString() + " as vessel type. Would you like to continue?"; } else { response = dtVesselType.Rows[0]["StaffName"].ToString() + " is having a open assignment on " + dtVesselType.Rows[0]["VesselName"].ToString() + " having " + dtVesselType.Rows[0]["VesselTypeName"].ToString() + " as vessel type. Would you like to continue?"; } ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "confirmation('" + response + "');", true); } } } } } if (response.Equals("")) { UpdateCrewPersonalDetails(); } } } } catch (Exception ex) { lblMessagePersonalDetails.Text = ex.Message; } }