protected void Page_Load(object sender, EventArgs e)
        {
            username = Session["UserName"].ToString();
            durationId = Convert.ToInt32(Session["DurationId"]);

            if (username!="" && durationId!=0)
            {
                AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

                var q = (from p in db.Assessments
                    where p.UserName == username
                    where p.DurationId == durationId
                    select p).First();

                lblPerTeach.Text = q.P_Teach + "%";
                lblPerResearch.Text = q.P_Research + "%";
                lblPerService.Text = q.P_Service + "%";
                lblPerOther.Text = q.P_Other + "%";

                lblTeaching.Text = q.E_Teach.ToString();
                lblResearching.Text = q.E_Research.ToString();
                lblService.Text = q.E_Service.ToString();
                lblOther.Text = q.E_Other.ToString();

                hdf1.Value = q.DealTeachDetail;
                hdf2.Value = q.DealResearchDetail;
                hdf3.Value = q.DealServiceDetail;
                hdf4.Value = q.DealOtherDetail;
            }

            // Auto Click
            ScriptManager.RegisterClientScriptBlock(this, GetType(), "goto", "ClickAuto()", true);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            var q = (from p in db.Users
                     where p.UserName == Session["OtherCarryUserName"].ToString()
                     select p.Prefix.Prefix1 + "" + p.FirstName + " " + p.LastName).First();

            FullName.InnerText = q;
        }
        //*************************************************************************************
        protected void Page_Load(object sender, EventArgs e)
        {
            #region If the system have not open to assess
            try
            {
                dm.getDurationId();
            }
            catch (Exception)
            {
                Response.Redirect("CloseSystem.aspx");
            }
            #endregion

            #region There is no user name redirect to Default
            if (Session["UserName"] == "")
            {
                Response.Redirect("~/");
            }
            #endregion

            UserName = Session["UserName"].ToString();
            DurationId = Convert.ToInt32(Session["DurationId"]);

            if (!IsPostBack)
            {
                AssessmentSystemsDBDataContext asm = new AssessmentSystemsDBDataContext();
                var q = from p in asm.Assessments
                    where p.UserName == UserName
                    orderby p.DurationId descending
                    select p;

                // --- Preparation
                DataTable tb = new DataTable("Year");
                DataColumn colValue = new DataColumn("value", typeof(Int32));
                DataColumn colYear = new DataColumn("Year", typeof(string));
                tb.Columns.Add(colValue);
                tb.Columns.Add(colYear);

                foreach (var x in q.ToList())
                {
                    DataRow row = tb.NewRow();
                    row["value"] = (x.DurationId);
                    row["Year"] = DateDisplay(x.Duration.StartDate);
                    tb.Rows.Add(row);
                }

                ddYear.DataTextField = "Year";
                ddYear.DataValueField = "value";
                ddYear.DataSource = tb;
                ddYear.DataBind();

                SetControl(DurationId);
                CarryTableDetail1.setData(UserName, DurationId);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            DurationManage dr = new DurationManage();
            if (dr.Header() || dr.Dean())
            {
                Session["OtherCarryUserName"] = HttpContext.Current.User.Identity.Name;
                Response.Redirect("~/CarryShowOnly/CarryCalculateMain.aspx");
            }

            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            var q = (from p in db.Users
                     where p.UserName == HttpContext.Current.User.Identity.Name
                     select p.Prefix.Prefix1 + "" + p.FirstName + " " + p.LastName).First();

            FullName.InnerText = q;
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            var q = (from p in db.Assessments
                     where p.UserName == Session["OtherCarryUserName"]
                     where p.DurationId == Convert.ToInt32(Session["DurationId"])
                     select p).First();

            if (q.Duration.Header == true)
            {
                q.G_CarryWork = Convert.ToInt32(ddHeader.Text);
                lbl_H.Text = q.G_CarryWork.ToString();

                q.D_CarryWork = q.G_CarryWork;
                lbl_D.Text = q.D_CarryWork.ToString();

                db.SubmitChanges();

                lbl_Result.Text = lbl_D.Text;
            }
            else if (q.Duration.Dean == true)
            {
                q.D_CarryWork = Convert.ToInt32(ddDean.SelectedValue);
                lbl_D.Text = q.D_CarryWork.ToString();

                db.SubmitChanges();

                lbl_Result.Text = lbl_D.Text;
            }

            lbl_H.Visible = true;
            lbl_D.Visible = true;

            ddHeader.Visible = false;
            ddDean.Visible = false;
            btnSave.Visible = false;
            btnCancle.Visible = false;
            btnAssess.Visible = true;

            AssessmentCheckComplete ckComplete = new AssessmentCheckComplete();
            ckComplete.CheckComplete(Session["OtherCarryUserName"].ToString(), Convert.ToInt32(Session["DurationId"]));
        }
예제 #6
0
        private bool CheckComplete(int id)
        {
            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();
            var q = from p in db.Assessments
                where p.DurationId == Convert.ToInt32(Session["DurationId"])
                where p.User.DeptId == id
                select p;

            bool complete = true;

            foreach (var item in q.ToList())
            {
                if (!Convert.ToBoolean(item.AssessApproved))
                {
                    complete = false;
                }
            }

            return complete;
        }
        public void CheckComplete(string username, int durationid)
        {
            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            var q = (from p in db.Assessments
                     where p.UserName == username
                     where p.DurationId == durationid
                     select p).First();

            if (q.G_CarryWork != 0 && q.G_Teach != 0 && q.G_Research != 0 && q.G_Service != 0 && q.G_Other != 0 && q.G_Organize != 0 && q.G_SelfDev != 0 && q.G_Professional != 0 && q.G_Communicate != 0 && q.G_TeamWork != 0 && q.G_Mind != 0)
            {
                q.AssessComplete = true;
            }
            else
            {
                q.AssessComplete = false;
            }

            db.SubmitChanges();
        }
        protected void btnAssess_Click(object sender, EventArgs e)
        {
            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            var q = (from p in db.Assessments
                     where p.UserName == Session["OtherCarryUserName"]
                     where p.DurationId == Convert.ToInt32(Session["DurationId"])
                     select p).First();

            btnSave.Visible = true;
            btnCancle.Visible = true;
            btnAssess.Visible = false;

            if (q.Duration.Header == true)
            {
                ddHeader.Visible = true;
                lbl_H.Visible = false;
            }
            else if (q.Duration.Dean == true)
            {
                ddDean.Visible = true;
                lbl_D.Visible = false;
            }
        }
예제 #9
0
        protected void linkBtnHeaderSave_Click(object sender, EventArgs e)
        {
            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            var q = (from p in db.Assessments
                     where p.UserName == Session["OtherCarryUserName"]
                     where p.DurationId == Convert.ToInt32(Session["DurationId"])
                     select p).First();

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

            q.ResearchComment = txtHeaderEdit.Text;
            db.SubmitChanges();
            txtHeaderShow.Text = txtHeaderEdit.Text;

            tbHeaderShow.Visible = true;
            tbHeaderEdit.Visible = false;
            tbAssessShow.Visible = true;
            tbAssessEdit.Visible = false;

            AssessmentCheckComplete ckComplete = new AssessmentCheckComplete();
            ckComplete.CheckComplete(Session["OtherCarryUserName"].ToString(), Convert.ToInt32(Session["DurationId"]));
        }
예제 #10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            String data = hdfMark.Value;

            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            var q = (from p in db.Assessments
                     where p.UserName == Session["OtherCarryUserName"]
                     where p.DurationId == Convert.ToInt32(Session["DurationId"])
                     select p).First();

            q.Mark_Research = data;
            db.SubmitChanges();

            Response.Redirect("Q_Research.aspx");
        }
