public async Task <ActionResult <Auditory> > PostAuditory(Auditory auditory) { _context.Auditories.Add(auditory); await _context.SaveChangesAsync(); return(CreatedAtAction("GetAuditory", new { id = auditory.Id }, auditory)); }
/// <summary>Begin page running after session validations</summary> private void Go() { this.user = Session["User"] as ApplicationUser; this.company = Session["company"] as Company; this.Dictionary = Session["Dictionary"] as Dictionary <string, string>; // Security access control if (!this.user.HasGrantToRead(ApplicationGrant.Questionary)) { this.Response.Redirect("NoPrivileges.aspx", Constant.EndResponse); Context.ApplicationInstance.CompleteRequest(); } // Parameters control if (this.Request.QueryString["c"] != null) { this.questionnaireId = Convert.ToInt32(this.Request.QueryString["c"]); } this.Auditory = Auditory.Empty; if (this.Request.QueryString["a"] != null) { this.auditoryId = Convert.ToInt32(this.Request.QueryString["a"]); this.Auditory = Auditory.ById(this.auditoryId, this.company.Id); } this.master = this.Master as Giso; this.master.AdminPage = true; string serverPath = this.Request.Url.AbsoluteUri.Replace(this.Request.RawUrl.Substring(1), string.Empty); this.formFooter = new FormFooter(); if (this.questionnaireId > 0) { this.Questionary = Questionary.ById(this.questionnaireId, this.company.Id); if (this.Questionary.CompanyId != this.company.Id) { this.Response.Redirect("NoAccesible.aspx", Constant.EndResponse); Context.ApplicationInstance.CompleteRequest(); } this.formFooter.ModifiedBy = this.Questionary.ModifiedBy.Description; this.formFooter.ModifiedOn = this.Questionary.ModifiedOn; this.master.TitleInvariant = true; this.observations = AuditoryCuestionarioObservations.ById(this.questionnaireId, this.auditoryId, this.company.Id); } else { this.Questionary = Questionary.Empty; } string label = this.questionnaireId == -1 ? "Item_Questionary_BreadCrumb_Edit" : string.Format("{0}: <strong>{1}</strong>", this.Dictionary["Item_Questionary"], this.Questionary.Description); this.master.AddBreadCrumb("Item_Questionaries", "QuestionaryList.aspx", Constant.NotLeaft); this.master.AddBreadCrumb("Item_Questionary_BreadCrumb_Edit"); this.master.Titulo = label; this.FillLists(); }
//TODO: Tests! Specifically testing when // 1. an update has a negative vs positive value, // 2. and are all senses updated virtual public void UpdateFrom(SensoryDisplay other) { Visual.UpdateFrom(other.Visual); Auditory.UpdateFrom(other.Auditory); Smell.UpdateFrom(other.Smell); Taste.UpdateFrom(other.Taste); }
public async Task <IActionResult> PutAuditory(int id, Auditory auditory) { if (id != auditory.Id) { return(BadRequest()); } _context.Entry(auditory).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AuditoryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void Edit(string newNumber, int rowId) { if (check.Firmness(newNumber) && check.TexboxValidation(newNumber)) { try { Auditory newRow = new Auditory(newNumber); var equalRecords = DB.Auditories.Where(l => l.Number.Equals(newNumber)); if (equalRecords.Any()) { MessageBox.Show("Такая аудитория уже существует в базе", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var EditedValue = DB.Auditories.Where(c => c.Id == rowId) .FirstOrDefault(); EditedValue.Number = newNumber; DB.SaveChanges(); } } catch (Exception ex) { MessageBox.Show("Произошла ошибка редактирования\n" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public IHttpActionResult UpdateAuditory([FromBody] Auditory auditory) { try { if (auditory.Id < 0 || auditory.Number < 0) { var auditories = Models.DataContexts.Context.SmartSchedulerContext.Instance.Auditories.AllAuditories; var indexes = (from item in auditories where item.Id == auditory.Id select item).ToList(); if (indexes.Count == 0) { return(NotFound()); } if (indexes.Count == 1) { indexes = (from item in auditories where item.Number == auditory.Number select item).ToList(); if (indexes.Count == 0) { Models.DataContexts.Context.SmartSchedulerContext.Instance.Auditories.UpdateAuditory(auditory.Id, auditory.Number); return(Ok()); } } return(BadRequest()); } return(BadRequest()); } catch (Exception e) { return(BadRequest()); } }
public void Edit(string discipline, string group, string auditory, int index) { var findDiscipline = DB.Disciplines.Where(l => l.Name == discipline); var findGroup = DB.Groups.Where(l => l.Name == group); var findAuditory = DB.Auditories.Where(l => l.Number == auditory); if (findDiscipline.Any() && findAuditory.Any() && findGroup.Any()) { try { Discipline lessonDiscipline = findDiscipline.FirstOrDefault(); Group lessonGroup = findGroup.FirstOrDefault(); Auditory lessonAuditory = findAuditory.FirstOrDefault(); var EditedValue = DB.Lessons.Where(c => c.Id == index) .FirstOrDefault(); EditedValue.Discipline = lessonDiscipline; EditedValue.Group = lessonGroup; EditedValue.Auditory = lessonAuditory; DB.SaveChanges(); } catch (Exception ex) { MessageBox.Show("Произошла ошибка редактирования\n" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public ActionResult DeleteConfirmed(int id) { Auditory auditory = db.Auditory.Find(id); db.Auditory.Remove(auditory); db.SaveChanges(); return(RedirectToAction("Index")); }
public object Clone() { SensoryFeature visual = (SensoryFeature)Visual.Clone(); SensoryFeature auditory = (SensoryFeature)Auditory.Clone(); SensoryFeature smell = (SensoryFeature)Smell.Clone(); SensoryFeature taste = (SensoryFeature)Taste.Clone(); return(new SensoryDisplay(visual, auditory, smell, taste)); }
public ActionResult Edit([Bind(Include = "AuditoryID,AuditoryNumber")] Auditory auditory) { if (ModelState.IsValid) { db.Entry(auditory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(auditory)); }
public ActionResult Create([Bind(Include = "AuditoryID,AuditoryNumber")] Auditory auditory) { if (ModelState.IsValid) { db.Auditory.Add(auditory); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(auditory)); }
public IActionResult Create(int id, Auditory auditory) { if (ModelState.IsValid) { auditory.FloorId = id; auditoryRepo.Create(auditory); return(RedirectToAction("Index", new { id })); } return(View()); }
public ActionResult Edit(Auditory auditory) { var dublicate = _db.Auditories.IsDublicate(auditory); if (ModelState.IsValid && !dublicate) { _db.Auditories.Edit(auditory); _db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.IsDublicate = dublicate; return(View(auditory)); }
public void DeleteByIndex(int index) { try { Auditory DelitedValue = DB.Auditories.Where(l => l.Id == index).FirstOrDefault(); DB.Auditories.Remove(DelitedValue); DB.SaveChanges(); } catch (Exception ex) { MessageBox.Show("Произошла ошибка удаления\n" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void DeleteLast() { try { Auditory DelitedValue = DB.Auditories.Last(); DB.Auditories.Remove(DelitedValue); DB.SaveChanges(); } catch (Exception ex) { MessageBox.Show("Произошла ошибка удаления\n" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// GET: Auditories/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Auditory auditory = db.Auditory.Find(id); if (auditory == null) { return(HttpNotFound()); } return(View(auditory)); }
public OperationResult saveAuditory(Auditory auditory) { // Guarda UN SÓLO registro en la tabla TransDocumento try { this.add_TransDocumento("[ifsDocsN4].[add_TransDocumento]", auditory); return(new Core.Domain.OperationResult()); } catch (Exception ex) { _iLogService.Error(ex.Message); return(null); } }
public ActionResult Edit([Bind(Include = "Id,Name,Capacity,Address,Description")] Auditory auditory) { if (ModelState.IsValid) { auditoryService.Edit(new AuditoryDTO { Id = auditory.Id, Address = auditory.Address, Capacity = auditory.Capacity, Description = auditory.Description, Name = auditory.Name }); return(RedirectToAction("Index")); } return(View(auditory)); }
public ActionResult ReportData(long id, int companyId) { var res = "{\"Cuestionarios\":["; res += Auditory.RenderCuestionarios(id, companyId); res += "],\"Founds\":"; res += AuditoryCuestionarioFound.JsonList(AuditoryCuestionarioFound.ByAuditory(id, companyId)); res += ",\"Improvements\":"; res += AuditoryCuestionarioImprovement.JsonList(AuditoryCuestionarioImprovement.ByAuditory(id, companyId)); res += "}"; return(new ActionResult { Success = true, ReturnValue = res, MessageError = string.Empty }); }
public void AuditoryHelp() { var auditory = new Auditory(); var auditoryVoteResults = new int[4]; var correctAnswerIndex = 0; var random = new Random(DateTime.Now.Millisecond); var successPercent = 0; switch (_activeQuestion.Difficult) { case QuestionDifficult.Easy: successPercent = 30; break; case QuestionDifficult.Medium: successPercent = 20; break; case QuestionDifficult.Expert: successPercent = 10; break; } for (var i = 0; i < _buttons.Length; ++i) { if ((QuestionResult)_buttons[i].Tag == QuestionResult.Correct) { auditoryVoteResults[i] += successPercent; correctAnswerIndex = i; break; } } for (var i = 0; i < 100 - successPercent; ++i) { var tmpIndex = random.Next(0, 4); ++auditoryVoteResults[tmpIndex]; } auditory.SetVoteResult(auditoryVoteResults); _gameForm.Controls["buttonAuditoryHelp"].Enabled = false; auditory.ShowDialog(); }
public IHttpActionResult DeleteAuditory([FromBody] Auditory auditory) { try { if (auditory.Id < 0 || auditory.Number < 0) { if (Models.DataContexts.Context.SmartSchedulerContext.Instance.Auditories.DeleteAuditory(auditory.Id)) { return(Ok()); } return(NotFound()); } return(BadRequest()); } catch (Exception e) { return(BadRequest()); } }
public string GetFilter(int companyId, DateTime?from, DateTime?to, bool interna, bool externa, bool provider, bool status0, bool status1, bool status2, bool status3, bool status4, bool status5) { var filter = new StringBuilder("{"); filter.Append(Tools.JsonPair("companyId", companyId)).Append(","); filter.Append(Tools.JsonPair("from", from)).Append(","); filter.Append(Tools.JsonPair("to", to)).Append(","); filter.Append(Tools.JsonPair("interna", interna)).Append(","); filter.Append(Tools.JsonPair("externa", externa)).Append(","); filter.Append(Tools.JsonPair("provider", provider)).Append(","); filter.Append(Tools.JsonPair("status0", status0)).Append(","); filter.Append(Tools.JsonPair("status1", status1)).Append(","); filter.Append(Tools.JsonPair("status2", status2)).Append(","); filter.Append(Tools.JsonPair("status3", status3)).Append(","); filter.Append(Tools.JsonPair("status4", status4)).Append(","); filter.Append(Tools.JsonPair("status5", status5)).Append("}"); Session["AuditoryFilter"] = filter.ToString(); return(Auditory.FilterList(companyId, from, to, interna, externa, provider, status0, status1, status2, status3, status4, status5)); }
public OperationResult saveAuditory(Auditory auditory) { /* * Author Billy Arredondo * Create date 02-feb-2017 * Modify date 02-feb-2017 * Function Ingresar a la tabla TRAMA_IFS_P un sólo registro. * El registro está modelado por LineH */ // Guarda UN SÓLO registro en la tabla TransDocumento try { this.add_TransDocumento("[ifsDocsMost].[add_TransDocumento]", auditory); return(new OperationResult()); } catch (Exception ex) { _iLogService.Error(ex.Message); return(null); } }
// GET: Auditories/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var auditoryDTO = auditoryService.Get(id); Auditory auditory = new Auditory { Id = auditoryDTO.Id, Address = auditoryDTO.Address, Capacity = auditoryDTO.Capacity, Description = auditoryDTO.Description, Name = auditoryDTO.Name }; if (auditory == null) { return(HttpNotFound()); } return(View(auditory)); }
public ActionResult Insert(Auditory auditory, bool toPlanned, string rules, int applicationUserId) { foreach (var ruleId in rules.Split('|')) { if (!string.IsNullOrEmpty(ruleId)) { auditory.AddRule(Convert.ToInt64(ruleId)); } } var res = auditory.Insert(applicationUserId, auditory.CompanyId); if (res.Success && toPlanned && auditory.Type != 1) { var resPlanned = Auditory.SetQuestionaries(auditory.Id, applicationUserId); if (!resPlanned.Success) { res.SetFail(resPlanned.MessageError); } } return(res); }
public void Add(string discipline, string group, string auditory, bool lecture) { var findDiscipline = DB.Disciplines.Where(l => l.Name == discipline); var findGroup = DB.Groups.Where(l => l.Name == group); var findAuditory = DB.Auditories.Where(l => l.Number == auditory); if (findDiscipline.Any() && findAuditory.Any() && findGroup.Any()) { try { Discipline lessonDiscipline = findDiscipline.FirstOrDefault(); Group lessonGroup = findGroup.FirstOrDefault(); Auditory lessonAuditory = findAuditory.FirstOrDefault(); Lesson newRow = new Lesson(lessonDiscipline, lessonGroup, lessonAuditory, lecture); DB.Lessons.Add(newRow); DB.SaveChanges(); } catch (Exception ex) { MessageBox.Show("Произошла ошибка добавления\n" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void add_TransDocumento(string SPName, Auditory auditory) { try { // Agregamos los parámetros this.addInParameter("@EST_DOC", auditory.est_doc); this.addInParameter("@FEC_AUD", auditory.fec_aud); this.addInParameter("@FEC_DOC", auditory.fec_doc); this.addInParameter("@NRO_DOC", auditory.nro_doc); this.addInParameter("@TIP_DOC", auditory.tip_doc); this.addInParameter("@USR_AUD", auditory.usr_aud); this.addInParameter("@EST_AUD", auditory.est_aud); this.addInParameter("@DES_FIL", auditory.des_fil); this.addInParameter("@EST_FIL", auditory.est_fil); this.addInParameter("@ORI_DOC", auditory.ori_doc); // Ejecutamos el método this.executeSPWithoutResults(SPName); } catch (Exception ex) { throw ex; } }
public void Add(string newNumber) { if (check.Firmness(newNumber) && check.TexboxValidation(newNumber)) { try { Auditory newRow = new Auditory(newNumber); var equalRecords = DB.Auditories.Where(l => l.Number.Equals(newNumber)); if (equalRecords.Any()) { MessageBox.Show("Такая аудитория уже существует в базе", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DB.Auditories.Add(newRow); DB.SaveChanges(); } } catch (Exception ex) { MessageBox.Show("Произошла ошибка добавления\n" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
//TODO: //int Auditory.number; //int Grou.number; //int BeginTime.number; //List<string> Group.pgs(1); //List<int> Group.pgi(1); //List<string> Group.grs(1); //List<int> Group.gri(1); //List<string> Group.sgs(1); //List<int> Group.sgi(1); static void Main(string[] args) { //Количество файлов int N = 3;//Number files //Список файлов string[] file = new string[] { "group_kol.txt", "aud_mest.txt", "par_nach.txt" }; //Массив файлов MyFile[] bp = new MyFile[N]; for (int i = 0; i < N; i++) { bp[i] = new MyFile(); bp[i].SetVar(file[i]); } /*********************************************************************************/ //START creating an array of abstract classes //Массив групп из файла Group[] g = new Group[bp[0].RetNumberLines()]; for (int j = 0; j < bp[0].RetNumberLines(); j++) { g[j] = new Group(); g[j].SetVar(bp[0], j); } //Массив аудиторий из файла Auditory[] a = new Auditory[bp[1].RetNumberLines()]; for (int j = 0; j < bp[1].RetNumberLines(); j++) { a[j] = new Auditory(); a[j].SetVar(bp[1], j); } //Массив начала пары из группы BeginTime[] t = new BeginTime[bp[2].RetNumberLines()]; for (int j = 0; j < bp[2].RetNumberLines(); j++) { t[j] = new BeginTime(); t[j].SetVar(bp[2], j); } //END creating an array of abstract classes /*********************************************************************************/ /*********************************************************************************/ //START constructor class Filling //Выбор подсчета по потокам или семинарам Console.WriteLine("Enter potok\'p\' or Seminar \'s\':"); char ch;// = 'p';//s or p do { ch = Console.ReadKey().KeyChar; } while (ch != 'p' && ch != 's'); Console.WriteLine(); //Заполнение аудиторий Filling1 Fil = new Filling1(); Fil.SetVar(a, t, g); Fil.Var(ch); Fil.GetVec(); Fil.SetMass(); closeAnswer(Fil); //END constructor class Filling /*********************************************************************************/ /*********************************************************************************/ //START free dynamic memory /*else { * cout << "Goodby. Some file not open!"; * }*/ ////END free dynamic memory /*********************************************************************************/ }
void Awake() { //set the caches correctly weaponController = GetComponent<AIWeaponController>(); movementManager = GetComponent<AIMovementSwitcher>(); coverManager = GetComponent<SearchCover>(); sightManager = sight.GetComponent<Sight>(); earsManager = ears.GetComponent<Auditory>(); patrolM = patrolManager.GetComponent<PatrolManager>(); //at the start the current state is patroling currentState = CurrentState.patrol; //and the engagment is set to free engagementStatus = EngagementState.free; //some variables that we will later use for reference initFreezeTime = freezeTime; initShockTime = shockTime; initFOV = sightManager.fieldOfView; initChanceForFight = chanceForFight; initFear = fear; audioControl = GetComponent<ShooterAIAudioControl>(); if(GetComponent<NavMeshAgent>() != null) { initHeight = GetComponent<NavMeshAgent>().height; } initYScale = GetComponentInChildren<HealthManager>().gameObject.transform.localScale.y; movement = movementManager; //anti-bottlenecking procedure enemyDistanceCheckFrameBarrier += Random.Range(-30f, 30f); //find the health manager automatically healthManager = GetComponentInChildren<HealthManager>().gameObject; //setup multiple weapons correctly otherWeapons.Add( weaponController.weaponHoldingObject ); otherWeaponsMelee.Add( meleeAttackUsed ); }
protected void Page_Load(object sender, EventArgs e) { long auditoryId = Convert.ToInt64(Request.QueryString["id"]); int companyId = Convert.ToInt32(Request.QueryString["companyId"]); var company = new Company(companyId); var res = ActionResult.NoAction; var user = HttpContext.Current.Session["User"] as ApplicationUser; var dictionary = HttpContext.Current.Session["Dictionary"] as Dictionary <string, string>; var auditory = Auditory.ById(auditoryId, user.CompanyId); string path = HttpContext.Current.Request.PhysicalApplicationPath; if (!path.EndsWith(@"\", StringComparison.OrdinalIgnoreCase)) { path = string.Format(CultureInfo.InvariantCulture, @"{0}\", path); } string formatedDescription = auditory.Description.Replace("?", string.Empty); formatedDescription = formatedDescription.Replace("#", string.Empty); formatedDescription = formatedDescription.Replace("/", string.Empty); formatedDescription = formatedDescription.Replace("\\", string.Empty); formatedDescription = formatedDescription.Replace(":", string.Empty); formatedDescription = formatedDescription.Replace(";", string.Empty); formatedDescription = formatedDescription.Replace(".", string.Empty); string fileName = string.Format( CultureInfo.InvariantCulture, @"{0}_{1}_Data_{2:yyyyMMddhhmmss}.pdf", dictionary["Item_Auditory"], formatedDescription, DateTime.Now); // FONTS var pathFonts = HttpContext.Current.Request.PhysicalApplicationPath; if (!path.EndsWith(@"\", StringComparison.OrdinalIgnoreCase)) { pathFonts = string.Format(CultureInfo.InstalledUICulture, @"{0}\", pathFonts); } this.headerFont = BaseFont.CreateFont(string.Format(CultureInfo.InvariantCulture, @"{0}fonts\ARIAL.TTF", pathFonts), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); this.arial = BaseFont.CreateFont(string.Format(CultureInfo.InvariantCulture, @"{0}fonts\ARIAL.TTF", pathFonts), BaseFont.IDENTITY_H, BaseFont.EMBEDDED); var descriptionFont = new Font(this.headerFont, 12, Font.BOLD, BaseColor.BLACK); var document = new iTextSharp.text.Document(PageSize.A4, 40, 40, 65, 55); var writer = PdfWriter.GetInstance(document, new FileStream(Request.PhysicalApplicationPath + "\\Temp\\" + fileName, FileMode.Create)); var pageEventHandler = new TwoColumnHeaderFooter() { CompanyLogo = string.Format(CultureInfo.InvariantCulture, @"{0}\images\logos\{1}.jpg", path, companyId), IssusLogo = string.Format(CultureInfo.InvariantCulture, "{0}issus.png", path), Date = string.Format(CultureInfo.InvariantCulture, "{0:dd/MM/yyyy}", DateTime.Now), CreatedBy = string.Format(CultureInfo.InvariantCulture, "{0}", user.UserName), CompanyId = auditory.CompanyId, CompanyName = company.Name, Title = dictionary["Item_Auditory"] }; writer.PageEvent = pageEventHandler; document.Open(); #region Dades bàsiques // Ficha pincipal var planning = AuditoryPlanning.ByAuditory(auditory.Id, auditory.CompanyId); var table = new PdfPTable(4) { WidthPercentage = 100, HorizontalAlignment = 0 }; table.SetWidths(new float[] { 30f, 50f, 30f, 50f }); table.AddCell(new PdfPCell(new Phrase(auditory.Description, descriptionFont)) { Colspan = 4, Border = Rectangle.NO_BORDER, PaddingTop = 20f, PaddingBottom = 20f, HorizontalAlignment = Element.ALIGN_CENTER }); table.AddCell(TitleLabel(dictionary["Item_Auditory_Label_Type"])); table.AddCell(TitleData(dictionary["Item_Adutory_Type_Label_" + auditory.Type.ToString()])); if (auditory.Provider.Id > 0) { table.AddCell(TitleLabel(dictionary["Item_Auditory_Label_Provider"])); table.AddCell(TitleData(auditory.Provider.Description)); } else if (auditory.Customer.Id > 0) { table.AddCell(TitleLabel(dictionary["Item_Auditory_Label_Customer"])); table.AddCell(TitleData(auditory.Customer.Description)); } else { table.AddCell(TitleData(string.Empty, 2)); } table.AddCell(TitleLabel(dictionary["Item_Auditory_Label_Rules"])); var rulesText = string.Empty; bool firstRule = true; foreach (var rule in auditory.Rules) { if (firstRule) { firstRule = false; } else { rulesText += ", "; } rulesText += rule.Description; } table.AddCell(TitleData(rulesText, 3)); var previewDateText = string.Empty; if (planning != null && planning.Count > 0) { previewDateText = string.Format(CultureInfo.InvariantCulture, "{0:dd/MM/yyyy}", planning.OrderBy(p => p.Date).First().Date); } table.AddCell(TitleLabel(dictionary["Item_Auditory_Label_InternalResponsible"])); table.AddCell(TitleData(auditory.InternalResponsible.FullName, 3)); //table.AddCell(TitleLabel(dictionary["Item_Auditory_Label_PannedDate"])); //table.AddCell(TitleData(previewDateText)); table.AddCell(TitleLabel(dictionary["Item_Audiotry_PDF_Planned"])); if (auditory.PlannedBy.Id > 0) { var planningText = string.Format( CultureInfo.InvariantCulture, "{0} {1} {2}", auditory.PlannedBy.FullName, dictionary["Item_Auditory_PDF_Label_date"], string.Format(CultureInfo.InvariantCulture, "{0:dd/MM/yyyy}", auditory.PlannedOn) ?? "-"); table.AddCell(TitleData(planningText, 3)); } else { table.AddCell(TitleData(string.Empty, 3)); } //table.AddCell(TitleLabel(dictionary["Item_Auditory_Label_PlanningDate"])); //table.AddCell(TitleData(string.Format(CultureInfo.InvariantCulture, "{0:dd/MM/yyyy}", auditory.PlannedOn) ?? "-")); table.AddCell(TitleLabel(dictionary["Item_Auditory_PDF_Closing"])); if (auditory.ClosedBy.Employee.Id > 0) { var closedText = string.Format( CultureInfo.InvariantCulture, "{0} {1} {2}", auditory.ClosedBy.Employee.FullName, dictionary["Item_Auditory_PDF_Label_date"], string.Format(CultureInfo.InvariantCulture, "{0:dd/MM/yyyy}", auditory.ClosedOn) ?? "-"); table.AddCell(TitleData(closedText, 3)); } else { table.AddCell(TitleData(string.Empty, 3)); } //table.AddCell(TitleLabel(dictionary["Item_Auditory_Label_ClosedOn"])); //table.AddCell(TitleData(string.Format(CultureInfo.InvariantCulture, "{0:dd/MM/yyyy}", auditory.ClosedOn) ?? "-")); table.AddCell(TitleLabel(dictionary["Item_Auditory_PDF_Validation"])); if (auditory.ValidatedBy.Id > 0) { var validatedText = string.Format( CultureInfo.InvariantCulture, "{0} {1} {2}", auditory.ValidatedBy.FullName, dictionary["Item_Auditory_PDF_Label_date"], string.Format(CultureInfo.InvariantCulture, "{0:dd/MM/yyyy}", auditory.ValidatedOn) ?? "-"); table.AddCell(TitleData(validatedText, 3)); } else { table.AddCell(TitleData(string.Empty, 3)); } //table.AddCell(TitleLabel(dictionary["Item_Auditory_Label_ValidatedOn"])); //table.AddCell(TitleData(string.Format(CultureInfo.InvariantCulture, "{0:dd/MM/yyyy}", auditory.ValidatedOn) ?? "-")); table.AddCell(TitleLabel(dictionary["Item_Auditory_Label_Scope"])); table.AddCell(TitleData(auditory.Scope, 3)); table.AddCell(TitleLabel(dictionary["Item_Auditory_Label_Address"])); table.AddCell(TitleData(auditory.EnterpriseAddress, 3)); table.AddCell(TitleLabel(dictionary["Item_Auditory_Label_Notes"])); table.AddCell(TitleData(string.IsNullOrEmpty(auditory.Notes.Trim()) ? "-" : auditory.Notes, 3)); document.Add(table); #endregion if (auditory.Status > 2) { var widthsPlanning = new float[] { 30f, 20f, 25f, 60f, 60f, 60f }; var tablePlanning = new PdfPTable(widthsPlanning.Length) { WidthPercentage = 100, HorizontalAlignment = 0 }; tablePlanning.SetWidths(widthsPlanning); tablePlanning.AddCell(new PdfPCell(new Phrase(dictionary["Item_Auditory_PlanningTable_Title"], descriptionFont)) { Colspan = 6, Border = Rectangle.NO_BORDER, PaddingTop = 20f, PaddingBottom = 20f, HorizontalAlignment = Element.ALIGN_CENTER }); tablePlanning.AddCell(ToolsPdf.HeaderCell(dictionary["Item_AuditoryPlanning_Header_Date"])); tablePlanning.AddCell(ToolsPdf.HeaderCell(dictionary["Item_AuditoryPlanning_Header_Hour"])); tablePlanning.AddCell(ToolsPdf.HeaderCell(dictionary["Item_AuditoryPlanning_Header_Duration"])); tablePlanning.AddCell(ToolsPdf.HeaderCell(dictionary["Item_AuditoryPlanning_Header_Process"])); tablePlanning.AddCell(ToolsPdf.HeaderCell(dictionary["Item_AuditoryPlanning_Header_Auditor"])); tablePlanning.AddCell(ToolsPdf.HeaderCell(dictionary["Item_AuditoryPlanning_Header_Audited"])); foreach (var pla in planning) { var hourText = string.Empty; var hours = 0; var minutes = pla.Hour; while (minutes > 59) { hours++; minutes -= 60; } hourText = string.Format(CultureInfo.InvariantCulture, "{0:0}:{1:00}", hours, minutes); var auditedText = pla.ProviderName; if (string.IsNullOrEmpty(auditedText)) { auditedText = pla.Audited.FullName; } tablePlanning.AddCell(ToolsPdf.DataCellCenter(pla.Date)); tablePlanning.AddCell(ToolsPdf.DataCellCenter(hourText)); tablePlanning.AddCell(ToolsPdf.DataCellCenter(pla.Duration)); tablePlanning.AddCell(ToolsPdf.DataCell(pla.Process.Description)); tablePlanning.AddCell(ToolsPdf.DataCell(pla.Auditor.Description)); tablePlanning.AddCell(ToolsPdf.DataCell(auditedText)); } document.Add(tablePlanning); document.SetPageSize(PageSize.A4.Rotate()); document.NewPage(); var widthsTroballes = new float[] { 30f, 30f, 20f, 8f }; var tableTroballes = new PdfPTable(widthsTroballes.Length) { WidthPercentage = 100, HorizontalAlignment = 0 }; tableTroballes.SetWidths(widthsTroballes); tableTroballes.AddCell(new PdfPCell(new Phrase(dictionary["Item_Auditory_Title_Found"], descriptionFont)) { Colspan = 4, Border = Rectangle.NO_BORDER, PaddingTop = 20f, PaddingBottom = 20f, HorizontalAlignment = Element.ALIGN_CENTER }); tableTroballes.AddCell(ToolsPdf.HeaderCell(dictionary["Item_Auditory_Header_Found"])); tableTroballes.AddCell(ToolsPdf.HeaderCell(dictionary["Item_Auditory_Header_Requirement"])); tableTroballes.AddCell(ToolsPdf.HeaderCell(dictionary["Item_Auditory_Header_Result"])); tableTroballes.AddCell(ToolsPdf.HeaderCell(dictionary["Item_Auditory_Header_Action"])); var troballes = AuditoryCuestionarioFound.ByAuditory(auditory.Id, auditory.CompanyId); foreach (var troballa in troballes) { tableTroballes.AddCell(ToolsPdf.DataCell(troballa.Text)); tableTroballes.AddCell(ToolsPdf.DataCell(troballa.Requeriment)); tableTroballes.AddCell(ToolsPdf.DataCell(troballa.Unconformity)); tableTroballes.AddCell(ToolsPdf.DataCell(troballa.Action ? dictionary["Common_Yes"] : dictionary["Common_No"])); } document.Add(tableTroballes); var widthsMillores = new float[] { 80f, 8f }; var tableMillores = new PdfPTable(widthsMillores.Length) { WidthPercentage = 100, HorizontalAlignment = 0 }; tableMillores.SetWidths(widthsMillores); tableMillores.AddCell(new PdfPCell(new Phrase(dictionary["Item_Auditory_Title_Improvements"], descriptionFont)) { Colspan = 4, Border = Rectangle.NO_BORDER, PaddingTop = 20f, PaddingBottom = 20f, HorizontalAlignment = Element.ALIGN_CENTER }); tableMillores.AddCell(ToolsPdf.HeaderCell(dictionary["Item_Auditory_Header_Improvement"])); tableMillores.AddCell(ToolsPdf.HeaderCell(dictionary["Item_Auditory_Header_Action"])); var millores = AuditoryCuestionarioImprovement.ByAuditory(auditory.Id, auditory.CompanyId); foreach (var millora in millores) { tableMillores.AddCell(ToolsPdf.DataCell(millora.Text)); tableMillores.AddCell(ToolsPdf.DataCell(millora.Action ? dictionary["Common_Yes"] : dictionary["Common_No"])); } document.Add(tableMillores); if (!string.IsNullOrEmpty(auditory.PuntosFuertes.Trim())) { document.Add(new Phrase(Environment.NewLine)); document.Add(new Phrase(dictionary["Item_Auditory_Label_PuntosFuertes"], new Font(this.arial, 10, Font.BOLD, BaseColor.BLACK))); document.Add(new Phrase(Environment.NewLine)); document.Add(new Phrase(auditory.PuntosFuertes)); } var actions = IncidentAction.ByAuditoryId(auditory.Id, auditory.CompanyId); if (actions != null && actions.Count > 0) { document.SetPageSize(PageSize.A4.Rotate()); document.NewPage(); var widthsActions = new float[] { 8f, 80f }; var tableActions = new PdfPTable(widthsActions.Length) { WidthPercentage = 100, HorizontalAlignment = 0 }; tableActions.SetWidths(widthsActions); tableActions.AddCell(new PdfPCell(new Phrase(dictionary["Item_IncidentActions"], descriptionFont)) { Colspan = 4, Border = Rectangle.NO_BORDER, PaddingTop = 20f, PaddingBottom = 20f, HorizontalAlignment = Element.ALIGN_CENTER }); tableActions.AddCell(ToolsPdf.HeaderCell(dictionary["Item_IncidentAction_Header_Type"])); tableActions.AddCell(ToolsPdf.HeaderCell(dictionary["Item_IncidentAction_Header_Description"])); foreach (var action in actions) { string actionTypeText = string.Empty; switch (action.ActionType) { default: case 1: actionTypeText = dictionary["Item_IncidentAction_Type1"]; break; case 2: actionTypeText = dictionary["Item_IncidentAction_Type2"]; break; case 3: actionTypeText = dictionary["Item_IncidentAction_Type3"]; break; } tableActions.AddCell(ToolsPdf.DataCell(actionTypeText)); tableActions.AddCell(ToolsPdf.DataCell(action.Description)); } document.Add(tableActions); } } document.Close(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", "inline;filename=outfile.pdf"); Response.ContentType = "application/pdf"; Response.WriteFile(Request.PhysicalApplicationPath + "\\Temp\\" + fileName); Response.Flush(); Response.Clear(); }