Exemple #1
0
    /// <summary>
    /// Save / Update Pre Joining Experience details
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSavePreJoiningExp_Click(object sender, EventArgs e)
    {
        try
        {
            int BHP = 0, GRT = 0;

            DateTime?ToDate, FromDate;
            if (txtPJDateTo.Text != "" && txtPJDateFrom.Text != "")
            {
                try
                {
                    ToDate   = DateTime.Parse(UDFLib.ConvertToDefaultDt(txtPJDateTo.Text));
                    FromDate = DateTime.Parse(UDFLib.ConvertToDefaultDt(txtPJDateFrom.Text));
                }
                catch
                {
                    lblMsgPreJoining.Text = "Enter valid Period of Service From or Period of Service To Date" + TodayDateFormat;
                    CurrentOperatorCheck();
                    string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
                    return;
                }
            }
            else
            {
                lblMsgPreJoining.Text = "Enter Period of Service From and Period of Service To Date";
                CurrentOperatorCheck();
                string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
                return;
            }
            int CrewID = GetCrewID();
            if (CrewID > 0)
            {
                foreach (GridViewRow row in GridView_PreJoiningExp.Rows)
                {
                    Label PreJoiningExpId = row.FindControl("lblPreJoiningExpId") as Label;
                    if (!PreJoiningExpId.Text.Equals(ViewState["PreJoiningId"]))
                    {
                        Label    a          = row.FindControl("lblDate_To") as Label;
                        DateTime?LastToDate = UDFLib.ConvertToDate(a.Text);
                        if (FromDate < LastToDate)
                        {
                            Label    b            = row.FindControl("lblDate_From") as Label;
                            DateTime?LastFromDate = UDFLib.ConvertToDate(b.Text);
                            if (FromDate >= LastFromDate)
                            {
                                lblMsgPreJoining.Text = "Two Different working experience cannot be on same date";
                                string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
                                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
                                return;
                            }
                            if (ToDate >= LastFromDate)
                            {
                                lblMsgPreJoining.Text = "Two Different working experience cannot be on same date";
                                string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
                                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
                                return;
                            }
                        }
                    }
                }
                if (txtCompanyName.Text.Trim() == "")
                {
                    lblMsgPreJoining.Text = "Company Name can not be blank";
                    CurrentOperatorCheck();
                    string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
                }
                else if (txtPJVessel.Text.Trim() == "")
                {
                    lblMsgPreJoining.Text = "Vessel Name can not be blank";
                    CurrentOperatorCheck();
                    string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
                }
                else if (txtPJFlag.Text.Trim() == "")
                {
                    lblMsgPreJoining.Text = "Flag can not be blank";
                    CurrentOperatorCheck();
                    string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
                }
                else if (ToDate < FromDate)
                {
                    lblMsgPreJoining.Text = "To Date can not be less than From date";
                    CurrentOperatorCheck();
                    string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
                }
                else
                {
                    if (txtGRT.Text.Trim() != "")
                    {
                        try
                        {
                            GRT = int.Parse(txtGRT.Text);
                        }
                        catch
                        {
                            lblMsgPreJoining.Text = "GRT value should be numeric";
                            CurrentOperatorCheck();
                            string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
                            return;
                        }
                    }

                    if (txtMEBHP.Text.Trim() != "")
                    {
                        try
                        {
                            BHP = int.Parse(txtMEBHP.Text);
                        }
                        catch
                        {
                            lblMsgPreJoining.Text = "BHP value should be numeric";
                            CurrentOperatorCheck();
                            string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
                            return;
                        }
                    }
                    int    result;
                    string VesselType = ddlPJVesselType.SelectedValue == "0" ? "" : ddlPJVesselType.SelectedItem.ToString();
                    if (ViewState["PreJoiningId"] == null)
                    {
                        result = objBLLCrew.INS_CrewPreJoiningExp(CrewID, txtPJVessel.Text, txtPJFlag.Text, VesselType, txtPJDWT.Text, GRT, txtCompanyName.Text, UDFLib.ConvertToInteger(ddPJRank.SelectedValue), UDFLib.ConvertToDefaultDt(txtPJDateFrom.Text), UDFLib.ConvertToDefaultDt(txtPJDateTo.Text), 0, 0, int.Parse(Session["USERID"].ToString()), txtMEModel.Text, BHP, UDFLib.ConvertIntegerToNull(UDFLib.ConvertStringToNull(hdnVesselManager.Value)));
                        if (result == 1)
                        {
                            UDFLib.GetException("SuccessMessage/SaveMessage");
                        }
                    }
                    else
                    {
                        objBLLCrew.UPDATE_CrewPreJoiningExp(int.Parse(ViewState["PreJoiningId"].ToString()), txtPJVessel.Text, txtPJFlag.Text, VesselType, txtPJDWT.Text, txtGRT.Text.Trim(), txtCompanyName.Text, UDFLib.ConvertToInteger(ddPJRank.SelectedValue), UDFLib.ConvertToDefaultDt(txtPJDateFrom.Text), UDFLib.ConvertToDefaultDt(txtPJDateTo.Text), int.Parse(Session["USERID"].ToString()), txtMEModel.Text, BHP, UDFLib.ConvertIntegerToNull(UDFLib.ConvertStringToNull(hdnVesselManager.Value)));
                        result = 1;
                        UDFLib.GetException("SuccessMessage/UpdateMessage");
                    }

                    if (result == 1)
                    {
                        ClearPreJoiningDetails();
                        GridView_PreJoiningExp.DataBind();
                        string hidemodal = String.Format("hideModal('dvAddPreJoiningExp')");
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "hidemodal", hidemodal, true);
                    }
                    else
                    {
                        UDFLib.GetException("FailureMessage/DataSaveMessage");
                        lblMsgPreJoining.Text = "Unable to add Pre-Joining details !!";
                        string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
                    }
                }
            }
            else
            {
                lblMsgPreJoining.Text = "First save crew details !!";
                string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
            }
        }
        catch (Exception ex)
        {
            lblMsgPreJoining.Text = "Unable to add Pre-Joining details !! " + ex.Message;
            string AddPreJoining = String.Format("showModal('dvAddPreJoiningExp',false);");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "AddPreJoining", AddPreJoining, true);
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Request.QueryString["Page"] == null)
            {
                flstPreviousOperator.Attributes.Remove("style");
                flstPreJoiningExp.Attributes.Remove("style");
                flstPreJoiningExpInterview.Attributes.Remove("style");
            }

            TodayDateFormat = UDFLib.DateFormatMessage();
            DateFormat      = UDFLib.GetDateFormat();

            if (!IsPostBack)
            {
                if (GetSessionUserID() == 0)
                {
                    lblMsg.Text = "Session Expired!! Log-out and log-in again.";
                }
                else
                {
                    CalendarExtender4.Format = CalendarExtender3.Format = DateFormat;

                    AjaxControlToolkit4.CalendarExtender calEx = GridView_PreJoiningExp.FindControl("CalendarExtender6") as AjaxControlToolkit4.CalendarExtender;

                    if (calEx != null)
                    {
                        calEx.Format = DateFormat;
                    }

                    UserAccessValidation();
                    int CrewID = UDFLib.ConvertToInteger(Request.QueryString["ID"]);

                    if (objUA.View == 1)
                    {
                        pnlView_PreJoining.Visible       = true;
                        pnlView_PreviousContacts.Visible = true;
                        Load_PreJoiningExpFromInterview(CrewID);
                        Load_CrewPreviousContactDetails(CrewID);
                        Load_CrewPersonalDetails(CrewID);
                    }

                    DataTable dtVesselType = objVessel.Get_VesselTypeList();
                    ddlPJVesselType.DataSource     = dtVesselType;
                    ddlPJVesselType.DataTextField  = "VesselTypes";
                    ddlPJVesselType.DataValueField = "VesselTypes";
                    ddlPJVesselType.DataBind();
                    ddlPJVesselType.Items.Insert(0, new ListItem("-SELECT-", "0"));
                    ddlPJVesselType.SelectedIndex = 0;

                    int       UserCompanyID = UDFLib.ConvertToInteger(getSessionString("USERCOMPANYID"));
                    DataTable dtvessels     = objVessel.Get_VesselListPreJoining(UserCompanyID);
                    ViewState["DtVessel"]    = dtvessels;
                    ddlVessel.DataSource     = dtvessels;
                    ddlVessel.DataTextField  = "VESSEL_NAME";
                    ddlVessel.DataValueField = "VESSEL_ID";
                    ddlVessel.DataBind();
                    ddlVessel.Items.Insert(0, new ListItem("-SELECT-", "0"));
                    ddlVessel.SelectedIndex = 0;

                    Session["VesselManager"] = Convert.ToString(dtvessels.Rows[0]["VesselManager"]);
                    hdnVesselManager.Value   = Convert.ToString(dtvessels.Rows[0]["VesselManager"]);
                }
                if (Session["UTYPE"].ToString() == "MANNING AGENT")
                {
                    chkCurrentOperator.Visible = false;
                }
                else
                {
                    chkCurrentOperator.Visible = true;
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Exemple #3
0
 protected void ImgReloadPreJoining_Click(object sender, ImageClickEventArgs e)
 {
     GridView_PreJoiningExp.DataBind();
     Load_CrewPreviousContactDetails(GetCrewID());
 }