コード例 #1
0
    public void FillDDL()
    {
        try
        {
            BLL_Infra_InspectionType onjInsp = new BLL_Infra_InspectionType();
            DataTable FleetDT = objVsl.GetFleetList(Convert.ToInt32(Session["USERCOMPANYID"].ToString()));
            DDLFleet.DataSource     = FleetDT;
            DDLFleet.DataTextField  = "Name";
            DDLFleet.DataValueField = "code";
            DDLFleet.DataBind();
            ListItem li = new ListItem("--SELECT ALL--", "0");
            DDLFleet.Items.Insert(0, li);

            BLL_Infra_Company objInfra = new BLL_Infra_Company();
            ddlVessel_Manager.DataSource     = objInfra.Get_Company_Parent_Child(1, 0, 0);
            ddlVessel_Manager.DataTextField  = "COMPANY_NAME";
            ddlVessel_Manager.DataValueField = "ID";
            ddlVessel_Manager.DataBind();
            ddlVessel_Manager.Items.Insert(0, new ListItem("-Select All-", "0"));



            DataTable dtVessel = objVsl.Get_VesselList(0, 0, Convert.ToInt32(Session["USERCOMPANYID"].ToString()), "", Convert.ToInt32(Session["USERCOMPANYID"].ToString()));
            DDLVessel.DataSource     = dtVessel;
            DDLVessel.DataTextField  = "Vessel_name";
            DDLVessel.DataValueField = "Vessel_id";
            DDLVessel.DataBind();
            DDLVessel.Items.Insert(0, new ListItem("--SELECT--", null));



            DataTable dtSup = objInsp.Get_Supritendent_Users(null, null);
            DDLInspector.DataSource     = dtSup;
            DDLInspector.DataTextField  = "Name";
            DDLInspector.DataValueField = "UserID";
            DDLInspector.DataBind();
            DDLInspector.Items.Insert(0, new ListItem("--SELECT--", null));

            DDLInspectorA.DataSource     = dtSup;
            DDLInspectorA.DataTextField  = "Name";
            DDLInspectorA.DataValueField = "UserID";
            DDLInspectorA.DataBind();
            DDLInspectorA.Items.Insert(0, new ListItem("--SELECT--", null));

            DataTable dtInsp = onjInsp.Get_InspectionTypeList();


            ddlInspectionType.DataSource     = dtInsp;
            ddlInspectionType.DataTextField  = "InspectionTypeName";
            ddlInspectionType.DataValueField = "InspectionTypeId";
            ddlInspectionType.DataBind();
            ddlInspectionType.Items.Insert(0, new ListItem("--SELECT--", null));
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
コード例 #2
0
    protected void gvInspecrionSchedule_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "onDelete")
            {
                objInsp.Del_ScheduledInspection(UDFLib.ConvertIntegerToNull(e.CommandArgument.ToString()), UDFLib.ConvertIntegerToNull(Session["USERID"]));
                Load_Current_Schedules();
            }
            if (e.CommandName == "ReOpen")
            {
                ViewState["SchDetailId"] = UDFLib.ConvertToInteger(e.CommandArgument.ToString().Split(';')[0]);;
            }
            if (e.CommandName.ToUpper() == "EDIT_SCHEDULE")
            {
            }
            if (e.CommandName.ToUpper() == "INSPUPD")
            {
                if (ViewState["edit"].ToString() == "0")
                {
                    btnUpdateInspection.Enabled = false;
                }

                ViewState["ShowImages"]  = 0;
                ViewState["SchDetailId"] = 1;
                string js;

                DataTable dtSup = objInsp.Get_Supritendent_Users(null, UDFLib.ConvertToInteger(e.CommandArgument.ToString().Split(';')[8]));

                if (dtSup != null)
                {
                    if (dtSup.Rows.Count > 0)
                    {
                        DDLInspectorA.DataSource     = dtSup;
                        DDLInspectorA.DataTextField  = "Name";
                        DDLInspectorA.DataValueField = "UserID";
                        DDLInspectorA.DataBind();
                        DDLInspectorA.Items.Insert(0, new ListItem("--SELECT--", null));
                        txtInsectionDate.Text = DateTime.Now.ToString("dd/MMM/yy");


                        ViewState["ScheduleID"]  = UDFLib.ConvertToInteger(e.CommandArgument.ToString().Split(';')[0]);
                        ViewState["SchDetailId"] = UDFLib.ConvertToInteger(e.CommandArgument.ToString().Split(';')[2]);
                        try
                        {
                            try
                            {
                                DDLInspectorA.SelectedValue = e.CommandArgument.ToString().Split(';')[1];
                            }
                            catch (Exception)
                            {
                                DDLInspectorA.SelectedValue = e.CommandArgument.ToString().Split(';')[4];
                            }
                        }
                        catch (Exception)
                        {
                            DDLInspectorA.SelectedIndex = 0;
                        }

                        try
                        {
                            txtInsectionDate.Text = Convert.ToDateTime(e.CommandArgument.ToString().Split(';')[5]).ToString("dd/MMM/yy");
                        }
                        catch (Exception)
                        {
                            txtInsectionDate.Text = Convert.ToDateTime(e.CommandArgument.ToString().Split(';')[6]).ToString("dd/MMM/yy");
                        }

                        try
                        {
                            hdfNewinspectionPortid.Value = "";
                            DataSet   dtAssignPortList = objInsp.INSP_Get_InspectionPort(UDFLib.ConvertToInteger(e.CommandArgument.ToString().Split(';')[2]));
                            DataTable dtPort           = objInfra.Get_PortList();

                            DDLPort.DataSource     = dtPort;
                            DDLPort.DataValueField = "PORT_ID";
                            DDLPort.DataTextField  = "PORT_NAME";
                            DDLPort.DataBind();
                            DDLPort.Items.Insert(0, new ListItem("-SELECT-", null));

                            if (dtAssignPortList.Tables[0].Rows.Count > 0)
                            {
                                try
                                {
                                    DDLPort.SelectedValue = dtAssignPortList.Tables[0].Rows[0]["PortID"].ToString();
                                }
                                catch { }
                            }
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }


                        txtDurJobsU.Text = e.CommandArgument.ToString().Split(';')[7].ToString();
                        txtDuration.Text = e.CommandArgument.ToString().Split(';')[7].ToString();
                        DateTime dt = Convert.ToDateTime(txtInsectionDate.Text);
                        dt = dt.AddDays(UDFLib.ConvertToDouble(txtDuration.Text) - 1);
                        txtCompletionDate.Text = dt.ToString("dd/MMM/yy");
                        txtOnboard.Text        = "";
                        txtOnShore.Text        = "";
                        txtDuration.Text       = "";
                        rdbCompleted.Checked   = false;
                        rdbPlanned.Checked     = true;

                        js = " $('#divAddSystem').prop('title', 'Update Inspection');showModal('dvUpdateInspe',false);";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "showModalJS", js, true);

                        js = " $('#dvUpdateInspe').prop('title', 'Update Inspection');";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "", js, true);

                        js = "handleStatus();";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "handleModal", js, true);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }