Beispiel #1
0
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;
            BLL_PMS_Change_Request objChangeRqst = new BLL_PMS_Change_Request();

            int?vesselcode = null;
            if (ViewState["VesselCode"] != null && (string)ViewState["VesselCode"] != "0")
            {
                vesselcode = Convert.ToInt32(ViewState["VesselCode"].ToString());
            }

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

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

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

            int?status = null;

            if (optStatus.SelectedValue == "ALL")
            {
                ViewState["Status"] = -1;
            }
            else if (optStatus.SelectedValue == "P")
            {
                ViewState["Status"] = null;
            }
            else if (optStatus.SelectedValue == "A")
            {
                ViewState["Status"] = 1;
            }
            else if (optStatus.SelectedValue == "R")
            {
                ViewState["Status"] = 0;
            }


            DataSet ds = objChangeRqst.TecMachineryChangeRequestSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue)
                                                                       , txtSearchSystem.Text.Trim() != "" ? txtSearchSystem.Text : null, status, null, null, null, null, sortbycoloumn, sortdirection, null, null, ref rowcount);


            string[] HeaderCaptions  = { "ID", "Vessel", "Machinery", "Maker", "Sets", "Model", "CR Machinery", "CR Maker", "CR Sets", "CR Model", "Status", "Actioned By", "Actioned On" };
            string[] DataColumnsName = { "ID", "Vessel_Name", "System_Description", "Maker", "Set_Installed", "Model", "CR_System_Description", "CR_Maker", "CR_Set_Installed", "CR_Model", "Status", "ACTIONEDBY", "CR_Actioned_On" };

            GridViewExportUtil.ShowExcel(ds.Tables[0], HeaderCaptions, DataColumnsName, "MachineryChangeRequest", "Machinery Change Request", HtmlFilterTable());
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
            string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true);
        }
    }
    protected void btnDivReject_Click(object sender, EventArgs e)
    {
        BLL_PMS_Change_Request objChangeRqst = new BLL_PMS_Change_Request();

        objChangeRqst.TecJobChangeRequestReject(Convert.ToInt32(Session["userid"].ToString()), Convert.ToInt32(Request.QueryString["Change_Reqst_ID"].ToString()), txtCRActionedRemarks.Text, Convert.ToInt32(Request.QueryString["VESSELID"].ToString()));

        String script = String.Format("alert('Change Request has been Rejected.');javascript:parent.ReloadParent_ByButtonID();");

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", script, true);
    }
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            BLL_PMS_Change_Request objChangeRqst = new BLL_PMS_Change_Request();

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

            int?status = null;
            if (optStatus.SelectedValue == "P")
            {
                status = 2;
            }
            else if (optStatus.SelectedValue == "A")
            {
                status = 1;
            }
            else if (optStatus.SelectedValue == "R")
            {
                status = 0;
            }


            DataSet ds = objChangeRqst.TecJobChangeRequestSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue), txtSearch.Text.Trim() != "" ? txtSearch.Text : null, status,
                                                                 UDFLib.ConvertIntegerToNull(ddlSystem.SelectedValue), UDFLib.ConvertIntegerToNull(ddlSubSystem.SelectedValue), UDFLib.ConvertIntegerToNull(ddlDepartment.SelectedValue)
                                                                 , UDFLib.ConvertIntegerToNull(ddlRank.SelectedValue), null, null, UDFLib.ConvertDateToNull(txtFromDate.Text.Trim()), UDFLib.ConvertDateToNull(txtToDate.Text.Trim())
                                                                 , sortbycoloumn, sortdirection, null, null, ref rowcount);

            string[] HeaderCaptions  = { "ID", "Vessel", "System", "Sub System", "Job Title", "Freq.", "Freq.Name", "Department", "Rank", "CMS", "CRITICAL", "CR Job Title", "CR Freq.", "CR Freq.Name", "CR Department", "CR Rank", "CR CMS", "CR CRITICAL", "Status", "Actioned By", "Actioned On" };
            string[] DataColumnsName = { "ID", "Vessel_Name", "System_Description", "Subsystem_Description", "JOB_TITLE", "FREQUENCY", "Frequency_Name", "Department", "RankName", "CMS", "CRITICAL", "CR_JOB_TITLE", "CR_FREQUENCY", "CR_Frequency_Name", "CR_Department", "CR_RankName", "CR_CMS", "CR_CRITICAL", "STATUS", "ACTIONEDBY", "CR_Actioned_On" };

            GridViewExportUtil.ShowExcel(ds.Tables[0], HeaderCaptions, DataColumnsName, "JOBChangeRequest", "JOB Change Request");
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
            string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true);
        }
    }
