Beispiel #1
0
    protected void btnPlanEvaluationForMaster_Click(object sender, EventArgs e)
    {
        try
        {
            if (GridView_Evaluation.Rows.Count > 0)
            {
                if (txtEvaDueDate.Text.Trim() != "")
                {
                    int       CrewID = UDFLib.ConvertToInteger(Request.QueryString["CrewID"].ToString());
                    DataTable dt     = objBLLCrew.Get_CrewVoyages(CrewID, 0, GetSessionUserID());
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        if (dt.Rows[0]["Sign_On_Date"].ToString() != "")
                        {
                            int Res = BLL_Crew_Evaluation.Plan_Crew_Evaluation_Adhoc(CrewID, UDFLib.ConvertToInteger(ddlEvaluations.SelectedValue), UDFLib.ConvertToDate(txtEvaDueDate.Text.Trim()).ToString(), GetSessionUserID());

                            string js = "";
                            if (Res == -1)
                            {
                                js = "alert('There is another evaluation already planned for this date.');";
                            }
                            if (Res == -2)
                            {
                                js = "alert('There is no voyage found for this staff.');";
                            }
                            if (Res > 0)
                            {
                                js = "alert('Evaluation Planned.');parent.hideModal('dvPopupFrame');";
                            }
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", js, true);
                        }
                        else
                        {
                            string js = "alert('Evaluation cannot be planned as  crew is not onboard.');parent.hideModal('dvPopupFrame');";
                            ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", js, true);
                        }
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", "alert('Select due date.');", true);
                }
            }
            else
            {
                string js = "alert('There is no evaluator on Vessel.Evaluation cannot be planned now.');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", js, true);
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }