protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                setControl();

                // Set Data 30% University espect
                DurationDataContext systemdb = new DurationDataContext();

                var uni = (from p in systemdb.DurationSystems
                           where p.DurationId == Convert.ToInt32(Session["DurationId"])
                           select p).First();

                lblOrganize.Text = uni.Organize.ToString();
                lblSelfDev.Text = uni.SelfDev.ToString();
                lblProfessional.Text = uni.Professional.ToString();
                lblCommunicate.Text = uni.Communicate.ToString();
                lblTeamWork.Text = uni.TeamWork.ToString();
                lblMind.Text = uni.Mind.ToString();
            }

            // Set Radio button out values
            O51 = RadioButtonX51.data;
            O52 = RadioButtonX52.data;
            O53 = RadioButtonX53.data;
            O54 = RadioButtonX54.data;
            O55 = RadioButtonX55.data;
            O56 = RadioButtonX56.data;
        }
        private int getRate(double data)
        {
            DurationDataContext ds = new DurationDataContext();

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

            int rate;
            if (data >= q.WorkLoad_Lv_5)
            {
                rate = 5;
            }
            else if (data >= q.WorkLoad_Lv_4 && data < q.WorkLoad_Lv_5)
            {
                rate = 4;
            }
            else if (data >= q.WorkLoad_Lv_3 && data < q.WorkLoad_Lv_4)
            {
                rate = 3;
            }
            else if (data >= q.WorkLoad_Lv_2 && data < q.WorkLoad_Lv_3)
            {
                rate = 2;
            }
            else
            {
                rate = 1;
            }

            return rate;
        }
        private Object SetColor(double data, int dura)
        {
            DurationDataContext db = new DurationDataContext();

            var q = (from p in db.DurationSystems
                where p.DurationId == dura
                select p).First();

            Color color = new Color();
            color = Color.Green;

            if (data < q.WorkLoad_Lv_2)
            {
                color = Color.Red;
            }
            else if (data >= q.WorkLoad_Lv_2 && data <= q.WorkLoad_Lv_3)
            {
                color = Color.Orange;
            }

            return color;
        }
        //*******************************************
        public void SetControl(String UserName, int DurationId)
        {
            username = UserName;
            Session["OtherCarryUserName"] = username;
            durationid = DurationId;
            try
            {
                var q = (from p in db.Assessments
                         where p.UserName == UserName
                         where p.DurationId == DurationId
                         select p).First();

                //**************************************************************************************** Professor

                // Percent Workload
                lblPercentTeach.Text = q.P_Teach + "%";
                lblPercentResearch.Text = q.P_Research + "%";
                lblPercentAcaService.Text = q.P_Service + "%";
                lblPercentOther.Text = q.P_Other + "%";

                // Professor
                    lblE_Carry.Text = q.E_CarryWork.ToString();
                    lblE_Teach.Text = q.E_Teach.ToString();
                    lblE_Research.Text = q.E_Research.ToString();
                    lblE_Service.Text = q.E_Service.ToString();
                    lblE_Other.Text = q.E_Other.ToString();
                // Header

                if (Convert.ToBoolean(q.AssessComplete))
                {
                    lblHWorkLoad.Text = q.G_CarryWork.ToString();

                    lblHTeach.Text = q.G_Teach.ToString();
                    lblHResearch.Text = q.G_Research.ToString();
                    lblHService.Text = q.G_Service.ToString();
                    lblHOther.Text = q.G_Other.ToString();

                    lblHOrganize.Text = q.G_Organize.ToString();
                    lblHSelfDev.Text = q.G_SelfDev.ToString();
                    lblHProfessional.Text = q.G_Professional.ToString();
                    lblHCommunicate.Text = q.G_Communicate.ToString();
                    lblHTeamWork.Text = q.G_TeamWork.ToString();
                    lblHMind.Text = q.G_Mind.ToString();

                    // Dean

                    ddWorkLoad.SelectedValue = q.D_CarryWork.ToString();

                    ddTeach.SelectedValue = q.D_Teach.ToString();
                    ddResearch.SelectedValue = q.D_Research.ToString();
                    ddService.SelectedValue = q.D_Service.ToString();
                    ddOther.SelectedValue = q.D_Other.ToString();

                    ddOrganize.SelectedValue = q.D_Organize.ToString();
                    ddSelfDev.SelectedValue = q.D_SelfDev.ToString();
                    ddProfessional.SelectedValue = q.D_Professional.ToString();
                    ddCommunicate.SelectedValue = q.D_Communicate.ToString();
                    ddTeamWork.SelectedValue = q.D_TeamWork.ToString();
                    ddMind.SelectedValue = q.D_Mind.ToString();
                    lblDWorkLoad.Text = q.D_CarryWork.ToString();

                    hightLightLabelHeader(q);
                    if (dm.Dean())
                    {

                        lblDTeach.Text = q.D_Teach.ToString();
                        lblDResearch.Text = q.D_Research.ToString();
                        lblDService.Text = q.D_Service.ToString();
                        lblDOther.Text = q.D_Other.ToString();

                        lblDOrganize.Text = q.D_Organize.ToString();
                        lblDSelfDev.Text = q.D_SelfDev.ToString();
                        lblDProfessional.Text = q.D_Professional.ToString();
                        lblDCommunicate.Text = q.D_Communicate.ToString();
                        lblDTeamWork.Text = q.D_TeamWork.ToString();
                        lblDMind.Text = q.D_Mind.ToString();

                        hightLightLabelDean(q);
                    }
                    else
                    {
                        lblDWorkLoad.Text = "-";

                        lblDTeach.Text = "-";
                        lblDResearch.Text = "-";
                        lblDService.Text = "-";
                        lblDOther.Text = "-";

                        lblDOrganize.Text = "-";
                        lblDSelfDev.Text = "-";
                        lblDProfessional.Text = "-";
                        lblDCommunicate.Text = "-";
                        lblDTeamWork.Text = "-";
                        lblDMind.Text = "-";
                    }

                }
                else
                {
                    lblHWorkLoad.Text = "-";

                    lblHTeach.Text = "-";
                    lblHResearch.Text = "-";
                    lblHService.Text = "-";
                    lblHOther.Text = "-";

                    lblHOrganize.Text = "-";
                    lblHSelfDev.Text = "-";
                    lblHProfessional.Text = "-";
                    lblHCommunicate.Text = "-";
                    lblHTeamWork.Text = "-";
                    lblHMind.Text = "-";

                    lblDWorkLoad.Text = "-";

                    lblDTeach.Text = "-";
                    lblDResearch.Text = "-";
                    lblDService.Text = "-";
                    lblDOther.Text = "-";

                    lblDOrganize.Text = "-";
                    lblDSelfDev.Text = "-";
                    lblDProfessional.Text = "-";
                    lblDCommunicate.Text = "-";
                    lblDTeamWork.Text = "-";
                    lblDMind.Text = "-";
                }

                //**************************************************************************************** University Expect

                DurationDataContext du = new DurationDataContext();

                var r = (from p in du.DurationSystems
                         where p.DurationId == DurationId
                         select p).First();

                // University Expect
                lblOrganize.Text = r.Organize.ToString();
                lblSelfDev.Text = r.SelfDev.ToString();
                lblProfessional.Text = r.Professional.ToString();
                lblComunicate.Text = r.Communicate.ToString();
                lblTeamWork.Text = r.TeamWork.ToString();
                lblMind.Text = r.Mind.ToString();

                CarryWorkCalculate CalCarry = new CarryWorkCalculate(UserName, DurationId);

                double a = CalCarry.SumOfTeaching();
                double b = CalCarry.SumOfResearch();
                double c = CalCarry.SumOfService();
                double d = CalCarry.SumOfOther();double result = a + b + c + d;

                popup_1.InnerHtml = q.Duration.WorkLoad_Lv_2.ToString();

                popup_2.InnerHtml = q.Duration.WorkLoad_Lv_2.ToString();
                popup_3.InnerHtml = (q.Duration.WorkLoad_Lv_3 - 1).ToString();

                popup_4.InnerHtml = q.Duration.WorkLoad_Lv_3.ToString();
                popup_5.InnerHtml = (q.Duration.WorkLoad_Lv_4 - 1).ToString();

                popup_6.InnerHtml = q.Duration.WorkLoad_Lv_4.ToString();
                popup_7.InnerHtml = (q.Duration.WorkLoad_Lv_5 - 1).ToString();

                popup_8.InnerHtml = q.Duration.WorkLoad_Lv_5.ToString();

                lblWorkLoad.ForeColor = (Color)SetColor(result, DurationId);
                lblWorkLoad.Text = result.ToString();

                if (dm.Dean())
                {
                    if (Convert.ToBoolean(q.AssessApproved))
                    {
                        btnUnApproved.Visible = true;
                        btnApproved.Visible = false;
                        btnEdit.Visible = false;
                    }
                    else
                    {
                        btnUnApproved.Visible = false;
                        btnApproved.Visible = true;
                        btnEdit.Visible = true;
                    }

                    btnApproveAll.Visible = true;
                }

            }
            catch (Exception)
            {

            }
        }
