Ejemplo n.º 1
0
    protected void AjaxFileUpload1_OnUploadComplete(object sender, AjaxFileUploadEventArgs file)
    {
        try
        {
            BLL_PMS_Library_Jobs objjobs = new BLL_PMS_Library_Jobs();

            Byte[] fileBytes  = file.GetContents();
            string sPath      = Server.MapPath("\\" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "\\uploads\\PmsJobs");
            Guid   GUID       = Guid.NewGuid();
            string AttachPath = "PMS_" + GUID.ToString() + Path.GetExtension(file.FileName);



            objjobs.LibrarySaveJobInstructionAttachment(Convert.ToInt32(Request.QueryString["VesselCode"].ToString()), Convert.ToInt32(Request.QueryString["JobId"].ToString()), Path.GetFileName(file.FileName), AttachPath
                                                        , Convert.ToInt32(Session["userid"].ToString()), null);

            string     FullFilename = Path.Combine(sPath, AttachPath);
            FileStream fileStream   = new FileStream(FullFilename, FileMode.Create, FileAccess.ReadWrite);
            fileStream.Write(fileBytes, 0, fileBytes.Length);
            fileStream.Close();
        }
        catch (Exception ex)
        {
        }
    }
    public void BindJobList(int jobid)
    {
        BLL_PMS_Library_Jobs objJob = new BLL_PMS_Library_Jobs();
        DataSet ds = objJob.LibraryJobList(jobid);

        if (ds.Tables[0].Rows.Count > 0)
        {
            DataRow dr = ds.Tables[0].Rows[0];

            txtJobtitle.Text            = dr["Job_Title"].ToString();
            txtjobDescription.Text      = dr["Job_Description"].ToString();
            lstDepartment.SelectedValue = dr["Department_ID"].ToString();

            if ((dr["Rank_ID"].ToString() != "0") && (dr["Rank_ID"].ToString() != ""))
            {
                ddlRank.SelectedValue = dr["Rank_ID"].ToString();
            }
            txtFrequency.Text          = dr["Frequency"].ToString();
            lstFrequency.SelectedValue = dr["Frequency_Type"].ToString();



            lblJobCode.Text   = dr["Job_Code"].ToString();
            lblMachinery.Text = dr["System_Description"].ToString();
            lblSubsystem.Text = dr["Subsystem_Description"].ToString();

            optCMS.SelectedValue      = dr["CMS"].ToString();
            optCritical.SelectedValue = dr["Critical"].ToString();
        }
    }
Ejemplo n.º 3
0
    protected void tvItemList_SelectedNodeChanged(object sender, EventArgs e)
    {
        BLL_PMS_Library_Jobs objJobs = new BLL_PMS_Library_Jobs();

        gvJobs.DataSource = null;
        gvJobs.DataBind();


        if (((TreeView)(sender)).SelectedNode.Depth == 1 || ((TreeView)(sender)).SelectedNode.Depth == 3)
        {
            int     rowcount = 0;
            DataSet ds       = objJobs.LibraryJobSearch(UDFLib.ConvertIntegerToNull(tvItemList.SelectedValue.Split(',')[0]), UDFLib.ConvertIntegerToNull(tvItemList.SelectedValue.Split(',')[1]), UDFLib.ConvertToInteger(DDLVessel.SelectedValue), null, null, null
                                                        , 1, "id"
                                                        , 1, 1, 200, ref rowcount);


            gvJobs.DataSource = ds.Tables[0];
            gvJobs.DataBind();
        }

        if (((TreeView)(sender)).SelectedNode.Depth == 0)
        {
            Function_Click((sender as TreeView).SelectedNode);
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        BLL_PMS_Library_Jobs objJobs = new BLL_PMS_Library_Jobs();

        foreach (GridViewRow gr in gvAssigneForm.Rows)
        {
            CheckBox chkAssingeForm = (CheckBox)gr.FindControl("chkAssingeForm");

            string lblForm_ID = ((Label)gr.FindControl("lblForm_ID")).Text;
            string lblJob_ID  = ((Label)gr.FindControl("lblJob_ID")).Text;
            string lbl_ID     = ((Label)gr.FindControl("lbl_ID")).Text;

            if ((chkAssingeForm.Checked == true || lblJob_ID != "") && chkAssingeForm.Enabled == true)
            {
                int retval = objJobs.LibrarySaveJob_eForm_Mapping(UDFLib.ConvertIntegerToNull(lbl_ID), UDFLib.ConvertIntegerToNull(Request.QueryString["Vessel_ID"].ToString())
                                                                  , UDFLib.ConvertIntegerToNull(Request.QueryString["Job_ID"].ToString()), UDFLib.ConvertIntegerToNull(lblForm_ID)
                                                                  , chkAssingeForm.Checked == true ? 1 : 0
                                                                  , Convert.ToInt32(Session["userid"].ToString()));
            }
        }


        string msg = String.Format("parent.ReloadParent_ByButtonID();");

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true);
    }
Ejemplo n.º 5
0
    public void BindCatalogueList(string systemid)
    {
        DataSet ds = objBLLPurc.LibraryCatalogueList(systemid);

        BLL_PMS_Library_Jobs objJob = new BLL_PMS_Library_Jobs();



        if (ds.Tables[0].Rows.Count > 0)
        {
            DataRow dr = ds.Tables[0].Rows[0];

            string systemcode = dr["System_code"].ToString();

            txtName.Text           = dr["System_Description"].ToString();
            txtParticular.Text     = dr["System_Particulars"].ToString();
            txtSetsInstalled.Text  = dr["Set_Instaled"].ToString();
            txtModel.Text          = dr["Module_Type"].ToString();
            txtSerialNo.Text       = dr["Serial_Number"].ToString();
            ddlMaker.SelectedValue = dr["Maker"].ToString() != "" ? dr["Maker"].ToString() : "0";

            //ddlCatalogDept.SelectedValue = dr["Dept1"].ToString() != "" ? dr["Dept1"].ToString() : "0";
            ddlDepartment.SelectedValue = dr["Dept1"].ToString() != "" ? dr["Dept1"].ToString() : "0";



            if ((dr["Functions"].ToString() != "") && (dr["Functions"].ToString() != "0"))
            {
                ddlFunction.SelectedValue = dr["Functions"].ToString();
            }
            else
            {
                ddlFunction.SelectedValue = "0";
            }

            if ((dr["ACCOUNT_CODE"].ToString() != "") && (dr["ACCOUNT_CODE"].ToString() != "0"))
            {
                ddlAccountCode.SelectedValue = dr["ACCOUNT_CODE"].ToString();
            }
            else
            {
                ddlAccountCode.SelectedValue = "0";
            }

            //DataTable dt = objJob.LibraryGetCatalogueLocationAssign(dr["System_code"].ToString(), Convert.ToInt32(dr["Vessel_Code"].ToString()));

            //if (dt.Rows.Count > 0)
            //{
            //    lstcatalogLocation.DataTextField = "LocationName";
            //    lstcatalogLocation.DataValueField = "AssginLocationID";
            //    lstcatalogLocation.DataSource = dt;
            //    lstcatalogLocation.DataBind();
            //}
            //else
            //{
            //    lstcatalogLocation.Items.Clear();
            //}
        }
    }
Ejemplo n.º 6
0
    public void BindItemTreeView()
    {
        BLL_PMS_Library_Jobs objBl = new BLL_PMS_Library_Jobs();

        DataSet dsRecords = objBl.Get_Functional_Tree_Data(UDFLib.ConvertToInteger(DDLVessel.SelectedValue));

        if (dsRecords.Tables.Count == 5)
        {
            foreach (DataRow drParent in dsRecords.Tables["function"].Rows)
            {
                TreeNode parentNode = new TreeNode(drParent["CODE"].ToString() + " - " + drParent["DESCRIPTION"].ToString(), drParent["CODE"].ToString());
                parentNode.ImageUrl = "../../images/noneimg.png";

                /*  DataRow[] drChildList_System = dsRecords.Tables["system"].Select("Functions=" + drParent["code"].ToString());
                 *
                 * foreach (DataRow drChild1 in drChildList_System)
                 * {
                 *    TreeNode Child_System = new TreeNode(drParent["CODE"].ToString() + "." + drChild1["System_code"].ToString() +" - "+ drChild1["System_Description"].ToString(), drChild1["System_code"].ToString());
                 *    Child_System.ImageUrl = "../../images/noneimg.png";
                 *
                 *    parentNode.ChildNodes.Add(Child_System);
                 *
                 *    DataRow[] drChildList_Location = dsRecords.Tables["systemlocation"].Select("system_code='" + drChild1["system_code"].ToString() + "'");
                 *
                 *    foreach (DataRow drChild2 in drChildList_Location)
                 *    {
                 *        TreeNode Child_Location = new TreeNode(drChild2["Location_Name"].ToString());
                 *        Child_Location.ImageUrl = "../../images/noneimg.png";
                 *        Child_System.ChildNodes.Add(Child_Location);
                 *
                 *        DataRow[] drChildList_SubSystem = dsRecords.Tables["subsystem"].Select("system_code='" + drChild1["system_code"].ToString() + "'");
                 *
                 *        foreach (DataRow drChild3 in drChildList_SubSystem)
                 *        {
                 *            TreeNode Child_SubSystem = new TreeNode(drChild3["Subsystem_Description"].ToString(), drChild3["ID"].ToString());
                 *            Child_SubSystem.ImageUrl = "../../images/noneimg.png";
                 *            Child_Location.ChildNodes.Add(Child_SubSystem);
                 *
                 *            DataRow[] drChildList_SubSystem_location = dsRecords.Tables["subsystemlocation"].Select("system_code='" + drChild1["system_code"].ToString() + "' and SubSystem_Code='" + drChild3["SubSystem_Code"].ToString() + "'");
                 *
                 *            foreach (DataRow drChild4 in drChildList_SubSystem_location)
                 *            {
                 *                TreeNode Child_SubSystem_Location = new TreeNode(drChild4["Location_Name"].ToString(), drChild4["systemid"].ToString() + "," + drChild4["id"].ToString());
                 *                Child_SubSystem_Location.ImageUrl = "../../images/noneimg.png";
                 *                Child_SubSystem.ChildNodes.Add(Child_SubSystem_Location);
                 *            }
                 *        }
                 *
                 *    }
                 *
                 *
                 *
                 * }*/

                tvItemList.Nodes.Add(parentNode);
                //parentNode.ExpandAll();
            }
        }
    }
Ejemplo n.º 7
0
    protected void BindPmsJobAttachment()
    {
        BLL_PMS_Library_Jobs objjobs = new BLL_PMS_Library_Jobs();
        DataTable            dt      = objjobs.LibraryGetJobInstructionAttachment(UDFLib.ConvertToInteger(ViewState["Vessel_ID"]), UDFLib.ConvertToInteger(ViewState["JOB_ID"]));

        gvPMSJobAttachment.DataSource = dt;
        gvPMSJobAttachment.DataBind();
    }
Ejemplo n.º 8
0
    protected void btnReplaceEquipment_Click(object sender, ImageClickEventArgs e)
    {
        BLL_PMS_Library_Jobs objPms = new BLL_PMS_Library_Jobs();

        objPms.Upd_Equipment_Replacement(UDFLib.ConvertToInteger(Request.QueryString["Vessel_ID"]), Convert.ToInt32(Request.QueryString["SystemLocation"]), Convert.ToInt32(hdfSpareEQPID.Value), Convert.ToInt32(DViewActive.DataKey["ID"].ToString()), txtRemark.Text, Convert.ToInt32(Session["userid"]));

        string script = string.Format("parent.DDlVessel_selectionChange();parent.hideModal('dvEQPReplacement');");

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "close", script, true);
    }
Ejemplo n.º 9
0
    public string PMS_Get_IsSystemRunHourBased(string systemid, string vesselid)
    {
        int SystemID = int.Parse(systemid);
        int VesselID = int.Parse(vesselid);
        BLL_PMS_Library_Jobs objJobs = new BLL_PMS_Library_Jobs();

        int Result = objJobs.PMS_Get_IsSystemRunHourBased(SystemID, VesselID);

        return(Result.ToString());
    }
    public void BindeFormAssign()
    {
        BLL_PMS_Library_Jobs objJobs = new BLL_PMS_Library_Jobs();

        int rowcount = ucCustomPager.isCountRecord;

        string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
        int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
        {
            sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
        }

        int?Vessel_ID = null;

        if (!string.IsNullOrEmpty(Request.QueryString["Vessel_ID"]))
        {
            Vessel_ID = UDFLib.ConvertIntegerToNull(Request.QueryString["Vessel_ID"].ToString());
        }

        int?Job_ID = null;

        if (!string.IsNullOrEmpty(Request.QueryString["Job_ID"]))
        {
            Job_ID = UDFLib.ConvertIntegerToNull(Request.QueryString["Job_ID"].ToString());
        }

        // DataTable dt = objJobs.LibraryGetJOB_eFORM_MAPPING_SEARCH(txtSearch.Text, Vessel_ID, sortbycoloumn, sortdirection
        //     , ucCustomPager.CurrentPageIndex, ucCustomPager.PageSize, ref rowcount);

        DataTable dt = objJobs.LibraryGetJOB_eFORM_MAPPING_SEARCH(txtSearch.Text, Vessel_ID, Job_ID, sortbycoloumn, sortdirection
                                                                  , null, null, ref rowcount);


        //if (ucCustomPager.isCountRecord == 1)
        //{
        //    ucCustomPager.CountTotalRec = rowcount.ToString();
        //    ucCustomPager.BuildPager();
        //}

        if (dt.Rows.Count > 0)
        {
            gvAssigneForm.DataSource = dt;
            gvAssigneForm.DataBind();
        }
        else
        {
            gvAssigneForm.DataSource = dt;
            gvAssigneForm.DataBind();
        }
    }
Ejemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BLL_PMS_Library_Jobs objPms = new BLL_PMS_Library_Jobs();
            DataSet dsLoc = objPms.Get_Equipment_Location(UDFLib.ConvertToInteger(Request.QueryString["Vessel_ID"]), Convert.ToInt32(Request.QueryString["SystemID"]), UDFLib.ConvertIntegerToNull(Request.QueryString["SubSystemID"]), Convert.ToInt32(Request.QueryString["SystemLocation"]), UDFLib.ConvertIntegerToNull(Request.QueryString["SubSystemLocation"]));

            DViewActive.DataSource = dsLoc.Tables["ACTIVELOCATION"];
            DViewActive.DataBind();

            gvSpare.DataSource = dsLoc.Tables["SPARELOCATION"];
            gvSpare.DataBind();
        }
    }
    /// <summary>
    /// Binding job attachment
    /// </summary>
    /// <param name="JOB_ID">Job Id </param>
    /// <param name="VESSEL_ID">Vessel ID</param>

    protected void BindPmsJobAttachment()
    {
        try
        {
            BLL_PMS_Library_Jobs objjobs = new BLL_PMS_Library_Jobs();
            DataTable            dt      = objjobs.LibraryGetJobInstructionAttachment(UDFLib.ConvertToInteger(Request.QueryString["VID"]), UDFLib.ConvertToInteger(Request.QueryString["JobID"].ToString()));

            gvPMSJobAttachment.DataSource = dt;
            gvPMSJobAttachment.DataBind();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    /// <summary>
    /// Bind history to gridview.
    /// </summary>
    public void BindItems()
    {
        BLL_PMS_Library_Jobs obj = new BLL_PMS_Library_Jobs();
        int rowcount             = 1;

        gvEQPHistory.DataSource = obj.Get_Equipment_Replacement_History(UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue),
                                                                        UDFLib.ConvertIntegerToNull(ddlFunction.SelectedValue),
                                                                        UDFLib.ConvertIntegerToNull(ddlSystem_location.SelectedValue.Split(',')[0]),
                                                                        UDFLib.ConvertIntegerToNull(ddlSubSystem_location.SelectedValue.Split(',')[0]),
                                                                        ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);
        gvEQPHistory.DataBind();

        ucCustomPagerItems.CountTotalRec = rowcount.ToString();
        ucCustomPagerItems.BuildPager();
    }
Ejemplo n.º 14
0
    private void Function_Click(TreeNode parentNode)
    {
        BLL_PMS_Library_Jobs objBl = new BLL_PMS_Library_Jobs();

        DataSet dsRecords = objBl.Get_Functional_Tree_Data(UDFLib.ConvertToInteger(DDLVessel.SelectedValue));

        if (dsRecords.Tables.Count == 5)
        {
            DataRow[] drChildList_System = dsRecords.Tables["system"].Select("Functions=" + parentNode.Value.ToString());

            foreach (DataRow drChild1 in drChildList_System)
            {
                TreeNode Child_System = new TreeNode(parentNode.Value.ToString() + "." + drChild1["System_code"].ToString() + " - " + drChild1["System_Description"].ToString(), drChild1["System_code"].ToString() + ",");
                Child_System.ImageUrl = "../../images/noneimg.png";

                parentNode.ChildNodes.Add(Child_System);

                DataRow[] drChildList_Location = dsRecords.Tables["systemlocation"].Select("system_code='" + drChild1["system_code"].ToString() + "'");

                foreach (DataRow drChild2 in drChildList_Location)
                {
                    TreeNode Child_Location = new TreeNode(parentNode.Value.ToString() + "." + drChild1["System_code"].ToString() + "." + drChild2["Location_code"].ToString() + " - " + drChild2["Location_Name"].ToString());
                    Child_Location.ImageUrl = "../../images/noneimg.png";
                    Child_System.ChildNodes.Add(Child_Location);

                    DataRow[] drChildList_SubSystem = dsRecords.Tables["subsystem"].Select("system_code='" + drChild1["system_code"].ToString() + "'");

                    foreach (DataRow drChild3 in drChildList_SubSystem)
                    {
                        TreeNode Child_SubSystem = new TreeNode(parentNode.Value.ToString() + "." + drChild1["System_code"].ToString() + "." + drChild2["Location_code"].ToString() + "." + drChild3["id"].ToString() + " - " + drChild3["Subsystem_Description"].ToString(), drChild1["System_code"].ToString() + "," + drChild3["ID"].ToString());
                        Child_SubSystem.ImageUrl = "../../images/noneimg.png";
                        Child_Location.ChildNodes.Add(Child_SubSystem);

                        DataRow[] drChildList_SubSystem_location = dsRecords.Tables["subsystemlocation"].Select("system_code='" + drChild1["system_code"].ToString() + "' and SubSystem_Code='" + drChild3["SubSystem_Code"].ToString() + "'");

                        foreach (DataRow drChild4 in drChildList_SubSystem_location)
                        {
                            TreeNode Child_SubSystem_Location = new TreeNode(parentNode.Value.ToString() + "." + drChild1["System_code"].ToString() + "." + drChild2["Location_code"].ToString() + "." + drChild3["id"].ToString() + "." + drChild4["Location_Code"].ToString() + " - " + drChild4["Location_Name"].ToString(), drChild4["systemid"].ToString() + "," + drChild4["id"].ToString());
                            Child_SubSystem_Location.ImageUrl = "../../images/noneimg.png";
                            Child_SubSystem.ChildNodes.Add(Child_SubSystem_Location);
                        }
                    }
                }
            }

            parentNode.Expand();
        }
    }
Ejemplo n.º 15
0
    private void FillDLLjobDepartment()
    {
        try
        {
            BLL_PMS_Library_Jobs obj = new BLL_PMS_Library_Jobs();

            DataTable dt = obj.LibraryGetPMSSystemParameterList("2487", "");
            DDLJobDepartment.DataSource     = dt;
            DDLJobDepartment.DataValueField = "Code";
            DDLJobDepartment.DataTextField  = "Name";
            DDLJobDepartment.DataBind();
        }
        catch
        {
        }
    }
Ejemplo n.º 16
0
    protected DataTable GetJobToCopy(Boolean blnOverWriteFlag)
    {
        BLL_PMS_Library_Jobs objJobs = new BLL_PMS_Library_Jobs();
        DataSet ds = new DataSet();

        if (blnOverWriteFlag)
        {
            int?isactivestatus = 1;
            ds = objJobs.LibraryJobGetToCopy(DDLToSystem.SelectedValue, UDFLib.ConvertIntegerToNull(DDLToSubsystem.SelectedValue), UDFLib.ConvertIntegerToNull(DDLToVessel.SelectedValue), isactivestatus);
        }
        else
        {
            int?isactivestatus = 1;
            ds = objJobs.LibraryJobGetToCopy(DDLFromSystem.SelectedValue, UDFLib.ConvertIntegerToNull(DDLFromSubsystem.SelectedValue), UDFLib.ConvertIntegerToNull(DDLFromVessel.SelectedValue), isactivestatus);
        }

        return(ds.Tables[0]);
    }
    public void BindCatalogueAssignLocation()
    {
        BLL_PMS_Library_Jobs objJobs = new BLL_PMS_Library_Jobs();
        int rowcount = ucCustomPagerItems.isCountRecord;

        string sortbycoloumn = (ViewState["ITEMSORTBYCOLOUMN"] == null) ? null : (ViewState["ITEMSORTBYCOLOUMN"].ToString());

        int?sortdirection = null;

        if (ViewState["ITEMSORTDIRECTION"] != null)
        {
            sortdirection = Int32.Parse(ViewState["ITEMSORTDIRECTION"].ToString());
        }

        string systemcode = ((Request.QueryString["SystemCode"].ToString() != "") || (Request.QueryString["SystemCode"] != null)) ? Request.QueryString["SystemCode"].ToString() : null;

        //if ((Request.QueryString["SystemCode"].ToString() != "") || (Request.QueryString["SystemCode"] !=null))
        //{

        //}


        DataSet ds = objJobs.LibraryCatalogueLocationAssignSearch(systemcode, Convert.ToString(ViewState["SubSystemId"]), txtSearchLocation.Text, Convert.ToInt32(19), sortbycoloumn
                                                                  , sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);


        if (ucCustomPagerItems.isCountRecord == 1)
        {
            ucCustomPagerItems.CountTotalRec = rowcount.ToString();
            ucCustomPagerItems.BuildPager();
        }

        if (ds.Tables[0].Rows.Count > 0)
        {
            gvLocation.DataSource = ds.Tables[0];
            gvLocation.DataBind();
        }
        else
        {
            gvLocation.DataSource = ds.Tables[0];
            gvLocation.DataBind();
        }
    }
Ejemplo n.º 18
0
    public string PMS_Get_DestinationSystemSubsystemFunction_Tree(string id, string vesselid)
    {
        BLL_PMS_Library_Jobs objJobs = new BLL_PMS_Library_Jobs();
        DataTable            dt      = objJobs.PMS_Get_DestinationSystemSubsystemTreeData(int.Parse(vesselid));
        string sParentID             = "";
        string sChildID = "";

        DataRow[] result = dt.Select("id = '" + id + "'");
        for (int i = 0; i < result.Length; i++)
        {
            sParentID = result[i]["parent"].ToString();
            if (sParentID == "#")
            {
                sParentID = "";
            }
            dt.Rows.Remove(result[i]);
            dt.AcceptChanges();


            DataRow[] result2 = dt.Select("[parent] = '" + sParentID + "'");
            for (int k = 0; k < result2.Length; k++)
            {
                sChildID = result2[k]["id"].ToString();
                dt.Rows.Remove(result2[k]);
                dt.AcceptChanges();

                DataRow[] result4 = dt.Select("[id] = '" + sChildID + "'");
                for (int j = 0; j < result4.Length; j++)
                {
                    dt.Rows.Remove(result4[j]);
                    dt.AcceptChanges();
                }
            }

            DataRow[] result3 = dt.Select("[id] = '" + sParentID + "'");
            for (int j = 0; j < result3.Length; j++)
            {
                dt.Rows.Remove(result3[j]);
                dt.AcceptChanges();
            }
        }
        return(ConvertDataTabletoJsonData(dt));
    }
Ejemplo n.º 19
0
    /// <summary>
    /// Binding Department using parent type code
    /// </summary>
    private void BindPMSDepartmentDDL()
    {
        try
        {
            BLL_PMS_Library_Jobs obj = new BLL_PMS_Library_Jobs();

            DataTable dt = obj.LibraryGetPMSSystemParameterList("2487", "");

            ddlDepartment.DataSource     = dt;
            ddlDepartment.DataValueField = "Code";
            ddlDepartment.DataTextField  = "Name";

            ddlDepartment.DataBind();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    private void BindFrequencyTypeDDL()
    {
        try
        {
            BLL_PMS_Library_Jobs obj = new BLL_PMS_Library_Jobs();
            DataTable            dt  = obj.LibraryGetPMSSystemParameterList("2491", "");
            lstFrequency.DataSource     = dt;
            lstFrequency.DataTextField  = "Name";
            lstFrequency.DataValueField = "Code";
            lstFrequency.DataBind();

            lstCRFrequency.DataSource     = dt;
            lstCRFrequency.DataTextField  = "Name";
            lstCRFrequency.DataValueField = "Code";
            lstCRFrequency.DataBind();
        }
        catch
        {
        }
    }
Ejemplo n.º 21
0
    protected void btnExport_Click(object sender, EventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            BLL_PMS_Library_Jobs objJob = new BLL_PMS_Library_Jobs();

            int?isactivestatus = null;
            if (optdisplayRecordType.SelectedValue != "2")
            {
                isactivestatus = Convert.ToInt32(optdisplayRecordType.SelectedValue);
            }

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());

            int?sortdirection = null;
            if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }


            DataSet ds = objJob.LibraryMachineryInforSearch(txtsearchtext.Text != "" ? txtsearchtext.Text : null, null, null, null
                                                            , "SP", UDFLib.ConvertIntegerToNull(cmbDept.SelectedValue), UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue)
                                                            , null, UDFLib.ConvertIntegerToNull(cmb_Function.SelectedValue), UDFLib.ConvertIntegerToNull(ddllocation.SelectedValue), null
                                                            , isactivestatus
                                                            , sortbycoloumn, sortdirection, null, null, ref rowcount);

            string[] HeaderCaptions  = { "Vessel", "Function", "Department", "Machinery Name", "Location", "Model", "Sets", "Serial Number", "Particulars", "Maker" };
            string[] DataColumnsName = { "Vessel_Name", "Function_Name", "Department", "System_Name", "Location_Name", "Model", "Set_Instaled", "SrNumber", "Particulars_Full_Details", "MakerName" };

            GridViewExportUtil.ShowExcel(ds.Tables[0], HeaderCaptions, DataColumnsName, "MachineryInformation", "Machinery Information", "");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
            string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true);
        }
    }
Ejemplo n.º 22
0
    protected void btnOverwrite_Click(object sender, EventArgs e)
    {
        BLL_PMS_Library_Jobs objJobs = new BLL_PMS_Library_Jobs();

        /* 1. Get All the existing job  pass overwrite flag to 'ture' for fatching exsisting job fro  To { selected vessel , system ,subsystem } criteria */
        DataTable dtExistingJob = GetJobToCopy(true);

        /* 2. Delete all the job Office :: Active status would be 0    Vessel :: Need to Send the delete Query to Delete paranently from the ship */

        foreach (DataRow dr in dtExistingJob.Rows)
        {
            objJobs.LibraryJobOverWrite(Convert.ToInt32(Session["userid"].ToString()), Convert.ToInt32(dr["ID"].ToString()));
        }

        /*3. Get All the Jobs that need to copy from {selected vessel , system ,subsystem }  To { selected vessel , system ,subsystem }  pass overwrite flag 'false' */

        DataTable dtJobsToCopy = GetJobToCopy(false);

        /*4. Insert the data into TEC_LIB_JOBS table */
        CopyJobsFromVesselToVessel(dtJobsToCopy, "Overwrite");
    }
Ejemplo n.º 23
0
    public void BindCatalogueAssignLocation()
    {
        BLL_PMS_Library_Jobs objJobs = new BLL_PMS_Library_Jobs();
        int rowcount = ucDivCustomPager.isCountRecord;

        string System_ID = (ViewState["System_ID"] == null) ? null : (ViewState["System_ID"].ToString());

        string sortbycoloumn = (ViewState["ITEMSORTBYCOLOUMN"] == null) ? null : (ViewState["ITEMSORTBYCOLOUMN"].ToString());

        int?sortdirection = null;

        if (ViewState["ITEMSORTDIRECTION"] != null)
        {
            sortdirection = Int32.Parse(ViewState["ITEMSORTDIRECTION"].ToString());
        }


        DataSet ds = objJobs.LibraryCatalogueLocationAssignSearch(System_ID, null, txtSearchLocation.Text, Convert.ToInt32(ViewState["Vessel_id"].ToString()), sortbycoloumn
                                                                  , sortdirection, ucDivCustomPager.CurrentPageIndex, ucDivCustomPager.PageSize, ref rowcount);


        if (ucDivCustomPager.isCountRecord == 1)
        {
            ucDivCustomPager.CountTotalRec = rowcount.ToString();
            ucDivCustomPager.BuildPager();
        }

        if (ds.Tables[0].Rows.Count > 0)
        {
            gvLocation.DataSource = ds.Tables[0];
            gvLocation.DataBind();
        }
        else
        {
            gvLocation.DataSource = ds.Tables[0];
            gvLocation.DataBind();
        }
    }
Ejemplo n.º 24
0
    protected void btnMove_Click(object sender, EventArgs e)
    {
        try
        {
            lblmsg.Text = "";

            BLL_PMS_Library_Jobs objBLL = new BLL_PMS_Library_Jobs();
            if (lstToMove.SelectedValue != "" && lstParent.SelectedValue != "")
            {
                objBLL.TEC_MOVE_SYSTEM_SUBSYSTEM(lstParent.SelectedValue, lstToMove.SelectedValue);
                lblmsg.Text = "System is moved to Selected Parent's Sub-System Level";
            }
            else
            {
                lblmsg.Text = "Select Parent System and System To Move";
            }
            Bindsystems();
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;
        }
    }
