/// <summary> /// Save /// </summary> /// <param name="companyId">companyId</param> public void Save(int companyId) { SupportTicketInformationTDS toDoListInformationChanges = (SupportTicketInformationTDS)Data.GetChanges(); if (toDoListInformationChanges != null) { if (toDoListInformationChanges.BasicInformation.Rows.Count > 0) { SupportTicketInformationBasicInformationGateway toDoListInformationBasicInformationGateway = new SupportTicketInformationBasicInformationGateway(toDoListInformationChanges); // Update to do foreach (SupportTicketInformationTDS.BasicInformationRow row in (SupportTicketInformationTDS.BasicInformationDataTable)toDoListInformationChanges.BasicInformation) { // Unchanged values int supportTicketId = row.SupportTicketID; int categoryId = row.CategoryID; string subject = toDoListInformationBasicInformationGateway.GetSubject(supportTicketId); DateTime creationDate = toDoListInformationBasicInformationGateway.GetCreationDate(supportTicketId); int createdById = toDoListInformationBasicInformationGateway.GetCreatedByID(supportTicketId); // Original values DateTime? originalDueDate = null; if (toDoListInformationBasicInformationGateway.GetDueDateOriginal(supportTicketId).HasValue) originalDueDate = (DateTime)toDoListInformationBasicInformationGateway.GetDueDateOriginal(supportTicketId); string originalState = toDoListInformationBasicInformationGateway.GetStateOriginal(supportTicketId); // New variables DateTime? newDueDate = null; if (toDoListInformationBasicInformationGateway.GetDueDate(supportTicketId).HasValue) newDueDate = (DateTime)toDoListInformationBasicInformationGateway.GetDueDate(supportTicketId); string newState = toDoListInformationBasicInformationGateway.GetState(supportTicketId); SupportTicketSupportTicket toDoListSupportTicket = new SupportTicketSupportTicket(null); toDoListSupportTicket.UpdateDirect(supportTicketId, categoryId, subject, creationDate, createdById, originalState, originalDueDate, row.Deleted, row.COMPANY_ID, supportTicketId, categoryId, subject, creationDate, createdById, newState, newDueDate, row.Deleted, row.COMPANY_ID); } } } }
private void LoadData(int supportTicketId) { SupportTicketInformationBasicInformationGateway supportTicketInformationBasicInformationGateway = new SupportTicketInformationBasicInformationGateway(supportTicketInformationTDS); if (supportTicketInformationBasicInformationGateway.Table.Rows.Count > 0) { // Load to do Details int companyId = Int32.Parse(hdfCompanyId.Value); int createdById = supportTicketInformationBasicInformationGateway.GetCreatedByID(supportTicketId); hdfCreatedById.Value = createdById.ToString(); EmployeeGateway employeeGateway = new EmployeeGateway(); employeeGateway.LoadByEmployeeId(createdById); tbxCreatedBy.Text = employeeGateway.GetFullName(createdById); tbxCreationDate.Text = supportTicketInformationBasicInformationGateway.GetCreationDate(supportTicketId).ToString(); tbxState.Text = supportTicketInformationBasicInformationGateway.GetState(supportTicketId); tbxCategoryName.Text = supportTicketInformationBasicInformationGateway.GetCategoryName(supportTicketId); if (supportTicketInformationBasicInformationGateway.GetDueDate(supportTicketId).HasValue) { DateTime dueDateValue = (DateTime)supportTicketInformationBasicInformationGateway.GetDueDate(supportTicketId); tbxDueDate.Text = dueDateValue.Month.ToString() + "/" + dueDateValue.Day.ToString() + "/" + dueDateValue.Year.ToString(); } } }