Exemplo n.º 1
0
    protected Boolean Validate(string sValue, string sDataType)
    {
        Boolean ret = true;
        string  js  = "";

        switch (sDataType)
        {
        case "DATETIME":
            try
            {
                DateTime dt = DateTime.Parse(UDFLib.ConvertToDefaultDt(sValue));
                ret = true;
            }
            catch
            {
                ret = false;
                js  = "ShowNotification('Alert','Entered value is not a valid Date', true)";
            }

            break;
        }

        if (js != "")
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true);
        }
        return(ret);
    }
Exemplo n.º 2
0
    protected void btnFindSignOffCrew_Click(object sender, EventArgs e)
    {
        string msg = "";

        if (txtFromDt.Text.Trim() != "")
        {
            try
            {
                DateTime dt = DateTime.Parse(UDFLib.ConvertToDefaultDt(txtFromDt.Text));
            }
            catch
            {
                msg += "Enter Valid From Date\\n";
            }
        }
        if (txtToDt.Text.Trim() != "")
        {
            try
            {
                DateTime dt = DateTime.Parse(UDFLib.ConvertToDefaultDt(txtToDt.Text));
            }
            catch
            {
                msg += "Enter Valid To Date\\n";
            }
        }
        if (msg != "")
        {
            string js = "alert('" + msg + "')";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true);
            return;
        }

        Search_SigningOff();
    }
Exemplo n.º 3
0
    /// <summary>
    /// Description: Method to bind the grid based on search criteria
    /// </summary>
    protected void BindKPI()
    {
        string sStartDate = UDFLib.ConvertToDefaultDt(txtStartDate.Text);
        string sEndDate   = UDFLib.ConvertToDefaultDt(txtEndDate.Text);

        //string sStartDate = txtStartDate.Text;
        //string sEndDate = txtEndDate.Text;
        try
        {
            if (sStartDate != "" && sEndDate != "")
            {
                DateTime  Startdate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));
                DateTime  EndDate   = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text));
                DataTable dt        = objKPI.Get_NOx_Average((DataTable)Session["Vessel_Id"], Startdate, EndDate);
                ViewState["RecCount"] = dt.Rows.Count;

                rgdItems.DataSource = dt;
                rgdItems.DataBind();
                hdnVessel_IDs.Value = null;
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// Description: Method to load data based on selected vessel and date range
    /// </summary>
    private void LoadData()
    {
        try
        {
            hdnVessel_IDs.Value = null;
            string Qtr        = "";
            string sStartDate = txtStartDate.Text;
            string sEndDate   = txtEndDate.Text;
            if (sStartDate != "" && sEndDate != "")
            {
                DateTime StartDate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));      //ConvertToDefaultDt() method is used to change the user selected date format to the default format, the format in which date is saved in database.
                DateTime EndDate   = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text));

                //hdnLastMonth.Value = lastMonth;
                DataSet   ds        = objKPI.Get_Vetting_KPI_ByCompany(Qtr, 0, StartDate, EndDate);
                DataTable dt        = ds.Tables[0];
                string[]  Pkey_cols = new string[] { "KPI_ID" };
                string[]  Hide_cols = new string[] { "ID", "Qtr_Start", "Qtr_End", "Code" };
                DataTable dt1       = objKPI.PivotTable("Qtr", "KPI_Value", "", Pkey_cols, Hide_cols, dt);

                gvCompanyKPI.DataSource = dt1;
                gvCompanyKPI.DataBind();

                IntializeControls();
                string jsMethodName = null;
                jsMethodName = "$(document).ready(function () {searchInitialize();});";
                ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "uniqueKey", jsMethodName, true);
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Exemplo n.º 5
0
    public void item_click(object sender, EventArgs e)
    {
        try
        {
            LinkButton  lnkVessel   = (LinkButton)sender;
            GridViewRow gvrSelected = (GridViewRow)lnkVessel.NamingContainer;
            foreach (GridViewRow gvr in gvCompanyKPI.Rows)
            {
                gvr.Cells[0].BackColor = System.Drawing.Color.White;
            }
            gvrSelected.Cells[0].BackColor = System.Drawing.Color.Yellow;


            HiddenField hdf  = (HiddenField)gvrSelected.FindControl("hdKPIID");
            HiddenField hdf2 = (HiddenField)gvrSelected.FindControl("hdnKpiName");



            start_date = UDFLib.ConvertToDefaultDt(txtStartDate.Text);
            end_date   = UDFLib.ConvertToDefaultDt(txtEndDate.Text);
            string jsMethodName = null;

            jsMethodName = "showChart2('" + Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text)).ToString("yyyy-MM-dd") + "','" + Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text)).ToString("yyyy-MM-dd") + "','" + hdf.Value + "','" + hdf2.Value + "')";

            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", jsMethodName, true);
        }

        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Exemplo n.º 6
