public async Task CreateReport(ReportContract contract, string userId) { var task = await _repository.GetTask(contract.TaskId); var group = await _repository.GetGroup(task.GroupId); if (group.Members.All(m => m.UserId != userId || !m.IsActive)) { throw new UserNotFoundException(); } var project = group.Projects.FirstOrDefault(p => p.Id == contract.ProjectId); if (project is null) { throw new ProjectsNotFoundException(contract.Id); } if (!project.MembersIds.Contains(userId)) { throw new UserNotFoundException(); } if (task.Reports.Any(r => r.UserId == userId)) { throw new UserAlreadyJoinedException(); } var report = _reportModelMapper.Map(contract, userId); await _repository.AddReport(report); }
public async Task <ReportContract> PostAsync(ReportContract report) { try { var registrationReference = await ValidateAndReturnCurrentUserId(); var reportContract = await _repository.InsertReport(report, registrationReference); var photoContract = await _repository.GetPhoto(reportContract.ContentId); if (photoContract.Status == PhotoStatus.UnderReview) { await _notificationHandler.SendPushAsync(PushNotificationPlatform.Windows, "user:"******"Your photo has been placed under review.", photoContract.ThumbnailUrl, photoContract.Id); } return(reportContract); } catch (DataLayerException ex) { _telemetryClient.TrackException(ex); if (ex.Error == DataLayerError.Unknown) { throw ServiceExceptions.UnknownInternalFailureException(ServiceExceptions.Source); } throw ServiceExceptions.DataLayerException(ex.Message); } }
public async Task EditReport(ReportContract contract, string userId) { var storageReport = await _repository.GetReport(contract.Id); var modelReport = _reportModelMapper.Map(contract, userId); var updatedReport = storageReport.Update(modelReport); await _repository.UpdateReport(updatedReport); }
public ReportContract GetReports(string ReportBaseURI) { ReportContract returncontract = new ReportContract(); returncontract.ReporFolders = Repo.GetReportFolders(); returncontract.ReportLinks = Repo.GetReports(ReportBaseURI); return(returncontract); }
/// <summary> /// Creates a <see cref="ReportDocument" /> from a <see cref="ReportContract" />. /// </summary> /// <returns>The <see cref="ReportDocument" />.</returns> public static ReportDocument CreateFromContract(ReportContract contract) { return(new ReportDocument { Id = contract.Id, Active = contract.Active, ReporterUserId = contract.ReporterUserId, ReportReason = contract.ReportReason, CreatedDateTime = new DateDocument { Date = contract.CreatedDateTime } }); }
public void Post(ReportContract reportContract) { var dbReport = reportContract.ToEntity(); dbReport.CustomerId = DoesCustomerExist(reportContract.Customer); dbReport.RecieverId = DoesRecieverExist(reportContract.Reciever); dbReport.TransporterId = DoesTransporterExist(reportContract.Transporter); if (reportContract.Id != 0) { EditArticles(dbReport); } _uow.ReportRepository.CreateOrUpdate(dbReport); }
public async Task <ReportContract> PostAsync(ReportContract report) { try { var registrationReference = await ValidateAndReturnCurrentUserId(); return(await _repository.InsertReport(report, registrationReference)); } catch (DataLayerException ex) { _telemetryClient.TrackException(ex); if (ex.Error == DataLayerError.Unknown) { throw ServiceExceptions.UnknownInternalFailureException(ServiceExceptions.Source); } throw ServiceExceptions.DataLayerException(ex.Message); } }
public static Report ToEntity(this ReportContract report) { return(new Report { Id = report.Id, Info = report.Info, Approved = report.Approved, CreatedDate = report.CreatedDate, EditedDate = report.EditedDate, LastEditBy = report.LastEditBy, OrderedDate = report.OrderedDate, RemovedDate = report.RemovedDate, Articles = report.Articles.ToEntities(), CreatedByUserName = report.CreatedByUserName, CustomerId = report.Customer.Id, RegionId = report.Region.Id, TransporterId = report.Transporter.Id, RecieverId = report.Reciever.Id, }); }
/// <summary> /// Reports the photo as inappropriate. /// </summary> /// <param name="photo">The photo to report.</param> /// <param name="reportReason">The reason for the report.</param> public async Task ReportPhoto(Photo photo, ReportReason reportReason) { try { var reportContract = new ReportContract { ReportReason = reportReason, ContentId = photo.Id, ContentType = ContentType.Photo }; await _mobileServiceClient.InvokeApiAsync <ReportContract, ReportContract>("report", reportContract, HttpMethod.Post, null); } catch (Exception e) { throw new ServiceException("ReportPhoto error", e); } }
/// <summary> /// Reports the Annotation as inappropriate. /// </summary> /// <param name="annotation">The annotation to report.</param> public async Task ReportAnnotation(Annotation annotation) { try { var reportContract = new ReportContract { ReportReason = ReportReason.Inappropriate, ContentId = annotation.Id, ContentType = ContentType.Annotation }; await _mobileServiceClient.InvokeApiAsync <ReportContract, ReportContract>("report", reportContract, HttpMethod.Post, null); } catch (Exception e) { throw new ServiceException("ReportAnnotation error", e); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { var paramTransId = Request["transactionId"].Trim(); //var paramPrint_Option = Request["reportOption"].Trim(); ReportDocument cryRep = new ReportDocument(); TableLogOnInfos tbloginfos = new TableLogOnInfos(); ConnectionInfo crConinfo = new ConnectionInfo(); const string reportName = "ReportContract"; string report = Utilities.ReportPath(reportName); cryRep.Load(report); SqlConnectionStringBuilder cnstrbuilding = new SqlConnectionStringBuilder(Utilities.DBGateway()); crConinfo.ServerName = cnstrbuilding.DataSource; crConinfo.DatabaseName = cnstrbuilding.InitialCatalog; crConinfo.UserID = cnstrbuilding.UserID; crConinfo.Password = cnstrbuilding.Password; var cryTables = cryRep.Database.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table cryTable in cryTables) { var tbloginfo = cryTable.LogOnInfo; tbloginfo.ConnectionInfo = crConinfo; tbloginfo.ConnectionInfo.IntegratedSecurity = true; cryTable.ApplyLogOnInfo(tbloginfo); } List <PrintContractDetails> conDetails = new List <PrintContractDetails>(); List <BookMenusViewModel> conBookMenus = new List <BookMenusViewModel>(); List <AddonsViewModel> addons = new List <AddonsViewModel>(); CRViewerContract.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None; ReportContract repcontract = new ReportContract(); conDetails = (from c in condetails.GetContractDetails() where c.transId == Convert.ToInt32(paramTransId) select c).ToList(); conBookMenus = bm.LisofMenusBook().Where(x => x.transId == Convert.ToInt32(paramTransId)).ToList(); addons = add.ListofAddons().Where(x => x.TransId == Convert.ToInt32(paramTransId)).ToList(); //repcontract.SetDataSource(conDetails); repcontract.Database.Tables[0].SetDataSource(conDetails); repcontract.Database.Tables[1].SetDataSource(conBookMenus); repcontract.Database.Tables[2].SetDataSource(addons); CRViewerContract.ReportSource = repcontract; CRViewerContract.RefreshReport(); } catch (Exception ex) { throw new Exception(ex.Message); } } }
public Report Map(ReportContract contract, string userId) =>
public Task <ReportContract> InsertReport(ReportContract report, string userRegistrationReference) { throw new NotImplementedException(); }
public IHttpActionResult Edit(ReportContract reportContract) { //_reportHandler.EditReport(reportContract); return(Ok()); }
public IHttpActionResult Post(ReportContract reportContract) { _reportHandler.Post(reportContract); return(Ok()); }
/// <summary> /// Inserts a report into Report table. /// </summary> /// <param name="report">The report being inserted.</param> /// <param name="userRegistrationReference">Azure Mobile Service user id who is reporting it.</param> /// <returns>The inserted Report.</returns> public Task <ReportContract> InsertReport(ReportContract report, string userRegistrationReference) { return(_repository.InsertReport(report, userRegistrationReference)); }
public JsonResult GetEmployeeReporting(int merchId, [FromBody] ReportContract reportContract) { return(Json(_reportingRepository.EmployeeReporting(merchId, reportContract.startDate, reportContract.endDate))); }
public ActionResult Contract(string mrfid, string applicants, string classification) { ReportContract report = new ReportContract(); return(File(report.Contract(mrfid, applicants, classification), "application/msword", "Contract - " + mrfid + ".doc")); }