Ejemplo n.º 5
0
        private int SetDurationId()
        {
            int durationId;
            try
            {
                durationId = dm.getDurationId();
            }
            catch (Exception)
            {
                DurationDataContext dr = new DurationDataContext();
                var q = (from p in dr.DurationSystems
                         orderby p.DurationId descending
                    select p).First();

                DurationSystems newDr = new DurationSystems();
                newDr.StartDate = q.EndDate.AddDays(1);
                newDr.EndDate = newDr.StartDate.AddMonths(6);

                newDr.Organize = q.Organize;
                newDr.SelfDev = q.SelfDev;
                newDr.Professional = q.Professional;
                newDr.Communicate = q.Communicate;
                newDr.Mind = q.Mind;
                newDr.TeamWork = q.TeamWork;

                newDr.WorkLoad_Lv_2 = q.WorkLoad_Lv_2;
                newDr.WorkLoad_Lv_3 = q.WorkLoad_Lv_3;
                newDr.WorkLoad_Lv_4 = q.WorkLoad_Lv_4;
                newDr.WorkLoad_Lv_5 = q.WorkLoad_Lv_5;

                dr.DurationSystems.InsertOnSubmit(newDr);
                dr.SubmitChanges();

                var newq = (from p in dr.DurationSystems
                         orderby p.DurationId descending
                         select p).First();

                durationId = newq.DurationId;
            }

            return durationId;
        }
        public void SetControl(String UserName, int DurationId)
        {
            username = UserName;
            durationid = DurationId;
            Session["OtherCarryUserName"] = username;
            try
            {
                var q = (from p in db.Assessments
                         where p.UserName == UserName
                         where p.DurationId == DurationId
                         select p).First();

                //**************************************************************************************** Professor

                // Percent Workload
                lblPercentTeach.Text = q.P_Teach + "%";
                lblPercentResearch.Text = q.P_Research + "%";
                lblPercentAcaService.Text = q.P_Service + "%";
                lblPercentOther.Text = q.P_Other + "%";

                // Professor Score
                lblE_Carry.Text = q.E_CarryWork.ToString();
                lblE_Teach.Text = q.E_Teach.ToString();
                lblE_Research.Text = q.E_Research.ToString();
                lblE_Service.Text = q.E_Service.ToString();
                lblE_Other.Text = q.E_Other.ToString();

                lblHWorkLoad.Text = q.G_CarryWork.ToString();

                lblHTeach.Text = q.G_Teach.ToString();
                lblHResearch.Text = q.G_Research.ToString();
                lblHService.Text = q.G_Service.ToString();
                lblHOther.Text = q.G_Other.ToString();

                lblHOrganize.Text = q.G_Organize.ToString();
                lblHSelfDev.Text = q.G_SelfDev.ToString();
                lblHProfessional.Text = q.G_Professional.ToString();
                lblHCommunicate.Text = q.G_Communicate.ToString();
                lblHTeamWork.Text = q.G_TeamWork.ToString();
                lblHMind.Text = q.G_Mind.ToString();

                //**************************************************************************************** University Expect

                DurationDataContext du = new DurationDataContext();

                var r = (from p in du.DurationSystems
                         where p.DurationId == DurationId
                         select p).First();

                // University Expect
                lblOrganize.Text = r.Organize.ToString();
                lblSelfDev.Text = r.SelfDev.ToString();
                lblProfessional.Text = r.Professional.ToString();
                lblComunicate.Text = r.Communicate.ToString();
                lblTeamWork.Text = r.TeamWork.ToString();
                lblMind.Text = r.Mind.ToString();

                CarryWorkCalculate CalCarry = new CarryWorkCalculate(UserName, DurationId);

                double a = CalCarry.SumOfTeaching();
                double b = CalCarry.SumOfResearch();
                double c = CalCarry.SumOfService();
                double d = CalCarry.SumOfOther();
                double result = a + b + c + d;

                lblWorkLoad.ForeColor = (Color)SetColor(result, DurationId);
                lblWorkLoad.Text = result.ToString();

                popup_1.InnerHtml = q.Duration.WorkLoad_Lv_2.ToString();

                popup_2.InnerHtml = q.Duration.WorkLoad_Lv_2.ToString();
                popup_3.InnerHtml = (q.Duration.WorkLoad_Lv_3 - 1).ToString();

                popup_4.InnerHtml = q.Duration.WorkLoad_Lv_3.ToString();
                popup_5.InnerHtml = (q.Duration.WorkLoad_Lv_4 - 1).ToString();

                popup_6.InnerHtml = q.Duration.WorkLoad_Lv_4.ToString();
                popup_7.InnerHtml = (q.Duration.WorkLoad_Lv_5 - 1).ToString();

                popup_8.InnerHtml = q.Duration.WorkLoad_Lv_5.ToString();

                hightLightLabelHeader(q);

            }
            catch (Exception)
            {

            }
        }