0
    public void item_click(object sender, EventArgs e)
    {
        try
        {
            LinkButton  lnkVessel   = (LinkButton)sender;
            GridViewRow gvrSelected = (GridViewRow)lnkVessel.NamingContainer;
            foreach (GridViewRow gvr in gvPMSOverdue.Rows)
            {
                gvr.Cells[0].BackColor = System.Drawing.Color.White;
            }
            gvrSelected.Cells[0].BackColor = System.Drawing.Color.Yellow;


            HiddenField hdf = (HiddenField)gvrSelected.FindControl("hdVesselID");

            hiddenStartDate.Value = UDFLib.ConvertToDefaultDt(txtStartDate.Text);
            hiddenEndDate.Value   = UDFLib.ConvertToDefaultDt(txtEndDate.Text);

            string vesselname   = lnkVessel.Text;
            string jsMethodName = null;

            jsMethodName = "showChart2('" + Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text)).ToString("yyyy-MM-dd") + "','" + Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text)).ToString("yyyy-MM-dd") + "','" + vesselname + "','" + hdf.Value + "')";
            //ScriptManager.RegisterClientScriptBlock(this, typeof(string), "uniqueKey", jsMethodName, true);
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", jsMethodName, true);
        }

        catch (Exception ex)
        {
            //UDFLib.WriteExceptionLog(ex);
        }
    }
    protected void btnSaveRefererDetail_Click(object sender, EventArgs e)
    {
        string msg = "";

        try
        {
            string   js;
            int      CrewID           = GetCrewID();
            DateTime Dt_ReferenceDate = DateTime.Parse(UDFLib.ConvertUserDateFormat(Convert.ToString("1900/01/01")));

            try
            {
                if (txtReferenceDate.Text != "")
                {
                    if (!UDFLib.DateCheck(txtReferenceDate.Text))
                    {
                        js = "alert('Enter valid Reference Check Date" + UDFLib.DateFormatMessage() + "');";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", js, true);
                        return;
                    }
                }
                Dt_ReferenceDate = DateTime.Parse(UDFLib.ConvertToDefaultDt(txtReferenceDate.Text.Trim()));
            }
            catch (Exception)
            {
                msg = "Enter valid Reference Check Date" + UDFLib.DateFormatMessage();
                js  = "alert('" + msg + "');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", js, true);
                return;
            }

            if ((Dt_ReferenceDate > DateTime.Today))
            {
                js = "alert('Reference Date cannot be greater than todays date.');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", js, true);
            }
            else if (Dt_ReferenceDate == Convert.ToDateTime("01/01/1900 "))
            {
                js = "alert('Invalid Date entry in REFERENCE CHECK DATE field.');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", js, true);
            }
            else
            {
                objBLLCrew.Save_Crew_Reference_Details(0, CrewID, txtRefererName.Text.Trim(), txtRefererPhoneNo.Text.Trim(), Dt_ReferenceDate.ToShortDateString(), txtPersonQuieredName.Text.Trim(), txtPersonQuieredTitle.Text.Trim(), GetSessionUserID());

                objDS_ReferenceDetail.SelectParameters["CrewID"].DefaultValue = CrewID.ToString();
                objDS_ReferenceDetail.Select();
                gdRefererDetails.DataBind();

                pnlView_RefererDetails.Visible = true;
                pnlAdd_RefererDetails.Visible  = false;

                js = "parent.GetInterviewResult(" + Request.QueryString["CrewID"].ToString() + ");";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true);
            }
        }
        catch (Exception)
        {
        }
    }
Exemplo n.º 8
0
    protected void Assign()
    {
        if (txtEventDate.Text.ToString() != "")
        {
            int EventID = objCrew.CREATE_CrewChangeEvent(VesselId, UDFLib.ConvertToDefaultDt(txtEventDate.Text).ToString(), 0, GetSessionUserID(), 0);
            if (EventID > 0)
            {
                DataSet   ds          = BLL_Crew_CrewList.Get_VesselTypeForCrewMatrix(VesselId);
                DataTable dtEventDate = ds.Tables[1];
                ddlEvents.DataSource = dtEventDate;
                ddlEvents.DataBind();
                ddlEvents.Items.Insert(0, new ListItem("- SELECT -", "0"));
                ddlEvents.SelectedValue = EventID.ToString();

                txtEventDate.Text = "";

                AddCrewToEvent();
            }
            else if (EventID == -1)
            {
                string js = "alert('Event date is not inside the vessel arrival and departure dates!!');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertUser", js, true);
            }
        }
        else
        {
            AddCrewToEvent();
        }
    }
    protected void btnsave_Click(object sender, EventArgs e)
    {
        DateTime Dt_EffectiveDate = DateTime.Parse("1900/01/01");

        if (!UDFLib.DateCheck(txtEffectiveDate.Text))
        {
            string js = "alert('Enter valid  Date" + TodayDateFormat + "');" + String.Format("showModal('divadd',false);");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "DateFormat", js, true);
            return;
        }
        try
        {
            txtEffectiveDate.Text = txtEffectiveDate.Text != "" ? UDFLib.ConvertToDefaultDt(txtEffectiveDate.Text) : txtEffectiveDate.Text;
            if (HiddenFlag.Value == "Add")
            {
                int retval = objBLL.Insert_Crew_Contract_Withhold(UDFLib.ConvertToInteger(txtContractNumber.Text), UDFLib.ConvertDecimalToNull(txtAmount.Text), txtWithholdType.Text
                                                                  , UDFLib.ConvertToInteger(ddlEntryType.SelectedValue), UDFLib.ConvertDateToNull(txtEffectiveDate.Text), Convert.ToInt32(Session["USERID"]));
            }
            else
            {
                int retval = objBLL.Edit_Crew_Contract_Withhold(UDFLib.ConvertIntegerToNull(txtContractWithholdID.Text.Trim()), UDFLib.ConvertToInteger(txtContractNumber.Text)
                                                                , UDFLib.ConvertDecimalToNull(txtAmount.Text), txtWithholdType.Text
                                                                , UDFLib.ConvertToInteger(ddlEntryType.SelectedValue), UDFLib.ConvertDateToNull(txtEffectiveDate.Text), Convert.ToInt32(Session["USERID"]));
            }

            BindCrewWithhold();

            string hidemodal = String.Format("hideModal('divadd')");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "hidemodal", hidemodal, true);
        }
        catch (Exception)
        {
            return;
        }
    }
