private void LoadReport(YearViewModel yearModel, Employee employee)
        {
            _reportViewer.Reset();

            Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();

            IndPlan dataset = new IndPlan();

            dataset.BeginInit();
            reportDataSource1.Name  = "DataSet1"; //Name of the report dataset in our .RDLC file
            reportDataSource1.Value = dataset.DataTable5;
            _reportViewer.LocalReport.DataSources.Add(reportDataSource1);
            _reportViewer.LocalReport.ReportPath  = @"./Reports/Controls/PersonalPlan.rdlc";
            _reportViewer.LocalReport.DisplayName = "Индивидуальный план " + employee.FullName + " (" + yearModel.Name.Replace('/', '-') + ")";
            dataset.EndInit();

            var context = DbContextSingleton.GetContext();

            var year      = context.AcademicYears.FirstOrDefault(y => y.Id == yearModel.Id);
            var workflows = WorkflowStaticWorker.GetAllWorkflowByYear(context, yearModel.Id)
                            .Where(w => w.EmployeeId == employee.Id).ToList();
            var statics = context.StaticWorkflows
                          .Include(s => s.Employee).Include(s => s.Employee2).Include(s => s.Employee3).Include(s => s.Employee4).Include(s => s.Employee5)
                          .Include(s => s.Agreement).Include(s => s.Semester)
                          .Where(s => s.IsEnabled).ToList();

            statics = statics.Where(s => s.ContainsEmployeeById(employee.Id)).ToList();
            //var ext = statics.Select(s=>new ExtendedStaticWorkflow(s,year)).ToList();

            DatatableDataImporter.FillIndPlanDataset(dataset.DataTable5, workflows, statics.Select(s => new ExtendedStaticWorkflow(s, year)).ToList(), employee);

            _reportViewer.RefreshReport();
        }
Ejemplo n.º 2
0
        public ActionResult DeleteConfirmed(int author, int id)
        {
            IndPlan indPlan = db.IndPlan.Find(id, author);          //находим элемент плана

            db.IndPlan.Remove(indPlan);                             //удаляем
            db.SaveChanges();                                       //сохраняем изменения
            return(RedirectToAction("Index", new { id = author })); //и к списку
        }
Ejemplo n.º 3
0
 public ActionResult Edit([Bind(Include = "Id,AspirantId,WorkName,Size,DueDate,DoneMarker,Readiness,Year")] IndPlan indPlan)
 {
     if (ModelState.IsValid)                                                 //если все введено верно
     {
         db.Entry(indPlan).State = EntityState.Modified;                     //состояние - изменено
         db.SaveChanges();                                                   //накатываем изменения
         return(RedirectToAction("Index", new { id = indPlan.AspirantId })); //и к списку
     }
     ViewBag.AspirantId = indPlan.AspirantId;                                //иначе
     return(View(indPlan));                                                  //все снова
 }
Ejemplo n.º 4
0
        public ActionResult Create([Bind(Include = "Id,AspirantId,WorkName,Size,DueDate,DoneMarker,Readiness,Year")] IndPlan indPlan)
        {
            if (ModelState.IsValid)                                                 //Если все введено верно
            {
                db.IndPlan.Add(indPlan);                                            //добавляем элемент плана
                db.SaveChanges();                                                   //накатываем изменения
                return(RedirectToAction("Index", new { id = indPlan.AspirantId })); //и к списку
            }

            ViewBag.AspirantId = indPlan.AspirantId; //иначе
            return(View(indPlan));                   //все по-новой
        }
Ejemplo n.º 5
0
        public ActionResult Edit(int?author, int?id)
        {
            if (id == null || author == null || !db.Aspirant.Any(x => x.Pass == author)) //если нет такого
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));             //автора или плана - ошибка!
            }
            IndPlan indPlan = db.IndPlan.Find(id, author);                               //ищем элемент плана

            if (indPlan == null)                                                         //не нашли?
            {
                return(HttpNotFound());                                                  //ошибка!
            }
            ViewBag.AspirantId = author;                                                 //передаем в представление
            return(View(indPlan));
        }
Ejemplo n.º 6
0
        public ActionResult Delete(int?author, int?id)
        {
            if (id == null || author == null || !db.Aspirant.Any(x => x.Pass == author)) //если нет такого
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));             //автора или плана - ошибка!
            }
            IndPlan indPlan = db.IndPlan.Find(id, author);                               //ищем элемент плана

            if (indPlan == null)                                                         //не нашли?
            {
                return(HttpNotFound());                                                  //ошибка!
            }
            ObjectParameter output = new ObjectParameter("result", typeof(string));

            db.JoinNames("Aspirant", id, output);
            ViewBag.Aspirant = (string)output.Value;//имя-фамилию своей процедурой передаем в представление
            return(View(indPlan));
        }