예제 #11
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            String data = hdfMark.Value;

            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            var q = (from p in db.Assessments
                     where p.UserName == username
                     where p.DurationId == durationId
                     select p).First();

            q.Mark_Others = data;
            db.SubmitChanges();

            Response.Redirect("Q_Others.aspx");
        }
예제 #12
0
        private int SetDepartmentId()
        {
            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            try
            {
                var q = (from p in db.Users
                         where p.UserName == Session["UserName"]
                    select p.DeptId).First();
                return Convert.ToInt32(q);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            username = Session["OtherCarryUserName"].ToString();
            durationId = Convert.ToInt32(Session["DurationId"]);

            durationId = dr.getDurationId();

            if (!IsPostBack)
            {
                FillGridView();
            }

            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            var q = (from p in db.Users
                     where p.UserName == Session["OtherCarryUserName"].ToString()
                     select p.Prefix.Prefix1 + "" + p.FirstName + " " + p.LastName).First();

            FullName.InnerText = q;
        }
        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("~/CarryShowOnly/Manage_DirectTeach.aspx");
            }

            durationId = dr.getDurationId();
            if (!IsPostBack)
            {
                FillGridView();
                FillGridView2();
            }

            AssessmentSystemsDBDataContext asm = new AssessmentSystemsDBDataContext();

            var q = (from p in asm.Users
                     where p.UserName == Session["UserName"].ToString()
                     select p.Prefix.Prefix1 + "" + p.FirstName + " " + p.LastName).First();

            FullName.InnerText = q;
        }