Exemplo n.º 10
0
    protected void BindPortCallHistory(int Type, int?PortID, int?VesselID)
    {
        DateTime dateTime;

        if (!string.IsNullOrEmpty(txtStartDate.Text) && !string.IsNullOrEmpty(txtEndDate.Text))
        {
            //This change has been done to validate the date format as per user selection
            if (DateTime.TryParseExact(txtStartDate.Text, DateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime) && DateTime.TryParseExact(txtEndDate.Text, DateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
            {
                // Format your DateTime for valid date time error

                var from = UDFLib.ConvertToDefaultDt(txtStartDate.Text);
                var To   = UDFLib.ConvertToDefaultDt(txtEndDate.Text);

                DateTime Startdate = Convert.ToDateTime(from);
                DateTime EndDate   = Convert.ToDateTime(To);

                DataTable dt = objPortCall.Get_PortCallHistory(Type, PortID, VesselID, Startdate, EndDate, rdborder.SelectedValue);

                if (dt.Rows.Count > 0)
                {
                    gvPortCallHistory.DataSource = dt;
                    gvPortCallHistory.DataBind();
                    gvPortCallHistory.Visible = true;
                }
                else
                {
                    gvPortCallHistory.DataSource = dt;
                    gvPortCallHistory.DataBind();
                }
            }
        }
    }
Exemplo n.º 11
0
    protected void btnSaveEOCEdit_Click(object sender, EventArgs e)
    {
        try
        {
            if (txtNewCOCDate.Text != "")
            {
                if (!UDFLib.DateCheck(txtNewCOCDate.Text))
                {
                    string js = "alert('Enter valid EOC Date" + UDFLib.DateFormatMessage() + "');";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true);
                    return;
                }
            }

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

            if (VoyID != 0)
            {
                int RetVal = objBLLCrew.UPDATE_COC_Date(VoyID, UDFLib.ConvertToDefaultDt(Convert.ToString(txtNewCOCDate.Text)), txtCOCRemark.Text, GetSessionUserID());
                if (RetVal == 1)
                {
                    lblMsg.Text = "EOC Date Modified";
                    string js = "parent.GetCrewVoyages(" + CrewID.ToString() + ");";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true);
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Exemplo n.º 12
0
    protected Boolean ValidateEntry(string IssueDate, string ExpiryDate)
    {
        Boolean ret = true;
        string  msg = "";

        if (IssueDate == "")
        {
            ret = false;
            msg = "Issue Date is mandatory ";
        }
        if (IssueDate != "")
        {
            try
            {
                DateTime dt = DateTime.Parse(UDFLib.ConvertToDefaultDt(IssueDate));
            }
            catch
            {
                ret = false;
                msg = "Enter valid ISSUE DATE" + CurrentDateFormatMessage;
            }
        }
        if (ExpiryDate != "")
        {
            try
            {
                DateTime dt = DateTime.Parse(UDFLib.ConvertToDefaultDt(ExpiryDate));
            }
            catch
            {
                ret = false;
                msg = "Enter valid EXPIRY DATE" + CurrentDateFormatMessage;
            }
        }
        if (IssueDate != "" && ExpiryDate != "")
        {
            try
            {
                DateTime dtExpiryDate = DateTime.Parse(UDFLib.ConvertToDefaultDt(ExpiryDate));
                DateTime dtIssueDate  = DateTime.Parse(UDFLib.ConvertToDefaultDt(IssueDate));
                if (dtIssueDate > dtExpiryDate)
                {
                    ret = false;
                    msg = "Issue date cannot be greater than Expiry date";
                }
            }
            catch
            {
                ret = false;
                msg = "Invalid entry in DATE field.";
            }
        }
        if (msg != "")
        {
            string js = "alert('" + msg + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "msgValidation", js, true);
        }
        return(ret);
    }
Exemplo n.º 13
0
    /// <summary>
    /// Description: Method to load data based on selected vessel and date range
    /// </summary>
    private void LoadData()
    {
        try
        {
            DataTable dt = (DataTable)Session["Vessel_Id"];
            hdnVessel_IDs.Value = null;

            if (dt.Rows.Count != 0)
            {
                BindKPI();
                Vessel_Ids = new string[dt.Rows.Count];
                int i = 0;
                foreach (DataRow dr in dt.Rows)
                {
                    Vessel_Ids[i]       = dr[0].ToString();
                    hdnVessel_IDs.Value = hdnVessel_IDs.Value + "," + dr[0].ToString();
                    i++;
                }
                hdnVessel_IDs.Value = hdnVessel_IDs.Value.Trim(',');
                if (Convert.ToInt32(ViewState["RecCount"]) > 0)
                {
                    divChart.Visible = true;
                    if (CheckBox1.Checked != true)
                    {
                        btnVoyageChart.Visible = false;
                        hdnStartDate.Value     = "";
                        hdnEndDate.Value       = "";
                        hdnStartDate.Value     = UDFLib.ConvertToDefaultDt(txtStartDate.Text);
                        hdnEndDate.Value       = UDFLib.ConvertToDefaultDt(txtEndDate.Text);
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", "showChart();", true);
                    }
                    else
                    {
                        btnVoyageChart.Visible = true;
                        btnChart.Visible       = false;
                    }
                }
                else
                {
                    btnVoyageChart.Visible = false;
                    btnChart.Visible       = false;
                    divChart.Visible       = false;
                }
            }
            else
            {
                string msg = String.Format("alert('Please select vessels')");
                if (CheckBox1.Checked != true)
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true);
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Exemplo n.º 14
0
    /// <summary>
    /// Description: If by voyage is selected , for all vessels voyage ddl wil populate based on search date
    /// </summary>
    protected void ddlVoyage_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            DateTime?Startdate = null;
            //Startdate = Convert.ToDateTime(txtStartDate.Text);
            Startdate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));
            DateTime?EndDate = null;
            //EndDate = Convert.ToDateTime(txtEndDate.Text);
            EndDate = Convert.ToDateTime(UDFLib.ConvertToDate(txtEndDate.Text));
            DropDownList ddlVoyage = (DropDownList)sender;
            GridDataItem item      = (GridDataItem)ddlVoyage.NamingContainer;
            Label        txtSrno   = (Label)item.FindControl("Vessel_Average");
            HiddenField  hdf       = (HiddenField)item.FindControl("hdVesselID");
            LinkButton   lnkVessel = (LinkButton)item.FindControl("Item_Name");
            if (ddlVoyage.SelectedIndex != 0)
            {
                string    val = ddlVoyage.SelectedValue.Trim().Split(':')[0] + ":" + ddlVoyage.SelectedValue.Trim().Split(':')[1];
                DataTable dtq = BLL_TMSA_PI.GetTelDate(val.Trim(), Convert.ToInt32(hdf.Value)).Tables[0];

                if (dtq.Rows[0][0].ToString() != "")
                {
                    Startdate = Convert.ToDateTime(dtq.Rows[0][1].ToString());

                    hiddenStartDate.Value = Startdate.Value.Date.ToString("dd-MM-yyyy");
                }
                if (dtq.Rows[dtq.Rows.Count - 1][0].ToString() != "")
                {
                    EndDate             = Convert.ToDateTime(dtq.Rows[dtq.Rows.Count - 1][1].ToString());
                    hiddenEndDate.Value = EndDate.Value.Date.ToString("dd-MM-yyyy");
                }
            }
            DataTable dt = BLL_TMSA_PI.GetVoyageDataNOx(ddlVoyage.SelectedValue.Trim(), Convert.ToInt32(hdf.Value)).Tables[0];
            if (dt.Rows.Count > 0)
            {
                txtSrno.Text = Math.Round(Convert.ToDouble(dt.Rows[0]["Value"].ToString()), 2).ToString();
                if (Convert.ToDouble(dt.Rows[0]["Value"]) == 0)
                {
                    lnkVessel.Enabled        = false;
                    item["Vessel"].BackColor = System.Drawing.Color.White;
                }
                else
                {
                    lnkVessel.Enabled = true;
                }
            }
            else
            {
                txtSrno.Text             = "0";
                lnkVessel.Enabled        = false;
                item["Vessel"].BackColor = System.Drawing.Color.White;
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Exemplo n.º 15
0
    protected void btnSaveCostItem_Click(object sender, EventArgs e)
    {
        try
        {
            string js;
            if (txtExp_Date.Text.Trim().Length == 0)
            {
                js = "alert('Date is not Valid!');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", js, true);
                js = "showModal('dvPopupCostItem');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "updated1", js, true);
                UpdatePanel2.Update();
                return;
            }
            else
            {
                try
                {
                    DateTime dt = DateTime.Parse(UDFLib.ConvertToDefaultDt(txtExp_Date.Text));
                }
                catch
                {
                    js = "alert('Enter valid  Date" + TodayDateFormat + "')";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "scripts", js, true);
                    js = "showModal('dvPopupCostItem');";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "script2", js, true);
                    UpdatePanel2.Update();
                    return;
                }
            }
            if (txtDesc.Text.ToString().Length == 0 || ddlExpType.SelectedIndex <= 0 || ddlLocalCurr.SelectedIndex == 0 || txtLocalAmt.Text.Trim().Length == 0)
            {
                js = "showModal('dvPopupCostItem');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "updated1", js, true);
                UpdatePanel2.Update();
                return;
            }

            int Vessel_ID    = UDFLib.ConvertToInteger(Request.QueryString["Vessel_ID"]);
            int Office_ID    = UDFLib.ConvertToInteger(Request.QueryString["Office_ID"]);
            int Cost_Item_ID = BLL_Crew_MedHistory.INSERT_Med_Cost_Item(UDFLib.ConvertToInteger(hdnCaseID.Value), Vessel_ID, Office_ID, UDFLib.ConvertToDefaultDt(Convert.ToString(txtExp_Date.Text)), txtDesc.Text, UDFLib.ConvertToInteger(ddlExpType.SelectedValue), UDFLib.ConvertToInteger(ddlLocalCurr.SelectedValue), UDFLib.ConvertDecimalToNull(txtLocalAmt.Text), UDFLib.ConvertDecimalToNull(txtUSDAmt.Text), GetSessionUserID());

            Upload_CostItemAttachments(Cost_Item_ID);

            Load_Crew_MedHistory_Details(UDFLib.ConvertToInteger(hdnCaseID.Value), Vessel_ID, Office_ID);

            string hidemodal = String.Format("hideModal('divadd')");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "hidemodal", hidemodal, true);
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
        finally
        {
            Session["MedicalCostItemAttachments"] = null;
        }
    }
Exemplo n.º 16
0
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            if (checkVoyage.Checked == false)
            {
                if (txtStartDate.Text != "")
                {
                    Startdate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));
                }
                if (txtEndDate.Text != "")
                {
                    EndDate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text));
                }
                DataTable dt = BLL_TMSA_PI.Search_PI_ValuesNOX(Convert.ToInt32(ddlvessel.SelectedValue), Convert.ToDateTime(txtStartDate.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtEndDate.Text).ToString("yyyy-MM-dd")).Tables[0];

                string[] HeaderCaptions  = { "Record_Date", "Value" };
                string[] DataColumnsName = { "Record_Date", "Value" };
                GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "NOX Effeciency-" + ddlvessel.SelectedItem.Text, "NOX Effeciency-" + ddlvessel.SelectedItem.Text);
            }
            else
            {
                DataTable liTable = new DataTable();
                if (listVoyage.Items.Count > 0)
                {
                    for (int x = 0; x < listVoyage.Items.Count; x++)
                    {
                        //string v1 = listVoyage.Items[0].Value.Split(':')[1].Trim();
                        //string v2 = listVoyage.Items[listVoyage.Items.Count - 1].Value.Split(':')[0].Trim();
                        string val = listVoyage.Items[x].Value.Split(':')[0] + ":" + listVoyage.Items[x].Value.Split(':')[1];

                        DataTable dtq = BLL_TMSA_PI.GetTelDate(val.Trim(), Convert.ToInt32(ddlvessel.SelectedValue)).Tables[0];
                        if (dtq.Rows[0]["Telegram_Date_DDMM"].ToString() != "")
                        {
                            Startdate = Convert.ToDateTime(dtq.Rows[0]["Telegram_Date_DDMM"].ToString());
                        }
                        if (dtq.Rows[dtq.Rows.Count - 1]["Telegram_Date_DDMM"].ToString() != "")
                        {
                            EndDate = Convert.ToDateTime(dtq.Rows[dtq.Rows.Count - 1]["Telegram_Date_DDMM"].ToString());
                        }



                        DataTable dt = BLL_TMSA_PI.GetVoyageDataNOx(listVoyage.Items[x].Value.Trim(), Convert.ToInt32(ddlvessel.SelectedValue)).Tables[0];

                        liTable.Merge(dt);
                    }
                    string[] HeaderCaptions  = { "From Port", "To Port", "Effective From", "Effective To", "Efficiency" };
                    string[] DataColumnsName = { "FromPort", "ToPort", "EffectiveFrom", "EffectiveTo", "Value" };
                    GridViewExportUtil.ExportToExcel(liTable, HeaderCaptions, DataColumnsName, "NOX Effeciency-" + ddlvessel.SelectedItem.Text, "NOX Effeciency(Voyage)-" + ddlvessel.SelectedItem.Text);
                }
            }
        }
        catch (Exception ex)
        { }
    }
