//[ValidateAntiForgeryToken] public async Task <IActionResult> Create(ReportNoteView reportNoteView) //[Bind("Id,Students,Tests,Note")] { var res = reportNoteView; ReportNote reportNote = new ReportNote { Student = this.repository.GetStudentId(reportNoteView.Student), Test = this.repository.GetTestId(reportNoteView.Test), Note = reportNoteView.Note }; if (ModelState.IsValid) { //Se valida que no repita el Test IEnumerable <ReportNote> report = this.repository.GetIdSumary(reportNote.Student.Id); var newTest = report.Where(r => r.Test.Id == reportNote.Test.Id).FirstOrDefault(); if (newTest == null) { this.repository.AddReportNote(reportNote); await repository.SaveAllAsync(); return(RedirectToAction(nameof(Index))); } } ViewBag.Message = "Test registered!"; reportNoteView.Tests = new SelectList(this.repository.GetTests(), "Id", "Name"); reportNoteView.Students = new SelectList(this.repository.GetStudents(), "Id", "Name"); return(View(reportNoteView)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Note")] ReportNote reportNote) { if (id != reportNote.Id) { return(NotFound()); } if (ModelState.IsValid) { try { this.repository.UpdateReportNotes(reportNote); await this.repository.SaveAllAsync(); } catch (DbUpdateConcurrencyException) { if (!ReportNoteExists(reportNote.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(reportNote)); }
public void TestReportNote() { var model = new EfDatabaseAutomation.Automation.BaseLogica.ModelGetPost.ModelGetPost(); var card = model.CardUi("7810942860", 2021); ReportNote report = new ReportNote(); report.CreateDocument(@"D:\", card, 2021); }
public void TestReportNote() { var model = new EfDatabaseAutomation.Automation.BaseLogica.ModelGetPost.ModelGetPost(); var card = model.CardUi("5258111850"); ReportNote report = new ReportNote(); report.CreateDocum(@"D:\", card, null); }
/// <summary> /// Генерация докладной записки ЮЛ /// </summary> /// <param name="innUl">ИНН ЮЛ</param> /// <param name="year">Год отчета выгрузки</param> /// <returns></returns> public async Task <Stream> GenerateNoteReportUl(string innUl, int year) { return(await Task.Factory.StartNew(() => { try { var model = new ModelGetPost(); var card = model.CardUi(innUl, year); model.Dispose(); if (card != null) { ReportNote report = new ReportNote(); report.CreateDocument(_parameterConfig.PathSaveTemplate, card, year); return report.FileArray(); } } catch (Exception ex) { Loggers.Log4NetLogger.Error(ex); } return null; })); }
public void RemoveReportNote(ReportNote reportNote) { this.context.Remove(reportNote); }
public void UpdateReportNotes(ReportNote reportNote) { this.context.Update(reportNote); }
public void AddReportNote(ReportNote reportNote) { this.context.ReportNote.Add(reportNote); }
public bool SaveNote(ReportNote note) { string sql = note.GetInsertSql(); return(CommonRepository.ExtInsert <ReportNote>(sql, SqlConnString, note)); }