Beispiel #4
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);
        }
    }
Beispiel #5
0
    public void BindMachineryChangeRequestsList()
    {
        BLL_PMS_Change_Request objChangeRqst = new BLL_PMS_Change_Request();

        DataSet ds = objChangeRqst.TecMachineryChangeRequestList(UDFLib.ConvertIntegerToNull(Request.QueryString["Change_Reqst_ID"]), UDFLib.ConvertIntegerToNull(Request.QueryString["VESSELID"].ToString()));

        if (ds.Tables[0].Rows.Count > 0)
        {
            //Make a default font colour black.

            txtCrName.ForeColor          = System.Drawing.Color.Black;
            txtCrParticular.ForeColor    = System.Drawing.Color.Black;
            txtCrModel.ForeColor         = System.Drawing.Color.Black;
            txtCrSetsInstalled.ForeColor = System.Drawing.Color.Black;
            txtCrMakerDetials.ForeColor  = System.Drawing.Color.Black;
            txtCrReason.ForeColor        = System.Drawing.Color.Black;


            DataRow dr = ds.Tables[0].Rows[0];



            if (dr["System_ID"].ToString() != "")
            {
                ViewState["System_ID"] = dr["System_ID"].ToString();
            }

            ViewState["REQUEST_FOR"] = dr["REQUEST_FOR"].ToString();


            ViewState["CR_Actual"] = dr["CR_Actual"].ToString();

            txtName.Text         = dr["System_Description"].ToString();
            txtCrName.Text       = dr["CR_System_Description"].ToString();
            txtParticular.Text   = dr["System_Particulars"].ToString();
            txtCrParticular.Text = dr["CR_System_Particulars"].ToString();

            txtModel.Text   = dr["Model"].ToString();
            txtCrModel.Text = dr["CR_Model"].ToString();

            txtSetsInstalled.Text   = dr["Set_Installed"].ToString();
            txtCrSetsInstalled.Text = dr["CR_Set_Installed"].ToString();

            txtCrMakerDetials.Text = dr["CR_Maker"].ToString();
            txtCrReason.Text       = dr["CR_Reason"].ToString();
            txtCrRemark.Text       = dr["CR_Remarked_Actioned"].ToString();
            lblActionedBy.Text     = dr["ACTIONEDBY"].ToString();
            lblRequestedBy.Text    = dr["REQUESTBY"].ToString();
            hdfAddNewFlag.Value    = dr["REQUEST_FOR"].ToString();

            ddlCatalogMaker.SelectedValue = dr["Maker_Code"].ToString();

            txtCrSerialNo.Text = dr["CR_Serial_Number"].ToString();


            ddlCrDepartment.SelectedValue = dr["CR_Dept1"].ToString();
            txtCrDepartChangeRemark.Text  = dr["CR_Dept1_Change_Reason"].ToString();



            if (dr["System_ID"].ToString() != "")
            {
                BindCatalogueList(ViewState["System_ID"].ToString());
            }

            if (dr["DiffSysDescFlag"].ToString() == "N")
            {
                txtName.ForeColor   = System.Drawing.Color.Blue;
                txtCrName.ForeColor = System.Drawing.Color.Blue;
            }

            if (dr["DiffSysPartFlag"].ToString() == "N")
            {
                txtParticular.ForeColor   = System.Drawing.Color.Blue;
                txtCrParticular.ForeColor = System.Drawing.Color.Blue;
            }

            if (dr["DiffSetInstalledFlag"].ToString() == "N")
            {
                txtSetsInstalled.ForeColor   = System.Drawing.Color.Blue;
                txtCrSetsInstalled.ForeColor = System.Drawing.Color.Blue;
            }

            if (dr["DiffModelFlag"].ToString() == "N")
            {
                txtModel.ForeColor   = System.Drawing.Color.Blue;
                txtCrModel.ForeColor = System.Drawing.Color.Blue;
            }

            if (dr["REQUEST_FOR"].ToString() == "ADDNEW")
            {
                txtCrName.ForeColor          = System.Drawing.Color.Red;
                txtCrParticular.ForeColor    = System.Drawing.Color.Red;
                txtCrModel.ForeColor         = System.Drawing.Color.Red;
                txtCrSetsInstalled.ForeColor = System.Drawing.Color.Red;
                txtCrMakerDetials.ForeColor  = System.Drawing.Color.Red;
                txtCrReason.ForeColor        = System.Drawing.Color.Red;
            }


            if (Request.QueryString["Status"].ToString().ToUpper() == "PENDING" || Request.QueryString["Status"].ToString() == "")
            {
                btnDivApprove.Enabled       = true;
                btnDivReject.Enabled        = true;
                txtCrName.ReadOnly          = false;
                txtCrParticular.ReadOnly    = false;
                txtCrModel.ReadOnly         = false;
                txtCrSetsInstalled.ReadOnly = false;

                txtCrReason.ReadOnly = false;
                txtCrRemark.ReadOnly = false;
            }
            else
            {
                btnDivApprove.Enabled = false;
                btnDivReject.Enabled  = false;

                txtCrName.ReadOnly          = true;
                txtCrParticular.ReadOnly    = true;
                txtCrModel.ReadOnly         = true;
                txtCrSetsInstalled.ReadOnly = true;

                txtCrReason.ReadOnly = true;
                txtCrRemark.ReadOnly = true;

                ddlCatalogMaker.SelectedItem.Text = txtCrMakerDetials.Text;
            }
        }
    }