Exemplo n.º 17
0
 protected void btnFilter_Click(object sender, ImageClickEventArgs e)
 {
     if (Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text)) <= Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text)))
     {
         LoadData();
     }
     else
     {
         string msg2 = String.Format("alert('Start Date should not be greater than End Date ')");
         ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
     }
 }
Exemplo n.º 18
0
    /// <summary>
    /// Method to export values displayed on the grid applying same search criteria
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            hdnVessel_IDs.Value = null;
            string Qtr        = "";
            string sStartDate = txtStartDate.Text;
            string sEndDate   = txtEndDate.Text;
            if (sStartDate != "" && sEndDate != "")
            {
                DateTime StartDate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));      //ConvertToDefaultDt() method is used to change the user selected date format to the default format, the format in which date is saved in database.
                DateTime EndDate   = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text));

                //hdnLastMonth.Value = lastMonth;
                DataSet   ds        = objKPI.Get_Vetting_KPI_ByCompany(Qtr, 0, StartDate, EndDate);
                DataTable dt        = ds.Tables[0];
                string[]  Pkey_cols = new string[] { "KPI_ID" };
                string[]  Hide_cols = new string[] { "ID", "Qtr_Start", "Qtr_End", "Code" };
                DataTable dt1       = objKPI.PivotTable("Qtr", "KPI_Value", "", Pkey_cols, Hide_cols, dt);



                string[] HeaderCaptions  = new string[dt1.Columns.Count - 1];
                string[] DataColumnsName = new string[dt1.Columns.Count - 1];
                string   ColumnName;
                int      i = 0;
                foreach (DataColumn column in dt1.Columns)
                {
                    ColumnName = column.ColumnName;
                    if (ColumnName != "KPI_ID")
                    {
                        if (ColumnName == "KPI_Name")
                        {
                            HeaderCaptions[i] = "KPI Name";
                        }
                        else
                        {
                            HeaderCaptions[i] = ColumnName;
                        }
                        DataColumnsName[i] = ColumnName;
                    }

                    i++;
                }

                GridViewExportUtil.ExportToExcel(dt1, HeaderCaptions, DataColumnsName, "Vetting Company KPIs", "Vetting Company KPIs");
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Exemplo n.º 19
0
    /// <summary>
    /// Method is called at the time of binding records from database to grid
    /// </summary>
    public void BindAccessGrid()
    {
        //string URL = String.Format("showprogressbar();");
        //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "URL", URL, true);
        try
        {
            int Count = ucCustomPagerItems.isCountRecord;
            //Take the values of Sorting order and sort column name
            string sortbycoloumn = (ViewState["SORTBYACOLOUMN"] == null) ? null : (ViewState["SORTBYACOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTADIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTADIRECTION"].ToString());
            }

            DateTime dt1 = DateTime.Parse(UDFLib.ConvertToDefaultDt(txtFrom.Text));
            DateTime dt2 = DateTime.Parse(UDFLib.ConvertToDefaultDt(txtTo.Text));

            string moduleName = "";
            if ((ddlModule.SelectedItem == null) || (ddlModule.SelectedItem.ToString() == "-SELECT-"))
            {
                moduleName = "";
            }
            else
            {
                moduleName = ddlModule.SelectedItem.ToString();
            }

            DataSet dt = objMenuBLL.Get_AccessRightChanges(UDFLib.ConvertDateToNull(dt1), UDFLib.ConvertDateToNull(dt2), ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, sortbycoloumn, sortdirection,
                                                           UDFLib.ConvertIntegerToNull(ddlUser.SelectedValue), UDFLib.ConvertStringToNull(moduleName), txtPage.Text, int.Parse(Session["USERID"].ToString()), ref Count);

            if (ucCustomPagerItems.isCountRecord == 1)
            {
                ucCustomPagerItems.CountTotalRec = Count.ToString();
                ucCustomPagerItems.BuildPager();
            }
            if (dt.Tables[0].Rows.Count > 0)
            {
                grdAccessReport.DataSource = dt;
                grdAccessReport.DataBind();
            }
            else
            {
                grdAccessReport.DataSource = dt;
                grdAccessReport.DataBind();
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
Exemplo n.º 20
0
    protected void BindKPI()
    {
        string sStartDate = UDFLib.ConvertToDefaultDt(txtStartDate.Text);
        string sEndDate   = UDFLib.ConvertToDefaultDt(txtEndDate.Text);

        if (sStartDate != "" && sEndDate != "")
        {
            DateTime  Startdate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));
            DateTime  EndDate   = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text));
            DataTable dt        = objKPI.Get_SOx_Average((DataTable)Session["Vessel_Id"], Startdate, EndDate).Tables[0];
            ViewState["RecCount"] = dt.Rows.Count;
            rgdItems.DataSource   = dt;
            rgdItems.DataBind();
            hdnVessel_IDs.Value = null;
        }
    }
