コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                username = Session["OtherCarryUserName"].ToString();
            durationId = Convert.ToInt32(Session["DurationId"]);
                // คำนวน ภาระงาน
                WorkLoadCalculate CalCarry = new WorkLoadCalculate(Session["OtherCarryUserName"].ToString(), Convert.ToInt32(Session["DurationId"]));
                double a = CalCarry.SumOfResearch_Main();
                double b = CalCarry.SumOfResearch_Article();
                // แสดงค่าภาระงาน
                ResearchValue.InnerHtml = " : " + a;
                ArticleValue.InnerHtml = " : " + b;
            }
            catch (Exception)
            {
            }

            try
            {
                // ค่าความคาดหวัง
                AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();
                var q = (from p in db.Assessments
                         where p.UserName == Session["OtherCarryUserName"].ToString()
                         where p.DurationId == Convert.ToInt32(Session["DurationId"])
                         select p).First();
                ExpectValue = Convert.ToInt32(q.E_Research); switch (ExpectValue)
                {
                    case 1:
                        Level1.InnerText += " (ระดับที่คาดหวัง)"; break;
                    case 2:
                        Level2.InnerText += " (ระดับที่คาดหวัง)"; break;
                    case 3:
                        Level3.InnerText += " (ระดับที่คาดหวัง)"; break;
                    case 4:
                        Level4.InnerText += " (ระดับที่คาดหวัง)"; break;
                    case 5:
                        Level5.InnerText += " (ระดับที่คาดหวัง)"; break;
                    default: break;
                }

                if (!IsPostBack)
                {
                    switch (q.G_Research)
                    {
                        case 5: rdo5.Checked = true
                           ; break;
                        case 4: rdo4.Checked = true
                            ; break;
                        case 3: rdo3.Checked = true
                            ; break;
                        case 2: rdo2.Checked = true
                            ; break;
                        case 1: rdo1.Checked = true
                            ; break;
                        default: break;
                    }
                    G_level.InnerText = "ระดับที่ได้ : " + q.G_Research;
                }

                FullName.InnerText = q.User.Prefix.Prefix1 + q.User.FirstName + " " + q.User.LastName;

                CheckBoxData = q.Mark_Research;

                txtDetailFirst.Text = q.DealResearchDetail;

                txtShowNewDetail.Text = q.NewResearchDetail;

                txtHeaderShow.Text = q.ResearchComment;

                // Show hide btn btnHeaderUploadBtn
                var r = (from p in db.Users
                         where p.UserName == Session["UserName"].ToString()
                         select p).First();

                DurationManage dm = new DurationManage();
                if (r.UserLevelId == 1 && q.DurationId == dm.getDurationId() && dm.Header())
                {
                    linkBtnHeaderEdit.Visible = true;
                    ASPxUploadControlHeader.Visible = true;
                }
            }
            catch (Exception)
            {
            }

            String[] tb = new string[5];
            Doc_MainDataContext doc_main = new Doc_MainDataContext();
            for (int i = 0; i < 5; i++)
            {
                var q = from p in doc_main.Doc_AssessDetails
                        where p.DocumentTypeId == DocTypeId
                        where p.Assess_level == i + 1
                        select p;

                tb[i] = "<table class=\"table table-condensed\">";

                foreach (var item in q.ToList())
                {
                    string dis  = "disabled";

                    if (item.MapId == "BB" )
                    {
                        tb[i] += "<tr class=\"row_map " + item.MapId + "_row active" + "\" style=\"cursor: pointer; color:#bfbfbf\">";
                        tb[i] += "<td>" + item.Assess_Details + "</td>";
                        tb[i] += "<td>" + "" + "</td>";
                    }
                    else
                    {
                        tb[i] += "<tr class=\"row_map " + item.MapId + "_row" + "\" onclick=\"heighLightMapId('" + item.MapId + "')\" onmouseover=\"\" style=\"cursor: pointer;\">";
                        tb[i] += "<td>" + item.Assess_Details + "</td>";
                        tb[i] += "<td><input id=\"cb_" + item.Assess_Id + "\" type=\"checkbox\" " + dis + "  onchange=\"Checked(" + item.Assess_Id + ")\" />" + "</td>";
                    }

                    tb[i] += "</tr>";
                }

                tb[i] += "</table>";
            }

            Table1.InnerHtml = tb[0];
            Table2.InnerHtml = tb[1];
            Table3.InnerHtml = tb[2];
            Table4.InnerHtml = tb[3];
            Table5.InnerHtml = tb[4];
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            username = Session["UserName"].ToString();
            durationId = Convert.ToInt32(Session["DurationId"]);

            if (dr.Header() || dr.Dean())
            {
                Session["OtherCarryUserName"] = username;
                Response.Redirect("~/QuanlityShowOnly/Q_Research.aspx");
            }
            try
            {
                // คำนวน ภาระงาน
                WorkLoadCalculate CalCarry = new WorkLoadCalculate(Session["UserName"].ToString(), Convert.ToInt32(Session["DurationId"]));
                double a = CalCarry.SumOfResearch_Main();
                double b = CalCarry.SumOfResearch_Article();
                // แสดงค่าภาระงาน
                ResearchValue.InnerHtml = " : " + a;
                ArticleValue.InnerHtml = " : " + b;
            }
            catch (Exception)
            {
            }

            try
            {
                // ค่าความคาดหวัง
                AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();
                var q = (from p in db.Assessments
                         where p.UserName == Session["UserName"].ToString()
                         where p.DurationId == Convert.ToInt32(Session["DurationId"])
                         select p).First();
                ExpectValue = Convert.ToInt32(q.E_Research); switch (ExpectValue)
                {
                    case 1:
                        Level1.InnerText += " (ระดับที่คาดหวัง)"; break;
                    case 2:
                        Level2.InnerText += " (ระดับที่คาดหวัง)"; break;
                    case 3:
                        Level3.InnerText += " (ระดับที่คาดหวัง)"; break;
                    case 4:
                        Level4.InnerText += " (ระดับที่คาดหวัง)"; break;
                    case 5:
                        Level5.InnerText += " (ระดับที่คาดหวัง)"; break;
                    default: break;
                }
                FullName.InnerText = q.User.Prefix.Prefix1 + q.User.FirstName + " " + q.User.LastName;
                CheckBoxData = q.Mark_Research;

                txtDetailFirst.Text = q.DealResearchDetail;

                txtShowNewDetail.Text = q.NewResearchDetail;

                tbEdit.Visible = false;
            }
            catch (Exception)
            {
            }

            String[] tb = new string[5];
            Doc_MainDataContext doc_main = new Doc_MainDataContext();
            for (int i = 0; i < 5; i++)
            {
                var q = from p in doc_main.Doc_AssessDetails
                        where p.DocumentTypeId == DocTypeId
                        where p.Assess_level == i + 1
                        select p;

                tb[i] = "<table class=\"table table-condensed\">";

                foreach (var item in q.ToList())
                {
                    string dis = "";
                    if (item.Assess_Id == 27 || item.Assess_Id == 30 || item.Assess_Id == 34 || item.Assess_Id == 41)
                    {
                        dis = "disabled";
                    }

                    if (item.MapId == "BB" )
                    {
                        tb[i] += "<tr class=\"row_map " + item.MapId + "_row active" + "\" style=\"cursor: pointer; color:#bfbfbf\">";
                        tb[i] += "<td><span id=\"td_" + item.Assess_Id + "\">" + item.Assess_Details + "</span></td>";
                        tb[i] += "<td>" + "" + "</td>";
                    }
                    else
                    {
                        tb[i] += "<tr class=\"row_map " + item.MapId + "_row" + "\" onclick=\"heighLightMapId('" + item.MapId + "')\" onmouseover=\"\" style=\"cursor: pointer;\">";
                        tb[i] += "<td><span id=\"td_" + item.Assess_Id + "\">" + item.Assess_Details + "</span></td>";
                        tb[i] += "<td><input id=\"cb_" + item.Assess_Id + "\" type=\"checkbox\" " + dis + "  onchange=\"Checked(" + item.Assess_Id + ")\" />" + "</td>";
                    }

                    tb[i] += "</tr>";
                }

                tb[i] += "</table>";
            }

            Table1.InnerHtml = tb[0];
            Table2.InnerHtml = tb[1];
            Table3.InnerHtml = tb[2];
            Table4.InnerHtml = tb[3];
            Table5.InnerHtml = tb[4];
        }