Ejemplo n.º 25
0
 protected void btnCopyData_Click(object sender, EventArgs e)
 {
     try
     {
         if (lstCopyFromVessel.SelectedIndex != -1 && lstCopyToVessel.SelectedIndex != -1)
         {
             BLL_PMS_Library_Jobs objCopy = new BLL_PMS_Library_Jobs();
             int sts = objCopy.Upd_Copy_PMS_Data(Convert.ToInt32(lstCopyFromVessel.SelectedValue), Convert.ToInt32(lstCopyToVessel.SelectedValue), Convert.ToInt32(Session["USERID"].ToString()), 0);
             if (sts == 1)
             {
                 lblmsg.Text = "PMS data copied successfully.";
             }
         }
         else
         {
             lblmsg.Text = "Please select vessel";
         }
     }
     catch (Exception ex)
     {
         lblmsg.Text = ex.Message;
     }
 }
Ejemplo n.º 26
0
    public string PMS_Get_SourceSystemSubsystemFunction_Tree(string id, string vesselid, string equipmentid, string equipmenttype)
    {
        BLL_PMS_Library_Jobs objJobs = new BLL_PMS_Library_Jobs();
        DataTable            dt      = objJobs.Get_System_SubsystemTreeData(int.Parse(vesselid));
        //for (int i = dt.Rows.Count - 1; i >= 0; i--)
        //{
        //    if (dt.Rows[i][0] == DBNull.Value && dt.Rows[i][2] == DBNull.Value)
        //        dt.Rows[i].Delete();
        //}
        //dt.AcceptChanges();

        int ID = int.Parse(id);

        if (ID > 0)
        {
            string    sParentID = "";
            string    sChildID  = "";
            DataRow[] result    = dt.Select("id = '" + ID + "'");
            for (int i = 0; i < result.Length; i++)
            {
                sParentID = result[i]["parent"].ToString();
                if (sParentID == "#")
                {
                    sParentID = "0";
                }
                dt.Rows.Remove(result[i]);
                dt.AcceptChanges();


                DataRow[] result2 = dt.Select("[parent] = '" + sParentID + "'");
                for (int k = 0; k < result2.Length; k++)
                {
                    sChildID = result2[k]["id"].ToString();
                    dt.Rows.Remove(result2[k]);
                    dt.AcceptChanges();

                    DataRow[] result4 = dt.Select("[id] = '" + sChildID + "'");
                    for (int j = 0; j < result4.Length; j++)
                    {
                        dt.Rows.Remove(result4[j]);
                        dt.AcceptChanges();
                    }
                }

                DataRow[] result3 = dt.Select("[id] = '" + sParentID + "'");
                for (int j = 0; j < result3.Length; j++)
                {
                    dt.Rows.Remove(result3[j]);
                    dt.AcceptChanges();
                }

                DataRow[] result5 = dt.Select("[parent] = '" + ID + "'");
                for (int j = 0; j < result5.Length; j++)
                {
                    dt.Rows.Remove(result5[j]);
                    dt.AcceptChanges();
                }
            }
        }
        if (int.Parse(equipmentid) > 0)
        {
            if (equipmenttype == "1")
            {
                DataRow[] result = dt.Select("id = '" + equipmentid + "'");
                for (int j = 0; j < result.Length; j++)
                {
                    dt.Rows.Remove(result[j]);
                    dt.AcceptChanges();
                }
                DataRow[] result2 = dt.Select("[parent] = '" + equipmentid + "'");
                for (int i = 0; i < result2.Length; i++)
                {
                    dt.Rows.Remove(result2[i]);
                    dt.AcceptChanges();
                }
            }
            else
            {
                int       ParentID = 0;
                DataRow[] result   = dt.Select("id = '" + equipmentid + "'");
                for (int j = 0; j < result.Length; j++)
                {
                    ParentID = int.Parse(Convert.ToString(result[j]["parent"]));
                    dt.Rows.Remove(result[j]);
                    dt.AcceptChanges();
                }
                DataRow[] result2 = dt.Select("[id] = '" + ParentID + "'");
                for (int i = 0; i < result2.Length; i++)
                {
                    dt.Rows.Remove(result2[i]);
                    dt.AcceptChanges();
                }
                DataRow[] result3 = dt.Select("[parent] = '" + ParentID + "'");
                for (int i = 0; i < result3.Length; i++)
                {
                    dt.Rows.Remove(result3[i]);
                    dt.AcceptChanges();
                }
            }
        }
        return(ConvertDataTabletoJsonData(dt));
    }