Exemplo n.º 21
0
    /// <summary>
    /// Description: Method to bind the grid based on search criteria
    /// </summary>
    protected void BindKPI()
    {
        string sStartDate = UDFLib.ConvertToDefaultDt(txtStartDate.Text);
        string sEndDate   = UDFLib.ConvertToDefaultDt(txtEndDate.Text);

        // string sStartDate = txtStartDate.Text;
        // string sEndDate = txtEndDate.Text;
        if (sStartDate != "" && sEndDate != "")
        {
            DateTime  Startdate = Convert.ToDateTime(sStartDate);
            DateTime  EndDate   = Convert.ToDateTime(sEndDate);
            DataTable dt        = objKPI.Get_CO2_Average((DataTable)Session["Vessel_Id"], Startdate, EndDate);
            ViewState["RecCount"] = dt.Rows.Count;
            hdnVessel_IDs.Value   = null;
        }
    }
Exemplo n.º 22
0
    protected void rgdItems_ItemDataBound(object sender, GridItemEventArgs e)
    {
        foreach (GridDataItem dataItem in rgdItems.MasterTableView.Items)
        {
            try
            {
                DropDownList ddlVoyage  = (DropDownList)dataItem.FindControl("ddlVoyage");
                HiddenField  hdVoyage   = (HiddenField)dataItem.FindControl("hdVoyage");
                HiddenField  hdVesselID = (HiddenField)dataItem.FindControl("hdVesselID");
                LinkButton   lnkVessel  = (LinkButton)dataItem.FindControl("Item_Name");
                if (hdVesselID.Value != null && CheckBox1.Checked == true)
                {
                    Label Vessel_Average = (Label)dataItem.FindControl("Vessel_Average");
                    Vessel_Average.Text = "0";

                    ddlVoyage.Enabled = true;
                    int Vessel_Id = Convert.ToInt32(hdVesselID.Value);
                    if (txtStartDate.Text != "" && txtEndDate.Text != "")
                    {
                        //DateTime Startdate = Convert.ToDateTime(txtStartDate.Text);
                        //DateTime EndDate = Convert.ToDateTime(txtEndDate.Text);

                        DateTime Startdate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));
                        DateTime EndDate   = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text));

                        DataTable dt = objKPI.GetVoyageList(Vessel_Id, Startdate, EndDate);
                        ddlVoyage.DataSource     = dt;
                        ddlVoyage.DataTextField  = "VOYAGE";
                        ddlVoyage.DataValueField = "TelID";

                        ddlVoyage.DataBind();
                        ddlVoyage.Items.Insert(0, new ListItem("-Select-", "0"));
                    }
                }
                Label avg = (Label)dataItem.FindControl("Vessel_Average");
                if (Convert.ToDouble(avg.Text) == 0)
                {
                    lnkVessel.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                UDFLib.WriteExceptionLog(ex);
            }
        }
    }
