protected void Page_Load(object sender, EventArgs e)
        {
            CarryWorkCalculate C = new CarryWorkCalculate(HttpContext.Current.User.Identity.Name);

            GridView1.DataSource = C.StdDevelopment().ToList();
            GridView1.DataBind();

            Label1.Text = C.SumOfStdDevelopment().ToString();
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String UserName = Session["UserName"].ToString();
            Int32 DurationId =  Convert.ToInt32(Session["PreviousDurationId"]);

            if (!IsPostBack)
            {
                ReportParameter[] para = new ReportParameter[28];

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

                var r = (from p in db.Users
                    where p.UserName == q.Assessor
                    select p).First();

                String Date = DateDisplay(q.Duration.StartDate);
                String FullName = q.User.Prefix.Prefix1+q.User.FirstName+" "+q.User.LastName;
                String DeptName = q.User.Department.DeptName;

                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;
                String WorkLoadSum = result.ToString();
                String WorkLoadGrade = q.D_CarryWork.ToString();
                if (WorkLoadSum=="")
                {
                    WorkLoadSum = "0";
                }
                if (WorkLoadGrade == "")
                {
                    WorkLoadGrade = "0";
                }
                para[0] = new ReportParameter("Date", Date);
                para[1] = new ReportParameter("FullName", FullName);
                para[2] = new ReportParameter("DeptName", DeptName);
                para[3] = new ReportParameter("WorkLoadSum", WorkLoadSum);
                para[4] = new ReportParameter("WorkLoadGrade", WorkLoadGrade);

                //****************************************************************************

                String DirectTeach = CalCarry.SumOfTeachingDirect().ToString();
                String UnDirectTeach = CalCarry.SumOfResearch().ToString();
                String Research = CalCarry.SumOfService().ToString();
                String AcademicService = CalCarry.SumOfService().ToString();
                String Culture = CalCarry.SumOfCulture().ToString();
                String StudentDev = CalCarry.SumOfStdDevelopment().ToString();
                String CenterService = CalCarry.SumOfCenterService().ToString();
                para[5] = new ReportParameter("DirectTeach", DirectTeach);
                para[6] = new ReportParameter("UnDirectTeach", UnDirectTeach);
                para[7] = new ReportParameter("Research", Research);
                para[8] = new ReportParameter("AcademicService", AcademicService);
                para[9] = new ReportParameter("Culture", Culture);
                para[10] = new ReportParameter("StudentDev", StudentDev);
                para[11] = new ReportParameter("CenterService", CenterService);

                //****************************************************************************

                int Teaching_40 = Convert.ToInt32(q.P_Teach);
                int Researching_40 = Convert.ToInt32(q.P_Research);
                int Service_40 = Convert.ToInt32(q.P_Service);
                int Other_40 = Convert.ToInt32(q.P_Other);

                int Teaching_40_Get = Convert.ToInt32(q.D_Teach);
                int Researching_40_Get = Convert.ToInt32(q.D_Research);
                int Service_40_Get = Convert.ToInt32(q.D_Service);
                int Other_40_Get = Convert.ToInt32(q.D_Other);

                para[12] = new ReportParameter("WorkPrimary", Teaching_40.ToString());
                para[13] = new ReportParameter("WorkSecondary", Researching_40.ToString());
                para[14] = new ReportParameter("WorkGen1", Service_40.ToString());
                para[15] = new ReportParameter("WorkGen2", Other_40.ToString());

                para[16] = new ReportParameter("Teaching_40_Get", Teaching_40_Get.ToString());
                para[17] = new ReportParameter("Researching_40_Get", Researching_40_Get.ToString());
                para[18] = new ReportParameter("Service_40_Get", Service_40_Get.ToString());
                para[19] = new ReportParameter("Other_40_Get", Other_40_Get.ToString());

                double SeventyPercentPoint = Math.Round(((Convert.ToInt32(WorkLoadGrade) * 6) + (Teaching_40_Get * Teaching_40 / 5) + (Researching_40_Get * Researching_40 / 5) +
                 (Service_40_Get * Service_40 / 5) + (Other_40_Get * Other_40 / 5)) / 70.00F, 3);

                //****************************************************************************

                String Organize = q.D_Organize.ToString();
                String SelfDev = q.D_SelfDev.ToString();
                String Professional = q.D_Professional.ToString();
                String Communicate = q.D_Communicate.ToString();
                String TeamWork = q.D_TeamWork.ToString();
                String Mind = q.D_Mind.ToString();
                para[20] = new ReportParameter("Organize", Organize);
                para[21] = new ReportParameter("SelfDev", SelfDev);
                para[22] = new ReportParameter("Professional", Professional);
                para[23] = new ReportParameter("Communicate", Communicate);
                para[24] = new ReportParameter("TeamWork", TeamWork);
                para[25] = new ReportParameter("Mind", Mind);

                //****************************************************************************
                CompareCalculate(q.Duration.Organize.ToString(), Organize);
                CompareCalculate(q.Duration.SelfDev.ToString(), SelfDev);
                CompareCalculate(q.Duration.Professional.ToString(), Professional);
                CompareCalculate(q.Duration.Communicate.ToString(), Communicate);
                CompareCalculate(q.Duration.TeamWork.ToString(), TeamWork);
                CompareCalculate(q.Duration.Mind.ToString(), Mind);
                double ThirtyPercentPoint = Math.Round(((Mul3 * 3) + (Mul2 * 2) + Mul1) / 18.00F, 3);

                para[26] = new ReportParameter("ThirtyPercentPoint", ThirtyPercentPoint.ToString());
                para[27] = new ReportParameter("SeventyPercentPoint", SeventyPercentPoint.ToString());

                ReportViewer1.LocalReport.SetParameters(para);

                // Report data source code...
                ReportViewer1.LocalReport.Refresh();
            }
        }