public bool Update(Domain.Report entity) { var original = this.FindById(entity.ReportId); var result = true; using (UnitOfWork.Build(_reportRepository.DbContext)) { result = _reportRepository.Update(entity); //localization _localizedLabelService.Update(entity.Name.IfEmpty(""), "LocalizedName", entity.ReportId, this._appContext.BaseLanguage); _localizedLabelService.Update(entity.Description.IfEmpty(""), "Description", entity.ReportId, this._appContext.BaseLanguage); //assigning roles if (original.IsAuthorization || !entity.IsAuthorization) { _eventPublisher.Publish(new AuthorizationStateChangedEvent { ObjectId = new List <Guid> { entity.ReportId } , State = false , ResourceName = ReportDefaults.ModuleName }); } } return(result); }
private void WrapLocalizedLabel(Domain.Report entity) { var labels = _localizedLabelService.Query(n => n.Where(f => f.LanguageId == this._appContext.BaseLanguage && f.ObjectId == entity.ReportId)); entity.Name = _localizedLabelService.GetLabelText(labels, entity.ReportId, "LocalizedName", entity.Name); entity.Description = _localizedLabelService.GetLabelText(labels, entity.ReportId, "Description", entity.Description); }
public void SaveReports(Domain.Report Record) { string query; bool isUpdate = false; // Want to know right off the bat if we're doing a insert or update if (CheckExistingRecord(Record.AssignedAAUserID).ReportId != 0) { query = ReportUpdateQuery; isUpdate = true; } else { query = ReportInsertQuery; } using (Npgsql.NpgsqlConnection conn = new Npgsql.NpgsqlConnection(Infrastructure.ConfigReader.ConnectionString.ToString())) { conn.Open(); using (Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(query, conn)) { command.Parameters.Add(new Npgsql.NpgsqlParameter("month", NpgsqlTypes.NpgsqlDbType.Text)); command.Parameters.Add(new Npgsql.NpgsqlParameter("year", NpgsqlTypes.NpgsqlDbType.Integer)); command.Parameters.Add(new Npgsql.NpgsqlParameter("calls", NpgsqlTypes.NpgsqlDbType.Integer)); command.Parameters.Add(new Npgsql.NpgsqlParameter("appointments", NpgsqlTypes.NpgsqlDbType.Integer)); command.Parameters.Add(new Npgsql.NpgsqlParameter("goodapts", NpgsqlTypes.NpgsqlDbType.Integer)); command.Parameters.Add(new Npgsql.NpgsqlParameter("closes", NpgsqlTypes.NpgsqlDbType.Integer)); command.Parameters.Add(new Npgsql.NpgsqlParameter("accounts", NpgsqlTypes.NpgsqlDbType.Integer)); command.Parameters.Add(new Npgsql.NpgsqlParameter("aauserid", NpgsqlTypes.NpgsqlDbType.Integer)); command.Parameters.Add(new Npgsql.NpgsqlParameter("sauserid", NpgsqlTypes.NpgsqlDbType.Integer)); if (isUpdate) { command.Parameters.Add(new Npgsql.NpgsqlParameter("mbsreport_id", NpgsqlTypes.NpgsqlDbType.Integer)); } command.Prepare(); command.Parameters[0].Value = Helper.ConverttoStringDate(DateTime.Now); command.Parameters[1].Value = DateTime.Now.Year; command.Parameters[2].Value = Record.MonthlyCalls; command.Parameters[3].Value = Record.MonthlyAppointments; command.Parameters[4].Value = Record.MonthlyGoodAppointments; command.Parameters[5].Value = Record.MonthlyCloses; command.Parameters[6].Value = Record.MonthlyAccounts; command.Parameters[7].Value = Record.AssignedAAUserID; command.Parameters[8].Value = Record.AssignedSAUserID; if (isUpdate) { command.Parameters[9].Value = Record.ReportId; } int rowsAffected = command.ExecuteNonQuery(); } } }
public static NEMILTEC.Interfaces.Service.Reporting.Report CreateReport(Domain.Report report, IDataContext context) { var newReport = new NEMILTEC.Interfaces.Service.Reporting.Report { Name = report.Name, Description = report.Description, Title = report.Title, TemplateFileStream = NEMILTEC.Service.Shared.Document.GetStream(report.TemplateFile.Id, context), OutputType = (NEMILTEC.Interfaces.Service.Reporting.Enums.ReportOutputType)report.OutputType.Id }; newReport.Elements = report.Elements.Select(e => _CreateElement(e, newReport, context)).ToArray(); return(newReport); }
public bool Create(Domain.Report entity) { entity.OrganizationId = _appContext.OrganizationId; var result = true; using (UnitOfWork.Build(_reportRepository.DbContext)) { result = _reportRepository.Create(entity); //solution component _solutionComponentService.Create(entity.SolutionId, entity.ReportId, ReportDefaults.ModuleName); //依赖于实体 _dependencyService.Create(ReportDefaults.ModuleName, entity.ReportId, EntityDefaults.ModuleName, entity.EntityId, entity.RelatedEntityId); //本地化标签 _localizedLabelService.Create(entity.SolutionId, entity.Name.IfEmpty(""), ReportDefaults.ModuleName, "LocalizedName", entity.ReportId, this._appContext.BaseLanguage); _localizedLabelService.Create(entity.SolutionId, entity.Description.IfEmpty(""), ReportDefaults.ModuleName, "Description", entity.ReportId, this._appContext.BaseLanguage); } return(result); }