Exemplo n.º 23
0
    protected void bindVoyage()
    {
        BLL_TMSA_KPI objKPI    = new BLL_TMSA_KPI();
        int          Vessel_Id = Convert.ToInt32(ddlvessel.SelectedValue);

        if (txtStartDate.Text != "" && txtEndDate.Text != "")
        {
            DateTime Startdate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text));
            DateTime EndDate   = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text));

            DataTable dt = objKPI.GetVoyageList(Vessel_Id, Startdate, EndDate);
            ddlVoyage.DataSource     = dt;
            ddlVoyage.DataTextField  = "VOYAGE";
            ddlVoyage.DataValueField = "TelID";

            ddlVoyage.DataBind();
        }
    }
Exemplo n.º 24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     CalStartDate.Format = UDFLib.GetDateFormat();   //Display the selected date from datepicker as in the same format which has been selected by the user.
     CalEndDate.Format   = UDFLib.GetDateFormat();
     // UserAccessValidation();
     if (!IsPostBack)
     {
         txtStartDate.Text     = DateTime.Now.AddYears(-1).ToString(UDFLib.GetDateFormat());
         txtEndDate.Text       = DateTime.Now.ToString(UDFLib.GetDateFormat());
         hiddenStartDate.Value = UDFLib.ConvertToDefaultDt(txtStartDate.Text);
         hiddenEndDate.Value   = UDFLib.ConvertToDefaultDt(txtEndDate.Text);
         //LoadKPIList();
         LoadData();
         IntializeControls();
         loadPIDetails();
         GenearteDiv();
     }
 }
