예제 #1
0
    protected void bindVoyage()
    {
        if (txtStartDate.Text != "" && txtEndDate.Text != "")
        {
            DateTime  Startdate = Convert.ToDateTime(txtStartDate.Text);
            DateTime  EndDate   = Convert.ToDateTime(txtEndDate.Text);
            int       Vessel_Id = Convert.ToInt32(ddlvessel.SelectedValue);
            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"));
        }
    }
예제 #2
0
    protected void rgdItems_ItemDataBound(object sender, GridItemEventArgs e)
    {
        foreach (GridDataItem dataItem in rgdItems.MasterTableView.Items)
        {
            DropDownList ddlVoyage       = (DropDownList)dataItem.FindControl("ddlVoyage");
            HiddenField  hdVoyage        = (HiddenField)dataItem.FindControl("hdVoyage");
            HiddenField  hdVesselID      = (HiddenField)dataItem.FindControl("hdVesselID");
            HiddenField  hiddenStartDate = (HiddenField)dataItem.FindControl("hiddenStartDate");
            HiddenField  hiddenEndDate   = (HiddenField)dataItem.FindControl("hiddenEndDate");
            if (hdVesselID.Value != null)
            {
                int Vessel_Id = Convert.ToInt32(hdVesselID.Value);
                if (txtStartDate.Text != "" && txtEndDate.Text != "")
                {
                    DateTime Startdate = Convert.ToDateTime(txtStartDate.Text);
                    DateTime EndDate   = Convert.ToDateTime(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"));
                }
            }
        }
    }
예제 #3
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);
            }
        }
    }
    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();
        }
    }
    protected void imgADD_Click(object sender, ImageClickEventArgs e)
    {
        if (ddlVoyage.SelectedItem != null)
        {
            if (!listVoyage.Items.Contains(ddlVoyage.SelectedItem))
            {
                listVoyage.Items.Add(ddlVoyage.SelectedItem);
            }

            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 dtable = objKPI.GetVoyageList(Vessel_Id, Startdate, EndDate);



                for (int i = 0; i < listVoyage.Items.Count; i++)
                {
                    DataRow[] result = dtable.Select("Voyage = '" + listVoyage.Items[i] + "'");
                    foreach (DataRow row in result)
                    {
                        dtable.Rows.Remove(row);
                    }
                }

                ddlVoyage.DataSource     = dtable;
                ddlVoyage.DataTextField  = "Voyage";
                ddlVoyage.DataValueField = "TelID";
                ddlVoyage.DataBind();
            }
            hdnEnd.Value   = "";
            hdnStart.Value = "";
            BindVoyageData();
        }
    }