public void Load_RankSeniorityRates(int RankID) { DataTable dt = BLL_PortageBill.Get_Seniority_Rates(RankID, GetSessionUserID()); gvNewSeniority.DataSource = dt; gvNewSeniority.DataBind(); }
protected void btnSaveAndClose_Click(object sender, EventArgs e) { if (ViewState["RankID"] != null) { RankID = int.Parse(ViewState["RankID"].ToString()); } if (RankID > 0) { int CompanySeniorityYear = int.Parse(txtCompanySeniorityYear.Text.ToString()); decimal CompanySeniorityAmount = decimal.Parse(txtCompanySeniorityAmount.Text.ToString()); int Res = BLL_PortageBill.Save_Company_Seniority_Rates(RankID, CompanySeniorityYear, CompanySeniorityAmount, GetSessionUserID()); if (Res == 1) { lblMsg1.Text = "Rates Updated !!"; } else { lblMsg1.Text = "Unable to Update !!"; } string msgdivResponseShow = string.Format("hideModal('dvAddNewCompanySeniority');"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgdivResponseShow", msgdivResponseShow, true); Load_CompanySeniorityRates(RankID); } }
protected void Load_SeniorityRecords() { int PAGE_SIZE = ucCustomPager.PageSize; int PAGE_INDEX = ucCustomPager.CurrentPageIndex; int SelectRecordCount = ucCustomPager.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = BLL_PortageBill.Get_SeniorityRecords(int.Parse(ddlFleet.SelectedValue) , int.Parse(ddlVessel.SelectedValue) , int.Parse(ddlRank.SelectedValue) , ddlMonth.SelectedValue , ddlYear.SelectedValue , txtSearch.Text , CrewID , PAGE_SIZE, PAGE_INDEX, ref SelectRecordCount, sortbycoloumn, sortdirection ); gvSeniorityRecords.DataSource = dt; gvSeniorityRecords.DataBind(); if (ucCustomPager.isCountRecord == 1) { ucCustomPager.CountTotalRec = SelectRecordCount.ToString(); ucCustomPager.BuildPager(); } }
public void Load_CompanySeniorityRates(int RankID) { DataTable dt = BLL_PortageBill.Get_CompanySeniority_Rates(RankID); gvCompanySeniority.DataSource = dt; gvCompanySeniority.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { if (ViewState["RankID"] != null) { RankID = int.Parse(ViewState["RankID"].ToString()); } if (RankID > 0) { DataTable dtRates = new DataTable(); dtRates.Columns.Add("PID", typeof(int)); dtRates.Columns.Add("Value", typeof(double)); foreach (GridViewRow gr in gvNewSeniority.Rows) { double amt = 0; int PID = 0; int.TryParse(((Label)gr.Cells[0].FindControl("lblSeniorityYear")).Text, out PID); double.TryParse(((TextBox)gr.Cells[1].FindControl("txtAmount")).Text, out amt); dtRates.Rows.Add(PID, amt); } int Res = BLL_PortageBill.Update_Seniority_Rates(dtRates, RankID, GetSessionUserID()); if (Res == 1) { lblMsg.Text = "Rates Updated !!"; } else { lblMsg.Text = "Unable to Update !!"; } } }
protected void btnUpdateCompanySeniorityRates_Click(object sender, EventArgs e) { if (UDFLib.ConvertToInteger(lstRank.SelectedValue) > 0) { DataTable dtRates = new DataTable(); dtRates.Columns.Add("PID", typeof(int)); dtRates.Columns.Add("Value", typeof(int)); foreach (GridViewRow gr in gvCompanySeniority.Rows) { double amt = 0; int PID = 0; int.TryParse(((Label)gr.Cells[0].FindControl("lblSeniorityYear")).Text, out PID); double.TryParse(((TextBox)gr.Cells[1].FindControl("txtAmount")).Text, out amt); dtRates.Rows.Add(PID, amt); } int Res = BLL_PortageBill.Update_Company_Seniority_Rates(dtRates, UDFLib.ConvertToInteger(lstRank.SelectedValue), GetSessionUserID()); if (Res == 1) { lblMsg1.Text = "Rates Updated !!"; } else { lblMsg1.Text = "Unable to Update !!"; } } }
protected void gvSeniorityRecords_RowUpdating(object sender, GridViewUpdateEventArgs e) { int VoyageID = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Value.ToString()); int SeniorityYear = UDFLib.ConvertToInteger(e.NewValues["SeniorityYear"]); BLL_PortageBill.Update_CrewSeniorityYear(VoyageID, SeniorityYear, Convert.ToInt32(Session["userid"])); gvSeniorityRecords.EditIndex = -1; Load_SeniorityRecords(); }
protected void Page_Load(object sender, EventArgs e) { if (AjaxFileUpload1.IsInFileUploadPostBack) { } else { btnLoadFiles.Attributes.Add("style", "visibility:hidden"); if (GetSessionUserID() == 0) { Response.Redirect("~/account/login.aspx"); } if (!IsPostBack) { UserAccessValidation(); int iCrewID = UDFLib.ConvertToInteger(getQueryString("CrewID")); int iVoyID = UDFLib.ConvertToInteger(getQueryString("VoyID")); Session["hdnCrewID"] = iCrewID.ToString(); Session["hdnVoyID"] = iVoyID.ToString(); int Wages = BLL_PortageBill.CRW_GET_Wage_Status(iCrewID, iVoyID); if (Wages == 0) { Response.Write("<h1>Contract can not be printed at this moment as Salary is not entered for the Crew</h1>"); Response.End(); } Load_Agreements(); Load_Agreement_Status(); System.Data.DataTable dt = objCrewBLL.Get_CrewAgreementData(iCrewID, iVoyID); frmCrewDetails.DataSource = dt; frmCrewDetails.DataBind(); DataTable dtSL = objCrewBLL.Get_SideLetter_ForVoyage(iVoyID, iCrewID, GetSessionUserID()); if (dtSL.Rows.Count > 0) { pnlSideLetterExists.Visible = true; lblSideLetter.Text = "There is a side letter of US$ " + dtSL.Rows[0]["Amount"].ToString() + " exists for this contract"; } else { pnlSideLetterExists.Visible = false; } } } }
protected void Load_SeniorityRecords() { try { int PAGE_SIZE = ucCustomPager.PageSize; int PAGE_INDEX = ucCustomPager.CurrentPageIndex; int SelectRecordCount = ucCustomPager.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } int RankId = int.Parse(ddlRank.SelectedValue.ToString()); string Status = ddlStaus.SelectedValue.ToString(); int CompanySeniorityYear = int.Parse(ddlCompanySeniorityFilter.SelectedValue.ToString()); DataTable dt = BLL_PortageBill.Get_CrewSeniorityRecords(RankId, Status, CompanySeniorityYear, txtSearchText.Text.Trim(), PAGE_SIZE, PAGE_INDEX, ref SelectRecordCount, sortbycoloumn, sortdirection); UDFLib.ChangeColumnDataType(dt, "RankEffective_date", typeof(string)); UDFLib.ChangeColumnDataType(dt, "CompanyEffective_date", typeof(string)); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { if (!string.IsNullOrEmpty(dr["RankEffective_date"].ToString())) { dr["RankEffective_date"] = UDFLib.ConvertUserDateFormat(Convert.ToDateTime(dr["RankEffective_date"].ToString()).ToString("dd/MM/yyyy"), UDFLib.GetDateFormat()); } if (!string.IsNullOrEmpty(dr["CompanyEffective_date"].ToString())) { dr["CompanyEffective_date"] = UDFLib.ConvertUserDateFormat(Convert.ToDateTime(dr["CompanyEffective_date"].ToString()).ToString("dd/MM/yyyy"), UDFLib.GetDateFormat()); } } } gvSeniorityRecords.DataSource = dt; gvSeniorityRecords.DataBind(); if (ucCustomPager.isCountRecord == 1) { ucCustomPager.CountTotalRec = SelectRecordCount.ToString(); ucCustomPager.BuildPager(); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void View_CrewWages() { int CrewID = GetCrewID(); int VoyID = UDFLib.ConvertToInteger(Request.QueryString["VoyID"]); DataSet ds = BLL_PortageBill.Get_CrewWagesByVoyage(CrewID, VoyID); if (ds.Tables[0].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0) { ds.Relations.Add(new DataRelation("Parent", ds.Tables[0].Columns["Effective_Date"], ds.Tables[1].Columns["Effective_Date"])); ds.Tables[1].TableName = "Child"; rpt1.DataSource = ds; rpt1.DataBind(); } }
protected void ddlJoiningRank_SelectedIndexChanged(object sender, EventArgs e) { int RankID = 0; int VesselId = int.Parse(ddlVessel.SelectedValue.ToString()); if (ddlJoiningRank.SelectedValue != "0" && ddlJoiningRank.SelectedValue != "") { RankID = int.Parse(ddlJoiningRank.SelectedValue); } if (RankScaleConsidered == 1) { Load_RankScaleList(RankID); } // load rank based salary int CurrentVoyageID = UDFLib.ConvertToInteger(Request.QueryString["VoyID"]); int WageContractID = 0; int Contract_Type = 0, CountryId = 0, RankScaleId = 0; try { //Get Current voyage details DataTable dtVoy = objBLLCrew.Get_CrewVoyages(GetCrewID(), CurrentVoyageID); if (dtVoy.Rows.Count > 0) { Contract_Type = int.Parse(dtVoy.Rows[0]["Vessel_Flag"].ToString()); } DataSet ds = new DataSet(); if (RankScaleConsidered == 0) { ds = BLL_PortageBill.Get_Rank_WageContract(RankID, Contract_Type, 0, NationalityConsidered, CountryId, RankScaleId, VesselId); hdWageContractId.Value = ds.Tables[1].Rows[0]["WageContractID"].ToString(); GridViewaddwages.DataSource = ds.Tables[1]; GridViewaddwages.DataBind(); } else { GridViewaddwages.DataSource = null; GridViewaddwages.DataBind(); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void ddlRankScale_SelectedIndexChanged(object sender, EventArgs e) { int VoyID = UDFLib.ConvertToInteger(Request.QueryString["VoyID"]); int RankId = int.Parse(ddlJoiningRank.SelectedValue.ToString()); int Contract_Type = 0; int VesselId = int.Parse(ddlVessel.SelectedValue.ToString()); DataSet ds = BLL_PortageBill.Get_CrewWagesByVoyage(GetCrewID(), VoyID); DataTable dtVoy = objBLLCrew.Get_CrewVoyages(GetCrewID(), VoyID); if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { Contract_Type = int.Parse(ds.Tables[0].Rows[0]["Contract_Type"].ToString()); } if (dtVoy != null && dtVoy.Rows.Count > 0 && VesselId == 0) { VesselId = int.Parse(dtVoy.Rows[0]["Vessel_ID"].ToString()); } DataTable dt = objBLLCrew.Get_CrewPersonalDetailsByID(GetCrewID()); int RankScaleId = int.Parse(ddlRankScale.SelectedValue.ToString()); int CountryId = int.Parse(dt.Rows[0]["Staff_Nationality"].ToString()); Staff_Nationality = int.Parse(dt.Rows[0]["Staff_Nationality"].ToString()); int WageContractId = 0; DataSet ds1 = BLL_PortageBill.Get_Rank_WageContract(RankId, Contract_Type, WageContractId, NationalityConsidered, CountryId, RankScaleId, VesselId); if (ds1.Tables[0].Rows.Count > 0) { WageContractId = int.Parse(ds1.Tables[0].Rows[0]["WageContractID"].ToString()); hdWageContractId.Value = ds1.Tables[0].Rows[0]["WageContractID"].ToString(); GridViewaddwages.DataSource = ds1.Tables[1]; GridViewaddwages.DataBind(); } else { GridViewaddwages.DataSource = null; GridViewaddwages.DataBind(); } }
protected void btnSaveRankSeniority_Click(object sender, EventArgs e) { if (txtRankEffectiveDate.Text != "") { if (!UDFLib.DateCheck(txtRankEffectiveDate.Text)) { string js = "alert('Enter valid Effective Date" + UDFLib.DateFormatMessage() + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true); return; } } if (txtRankSeniorityDays.Text.Trim() == "" && txtRankSeniorityYear.Text.Trim() == "") { string js = "alert('Enter Rank Seniority Years/Days');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true); } else { int RankSeniorityDays = 0, RankSeniorityYears = 0; if (txtRankSeniorityDays.Text.Trim() != "") { RankSeniorityDays = int.Parse(txtRankSeniorityDays.Text.Trim()); } if (txtRankSeniorityYear.Text.Trim() != "") { RankSeniorityYears = int.Parse(txtRankSeniorityYear.Text.Trim()); } if (RankSeniorityDays > 364) { string js = "alert('Seniority Days cannot be greater than 364');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true); } else { int RankId = int.Parse(ddlRank.SelectedValue.ToString()); string RankEffectiveDate = txtRankEffectiveDate.Text.Trim(); if (RankEffectiveDate.Length > 0) { try { DateTime Dt_RankEffectiveDate = UDFLib.ConvertToDate(RankEffectiveDate, UDFLib.GetDateFormat()); BLL_PortageBill.Update_CrewRankSeniority(CrewID, RankId, RankSeniorityYears, RankSeniorityDays, 0, txtRankSeniorityRemarks.Text.Trim(), Dt_RankEffectiveDate, Convert.ToInt32(Session["userid"])); ddlRank.Enabled = false; txtRankSeniorityDays.Enabled = false; txtRankSeniorityYear.Enabled = false; trRankEffectiveDate.Visible = false; trRankSeniorityRemarks.Visible = false; DataSet ds = objBLLCrew.Get_CrewSeniorityDetails(CrewID); gvRankSeniority.DataSource = ds.Tables[2]; gvRankSeniority.DataBind(); btnEditRankSeniority.Visible = true; btnReverseRankSeniority.Visible = true; } catch { string js = "alert('Invalid entry in Effective Date.');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true); } } } } }
protected void Generate_Crew_Agreement() { int iCrewID = int.Parse(getQueryString("CrewID")); int VoyID = int.Parse(getQueryString("VoyID")); int Contract_template_ID = 0; BLL_Crew_CrewDetails objCrewBLL = new BLL_Crew_CrewDetails(); System.Data.DataTable dt = objCrewBLL.Get_CrewAgreementData(iCrewID, VoyID); System.Data.DataTable dtPersonal = objCrewBLL.Get_CrewPersonalDetailsByID1(iCrewID); System.Data.DataTable dtNOK = objCrewBLL.Get_Crew_DependentsByCrewID(iCrewID, 1); string Photo = ""; int NOK_Mandatory = 0, Photo_Mandatory = 0; DataTable dtMandatorySettings = objCrewAdmin.GetMandatorySettings(); if (dtMandatorySettings != null && dtMandatorySettings.Rows.Count > 0) { if (dtMandatorySettings.Rows[0]["Value"].ToString() == "1") { NOK_Mandatory = 1; } if (dtMandatorySettings.Rows[1]["Value"].ToString() == "1") { Photo_Mandatory = 1; } } if (dtPersonal.Rows.Count > 0) { Photo = dtPersonal.Rows[0]["PhotoURL"].ToString(); } if (Photo_Mandatory == 1 && Photo == "") { Response.Write("<h1>Contract can not be printed at this moment as Photo is not yet uploaded for the Crew</h1>"); Response.End(); } else if (NOK_Mandatory == 1 && dtNOK.Rows.Count == 0) { Response.Write("<h1>Contract can not be printed at this moment as Next Of Kin details is not yet updated</h1>"); Response.End(); } else if (dt.Rows.Count == 0) { Response.Write("<h1>Contract can not be printed at this moment. Please enter the voyage details for the crew.</h1>"); Response.End(); } else { try { DataSet ds = BLL_PortageBill.Get_CrewWagesByVoyage_ForAgreement(iCrewID, VoyID); ds.Relations.Add(new DataRelation("Parent", ds.Tables[0].Columns["Effective_Date"], ds.Tables[1].Columns["Effective_Date"])); ds.Tables[1].TableName = "Child"; ds.Tables[1].DefaultView.RowFilter = "amount > 0"; dataview = ds.Tables[1].DefaultView; DataTable dtCheckSalaryComponent = ds.Tables[1].DefaultView.ToTable(); dtCheckSalaryComponent.DefaultView.RowFilter = " ( Name like '%//%' OR Name like '%&%') "; if (dtCheckSalaryComponent.DefaultView.ToTable().Rows.Count > 0) { string js = "alert('Contract cannot be generated as Salary Component contains special charaters. Update Salary Components to generate contract');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "errorsaving", js, true); } else { rpt2.DataSource = dataview; rpt2.DataBind(); System.Data.DataTable dtVoy = objCrewBLL.Get_CrewVoyages(iCrewID, VoyID); int Vessel_Flag = UDFLib.ConvertToInteger(dtVoy.Rows[0]["Vessel_Flag"].ToString()); int UserCompanyID = UDFLib.ConvertToInteger(Session["USERCOMPANYID"].ToString()); int VesselID = UDFLib.ConvertToInteger(dtVoy.Rows[0]["Vessel_ID"].ToString()); System.Data.DataSet dtCompany = objCrewBLL.Get_Crew_CompanyDetails(UDFLib.ConvertIntegerToNull(VesselID)); System.Data.DataTable dtTemplate; int ContractId = UDFLib.ConvertToInteger(dtVoy.Rows[0]["ContractId"].ToString()); dtTemplate = objBLLCrewContract.Get_ContractTemplate(ContractId); string TemplateText = ""; string FooterText1 = ""; string FooterText2 = ""; FooterText = "."; if (dtTemplate.Rows.Count > 0) { Contract_template_ID = UDFLib.ConvertToInteger(dtTemplate.Rows[0]["ID"].ToString()); FooterText = dtTemplate.Rows[0]["FooterText"].ToString(); TemplateText = "<template><br></br><br></br>" + dtTemplate.Rows[0]["template_text"].ToString() + "</template>"; TemplateText = TemplateText.Replace(" ", " "); TemplateText = TemplateText.Replace(" & ", " & "); TemplateText = TemplateText.Replace(" & ", " and "); TemplateText = TemplateText.Replace("’", "'"); TemplateText = TemplateText.Replace("“", """); TemplateText = TemplateText.Replace("”", """); TemplateText = TemplateText.Replace("…", "."); TemplateText = TemplateText.Replace("–", "–"); //TemplateText = TemplateText.Replace("<p></p>", ""); XmlDocument _doc = new XmlDocument(); _doc.LoadXml(TemplateText); XmlNodeList wages = _doc.GetElementsByTagName("wages"); if (wages != null && wages.Count > 0) { StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); rpt2.RenderControl(hw); string tblWages = "<table style='width:100%'><tr style='background-color: #D8D8D8; color: Black; font-weight: bold;'><td>Earning/Deduction</td><td>Name</td><td>Currency</td><td>Amount</td><td>Salary Type</td></tr>"; tblWages += sw.ToString().Replace("\n\r", "").Replace("\r\n", "").Replace(" & ", " & "); tblWages += "</table>"; wages[0].InnerXml = string.Format(tblWages); } TemplateText = _doc.InnerXml; string ST_NAME = "<input name=\"STAFF_NAME\" type=\"text\" value=\"NAME\" />"; string ST_ADD = "<input name=\"ADDRESS\" type=\"text\" value=\"ADDRESS\" />"; string ST_RANK = "<input name=\"STAFF_RANK\" type=\"text\" value=\"RANK\" />"; string ST_RANK1 = "<input name=\"STAFF_RANK\" type=\"text\" value=\"RANK\" />"; string VSL = "<input name=\"VESSEL\" type=\"text\" value=\"VESSEL\" />"; string VSL1 = "<input name=\"VESSEL\" type=\"text\" value=\"VESSEL\" />"; string DURATION = "<input name=\"DURATION\" type=\"text\" value=\"0 Month(s) 0 Days \" />"; string DURATION1 = "<input name=\"DURATION\" type=\"text\" value=\"0 Month(s) 0 Days \" />"; string ST_DAY = "<input name=\"START_DAY\" type=\"text\" value=\"0\" />"; string ST_MONTH = "<input name=\"START_MONTH\" type=\"text\" value=\"MMM yyyy\" />"; string ST_DAY1 = "<input name=\"START_DAY\" type=\"text\" value=\"0\" />"; string ST_MONTH1 = "<input name=\"START_MONTH\" type=\"text\" value=\"MMM yyyy\" />"; string STAFF_CODE = "<input name=\"STAFF_CODE\" type=\"text\" value=\"STAFF_CODE\" />"; string PASSPORT_NO = "<input name=\"PASSPORT_NO\" type=\"text\" value=\"PASSPORT_NO\" />"; string CONTRACT_DATE = "<input name=\"CONTRACT_DATE\" type=\"text\" />"; string DOB = "<input name=\"DOB\" type=\"text\" />"; string BIRTH_PLACE = "<input name=\"BIRTH_PLACE\" type=\"text\" value=\"BIRTH_PLACE\" />"; string NATIONALITY = "<input name=\"NATIONALITY\" type=\"text\" value=\"NATIONALITY\" />"; string SEAMAN_NO = "<input name=\"SEAMAN_NO\" type=\"text\" value=\"SEAMAN_NO\" />"; //string MGR_Name = "<input name=\"Manager_Name\" type=\"text\" value=\"Manager_Name\" />"; string Comp_Name = "<input name=\"COMPANY_NAME\" type=\"text\" value=\"COMPANY_NAME\" />"; string Comp_Address = "<input name=\"COMPANY_ADDRESS\" type=\"text\" value=\"COMPANY_ADDRESS\" />"; TemplateText = TemplateText.Replace(ST_NAME, dt.Rows[0]["CrewName"].ToString()); TemplateText = TemplateText.Replace(ST_ADD, dt.Rows[0]["Address"].ToString()); TemplateText = TemplateText.Replace(ST_RANK, dt.Rows[0]["Rank_Name"].ToString()); TemplateText = TemplateText.Replace(ST_RANK1, dt.Rows[0]["Rank_Name"].ToString()); TemplateText = TemplateText.Replace(VSL, dt.Rows[0]["Vessel_Name"].ToString()); TemplateText = TemplateText.Replace(VSL1, dt.Rows[0]["Vessel_Name"].ToString()); TemplateText = TemplateText.Replace(DURATION, dt.Rows[0]["MonthDays"].ToString()); TemplateText = TemplateText.Replace(DURATION1, dt.Rows[0]["MonthDays"].ToString()); TemplateText = TemplateText.Replace(STAFF_CODE, dt.Rows[0]["STAFF_CODE"].ToString()); TemplateText = TemplateText.Replace(PASSPORT_NO, dt.Rows[0]["Passport_Number"].ToString()); TemplateText = TemplateText.Replace(CONTRACT_DATE, dt.Rows[0]["Joining_Date"].ToString() == "" ? "________________" : dt.Rows[0]["Joining_Date"].ToString()); TemplateText = TemplateText.Replace(DOB, dt.Rows[0]["DOB"].ToString()); TemplateText = TemplateText.Replace(BIRTH_PLACE, dt.Rows[0]["BIRTH_PLACE"].ToString()); TemplateText = TemplateText.Replace(NATIONALITY, dt.Rows[0]["NATIONALITY"].ToString()); TemplateText = TemplateText.Replace(SEAMAN_NO, dt.Rows[0]["Seaman_Book_Number"].ToString()); TemplateText = TemplateText.Replace(Comp_Name, dtCompany.Tables[0].Rows[0]["Company_Name"].ToString()); TemplateText = TemplateText.Replace(Comp_Address, dtCompany.Tables[0].Rows[0]["Address"].ToString()); //TemplateText = TemplateText.Replace(MGR_Name, dtCompany.Tables[1].Rows[0]["Manager_Name"].ToString()); string JoinDate = ""; if (dt.Rows[0]["Joining_Date"].ToString() != "") { JoinDate = dt.Rows[0]["Joining_Date"].ToString(); DateTime DtJoining = DateTime.Parse(JoinDate); TemplateText = TemplateText.Replace(ST_DAY, DtJoining.ToString("dd")); TemplateText = TemplateText.Replace(ST_MONTH, DtJoining.ToString("MMMM") + " " + DtJoining.ToString("yyyy")); TemplateText = TemplateText.Replace(ST_DAY1, DtJoining.ToString("dd")); TemplateText = TemplateText.Replace(ST_MONTH1, DtJoining.ToString("MMMM") + " " + DtJoining.ToString("yyyy")); } else { TemplateText = TemplateText.Replace(ST_DAY, "_______"); TemplateText = TemplateText.Replace(ST_MONTH, "________________"); } if (TemplateText != "") { string sFileName = iCrewID.ToString() + "_" + VoyID.ToString() + "_1" + ".pdf"; string filePath = Server.MapPath("~/Uploads/CrewDocuments/") + sFileName; //string filePath = Server.MapPath("~/Uploads/CrewDocuments/") + Flag_Attach; //FileUpload1.SaveAs(filePath); System.Data.DataTable dtAgreement = objCrewBLL.Get_CrewAgreementRecords(iCrewID, VoyID, 0, GetSessionUserID()); DataRow[] dr = dtAgreement.Select("agreement_stage = 1"); if (dr.Length > 0) { ViewState["pagecount"] = dr[0]["PageCounts"].ToString(); } else { ViewState["pagecount"] = 0; } //-- write pdf file -- /* Added by pranali_070715 License Key EO.Pdf*/ EO.Pdf.Runtime.AddLicense("p+R2mbbA3bNoqbTC4KFZ7ekDHuio5cGz4aFZpsKetZ9Zl6TNHuig5eUFIPGe" + "tcznH+du5PflEuCG49jjIfewwO/o9dB2tMDAHuig5eUFIPGetZGb566l4Of2" + "GfKetZGbdePt9BDtrNzCnrWfWZekzRfonNzyBBDInbW6yuCwb6y9xtyxdabw" + "+g7kp+rp2g+9RoGkscufdePt9BDtrNzpz+eupeDn9hnyntzCnrWfWZekzQzr" + "peb7z7iJWZekscufWZfA8g/jWev9ARC8W7zTv/vjn5mkBxDxrODz/+ihb6W0" + "s8uud4SOscufWbOz8hfrqO7CnrWfWZekzRrxndz22hnlqJfo8h8="); EO.Pdf.HtmlToPdf.Options.AfterRenderPage = new EO.Pdf.PdfPageEventHandler(On_AfterRenderPage); EO.Pdf.HtmlToPdf.Options.HeaderHtmlFormat = "<center><img alt='' src='" + System.Configuration.ConfigurationManager.AppSettings["APP_URL"].ToString() + "/images/Company_logo.jpg' height='60px' /></center>"; EO.Pdf.HtmlToPdf.Options.FooterHtmlFormat = "<div style='color:white;z-order:100'><table style='width:100%'><tr><td style='width:33%;text-align:left;height:40px;vertical-align:bottom;'>" + FooterText1 + "</td><td style='width:34%;text-align:center;height:40px;vertical-align:bottom;'>Page {page_number} of {total_pages}</td><td style='width:33%;text-align:right;height:40px;vertical-align:bottom;'>" + FooterText2 + "</td></tr></table></div>"; EO.Pdf.HtmlToPdf.ConvertHtml(TemplateText, filePath); Random r1 = new Random(); string ver1 = r1.Next().ToString(); int Pagecount = getNumberOfPdfPages(filePath); int DocID = objCrewBLL.Insert_CrewAgreementRecord(iCrewID, VoyID, 1, Contract_template_ID, "Crew Agreement", sFileName, sFileName, GetSessionUserID(), Pagecount); hdnCurrentDocID.Value = DocID.ToString(); if (DocID > 0) { //--Delete the existing file try { System.IO.FileInfo fi = new FileInfo(filePath); fi.Delete(); } catch { } //-- write pdf file -- /* Added by pranali_070715 License Key EO.Pdf*/ EO.Pdf.Runtime.AddLicense("p+R2mbbA3bNoqbTC4KFZ7ekDHuio5cGz4aFZpsKetZ9Zl6TNHuig5eUFIPGe" + "tcznH+du5PflEuCG49jjIfewwO/o9dB2tMDAHuig5eUFIPGetZGb566l4Of2" + "GfKetZGbdePt9BDtrNzCnrWfWZekzRfonNzyBBDInbW6yuCwb6y9xtyxdabw" + "+g7kp+rp2g+9RoGkscufdePt9BDtrNzpz+eupeDn9hnyntzCnrWfWZekzQzr" + "peb7z7iJWZekscufWZfA8g/jWev9ARC8W7zTv/vjn5mkBxDxrODz/+ihb6W0" + "s8uud4SOscufWbOz8hfrqO7CnrWfWZekzRrxndz22hnlqJfo8h8="); EO.Pdf.HtmlToPdf.Options.AfterRenderPage = new EO.Pdf.PdfPageEventHandler(On_AfterRenderPage); EO.Pdf.HtmlToPdf.Options.HeaderHtmlFormat = "<center><img alt='' src='" + System.Configuration.ConfigurationManager.AppSettings["APP_URL"].ToString() + "/images/Company_logo.jpg' height='60px' /></center>"; EO.Pdf.HtmlToPdf.Options.FooterHtmlFormat = "<div style='color:white;z-order:100'><table style='width:100%'><tr><td style='width:33%;text-align:left;height:40px;vertical-align:bottom;'>" + FooterText1 + "</td><td style='width:34%;text-align:center;height:40px;vertical-align:bottom;'>Page {page_number} of {total_pages}</td><td style='width:33%;text-align:right;height:40px;vertical-align:bottom;'>" + FooterText2 + "</td></tr></table></div>"; EO.Pdf.HtmlToPdf.ConvertHtml(TemplateText, filePath); Random r = new Random(); string ver = r.Next().ToString(); lblMessage.Text = "Crew Agreement Generated. The agreement is yet to be signed by the office."; } Load_Agreements(); Load_Agreement_Status(); } else { lblMessage.Text = "Contract template do not have wages section"; } } else { lblMessage.Text = "Contract template not found for the vessel flag"; } } } catch (Exception ex) { lblMessage.Text = ex.Message; } } }
protected string Save_Wages(int CrewID, int VoyID, int Vessel_ID) { DataTable dtWagesINS = new DataTable(); string sValidationMessage = ""; dtWagesINS.Columns.Add("Vessel_ID", typeof(int)); dtWagesINS.Columns.Add("VoyageID", typeof(int)); dtWagesINS.Columns.Add("CrewID", typeof(int)); dtWagesINS.Columns.Add("EntryType", typeof(int)); dtWagesINS.Columns.Add("SalaryType", typeof(int)); dtWagesINS.Columns.Add("PayAt", typeof(int)); dtWagesINS.Columns.Add("Amount", typeof(decimal)); dtWagesINS.Columns.Add("CURR", typeof(int)); dtWagesINS.Columns.Add("Updated_BY", typeof(int)); dtWagesINS.Columns.Add("Effective_Date", typeof(DateTime)); dtWagesINS.Columns.Add("ID", typeof(int)); bool IsValidated = false; foreach (GridViewRow gr in GridViewaddwages.Rows) { double amt = 0; int ii = Convert.ToInt32(GridViewaddwages.DataKeys[0].Value); if (double.TryParse(((TextBox)gr.Cells[4].FindControl("txtAmount")).Text, out amt)) { if (Convert.ToString(((TextBox)gr.Cells[4].FindControl("txtAmount")).Text) != "") { IsValidated = true; break; } } } DataSet ds = BLL_PortageBill.Get_CrewWageContract(CrewID, VoyID, GetSessionUserID()); if (ds.Tables[1].Rows.Count > 0) { if (txteffdt.Text != "") { if (ds.Tables[1].Rows[0]["effective_date"].ToString() != "") { if (DateTime.Parse(txteffdt.Text) < DateTime.Parse(ds.Tables[1].Rows[0]["effective_date"].ToString())) { IsValidated = false; sValidationMessage = "Wages can not be saved as the new effective date can not be prior to the previous effective date."; } } } else { IsValidated = false; sValidationMessage = "Please select effective date"; } } if (IsValidated == true) { int currusd = 0; foreach (GridViewRow gr in GridViewaddwages.Rows) { double amt = 0; int ii = Convert.ToInt32(GridViewaddwages.DataKeys[0].Value); if (double.TryParse(((TextBox)gr.Cells[4].FindControl("txtAmount")).Text, out amt)) { DateTime dt = new DateTime(); if (txteffdt.Text != "") { string efdt = txteffdt.Text.Trim().ToString(); dt = DateTime.Parse(efdt); } else { string efdt = "1900/01/01"; dt = DateTime.Parse(efdt); } string sentry = ((Label)GridViewaddwages.Rows[gr.RowIndex].FindControl("lblentry_type")).Text; currusd = 5; int iSalaryType = Convert.ToInt32(((RadioButtonList)gr.Cells[2].FindControl("SalaryTypes")).SelectedValue); int iPayAt = Convert.ToInt32(((RadioButtonList)gr.Cells[2].FindControl("PayableAT")).SelectedValue); DataRow dr = dtWagesINS.NewRow(); dr["Vessel_ID"] = Vessel_ID; dr["VoyageID"] = VoyID; dr["CrewID"] = CrewID; dr["EntryType"] = UDFLib.ConvertToInteger(GridViewaddwages.DataKeys[gr.RowIndex].Value.ToString()); dr["SalaryType"] = iSalaryType; dr["PayAt"] = iPayAt; dr["Amount"] = amt; dr["CURR"] = currusd; dr["Updated_BY"] = GetSessionUserID(); dr["Effective_Date"] = dt.ToString(Convert.ToString(Session["User_DateFormat"])); dr["ID"] = 0; dtWagesINS.Rows.Add(dr); sValidationMessage = "Salary Updated."; } } int WageContractId = 0; if (hdWageContractId.Value != null && hdWageContractId.Value.ToString() != "") { WageContractId = int.Parse(hdWageContractId.Value.ToString()); } BLL_PortageBill.Ins_CrewWages(dtWagesINS, WageContractId); } return(sValidationMessage); }
protected void gvSeniorityRecords_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { lblmsg.Text = ""; int CrewID = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[0].ToString()); int CompanySeniorityYear = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[1].ToString()); int CompanySeniorityDays = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[2].ToString()); int CompanySeniorityYear_New = UDFLib.ConvertToInteger(e.NewValues["CompanySeniorityYear"]); int CompanySeniorityDays_New = UDFLib.ConvertToInteger(e.NewValues["CompanySeniorityDays"]); string Remarks = "Updating Company Seniority first time for existing crews"; DateTime CompanyEffectiveDate_New; if ((CompanySeniorityYear_New > 0 || CompanySeniorityDays_New > 0) && (CompanySeniorityYear != CompanySeniorityYear_New || CompanySeniorityDays != CompanySeniorityDays_New)) { if (CompanySeniorityDays_New > 364) { lblmsg.Text = "Company Seniority Days cannot be greater than 364"; } if (e.NewValues["CompanyEffective_date"] != null) { CompanyEffectiveDate_New = UDFLib.ConvertToDate(Convert.ToString(e.NewValues["CompanyEffective_date"]), UDFLib.GetDateFormat()); BLL_PortageBill.Update_CrewCompanySeniority(CrewID, CompanySeniorityYear_New, CompanySeniorityDays_New, Remarks, CompanyEffectiveDate_New, Convert.ToInt32(Session["userid"])); } else { lblmsg.Text = "Company Effective Date is mandatory to update Company Seniority"; } } int RankSeniorityYear = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[3].ToString()); int RankSeniorityDays = UDFLib.ConvertToInteger(gvSeniorityRecords.DataKeys[e.RowIndex].Values[4].ToString()); int RankSeniorityYear_New = UDFLib.ConvertToInteger(e.NewValues["RankSeniorityYear"]); int RankSeniorityDays_New = UDFLib.ConvertToInteger(e.NewValues["RankSeniorityDays"]); Remarks = "Updating Rank Seniority first time for existing crews"; if ((RankSeniorityYear_New > 0 || RankSeniorityDays_New > 0) && (RankSeniorityYear != RankSeniorityYear_New || RankSeniorityDays != RankSeniorityDays_New)) { GridViewRow row = (GridViewRow)gvSeniorityRecords.Rows[e.RowIndex]; int RankId1 = int.Parse(((DropDownList)row.FindControl("ddlSeniorityRank")).SelectedValue.ToString()); if (RankSeniorityDays_New > 364) { lblmsg.Text = "Rank Seniority Days cannot be greater than 364"; } if (e.NewValues["RankEffective_date"] != null) { BLL_PortageBill.Update_CrewRankSeniority(CrewID, RankId1, RankSeniorityYear_New, RankSeniorityDays_New, 0, Remarks, UDFLib.ConvertToDate(e.NewValues["RankEffective_date"].ToString(), UDFLib.GetDateFormat()), Convert.ToInt32(Session["userid"])); } else { lblmsg.Text = "Rank Effective Date is mandatory to update Rank Seniority"; } } if (lblmsg.Text.Trim() == "") { lblmsg.Visible = false; gvSeniorityRecords.EditIndex = -1; Load_SeniorityRecords(); } else { lblmsg.Visible = true; } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
public string Get_RJBDetails(int ID) { DataTable dt = BLL_PortageBill.Get_RJBDetails(ID); return(UDFLib.CreateHtmlTableFromDataTable(dt, new string[] { }, new string[] { "RJB_More_Info" }, "")); }
protected void btnSaveVoyage_Click(object sender, EventArgs e) { string Message = ""; string Joining_Date = ""; int Joining_Rank = 0, CurrentRankId = 0, CurrentRankScaleId = 0; int Vessel_ID = 0; string COCDate = ""; int Joining_Port = 0; string Sign_On_Date = ""; int Join_Type = UDFLib.ConvertToInteger(rdoOptions.SelectedValue); int CurrentVoyageID = UDFLib.ConvertToInteger(Request.QueryString["VoyID"]); int New_Voy_ID = 0, RankScaleId = 0; try { //Get Current voyage details DataTable dtVoy = objBLLCrew.Get_CrewVoyages(GetCrewID(), CurrentVoyageID); if (dtVoy.Rows.Count > 0) { Joining_Date = dtVoy.Rows[0]["Joining_Date"].ToString(); Joining_Rank = UDFLib.ConvertToInteger(dtVoy.Rows[0]["Joining_Rank"].ToString()); Vessel_ID = UDFLib.ConvertToInteger(dtVoy.Rows[0]["Vessel_ID"].ToString()); COCDate = dtVoy.Rows[0]["COCDate"].ToString(); Joining_Port = UDFLib.ConvertToInteger(dtVoy.Rows[0]["Joining_Port"].ToString()); Sign_On_Date = dtVoy.Rows[0]["Sign_On_Date"].ToString(); RankScaleId = UDFLib.ConvertToInteger(dtVoy.Rows[0]["RankScaleId"].ToString()); CurrentRankId = Joining_Rank; CurrentRankScaleId = RankScaleId; } if (rdoOptions.SelectedValue == "1") { if (txtJoiningDate.Text.Trim() == "" || txtSignOnDate.Text.Trim() == "" || UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) == 0 || UDFLib.ConvertToInteger(ddlVessel.SelectedValue) == 0 || txtCOCDate.Text == "" || txtSignOffDate.Text == "" || UDFLib.ConvertToInteger(ctlSignOffPort.SelectedValue) == 0 || UDFLib.ConvertToInteger(ctlJoiningPort.SelectedValue) == 0 || UDFLib.ConvertToInteger(ddlContract.SelectedValue) == 0) { Message = "Vessel Name,Contract Template, Joining Rank, Contract Date, Sign-On Date, Sign-Off-Date, Sign-Off-Port, Joining Port and EOC Date are mandatory fields. You might have missed one of the fields."; } else if (UDFLib.ConvertToDate(txtJoiningDate.Text) < UDFLib.ConvertDateToNull(COCDate)) { Message = "Contract date should be greater than the EOC of previous voyage"; } else if (txtJoiningDate.Text.Trim() != "" && txtSignOnDate.Text != "" && UDFLib.ConvertToDate(txtJoiningDate.Text) > UDFLib.ConvertToDate(txtSignOnDate.Text)) { Message = "Sign-On Date can not be less than the Contract date"; } else if (UDFLib.ConvertToDate(txtSignOffDate.Text) < DateTime.Today.AddDays(1)) { Message = "The transfer has to be planned atleast 1 day in advance"; } else if (UDFLib.ConvertToDate(txtSignOffDate.Text) > UDFLib.ConvertToDate(txtSignOnDate.Text)) { Message = "The sign-off/sign-on dates are incorrect. Sign-off has to happen before the next sign-on"; } else if (Vessel_ID == UDFLib.ConvertToInteger(ddlVessel.SelectedValue)) { Message = "Please select the new vessel different from the staff's current vessel."; } else { Vessel_ID = UDFLib.ConvertToInteger(ddlVessel.SelectedValue); Joining_Rank = UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue); New_Voy_ID = objBLLCrew.TransferCrew(CurrentVoyageID, GetCrewID(), Vessel_ID, Join_Type, Joining_Rank, UDFLib.ConvertToDate(txtJoiningDate.Text).ToShortDateString(), UDFLib.ConvertToDate(txtSignOnDate.Text).ToShortDateString(), UDFLib.ConvertToInteger(ctlJoiningPort.SelectedValue), UDFLib.ConvertToDate(txtCOCDate.Text).ToShortDateString(), GetSessionUserID(), UDFLib.ConvertToDate(txtSignOffDate.Text).ToShortDateString(), UDFLib.ConvertToInteger(ctlSignOffPort.SelectedValue), UDFLib.ConvertToInteger(ddlContract.SelectedValue)); if (New_Voy_ID > 0) { Message = "Crew transfer planned"; btnSaveVoyage.Enabled = false; } else { Message = "The transfer is already planned for the crew"; } } } if (rdoOptions.SelectedValue == "2") { if (txtJoiningDate.Text.Trim() == "" || txtSignOnDate.Text.Trim() == "" || UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) == 0 || txtCOCDate.Text == "" || UDFLib.ConvertToInteger(ddlContract.SelectedValue) == 0) { Message = "Contract Template,Joining Rank, Contract Date, Sign-On Date and EOC Date are mandatory fields. You might have missed one of the fields."; } else if (Joining_Rank == UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) && RankScaleConsidered == 1 && RankScaleId == UDFLib.ConvertToInteger(ddlRankScale.SelectedValue)) { Message = "Promoted rank scale should not be the same as the current rank scale."; } else if (Joining_Rank == UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) && RankScaleConsidered == 0) { Message = "Promoted rank should not be the same as the current rank."; } else if (UDFLib.ConvertDateToNull(txtJoiningDate.Text) < UDFLib.ConvertDateToNull(COCDate)) { Message = "Contract date should be greater than the EOC of previous voyage"; } else if (txtJoiningDate.Text.Trim() != "" && txtSignOnDate.Text != "" && UDFLib.ConvertDateToNull(txtJoiningDate.Text) > UDFLib.ConvertDateToNull(txtSignOnDate.Text)) { Message = "Sign-On Date can not be less than the Contract date"; } else if (UDFLib.ConvertDateToNull(txtSignOnDate.Text) < DateTime.Today.AddDays(1)) { Message = "The promotion has to be planned atleast 1 day in advance"; } else { Joining_Rank = UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue); int NewWageContractId = 0; if (hdWageContractId.Value != null && hdWageContractId.Value.ToString() != "") { NewWageContractId = int.Parse(hdWageContractId.Value.ToString()); } New_Voy_ID = objBLLCrew.TransferCrew(CurrentVoyageID, GetCrewID(), Vessel_ID, Join_Type, Joining_Rank, UDFLib.ConvertToDate(txtJoiningDate.Text).ToShortDateString(), UDFLib.ConvertToDate(txtSignOnDate.Text).ToShortDateString(), UDFLib.ConvertToInteger(ctlJoiningPort.SelectedValue), UDFLib.ConvertToDate(txtCOCDate.Text).ToShortDateString(), GetSessionUserID(), "", 0, NewWageContractId, UDFLib.ConvertToInteger(ddlContract.SelectedValue)); if (New_Voy_ID > 0) { Message = "Staff promotion planned"; Message = Message + Save_Wages(GetCrewID(), New_Voy_ID, Vessel_ID); btnSaveVoyage.Enabled = false; if ((CurrentRankId != Joining_Rank) || (RankScaleConsidered == 1 && CurrentRankScaleId != UDFLib.ConvertToInteger(ddlRankScale.SelectedValue))) { //Save entry in Log for change in Wage Rank Scale BLL_PortageBill.Ins_CrewChangeWageLog(CurrentRankId, UDFLib.ConvertToInteger(ddlRankScale.SelectedValue.ToString()), GetCrewID(), GetSessionUserID()); } } else { Message = "The transfer is already planned for the crew"; } } } if (rdoOptions.SelectedValue == "3") { if (UDFLib.ConvertToInteger(ddlVessel.SelectedValue) == 0 || txtJoiningDate.Text.Trim() == "" || txtSignOnDate.Text.Trim() == "" || UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) == 0 || txtCOCDate.Text == "" || txtSignOffDate.Text == "" || UDFLib.ConvertToInteger(ctlSignOffPort.SelectedValue) == 0 || UDFLib.ConvertToInteger(ddlContract.SelectedValue) == 0) { Message = "Vessel Name,Contract Template, Joining Rank, Contract Date, Sign-On Date, Sign-Off-Date, Sign-Off-Port and EOC Date are mandatory fields. You might have missed one of the fields."; } else if (Joining_Rank == UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) && RankScaleConsidered == 1 && RankScaleId == UDFLib.ConvertToInteger(ddlRankScale.SelectedValue)) { Message = "Promoted rank scale should not be the same as the current rank scale."; } else if (Joining_Rank == UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue) && RankScaleConsidered == 0) { Message = "Promoted rank should not be the same as the current rank."; } else if (Vessel_ID == UDFLib.ConvertToInteger(ddlVessel.SelectedValue)) { Message = "Please select the new vessel different from the staff's current vessel."; } else if (UDFLib.ConvertDateToNull(txtJoiningDate.Text) < UDFLib.ConvertDateToNull(COCDate)) { Message = "Contract date should be greater than the EOC of previous voyage"; } else if (txtJoiningDate.Text.Trim() != "" && txtSignOnDate.Text != "" && UDFLib.ConvertDateToNull(txtJoiningDate.Text) > UDFLib.ConvertDateToNull(txtSignOnDate.Text)) { Message = "Sign-On Date can not be less than the Contract date"; } else if (UDFLib.ConvertDateToNull(txtSignOffDate.Text) < DateTime.Today.AddDays(1)) { Message = "The transfer has to be planned atleast 1 day in advance"; } else if (UDFLib.ConvertDateToNull(txtSignOffDate.Text) > UDFLib.ConvertDateToNull(txtSignOnDate.Text)) { Message = "The sign-off/sign-on dates are incorrect. Sign-off has to happen before the next sign-on"; } else { Vessel_ID = UDFLib.ConvertToInteger(ddlVessel.SelectedValue); Joining_Rank = UDFLib.ConvertToInteger(ddlJoiningRank.SelectedValue); New_Voy_ID = objBLLCrew.TransferCrew(CurrentVoyageID, GetCrewID(), Vessel_ID, Join_Type, Joining_Rank, UDFLib.ConvertToDate(txtJoiningDate.Text).ToShortDateString(), UDFLib.ConvertToDate(txtSignOnDate.Text).ToShortDateString(), UDFLib.ConvertToInteger(ctlJoiningPort.SelectedValue), UDFLib.ConvertToDate(txtCOCDate.Text).ToShortDateString(), GetSessionUserID(), UDFLib.ConvertToDate(txtSignOffDate.Text).ToShortDateString(), UDFLib.ConvertToInteger(ctlSignOffPort.SelectedValue), UDFLib.ConvertToInteger(ddlContract.SelectedValue)); if (New_Voy_ID > 0) { Message = "Staff transfer promotion planned"; Message = Message + Save_Wages(GetCrewID(), New_Voy_ID, Vessel_ID); btnSaveVoyage.Enabled = false; if ((CurrentRankId != Joining_Rank) || (RankScaleConsidered == 1)) { //Save entry in Log for change in Wage Rank Scale if (RankScaleConsidered == 1 && CurrentRankScaleId != UDFLib.ConvertToInteger(ddlRankScale.SelectedValue)) { BLL_PortageBill.Ins_CrewChangeWageLog(CurrentRankId, UDFLib.ConvertToInteger(ddlRankScale.SelectedValue.ToString()), GetCrewID(), GetSessionUserID()); } else { BLL_PortageBill.Ins_CrewChangeWageLog(CurrentRankId, 0, GetCrewID(), GetSessionUserID()); } } } else { Message = "The transfer is already planned for the crew"; } } } if (New_Voy_ID > 0) { int VoyID = UDFLib.ConvertToInteger(Request.QueryString["VoyID"]); DataTable dt = objBLLCrew.Get_Transfer_Promotions(GetCrewID(), VoyID, GetSessionUserID()); GridView1.DataSource = dt; GridView1.DataBind(); pnlViewTransfer.Visible = true; pnlTransfer.Visible = false; pnlPromotion.Visible = false; } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } if (Message.Length > 0) { lblMessage.Text = Message; } }