Exemplo n.º 25
0
    /// <summary>
    /// Default EOC months is    set in Contract period library page according to Ranks.If not set txtCOCDate will be blanck
    /// </summary>
    protected void txtJoiningDate_TextChanged(object sender, EventArgs e)
    {
        int    Joining_Rank = UDFLib.ConvertToInteger(((DropDownList)gvSignOnCrew.Rows[0].FindControl("ddlRank")).SelectedValue);
        string Joining_Date = ((TextBox)gvSignOnCrew.Rows[0].FindControl("txtJoinDate")).Text;

        try
        {
            DateTime.Parse(UDFLib.ConvertToDefaultDt(Joining_Date));
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "$('#gvSignOnCrew_ctl02_txtCOCDate').val('');alert('Enter valid Joining Date" + UDFLib.DateFormatMessage() + "');", true);
            return;
        }

        if (Joining_Rank > 0)
        {
            if (Joining_Date != "")
            {
                int Days = 0;

                try
                {
                    DataTable dt = new DataTable();
                    dt = objBLLInfra.Get_Crew_Contract_Period_List(Joining_Rank);

                    if (dt.Rows.Count > 0 && dt.Rows[0]["Days"].ToString() != "")
                    {
                        Days = int.Parse(dt.Rows[0]["Days"].ToString());
                    }

                    if (Days > 0)
                    {
                        ((TextBox)gvSignOnCrew.Rows[0].FindControl("txtCOCDate")).Text = DateTime.Parse(UDFLib.ConvertToDefaultDt(Joining_Date)).AddDays(Days).ToString(DateFormat);
                    }
                }
                catch
                {
                    string js = "parent.ShowNotification('Alert','Enter valid Joining Date" + UDFLib.DateFormatMessage() + "',true)";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", js, true);
                }
            }
        }
    }
Exemplo n.º 26
0
    protected void btnportfilter_Click(object sender, ImageClickEventArgs e)
    {
        if (ddlvessel.SelectedIndex != 0 && !string.IsNullOrEmpty(txtEndDate.Text) && !string.IsNullOrEmpty(txtStartDate.Text))
        {
            if (Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtStartDate.Text)) <= Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text)))
            {
                if (checkVoyage.Checked)
                {
                    bindVoyage();
                    BindVoyageData();
                    gvSearch.Visible  = false;
                    gvVoyage.Visible  = true;
                    imgADD.Enabled    = true;
                    divVoyage.Visible = true;
                }
                else
                {
                    bindgvSearch();
                    gvSearch.Visible = true;
                    gvVoyage.Visible = false;
                    imgADD.Enabled   = false;
                }

                ImgComp.Visible = true;
                listVoyage.Items.Clear();

                int KPI_ID = 1;
            }
            else
            {
                clear();
                string msg2 = String.Format("alert('Start Date should not be greater than End Date  ')");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
            }
        }
        else
        {
            clear();


            string msg2 = String.Format("alert('Vessel/StartDate/EndDate should not be blank')");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
    }