Ejemplo n.º 27
0
    /// <summary>
    /// Binding machinery info
    /// </summary>
    /// <param name="search">search keyword</param>
    /// <param name="systemcode">System Id</param>
    /// <param name="systemdesc">description</param>
    /// <param name="systemdesc_FilterType"></param>
    /// <param name="deptType"></param>
    /// <param name="Dept">department</param>
    /// <param name="fleetcode">fleetcode</param>
    /// <param name="ddlvessel">vessel</param>
    /// <param name="maker">maker</param>
    /// <param name="Function">fuction name</param>
    /// <param name="Location">location</param>
    /// <param name="maker_FilterType"></param>
    /// <param name="IsActive">Active status</param>
    /// <param name="sortby">sort by</param>
    /// <param name="sortdirection">sort direction</param>
    /// <param name="pagenumber">pagenumber</param>
    /// <param name="pagesize">return page size</param>
    /// <param name="isfetchcount">fetch count</param>
    /// <returns></returns>
    public void BindMachineryInfo()
    {
        try
        {
            BLL_PMS_Library_Jobs objJob = new BLL_PMS_Library_Jobs();
            int rowcount = ucCustomPagerItems.isCountRecord;



            int?isactivestatus = null;
            if (optdisplayRecordType.SelectedValue != "2")
            {
                isactivestatus = Convert.ToInt32(optdisplayRecordType.SelectedValue);
            }

            string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            int?   sortdirection = null; if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }

            //string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString());
            // int? sortdirection = null;
            if (ViewState["SORTDIRECTION"] != null)
            {
                sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString());
            }


            DataSet ds = objJob.LibraryMachineryInforSearch(txtsearchtext.Text != "" ? txtsearchtext.Text : null, null, null, null
                                                            , "SP", UDFLib.ConvertIntegerToNull(cmbDept.SelectedValue), UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue)
                                                            , null, UDFLib.ConvertIntegerToNull(cmb_Function.SelectedValue), UDFLib.ConvertIntegerToNull(ddllocation.SelectedValue), null
                                                            , isactivestatus
                                                            , sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);


            if (ucCustomPagerItems.isCountRecord == 1)
            {
                ucCustomPagerItems.CountTotalRec = rowcount.ToString();
                ucCustomPagerItems.BuildPager();
            }
            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    gvCatalogue.DataSource = ds.Tables[0];
                    gvCatalogue.DataBind();

                    ViewState["ExportData"] = ds.Tables[0];
                }
                else
                {
                    gvCatalogue.DataSource = ds.Tables[0];
                    gvCatalogue.DataBind();
                    ViewState["ExportData"] = null;
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Ejemplo n.º 28
0
    protected void btnDivApprove_Click(object sender, EventArgs e)
    {
        try
        {
            BLL_PMS_Change_Request objChangeRqst = new BLL_PMS_Change_Request();
            BLL_PMS_Library_Jobs   objJobs       = new BLL_PMS_Library_Jobs();

            int?function = null;
            if (ddlFunction.SelectedValue != "")
            {
                function = Convert.ToInt32(ddlFunction.SelectedValue);
            }
            StringBuilder cr_actual_values = new StringBuilder();


            if ((string)ViewState["REQUEST_FOR"] == "ADDNEW")
            {
                string systemcode = "";

                objChangeRqst.TecMachineryChangeRequestSave(Convert.ToInt32(Session["userid"].ToString())
                                                            , Convert.ToInt32(Request.QueryString["Change_Reqst_ID"]), txtCrRemark.Text, txtCrName.Text, txtCrParticular.Text, UDFLib.ConvertStringToNull(ddlCatalogMaker.SelectedValue)
                                                            , txtCrSetsInstalled.Text, txtCrModel.Text, UDFLib.ConvertStringToNull(ddlCrDepartment.SelectedValue)
                                                            , function
                                                            , UDFLib.ConvertIntegerToNull(ddlAccountCode.SelectedValue), UDFLib.ConvertIntegerToNull(Request.QueryString["VESSELID"].ToString()), txtCrSerialNo.Text, ref systemcode);
            }

            if ((string)ViewState["REQUEST_FOR"] == "DELETE")
            {
                objChangeRqst.TecMachineryChangeRequestDelete(Convert.ToInt32(Session["userid"].ToString())
                                                              , Convert.ToInt32(Request.QueryString["Change_Reqst_ID"].ToString()), txtCrRemark.Text, Convert.ToInt32(Request.QueryString["VESSELID"].ToString()), Convert.ToInt32(ViewState["System_ID"].ToString()));
            }

            if ((string)ViewState["REQUEST_FOR"] == "EDIT")
            {
                cr_actual_values.Append("Machinery Name : ");
                cr_actual_values.Append(txtCrName.Text);
                cr_actual_values.AppendLine();
                cr_actual_values.Append("Maker :");
                cr_actual_values.Append(ddlMaker.SelectedValue != "0" ? ddlMaker.SelectedItem.Text : "");
                cr_actual_values.AppendLine();
                cr_actual_values.Append("Set Installed :");
                cr_actual_values.Append(txtSetsInstalled.Text);
                cr_actual_values.AppendLine();

                cr_actual_values.Append("Department :");/* This store actual department before changing */
                cr_actual_values.Append(ddlDepartment.SelectedValue != "0" ? ddlDepartment.SelectedItem.Text : "");
                cr_actual_values.AppendLine();

                cr_actual_values.Append("Model :");
                cr_actual_values.Append(txtCrModel.Text);
                cr_actual_values.AppendLine();
                cr_actual_values.Append("Particular :");
                cr_actual_values.Append(txtCrParticular.Text);
                cr_actual_values.Append("Actioned Remark  :");
                cr_actual_values.Append(txtCrRemark.Text);

                /* parameter "dept" is added to "TecMachineryChangeRequestUpdate" function By Someshwar On 09-06-2016   */
                objChangeRqst.TecMachineryChangeRequestUpdate(Convert.ToInt32(Session["userid"].ToString())
                                                              , Convert.ToInt32(Request.QueryString["Change_Reqst_ID"].ToString()), txtCrRemark.Text, Convert.ToInt32(ViewState["System_ID"].ToString()), txtCrName.Text, txtCrParticular.Text
                                                              , txtCrSetsInstalled.Text, txtCrModel.Text, UDFLib.ConvertIntegerToNull(Request.QueryString["VESSELID"].ToString()), ddlCrDepartment.SelectedValue, cr_actual_values.ToString());
            }


            String Mscript = String.Format("alert('Change Request has been Approved.');javascript:parent.ReloadParent_ByButtonID();");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Mscript", Mscript, true);
        }
        catch (Exception ex)
        {
            String ErrScr1 = String.Format("alert(" + ex.Message.ToString() + ");");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ErrScr1", ErrScr1, true);
        }
    }
    /// <summary>
    /// For binding Function, SystemLocation & SubSystemLoaction
    /// </summary>
    /// <param name="jobid">Job Id </param>
    /// <param name="JobHistoryID">Job History ID</param>
    /// <param name="QueryFlag">QueryFlag </param>
    /// <param name="SysLocID">System location Id</param>
    /// <param name="SubSysLocID">Sub system location Id</param>
    /// <returns></returns>
    private void BindJobIndividualDetails()
    {
        try
        {
            BLL_PMS_Library_Jobs objJobs = new BLL_PMS_Library_Jobs();
            DataSet ds = objJobs.LibraryJobIndividualDetails(Convert.ToInt32(Request.QueryString["JobID"].ToString()), UDFLib.ConvertIntegerToNull(Request.QueryString["JobHistoryID"].ToString()), Request.QueryString["Qflag"].ToString(), Convert.ToInt32(Request.QueryString["System_ID"].ToString().Split(',')[0]), Convert.ToInt32(Request.QueryString["SubSystem_ID"].ToString().Split(',')[0]));

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DataRow dr = ds.Tables[0].Rows[0];

                    txtJobCode.Text = dr["JobCode"].ToString();
                    txtVessel.Text  = dr["Vessel_Name"].ToString();
                    // txtMachinery.Text = dr["Machinery"].ToString();

                    txtFun.Text            = dr["FunctionName"].ToString();
                    txtLocation.Text       = dr["Location"].ToString();
                    txtSubsystemLoc.Text   = dr["SubSysLocation"].ToString();
                    txtJobTitle.Text       = dr["Job_Title"].ToString();
                    txtJobDescription.Text = dr["Job_Description"].ToString();
                    txtDepartment.Text     = dr["DepartmentName"].ToString();
                    txtRank.Text           = dr["RankShortName"].ToString();
                    txtcms.Text            = dr["CMS"].ToString();

                    if (dr["CMS"].ToString() == "Y")
                    {
                        txtcms.BackColor = System.Drawing.Color.RosyBrown;
                    }

                    if (dr["CRITICAL"].ToString() == "Y")
                    {
                        txtCritical.BackColor = System.Drawing.Color.RosyBrown;
                    }


                    txtCritical.Text      = dr["CRITICAL"].ToString();
                    txtFrequencyName.Text = dr["FrequencyName"].ToString();
                    txtFrequencyType.Text = dr["Frequency"].ToString();
                }
            }
            if (ds != null)
            {
                if (ds.Tables[1].Rows.Count > 0)
                {
                    DataRow dr = ds.Tables[1].Rows[0];
                    txtLocation.Text          = dr["Location"].ToString();
                    txtSubsystemLoc.Text      = dr["SubSysLocation"].ToString();
                    txtDateOriginallyDue.Text = dr["DateOriginallyDue"].ToString();
                    txtDateNextDue.Text       = dr["DateNextDue"].ToString();
                    txtDateJobDone.Text       = dr["DateJobDone"].ToString();
                    txtRhrsWhenJobDone.Text   = dr["RhrsWhenJobDone"].ToString();
                    txtJobRemark.Text         = dr["History"].ToString();

                    lbnCreatedBy.Text         = dr["Created_By_Name"].ToString();
                    txtCreatedOn.Text         = dr["Created_On"].ToString();
                    lbnVerifiedBy.Text        = dr["Verified_By_Name"].ToString();
                    txtVerifiedOn.Text        = dr["Verified_On"].ToString();
                    ViewState["CreatedByID"]  = dr["CreatedByID"].ToString();
                    ViewState["VerifiedByID"] = dr["VerifierID"].ToString();

                    lbnRequisition.Text = dr["REQUISITION_CODE"].ToString();

                    ViewState["DOCUMENT_CODE"]    = dr["DOCUMENT_CODE"].ToString();
                    ViewState["REQUISITION_CODE"] = dr["REQUISITION_CODE"].ToString();
                    ViewState["DEPARTMENT"]       = dr["DEPARTMENT"].ToString();
                }
            }

            tdg.Visible = false;

            if (ds != null)
            {
                if (ds.Tables[2].Rows.Count > 0)
                {
                    DataView dvImage = ds.Tables[2].DefaultView;
                    dvImage.RowFilter = "Is_Image='1' ";

                    ListView1.DataSource = dvImage;
                    ListView1.DataBind();
                    ListView2.DataSource = dvImage;
                    ListView2.DataBind();
                    hidenTotalrecords.Value = dvImage.Count.ToString();
                    HCurrentIndex.Value     = "0";
                    if (dvImage.Count == 0)
                    {
                        tdg.Visible = false;
                    }
                    else
                    {
                        tdg.Visible = true;
                    }

                    ds.Tables[2].DefaultView.RowFilter = "Is_Image='0'  ";
                    rptDrillImages.DataSource          = ds.Tables[2].DefaultView;
                    rptDrillImages.DataBind();
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Ejemplo n.º 30
0
    public void btnDivSave_click(object sender, EventArgs e)
    {
        Boolean blnRecSel = false;

        DataTable dt = new DataTable();

        dt.Columns.Add("LocationID");
        dt.Columns.Add("LocationName");

        string System_ID = (ViewState["System_ID"] == null) ? null : (ViewState["System_ID"].ToString());



        foreach (GridViewRow gr in gvLocation.Rows)
        {
            CheckBox chkAssignLoc = (CheckBox)gr.FindControl("chkDivAssingLoc");

            if (chkAssignLoc.Checked == true && chkAssignLoc.Enabled == true)
            {
                blnRecSel = true;
                string Locationcode = ((Label)gr.FindControl("lblDivLocationCode")).Text;
                string LocationName = ((Label)gr.FindControl("lblDivLocationName")).Text;

                if (!string.IsNullOrEmpty(System_ID)) // When Change request is in (update or delete Mode)
                {
                    string Category_Code = ((CheckBox)gr.FindControl("chkIsSpare")).Checked ? "SP" : "AC";

                    BLL_PMS_Library_Jobs objJobs = new BLL_PMS_Library_Jobs();
                    int retval = objJobs.LibraryCatalogueLocationAssignSave(Convert.ToInt32(Session["userid"].ToString())
                                                                            , System_ID, null, Convert.ToInt32(Locationcode), Convert.ToInt32(ViewState["Vessel_id"].ToString()), Category_Code);
                }
                else
                {
                    // When Change request is in  Add Mode
                    AddDataTempLocation(Locationcode, LocationName, dt);
                }
            }
        }

        if (!blnRecSel)
        {
            lblErrMsg.Text = "Please select location/s to assign";
            string AssginLocmodal = String.Format("showModal('divAddLocation',false);");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "ApprmodalUser", AssginLocmodal, true);
        }
        else
        {
            lblErrMsg.Text = "";
            string AssginLocmodalHide = String.Format("hideModal('divAddLocation');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "", AssginLocmodalHide, true);
        }

        if (!string.IsNullOrEmpty(System_ID))
        {
            BindCatalogueList(System_ID);
        }
        else
        {
            //lstcatalogLocation.DataSource = (DataTable)ViewState["TempDtLocation"];
            //lstcatalogLocation.DataTextField = "LocationName";
            //lstcatalogLocation.DataValueField = "LocationID";
            //lstcatalogLocation.DataBind();
        }


        updCatalogue.Update();
    }