예제 #15
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_Service.aspx");
            }

            try{
                // คำนวน ภาระงาน
                WorkLoadCalculate CalCarry = new WorkLoadCalculate(Session["UserName"].ToString(), Convert.ToInt32(Session["DurationId"]));
                double a = CalCarry.SumOfService();
                // แสดงค่าภาระงาน
                ServiceValue.InnerHtml = " : " + a;
            }
            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_Service); 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_Service;

                txtDetailFirst.Text = q.DealServiceDetail;

                txtShowNewDetail.Text = q.NewServiceDetail;

                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 == 52 || item.Assess_Id == 57 || item.Assess_Id == 61)
                    {
                        dis = "disabled";
                    }

                    if (item.MapId == "CC")
                    {
                        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>" + item.Assess_Id + "<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];
        }
예제 #16
0
        protected void linkBtnSave_Click(object sender, EventArgs e)
        {
            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            var q = (from p in db.Assessments
                     where p.UserName == Session["UserName"]
                     where p.DurationId == Convert.ToInt32(Session["DurationId"])
                     select p).First();

            q.NewServiceDetail = txtNewDetail.Text;
            db.SubmitChanges();
            txtShowNewDetail.Text = txtNewDetail.Text;
            tbEdit.Visible = false;
            tbShow.Visible = true;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            username = Session["OtherCarryUserName"].ToString();
            durationId = Convert.ToInt32(Session["DurationId"]);

            if (!IsPostBack)
            {
                CarryWorkCalculate cr = new CarryWorkCalculate(username, durationId);
                ASPxGridView1.DataSource = cr.AcademicService().ToList();
                ASPxGridView1.DataBind();
            }
            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            var q = (from p in db.Users
                     where p.UserName == Session["OtherCarryUserName"].ToString()
                     select p.Prefix.Prefix1 + "" + p.FirstName + " " + p.LastName).First();

            FullName.InnerText = q;
        }
예제 #18
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];
        }
        protected void btnApproveAll_Click(object sender, EventArgs e)
        {
            if (hdfConfirm.Value == "1")
            {
                AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

                var q = (from p in db.Assessments
                         where p.DurationId == Convert.ToInt32(Session["DurationId"])
                         where p.User.DeptId == Convert.ToInt32(ddDepartment.SelectedValue)
                         select p).ToList();

                foreach (var item in q)
                {
                    item.AssessApproved = true;
                }

                db.SubmitChanges();

                GridView1.DataBind();

                btnUnApproved.Visible = true;

                btnApproved.Visible = false;
                btnEdit.Visible = false;
            }
            else
            {
                hdfConfirm.Value = "0";
            }
        }
