Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            var employee = (Employee)employeeBindingSource.Current;
            var sy       = (from s in _db.SchoolYear
                            where s.ID == Repository.GetSchollYearID()
                            select s).FirstOrDefault();
            var form = new FormViewLoadEmployee(employee.GetEmployeeInfo(sy));

            form.ShowDialog();
        }
Exemplo n.º 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            string returnString = "Фамилия".PadRight(30) + "|" +
                                  "Должность".PadRight(20) + "|" +
                                  "Ставка".PadRight(10) + "|" +
                                  "Часов по ставке".PadRight(15) + "|" +
                                  "Факт. нагрузка".PadRight(14) + "|" +
                                  "Перегрузка".PadRight(10) + "|" +
                                  "Недогрузка".PadRight(10) + "|" + Environment.NewLine;

            decimal workloadForm = 0;
            decimal overload     = 0;
            decimal underload    = 0;
            decimal workloadFact = 0;

            List <Employee> employeeList = (from emp in _db.Employee
                                            where emp.NonActive == false
                                            select emp).ToList();

            foreach (Employee eisy in employeeList)
            {
                if (eisy.RateInHours != 0 ||
                    eisy.Overload != 0 ||
                    eisy.Underload != 0)
                {
                    returnString += eisy.Fio.PadRight(30) + "|" +
                                    eisy.Rate.First(r => r.SchoolYearID == Repository.SchoolYear).Post.Name.PadRight(20) + "|" +
                                    eisy.Rate.FirstOrDefault(x => x.SchoolYearID == Repository.SchoolYear).Rate1.ToString().PadRight(10) + "|" +
                                    eisy.RateInHours.ToString().PadLeft(15) + "|" +
                                    eisy.WorkLoad.ToString().PadLeft(15) + "|" +
                                    eisy.Overload.ToString().PadLeft(10) + "|" +
                                    eisy.Underload.ToString().PadLeft(10) + "|" + Environment.NewLine;

                    workloadForm += eisy.RateInHours;
                    overload     += eisy.Overload;
                    underload    += eisy.Underload;
                    workloadFact += eisy.WorkLoad;
                }
            }
            returnString += "\n";
            returnString += "ИТОГО: ".PadRight(30) + "|" +
                            "".PadRight(20) + "|" +
                            "".PadRight(10) + "|" +
                            workloadForm.ToString().PadLeft(15) + "|" +
                            workloadFact.ToString().PadLeft(15) + "|" +
                            overload.ToString().PadLeft(10) + "|" +
                            underload.ToString().PadLeft(10) + "|" + Environment.NewLine;

            FormViewLoadEmployee foemEditor = new FormViewLoadEmployee(returnString);

            foemEditor.ShowDialog();
        }
Exemplo n.º 3
0
        private void поРаспределеннойНагрузкиToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var str        = "";
            var collection = (from licp in _db.LoadInCoursePlan
                              join ciw in _db.CourseInWork on licp.CourseInWorkID equals ciw.ID
                              join sl in _db.SortLoad on licp.SortLoadID equals sl.Id
                              join slict in _db.SortLoadInCourseType on sl.Id equals slict.SortLoadID
                              join d in _db.Documents on ciw.DocumentId equals d.DocumentId
                              join ct in _db.CourseType on slict.CourseTypeID equals ct.Id
                              where d.CourseTypeInDocument.Any(x => x.CourseTypeId == ct.Id) &&
                              ciw.SchoolYearID == Repository.SchoolYear
                              select new
            {
                Plan = licp,
                Doc = d,
                Type = ct,
                Work = ciw
            });

            foreach (var item in collection.GroupBy(x => x.Doc))
            {
                str += item.Key.Name + "\r\n";
                foreach (var item2 in item.GroupBy(x => x.Type))
                {
                    str += "\t" + item2.Key.Name + "\r\n";
                    foreach (var item3 in item2.GroupBy(x => x.Work.FormStudy))
                    {
                        str += "\t\t" + (item3.Key == true ? "Очники" : "Заочники") + "\r\n";
                        foreach (var item4 in item3.GroupBy(x => x.Work.Semestr1))
                        {
                            str += string.Format("\t\t\t{0} семестр. \r\n\t\t\t\tПо плану: \t{1} часов. \r\n\t\t\t\tРаспределено: \t{2} часов.\r\n",
                                                 item4.Key?.Name ?? "---", item4.Sum(x => x.Plan.CountHours), item4.Sum(x => x.Plan.LoadInCourseFact.Sum(y => y.CountHours)));
                        }
                        str += string.Format("\t\t{0} / {1}\r\n", item3.Sum(x => x.Plan.CountHours), item3.Sum(x => x.Plan.LoadInCourseFact.Sum(y => y.CountHours)));
                    }
                    str += string.Format("\t{0} / {1}\r\n", item2.Sum(x => x.Plan.CountHours), item2.Sum(x => x.Plan.LoadInCourseFact.Sum(y => y.CountHours)));
                }
                str += string.Format("{0} / {1}\r\n\r\n", item.Sum(x => x.Plan.CountHours), item.Sum(x => x.Plan.LoadInCourseFact.Sum(y => y.CountHours)));
            }
            str += string.Format("Всего по плану {0} часов.\r\nРаспределено {1}",
                                 _db.LoadInCoursePlan.Where(p => p.CourseInWork.SchoolYearID == Repository.SchoolYear).Sum(x => x.CountHours),
                                 _db.LoadInCourseFact.Where(f => f.LoadInCoursePlan.CourseInWork.SchoolYearID == Repository.SchoolYear).Sum(x => x.CountHours));
            var form = new FormViewLoadEmployee(str);

            form.ShowDialog();
        }