Exemplo n.º 27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     CalStartDate.Format = UDFLib.GetDateFormat();      //Display the selected date from datepicker as in the same format which has been selected by the user.
     CalEndDate.Format   = UDFLib.GetDateFormat();
     UserAccessValidation();
     if (!IsPostBack)
     {
         txtStartDate.Text = DateTime.Now.AddDays(-30).ToString(UDFLib.GetDateFormat());
         txtEndDate.Text   = DateTime.Now.ToString(UDFLib.GetDateFormat());
         //txtStartDate.Text = DateTime.Now.AddDays(-30).ToString("dd-MM-yyyy");
         //txtEndDate.Text = DateTime.Now.ToString("dd-MM-yyyy");
         hiddenStartDate.Value = UDFLib.ConvertToDefaultDt(txtStartDate.Text);
         hiddenEndDate.Value   = UDFLib.ConvertToDefaultDt(txtEndDate.Text);
         BindVesselList();
         loadFormula();
         bindgvSearch();
         gvSearch.Visible = true;
     }
 }
Exemplo n.º 28
0
    /// <summary>
    /// Method use to intialize the default Quarter and Default KPI for selected
    /// </summary>
    protected void IntializeControls()
    {
        DataTable dt          = objKPI.Get_Vetting_KPI_List();
        int       firstKPI_Id = 0;
        string    Kpi_Name    = "";

        if (dt.Rows.Count > 0)
        {
            firstKPI_Id         = Convert.ToInt16(dt.Rows[0]["KPI_ID"]);
            Kpi_Name            = dt.Rows[0]["Name"].ToString();
            ViewState["KPI_ID"] = firstKPI_Id;

            hdnKpi_ID.Value   = firstKPI_Id.ToString();
            hdnKpi_Name.Value = Kpi_Name;

            DateTime EndDate = Convert.ToDateTime(UDFLib.ConvertToDefaultDt(txtEndDate.Text));

            int IMonth = 0;
            int Year   = 2017;
            int Qtr    = 1;
            IMonth = EndDate.Month;
            Year   = EndDate.Year;

            if (IMonth < 4)
            {
                Qtr = 1;
            }
            else if ((IMonth > 3 && IMonth <= 6))
            {
                Qtr = 2;
            }
            else if ((IMonth > 6 && IMonth <= 9))
            {
                Qtr = 3;
            }
            else
            {
                Qtr = 4;
            }

            hdnQtr.Value = "Q" + Qtr.ToString() + "-" + Year.ToString();
        }
    }
Exemplo n.º 29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     CalStartDate.Format = UDFLib.GetDateFormat();      //Display the selected date from datepicker as in the same format which has been selected by the user.
     CalEndDate.Format   = UDFLib.GetDateFormat();
     UserAccessValidation();
     if (!IsPostBack)
     {
         txtStartDate.Text = DateTime.Now.AddDays(-30).ToString(UDFLib.GetDateFormat());
         txtEndDate.Text   = DateTime.Now.ToString(UDFLib.GetDateFormat());
         //txtStartDate.Text = DateTime.Now.AddDays(-30).ToString("dd-MM-yyyy");
         //txtEndDate.Text = DateTime.Now.ToString("dd-MM-yyyy");
         hdnStartDate.Value = UDFLib.ConvertToDefaultDt(txtStartDate.Text);
         hdnEndDate.Value   = UDFLib.ConvertToDefaultDt(txtEndDate.Text);
         BindFleetDLL();
         Load_VesselList();
         LoadData();
         loadPIDetails();
     }
 }
Exemplo n.º 30
0
    private void LoadData()
    {
        DataTable dt = (DataTable)Session["Vessel_Id"];

        hdnVessel_IDs.Value = null;
        hiddenStart.Value   = UDFLib.ConvertToDefaultDt(txtStartDate.Text); //ConvertToDefaultDt() method is used to change the user selected date format to the default format, the format in which date is saved in database.
        hiddenEnd.Value     = UDFLib.ConvertToDefaultDt(txtEndDate.Text);

        if (dt.Rows.Count != 0)
        {
            Vessel_Ids = new string[dt.Rows.Count];
            int i = 0;
            foreach (DataRow dr in dt.Rows)
            {
                Vessel_Ids[i]       = dr[0].ToString();
                hdnVessel_IDs.Value = hdnVessel_IDs.Value + "," + dr[0].ToString();
                i++;
            }
            hdnVessel_IDs.Value = hdnVessel_IDs.Value.Trim(',');
            if (ViewState["SelectedTab"] != null)
            {
                if (Convert.ToInt32(ViewState["SelectedTab"]) == 2)
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", "showChart(2);", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", "showChart(1);", true);
                }
            }

            else
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", "showChart(1);", true);
            }
        }
        else
        {
            string msg = String.Format("alert('Please select vessels.')");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true);
        }
    }