예제 #20
0
        private void SetButtonDisplay()
        {
            if (Roles.IsUserInRole(User.Identity.Name, "Admin"))  // --> Admin
            {
                Response.Redirect("~/Admin/SystemManagement.aspx");
            }
            else if (Roles.IsUserInRole(User.Identity.Name, "Dean"))  // --> Dean
            {
                Literal1.Visible = false;

                try
                {
                    AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();
                    var q = from p in db.Departments
                            select p;

                    String data = "<br/><table style='width:80%'  class=\"table table-striped\">";
                    data += "<thead>";
                    data += "<tr class=\"danger\">";
                    data += "<td style='width:5%'></td>";
                    data += "<td style='text-align:left;width:75%'>ภาควิชา</td>";

                    data += "<td style='text-align:center;width:20%'>สถานะการประเมิน</td>";
                    data += "</tr>";
                    data += "</thead>";
                    foreach (var item in q.ToList())
                    {
                        data += "<tr >";
                        data += "<td ></td>";
                        data += "<td style='text-align:left'>";
                        data += "<a href=\"Dean/Dean_AssessMainForm?deptId=" + item.DeptId + "\" target=\"_blank\">" + item.DeptName + "</a>";
                        data += "</td>";

                        data += "<td style='text-align:center'>";
                        if (CheckComplete(item.DeptId))
                        {
                            data += "<a href=\"Dean/Dean_AssessMainForm?deptId=" + item.DeptId + "\" target=\"_blank\"><img src='../Content/icons/success.png' style='width:20px'></a>";
                            //data += "<input class='btn btn-success' id=\"" + item.DeptId + "\" type=\"button\" value=\"การประเมินสมบูรณ์\" />";
                        }
                        else
                        {
                            data += "<a href=\"Dean/Dean_AssessMainForm?deptId=" + item.DeptId + "\" target=\"_blank\"><img src='../Content/icons/fail.png' style='width:20px'></a>";
                            //data += "<input class='btn btn-warning' id=\"" + item.DeptId + "\" type=\"button\" value=\"ยังไม่ได้รับการประเมิณ\" />";
                        }
                        data += "</td>";
                        data += "</tr>";
                    }

                    data += "</table>";

                    DeanTableState.InnerHtml = data;}
                catch (Exception)
                {

                    throw;
                }

                btnProfessor.Visible = true;
                btnDean.Visible = true;
                btnDeanGraph.Visible = true;
            }
            else if (Roles.IsUserInRole(User.Identity.Name, "Header"))  // --> Header
            {
                btnProfessor.Visible = true;
                btnHeader.Visible = true;
                btnHeaderGraph.Visible = true;
            }
            else if (Roles.IsUserInRole(User.Identity.Name, "Professor"))  // --> Header
            {
                btnProfessor.Visible = true;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

            var q = (from p in db.Assessments
                     where p.UserName == Session["OtherCarryUserName"]
                     where p.DurationId == Convert.ToInt32(Session["DurationId"])
                     select p).First();

            var r = (from p in db.Assessments
                     where p.UserName == Session["UserName"]
                     where p.DurationId == Convert.ToInt32(Session["DurationId"])
                     select p).First();

            lbl_E.Text = q.E_CarryWork.ToString();

            if (Convert.ToBoolean(q.AssessComplete))
            {
                lbl_H.Text = q.G_CarryWork.ToString();
            }
            else
            {
                lbl_H.Text = "-";
            }

            if (Convert.ToBoolean(q.AssessApproved))
            {
                lbl_D.Text = q.G_CarryWork.ToString();
            }
            else
            {
                lbl_D.Text = "-";
            }

            if (lbl_D.Text != "-")
            {
                lbl_Result.Text = lbl_D.Text;
            }
            else if (lbl_D.Text == "-")
            {
                lbl_Result.Text = lbl_H.Text;
            }
            else if (lbl_H.Text == "-")
            {
                lbl_Result.Text = lbl_E.Text;
            }

            if (!IsPostBack)
            {

                ddHeader.SelectedValue = q.G_CarryWork.ToString();
                ddDean.SelectedValue = q.D_CarryWork.ToString();

                if ((q.Duration.Header == true && r.User.UserLevelId == 1) || (q.Duration.Dean == true && r.User.UserLevelId == 0))
                {
                    btnAssess.Visible = true;
                }

            }

            if ((q.Duration.Dean == true && r.User.UserLevelId == 0) || q.Duration.Dean == true) // Dean
                {
                    tr_Dean.Visible = true;
                }
        }
예제 #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            setDefaultPage();

            if (HttpContext.Current.User.Identity.Name != "")
            {
                DurationManage dm = new DurationManage();

                if (Roles.IsUserInRole(User.Identity.Name, "Admin"))
                {
                    Response.Redirect("~/Admin/Admin_DefaultPage.aspx");
                }
                else if (Roles.IsUserInRole(User.Identity.Name, "Dean"))
                {
                    btnProfessor.Visible = true;
                    try
                    {
                        if (dm.Dean())
                        {
                            btnDean.Visible = true;
                        }
                    }
                    catch (Exception)
                    { }
                }
                else if (Roles.IsUserInRole(User.Identity.Name, "Header"))
                {
                    btnProfessor.Visible = true;
                    try
                    {
                        if (dm.Header())
                        {
                            btnHeader.Visible = true;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
                else if (Roles.IsUserInRole(User.Identity.Name, "Professor"))
                {
                    btnProfessor.Visible = true;
                }

                Session["UserName"] = HttpContext.Current.User.Identity.Name;

                try
                {
                    Session["DurationID"] = dm.getDurationId();
                    Session["PreviousDurationID"] = dm.getPreviousDurationId();
                }
                catch (Exception)
                {
                    Session["DurationID"] = dm.getPreviousDurationId();
                    Session["PreviousDurationID"] = dm.getPreviousDurationId()-1;
                }

                AssessmentSystemsDBDataContext db = new AssessmentSystemsDBDataContext();

                try
                {
                    var q = (from p in db.Users
                             where p.UserName == HttpContext.Current.User.Identity.Name
                             select p.DeptId).First();
                    Session["DeptId"] = q;
                }
                catch (Exception)
                {

                }
            }
        }