protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ManageCookie mgCookie = new ManageCookie();
            users        ck       = mgCookie.ReadCookies();

            if (ck != null)
            {
                String strPJid = ck.pj_id;

                StringBuilder strSQL = new StringBuilder();
                strSQL.Append("select d.d_code, d.d_name, m.mi_code, m.mi_name, p.pj_code, p.d_id, p.pj_name, y.yut_name, p.pj_year, p.pj_budget, pj_integrateProject, pj_relateDept, pj_background, pj_urgency, pj_type, pj_complete_status ");
                strSQL.Append(" from projects p, department d, ministry m, yutasad y");
                strSQL.Append(" where p.d_id = d.d_id and p.mi_id = m.mi_id and p.pj_yut_id = y.yut_id and p.pj_id = '" + strPJid + "'");

                SqlDataSource4.SelectCommand = strSQL.ToString();
                SqlDataSource4.DataBind();

                DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

                foreach (DataRow dRow in dv1.Table.Rows)
                {
                    lblDeptCode.Text     = dRow["mi_code"].ToString();
                    lblDeptName.Text     = dRow["mi_name"].ToString();
                    lblDivisionCode.Text = dRow["d_code"].ToString();
                    lblDivisionName.Text = dRow["d_name"].ToString();
                    lblProjectName.Text  = dRow["pj_name"].ToString();
                    lblProjectCode.Text  = dRow["pj_code"].ToString();
                    lblYutasard.Text     = dRow["yut_name"].ToString();
                    //lblIntegrateProject.Text = dRow["pj_integrateProject"].ToString();
                    //lblRelateDept.Text = dRow["pj_relateDept"].ToString();
                    lblBudget.Text = dRow["pj_budget"].ToString();
                    lblYear.Text   = dRow["pj_year"].ToString();
                }

                gUtilities gt = new gUtilities();
                litRisk1.Text = gt.getReportTammaTotal(ck.pj_id);
                litRisk2.Text = gt.getReportFactorRiskTotal(ck.pj_id);
                // litRisk12.Text = gt.getReportTammaMainTotal(ck.pj_id);
                // litRisk13.Text = gt.getReportTammaSubTotal(ck.pj_id);

                if (dv1.Table.Rows[0]["pj_complete_status"].ToString() == null)
                {
                    Response.Redirect("project_summary.aspx");
                }
            }
            else
            {
                //redirect
                Response.Redirect("project_summary.aspx");
            }
        }
    }
 protected void dgProject_OnRowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         gUtilities gt = new gUtilities();
         //litRisk2.Text = gt.getReportFactorRiskTotal(ck.pj_id);
         //double dbTotal = gutil.getReportQSETTotal(ck.p_id);
         string strpj_id = dgProject.DataKeys[e.Row.RowIndex].Value.ToString();
         e.Row.Cells[4].Text = gt.getReportTammaTotal(strpj_id);
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        ton.tonUtilities.pageaAuthorize(ton.config.Global_config.authtext_budgetor, ton.config.Global_config.warning_text);

        ManageCookie mgCookie = new ManageCookie();
        users        ck       = mgCookie.ReadCookies();

        if (!Page.IsPostBack)
        {
            if (ck != null)
            {
                // Copy from ProjectSummary.aspx which created by Narut
                sds_project_summary.SelectParameters["pj_id"].DefaultValue = ck.pj_id;

                DataView dv1 = (DataView)sds_project_summary.Select(DataSourceSelectArguments.Empty);

                foreach (DataRow dRow in dv1.Table.Rows)
                {
                    lblDeptCode.Text               = dRow["mi_code"].ToString();
                    lblDeptName.Text               = dRow["mi_name"].ToString();
                    lblDivisionCode.Text           = dRow["d_code"].ToString();
                    lblDivisionName.Text           = dRow["d_name"].ToString();
                    lblProjectName.Text            = dRow["pj_name"].ToString();
                    lblProjectCode.Text            = dRow["pj_code"].ToString();
                    lblYutasard.Text               = dRow["yut_name"].ToString();
                    lblIntegrateProject.Text       = dRow["pj_integrateProject"].ToString();
                    lblRelateDept.Text             = dRow["pj_relateDept"].ToString();
                    lblBudget.Text                 = dRow["pj_budget"].ToString();
                    lblYear.Text                   = dRow["pj_year"].ToString();
                    lit_approval.Text              = dRow["pj_approval_status"].ToString();
                    lbl_pj_doc_no.Text             = dRow["pj_doc_number"].ToString();
                    lbl_pj_date_doc_submitted.Text = dRow["pj_date_doc_submitted"].ToString().Substring(0, dRow["pj_date_doc_submitted"].ToString().IndexOf(" "));
                }

                // Show result in case its has value
                if (String.IsNullOrEmpty(lit_approval.Text))
                {
                    tbl_appr.Visible = false;
                    //btn_goto_step3.Enabled = true;
                }
                else
                {
                    tbl_appr.Visible = true;
                    //btn_goto_step3.Enabled = false;
                }

                gUtilities gt = new gUtilities();
                litRisk1.Text  = gt.getReportTammaTotal(ck.pj_id);
                litRisk2.Text  = gt.getReportFactorRiskTotal(ck.pj_id);
                litRisk12.Text = gt.getReportTammaMainTotal(ck.pj_id);
                litRisk13.Text = gt.getReportTammaSubTotal(ck.pj_id);
            }

            // Below is an OLD code------------------------------------------------------------------

            // This page only allow เจ้าหน้าที่สำนักงบประมาณ role=2
            //if ((ck == null) || string.IsNullOrEmpty(ck.pj_id) || (ck.p_role_id != "2"))
            if ((ck == null) || string.IsNullOrEmpty(ck.pj_id))
            {
                //ton.JavaScript.MessageBox(" โปรเจค ว่างเปล่า กรุณาเข้าสู่ระบบ ");
                Response.Redirect(ton.config.Global_config.RootURL);
            }

            sds_project_approve_comment.SelectParameters["pj_id"].DefaultValue = ck.pj_id;
            DataView dv2 = (DataView)sds_project_approve_comment.Select(DataSourceSelectArguments.Empty);

            // Double check for prevention of re-approval

            string appr_text = dv2[0]["pj_approval_status"].ToString();

            // Pre DisAble การให้ความคิดเห็นเพิ่มเติมของเจ้าหน้าที่จัดทำงบประมาณ
            pnl_L0.Enabled   = false;
            btn_save.Enabled = false;

            if (string.IsNullOrEmpty(appr_text))
            {
                pnl_L0.Enabled   = true;
                btn_save.Enabled = true;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ton.tonUtilities.pageaAuthorize(ton.config.Global_config.authtext_budgetor, ton.config.Global_config.warning_text);

        ManageCookie mgCookie = new ManageCookie();
        users        ck       = mgCookie.ReadCookies();

        if (ck != null)
        {
            // option 1 Call from Cookies
            sds_project_summary.SelectParameters["pj_id"].DefaultValue  = ck.pj_id;
            SqlDataSource1.SelectParameters["pj_id"].DefaultValue       = ck.pj_id;
            SqlDataSource2.SelectParameters["pj_id"].DefaultValue       = ck.pj_id;
            SqlDataSource3.SelectParameters["pj_id"].DefaultValue       = ck.pj_id;
            SqlDataSource4.SelectParameters["pj_id"].DefaultValue       = ck.pj_id;
            SqlDataSource5.SelectParameters["pj_id"].DefaultValue       = ck.pj_id;
            sds_factor_tamma.SelectParameters["pj_id"].DefaultValue     = ck.pj_id;
            sds_tamma_no_proceed.SelectParameters["pj_id"].DefaultValue = ck.pj_id;


            //// option 2 Call from Query String
            //// Option has problem with 128bit Encryption which contain '+' but URL.decode will replace '+' as ' '(space).
            //// The decoding process error will occur
            //// Solution: replace with 64 bit Enryption
            //string pj_id = Encryption.Decrypt(Request.QueryString["id"], ton.Encryption.keyword);
            //pj_id = tonUtilities.cleanQueryString(pj_id);
            //sds_project_summary.SelectParameters["pj_id"].DefaultValue = pj_id;
            //// End Option2

            // Copy from ProjectSummary.aspx which created by Narut

            DataView dv1 = (DataView)sds_project_summary.Select(DataSourceSelectArguments.Empty);

            foreach (DataRow dRow in dv1.Table.Rows)
            {
                lblDeptCode.Text               = dRow["mi_code"].ToString();
                lblDeptName.Text               = dRow["mi_name"].ToString();
                lblDivisionCode.Text           = dRow["d_code"].ToString();
                lblDivisionName.Text           = dRow["d_name"].ToString();
                lblProjectName.Text            = dRow["pj_name"].ToString();
                lblProjectCode.Text            = dRow["pj_code"].ToString();
                lblYutasard.Text               = dRow["yut_name"].ToString();
                lblIntegrateProject.Text       = dRow["pj_integrateProject"].ToString();
                lblRelateDept.Text             = dRow["pj_relateDept"].ToString();
                lblBudget.Text                 = dRow["pj_budget"].ToString();
                lblYear.Text                   = dRow["pj_year"].ToString();
                lit_approval.Text              = dRow["pj_approval_status"].ToString();
                lbl_pj_doc_no.Text             = dRow["pj_doc_number"].ToString();
                lbl_pj_date_doc_submitted.Text = dRow["pj_date_doc_submitted"].ToString().Substring(0, dRow["pj_date_doc_submitted"].ToString().IndexOf(" "));
            }

            // Show result in case its has value
            if ((lit_approval.Text == Global_config.pj_approval_status_value[1]) || string.IsNullOrEmpty(lit_approval.Text))
            {
                tbl_appr.Visible       = false;
                btn_goto_step3.Enabled = true;
            }
            else
            {
                tbl_appr.Visible       = true;
                btn_goto_step3.Enabled = false;
            }

            gUtilities gt = new gUtilities();
            litRisk1.Text  = gt.getReportTammaTotal(ck.pj_id);
            litRisk2.Text  = gt.getReportFactorRiskTotal(ck.pj_id);
            litRisk12.Text = gt.getReportTammaMainTotal(ck.pj_id);
            litRisk13.Text = gt.getReportTammaSubTotal(ck.pj_id);
        }
    }
示例#5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ManageCookie mgCookie = new ManageCookie();
            users        ck       = mgCookie.ReadCookies();

            if (ck != null)
            {
                String strPJid = Request.QueryString["pjid"];

                //Add by Itsada Jitchot 2014/04/30 เนื่องจากในการออกรายงานต้องการ pj_id ที่กดมาจากลิ้ง
                mgCookie.UpdateCookies("pj_id", strPJid);

                StringBuilder strSQL = new StringBuilder();
                strSQL.Append("select d.d_code, d.d_name, m.mi_code, m.mi_name, p.pj_code, p.d_id, p.pj_name, y.yut_name, p.pj_year, p.pj_budget, pj_integrateProject, pj_relateDept, pj_background, pj_urgency, pj_type, pj_complete_status ");
                strSQL.Append(" from projects p, department d, ministry m, yutasad y");
                strSQL.Append(" where p.d_id = d.d_id and p.mi_id = m.mi_id and p.pj_yut_id = y.yut_id and p.pj_id = '" + strPJid + "'");

                SqlDataSource4.SelectCommand = strSQL.ToString();
                SqlDataSource4.DataBind();

                DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

                foreach (DataRow dRow in dv1.Table.Rows)
                {
                    lblDeptCode.Text     = dRow["mi_code"].ToString();
                    lblDeptName.Text     = dRow["mi_name"].ToString();
                    lblDivisionCode.Text = dRow["d_code"].ToString();
                    lblDivisionName.Text = dRow["d_name"].ToString();
                    lblProjectName.Text  = dRow["pj_name"].ToString();
                    lblProjectCode.Text  = dRow["pj_code"].ToString();
                    lblYutasard.Text     = dRow["yut_name"].ToString();

                    lblBudget.Text = dRow["pj_budget"].ToString();
                    lblYear.Text   = dRow["pj_year"].ToString();
                }

                gUtilities gt = new gUtilities();


                if (dv1.Table.Rows[0]["pj_complete_status"].ToString() == "ไม่อยู่ในเกณฑ์การประเมิน/กรอกสมบูรณ์")
                {
                    linkreport2.Visible = false;
                    linkreport3.Visible = false;

                    litHeader.Text = " โครงการกรอกสมบูรณ์ที่ไม่อยู่ในข่ายที่ต้องวิเคราะห์ความเสี่ยง";

                    litRisk1.Text = "-";
                    litRisk2.Text = "-";
                }
                else
                {
                    linkreport2.Visible = true;
                    linkreport3.Visible = true;

                    litHeader.Text = "โครงการที่เข้าข่ายการวิเคราะห์ความเสี่ยงตามหลักธรรมาภิบาล";

                    litRisk1.Text = gt.getReportTammaTotal(ck.pj_id);
                    litRisk2.Text = gt.getReportFactorRiskTotal(ck.pj_id);
                }
            }
            else
            {
                //redirect
                //Response.Redirect("project_summary.aspx");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ton.tonUtilities.pageaAuthorize(Global_config.authtext_23, ton.config.Global_config.warning_text);

        ManageCookie mgCookie = new ManageCookie();
        users        ck       = mgCookie.ReadCookies();

        if (!Page.IsPostBack)
        {
            intial_ApproveList();
            if (ck != null)
            {
                // Copy from ProjectSummary.aspx which created by Narut
                sds_project_summary.SelectParameters["pj_id"].DefaultValue = ck.pj_id;

                DataView dv1 = (DataView)sds_project_summary.Select(DataSourceSelectArguments.Empty);

                foreach (DataRow dRow in dv1.Table.Rows)
                {
                    lblDeptCode.Text               = dRow["mi_code"].ToString();
                    lblDeptName.Text               = dRow["mi_name"].ToString();
                    lblDivisionCode.Text           = dRow["d_code"].ToString();
                    lblDivisionName.Text           = dRow["d_name"].ToString();
                    lblProjectName.Text            = dRow["pj_name"].ToString();
                    lblProjectCode.Text            = dRow["pj_code"].ToString();
                    lblYutasard.Text               = dRow["yut_name"].ToString();
                    lblIntegrateProject.Text       = dRow["pj_integrateProject"].ToString();
                    lblRelateDept.Text             = dRow["pj_relateDept"].ToString();
                    lblBudget.Text                 = dRow["pj_budget"].ToString();
                    lblYear.Text                   = dRow["pj_year"].ToString();
                    lbl_pj_doc_no.Text             = dRow["pj_doc_number"].ToString();
                    lbl_pj_date_doc_submitted.Text = dRow["pj_date_doc_submitted"].ToString().Substring(0, dRow["pj_date_doc_submitted"].ToString().IndexOf(" "));
                    lit_approval.Text              = dRow["pj_approval_status"].ToString();
                }
                gUtilities gt = new gUtilities();
                litRisk1.Text  = gt.getReportTammaTotal(ck.pj_id);
                litRisk2.Text  = gt.getReportFactorRiskTotal(ck.pj_id);
                litRisk12.Text = gt.getReportTammaMainTotal(ck.pj_id);
                litRisk13.Text = gt.getReportTammaSubTotal(ck.pj_id);
            }

            // Below is an OLD code------------------------------------------------------------------

            // This page only allow เจ้าหน้าที่สำนักงบประมาณ role=2
            //if ((ck == null) || string.IsNullOrEmpty(ck.pj_id) || (ck.p_role_id != "2"))
            if ((ck == null) || string.IsNullOrEmpty(ck.pj_id))
            {
                //ton.JavaScript.MessageBox(" โปรเจค ว่างเปล่า กรุณาเข้าสู่ระบบ ");
                Response.Redirect(ton.config.Global_config.RootURL);
            }

            sds_project_approve_final.SelectParameters["pj_id"].DefaultValue = ck.pj_id;
            DataView dv2 = (DataView)sds_project_approve_final.Select(DataSourceSelectArguments.Empty);

            // Double check for prevention of re-approval

            string appr_text = dv2[0]["pj_approval_status"].ToString();

            // Pre DisAble การอนุมัติจากสภา
            pnl_parliament.Enabled    = false;
            pnl_parliament.Visible    = false;
            report_palia_link.Visible = false;
            // Allow ONLY สำนักงบประมาณ ( role id = 2 ) และ ต้องผ่านการให้ความเห็นมาแล้ว
            if ((appr_text == Global_config.pj_approval_status_value[1]) && (ck.p_role_id == ton.config.Global_config.authtext_budgetor))
            {
                rng_app_budget.MaximumValue = lblBudget.Text;
                //txt_approval_budget.Text = lblBudget.Text;
                pnl_parliament.Enabled = true;
                pnl_parliament.Visible = true;
            }
        }
    }