public ActionResult EditProfile(ReportProfileDto model, IEnumerable<string> fields)
        {
            var editor = this.LoginUser.Identity.Name;
            using (var service = ServiceLocator.Instance.Resolve<IReportProfileService>())
            {
                // Update the report profile header
                service.UpdateReportProfile(model.ID, model.Name, model.Description, editor);

                // Update the fields (remove all, and then add)
                service.SetProfileFields(model.ID, fields);

                return Json(true);
            }
        }
        public ActionResult CreateProfile(ReportProfileDto model)
        {
            try
            {
                using (var service = ServiceLocator.Instance.Resolve<IReportProfileService>())
                {
                    var isExistProfile = service.ExistReportProfile(model.Name);
                    if (isExistProfile)
                        return Json(false, string.Format("Create the report profile failure. The profile name:[{0}] already exists.", model.Name));

                    model.CreatedBy = this.LoginUser.Identity.Name;
                    service.AddReportProfile(model);
                    return Json(true);
                }
            }
            catch(Exception)
            {
                return Json(false, "Create the report profile failure.");
            }
        }
Exemplo n.º 3
0
 public void AddReportProfile(ReportProfileDto profileDto)
 {
     var reportProfile = new ReportProfile(profileDto.Name, profileDto.Description, profileDto.ReportId, profileDto.CreatedBy);
     this._reportProfileRepository.Add(reportProfile);
 }