Beispiel #6
0
    /// <summary>
    /// To fill details of machinaery change request to grid view
    /// </summary>
    public void BindMachineryChageRequests()
    {
        BLL_PMS_Change_Request objChangeRqst = new BLL_PMS_Change_Request();

        int rowcount = ucCustomPagerItems.isCountRecord;


        int?vesselcode = null;

        if (ViewState["VesselCode"] != null && (string)ViewState["VesselCode"] != "0")
        {
            vesselcode = Convert.ToInt32(ViewState["VesselCode"].ToString());
        }


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

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

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


        int?status = null;


        if (optStatus.SelectedValue == "P")
        {
            status = 2;
        }
        else if (optStatus.SelectedValue == "A")
        {
            status = 1;
        }
        else if (optStatus.SelectedValue == "R")
        {
            status = 0;
        }

        DataSet ds = objChangeRqst.TecMachineryChangeRequestSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue)
                                                                   , txtSearchSystem.Text.Trim() != "" ? txtSearchSystem.Text : null, status, null, null, UDFLib.ConvertDateToNull(txtFromDate.Text), UDFLib.ConvertDateToNull(txtToDate.Text)
                                                                   , 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)
        {
            gvMachinery.DataSource = ds.Tables[0];
            gvMachinery.DataBind();
        }
        else
        {
            gvMachinery.DataSource = ds.Tables[0];
            gvMachinery.DataBind();
        }
    }
    /// <summary>
    /// Binding change request detail
    /// </summary>
    /// <param name="Fleet_ID"> fleet id</param>
    /// <param name="Vessel_ID">vessel</param>
    /// <param name="SearchText">search keyword</param>
    /// <param name="Status">Active status</param>
    /// <param name="SYSTEMID">System</param>
    /// <param name="SUBSYSTEMID">subsystem</param>
    /// <param name="DEPARTMENTID">department</param>
    /// <param name="RANKID">rank</param>
    public void BindGrid()
    {
        try
        {
            BLL_PMS_Change_Request objChangeRqst = new BLL_PMS_Change_Request();

            int rowcount = ucCustomPagerItems.isCountRecord;

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


            int?status = null;
            if (optStatus.SelectedValue == "P")
            {
                status = 2;
            }
            else if (optStatus.SelectedValue == "A")
            {
                status = 1;
            }
            else if (optStatus.SelectedValue == "R")
            {
                status = 0;
            }



            DataSet ds = objChangeRqst.TecJobChangeRequestSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue), txtSearch.Text.Trim() != "" ? txtSearch.Text : null, status,
                                                                 UDFLib.ConvertIntegerToNull(ddlSystem.SelectedValue), UDFLib.ConvertIntegerToNull(ddlSubSystem.SelectedValue), UDFLib.ConvertIntegerToNull(ddlDepartment.SelectedValue)
                                                                 , UDFLib.ConvertIntegerToNull(ddlRank.SelectedValue), null, null, UDFLib.ConvertDateToNull(txtFromDate.Text.Trim()), UDFLib.ConvertDateToNull(txtToDate.Text.Trim())
                                                                 , 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)
                {
                    gvJobChangeRqst.DataSource = ds.Tables[0];
                    gvJobChangeRqst.DataBind();
                }

                else
                {
                    gvJobChangeRqst.DataSource = ds.Tables[0];
                    gvJobChangeRqst.DataBind();
                }
            }
            UpdPnlGrid.Update();
            UpdPnlFilter.Update();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    public void BindJobChangeRequestsList()
    {
        BLL_PMS_Change_Request objChangeRqst = new BLL_PMS_Change_Request();
        DataSet ds = objChangeRqst.TecJobChangeRequestList(Convert.ToInt32(Request.QueryString["Change_Reqst_ID"].ToString()), Convert.ToInt32(Request.QueryString["VESSELID"].ToString()));

        if (ds.Tables[0].Rows.Count > 0)
        {
            //Make a default font colour black.
            txtCRJobtitle.ForeColor        = System.Drawing.Color.Black;
            txtCRjobDescription.ForeColor  = System.Drawing.Color.Black;
            txtCRFrequency.ForeColor       = System.Drawing.Color.Black;
            lstCRFrequency.ForeColor       = System.Drawing.Color.Black;
            optCRCMS.ForeColor             = System.Drawing.Color.Black;
            optCRCritical.ForeColor        = System.Drawing.Color.Black;
            lstDepartment.ForeColor        = System.Drawing.Color.Black;
            ddlCRRank.ForeColor            = System.Drawing.Color.Black;
            txtCRActionedRemarks.ForeColor = System.Drawing.Color.Black;
            txtCRChangeReason.ForeColor    = System.Drawing.Color.Black;


            DataRow dr = ds.Tables[0].Rows[0];

            ViewState["JOB_ID"]       = dr["JOB_ID"].ToString();
            ViewState["System_ID"]    = dr["System_ID"].ToString();
            ViewState["SubSystem_ID"] = dr["SubSystem_ID"].ToString();
            ViewState["REQUEST_FOR"]  = dr["REQUEST_FOR"].ToString();

            ViewState["CR_Actual"] = dr["CR_Actual"].ToString();

            if (dr["REQUEST_FOR"].ToString() == "ADDNEW")
            {
                lblRequestFor.Text = "Adding New Job";
            }
            else if (dr["REQUEST_FOR"].ToString() == "EDIT")
            {
                lblRequestFor.Text = "Editing Job";
            }
            else if (dr["REQUEST_FOR"].ToString() == "DELETE")
            {
                lblRequestFor.Text = "Delete this Job";
            }



            txtJobtitle.Text   = dr["JOB_TITLE"].ToString();
            txtCRJobtitle.Text = dr["CR_JOB_TITLE"].ToString();

            txtjobDescription.Text   = dr["JOB_DESCRIPTION"].ToString();
            txtCRjobDescription.Text = dr["CR_JOB_DESCRIPTION"].ToString();

            txtFrequency.Text   = dr["FREQUENCY"].ToString();
            txtCRFrequency.Text = dr["CR_FREQUENCY"].ToString();

            optCMS.SelectedValue   = dr["CMS"].ToString();
            optCRCMS.SelectedValue = dr["CR_CMS"].ToString();

            optCritical.Text   = dr["CRITICAL"].ToString();
            optCRCritical.Text = dr["CR_CRITICAL"].ToString();

            lstFrequency.SelectedValue   = dr["FREQUENCY_TYPE"].ToString();
            lstCRFrequency.SelectedValue = dr["CR_FREQUENCY_TYPE"].ToString();

            lstDepartment.SelectedValue   = dr["DEPARTMENT_ID"].ToString();
            lstCRDepartment.SelectedValue = dr["CR_DEPARTMENT_ID"].ToString();

            txtCRChangeReason.Text = dr["CR_Reason"].ToString();


            if ((dr["Rank_ID"].ToString() != "0") && (dr["Rank_ID"].ToString() != ""))
            {
                ddlRank.SelectedValue = dr["Rank_ID"].ToString();
            }
            if ((dr["CR_RANK_ID"].ToString() != "0") && (dr["CR_RANK_ID"].ToString() != ""))
            {
                ddlCRRank.SelectedValue = dr["CR_RANK_ID"].ToString();
            }

            txtCRActionedRemarks.Text = dr["CR_Remarked_Actioned"].ToString();
            lblActionedBy.Text        = dr["ACTIONEDBY"].ToString();
            lblRequestedBy.Text       = dr["REQUESTBY"].ToString();

            if (dr["JOB_ID"].ToString() != "")
            {
                BindJobList(Convert.ToInt32(ViewState["JOB_ID"].ToString()));
            }


            if (dr["REQUEST_FOR"].ToString() == "EDIT")
            {
                if (dr["DiffJobTitleFlag"].ToString() == "N")
                {
                    txtJobtitle.ForeColor   = System.Drawing.Color.Blue;
                    txtCRJobtitle.ForeColor = System.Drawing.Color.Blue;
                }

                if (dr["DiffJobDescFlag"].ToString() == "N")
                {
                    txtjobDescription.ForeColor   = System.Drawing.Color.Blue;
                    txtCRjobDescription.ForeColor = System.Drawing.Color.Blue;
                }

                if (dr["DiffFrequencyFlag"].ToString() == "N")
                {
                    txtFrequency.ForeColor   = System.Drawing.Color.Blue;
                    txtCRFrequency.ForeColor = System.Drawing.Color.Blue;
                }

                if (dr["DiffFreqTypeFlag"].ToString() == "N")
                {
                    lstFrequency.ForeColor   = System.Drawing.Color.Blue;
                    lstCRFrequency.ForeColor = System.Drawing.Color.Blue;
                }

                if (dr["DiffDeptFlag"].ToString() == "N")
                {
                    lstDepartment.ForeColor   = System.Drawing.Color.Blue;
                    lstCRDepartment.ForeColor = System.Drawing.Color.Blue;
                }

                if (dr["DiffRankFlag"].ToString() == "N")
                {
                    ddlRank.ForeColor   = System.Drawing.Color.Blue;
                    ddlCRRank.ForeColor = System.Drawing.Color.Blue;
                }

                if (dr["DiffCmsFlag"].ToString() == "N")
                {
                    optCMS.ForeColor   = System.Drawing.Color.Blue;
                    optCRCMS.ForeColor = System.Drawing.Color.Blue;
                }

                if (dr["DiffCriticalFlag"].ToString() == "N")
                {
                    optCritical.ForeColor   = System.Drawing.Color.Blue;
                    optCRCritical.ForeColor = System.Drawing.Color.Blue;
                }
            }


            if (Request.QueryString["Status"].ToString() == "PENDING" || Request.QueryString["Status"].ToString() == "")
            {
                btnDivApprove.Enabled = true;
                btnDivReject.Enabled  = true;

                txtCRJobtitle.ReadOnly        = false;
                txtCRjobDescription.ReadOnly  = false;
                txtCRFrequency.ReadOnly       = false;
                txtCRActionedRemarks.ReadOnly = false;
            }
            else
            {
                btnDivApprove.Enabled = false;
                btnDivReject.Enabled  = false;

                txtCRJobtitle.ReadOnly        = true;
                txtCRjobDescription.ReadOnly  = true;
                txtCRFrequency.ReadOnly       = true;
                txtCRActionedRemarks.ReadOnly = true;
            }
        }
    }
    protected void btnDivApprove_Click(object sender, EventArgs e)
    {
        BLL_PMS_Change_Request objChangeRqst    = new BLL_PMS_Change_Request();
        StringBuilder          cr_actual_values = new StringBuilder();


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

            objChangeRqst.TecJobChangeRequestSave(Convert.ToInt32(Session["userid"].ToString())
                                                  , Convert.ToInt32(Request.QueryString["Change_Reqst_ID"].ToString()), txtCRActionedRemarks.Text, Convert.ToInt32(ViewState["System_ID"].ToString())
                                                  , Convert.ToInt32(ViewState["SubSystem_ID"].ToString())
                                                  , Convert.ToInt32(Request.QueryString["VESSELID"].ToString()), UDFLib.ConvertIntegerToNull(lstCRDepartment.SelectedValue)
                                                  , UDFLib.ConvertIntegerToNull(ddlCRRank.SelectedValue), txtCRJobtitle.Text, txtCRjobDescription.Text, Convert.ToInt32(txtCRFrequency.Text)
                                                  , Convert.ToInt32(lstCRFrequency.SelectedValue.ToString())
                                                  , Convert.ToInt32(optCRCMS.SelectedValue), Convert.ToInt32(optCRCritical.SelectedValue), ref Jobid);
        }

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

        if ((string)ViewState["REQUEST_FOR"] == "EDIT")
        {
            cr_actual_values.Append("Job Title : ");
            cr_actual_values.Append(txtCRJobtitle.Text);
            cr_actual_values.AppendLine();
            cr_actual_values.Append("Job Description :");
            cr_actual_values.Append(txtCRjobDescription.Text);
            cr_actual_values.AppendLine();
            cr_actual_values.Append("Frequency :");
            cr_actual_values.Append(txtCRFrequency.Text);
            cr_actual_values.AppendLine();
            cr_actual_values.Append("Frequency Type :");
            cr_actual_values.Append(lstCRFrequency.SelectedItem.Text);
            cr_actual_values.AppendLine();
            cr_actual_values.Append("CMS :");
            cr_actual_values.Append(optCRCMS.SelectedValue == "0" ? "N" : "Y");
            cr_actual_values.AppendLine();
            cr_actual_values.Append("CRITICAL:");
            cr_actual_values.Append(optCRCritical.SelectedValue == "0" ? "N" : "Y");
            cr_actual_values.AppendLine();
            cr_actual_values.Append("Department:");
            cr_actual_values.Append(lstCRDepartment.SelectedItem.Text);
            cr_actual_values.AppendLine();
            cr_actual_values.Append("Rank:");
            cr_actual_values.Append(ddlCRRank.SelectedItem.Text);
            cr_actual_values.AppendLine();
            cr_actual_values.Append("Change Reason:");
            cr_actual_values.Append(txtCRChangeReason.Text);
            cr_actual_values.AppendLine();
            cr_actual_values.Append("Action Remarks:");
            cr_actual_values.Append(txtCRActionedRemarks.Text);
            cr_actual_values.AppendLine();



            objChangeRqst.TecJobChangeRequestUpdate(Convert.ToInt32(Session["userid"].ToString()), Convert.ToInt32(Request.QueryString["Change_Reqst_ID"].ToString())
                                                    , txtCRActionedRemarks.Text, Convert.ToInt32(ViewState["JOB_ID"].ToString())
                                                    , Convert.ToInt32(Request.QueryString["VESSELID"].ToString()), UDFLib.ConvertIntegerToNull(lstCRDepartment.SelectedValue)
                                                    , UDFLib.ConvertIntegerToNull(ddlCRRank.SelectedValue), txtCRJobtitle.Text, txtCRjobDescription.Text, Convert.ToInt32(txtCRFrequency.Text)
                                                    , Convert.ToInt32(lstCRFrequency.SelectedValue.ToString())
                                                    , Convert.ToInt32(optCRCMS.SelectedValue), Convert.ToInt32(optCRCritical.SelectedValue), cr_actual_values.ToString());
        }


        String script = String.Format("alert('Change Request has been Approved.');javascript:parent.ReloadParent_ByButtonID();");

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