public APIResult AppealFeedBack(UploadData uploadData) { try { List <AppealDto> list = CommonHelper.DecodeString <List <AppealDto> >(uploadData.ListJson); foreach (AppealDto appealDto in list) { Appeal appeal = new Appeal(); appeal.AppealId = appealDto.AppealId; appeal.FeedBackReason = appealDto.FeedBackReason; appeal.FeedBackStatus = appealDto.FeedBackStatus; appeal.FeedBackUserId = appealDto.FeedBackUserId; appealService.AppealFeedBack(appeal); //foreach (AppealFile appealFile in appealDto.AppealFileList) //{ // appealFile.AppealId = appealDto.AppealId; // appealService.AppealFileSave(appealFile); //} } return(new APIResult() { Status = true, Body = "" }); } catch (Exception ex) { return(new APIResult() { Status = false, Body = ex.Message.ToString() }); } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); IAppeal laheKoht = new Appeal() { kirjeldus = "Lahe Leht", lahendamiseT2htAeg = DateTime.Parse("10.07.2017 14:40:59") }; Appeals.AadAppeal(laheKoht); IAppeal p88rdumine = new Appeal() { kirjeldus = "Uus pöördumine", lahendamiseT2htAeg = DateTime.Parse("5.06.2017 18:38:32") }; Appeals.AadAppeal(p88rdumine); IAppeal aegumata = new Appeal() { kirjeldus = "Aegumata", lahendamiseT2htAeg = DateTime.Parse("5.06.2018 18:38:32") }; Appeals.AadAppeal(aegumata); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Contact,Text")] Appeal appeal) { if (id != appeal.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(appeal); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppealExists(appeal.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(ViewAll))); } return(View(appeal)); }
public void Setup() { _command = new CancelAppealCommand { ApplicationId = _applicationId, UserId = "userId", UserName = "******" }; var appeal = new Appeal { Id = Guid.NewGuid(), ApplicationId = _applicationId }; _appealRepository = new Mock <IAppealRepository>(); _appealRepository.Setup(x => x.GetByApplicationId(_applicationId)).ReturnsAsync(appeal); _appealRepository.Setup(x => x.Remove(It.IsAny <Guid>())); var appealFiles = new List <AppealFile> { new AppealFile { Id = Guid.NewGuid(), ApplicationId = _applicationId } }; _appealFileRepository = new Mock <IAppealFileRepository>(); _appealFileRepository.Setup(x => x.GetAllForApplication(_applicationId)).ReturnsAsync(appealFiles); _appealFileRepository.Setup(x => x.Remove(It.IsAny <Guid>())); _auditService = new Mock <IAuditService>(); _auditService.Setup(x => x.StartTracking(UserAction.CancelAppeal, _command.UserId, _command.UserName)); _auditService.Setup(x => x.AuditDelete(It.IsAny <AppealFile>())); _auditService.Setup(x => x.AuditDelete(It.IsAny <Appeal>())); _handler = new CancelAppealCommandHandler(_appealRepository.Object, _appealFileRepository.Object, _auditService.Object); }
public async void GetAllAppealByEmailTest() { var appeal = new Appeal() { Email = "*****@*****.**", Text = "Text1" }; var appeal1 = new Appeal() { Email = "*****@*****.**", Text = "Text2" }; var repos = new AppealRepository(new AppDbContext()); repos.Add(appeal); repos.Add(appeal1); var appeals = await repos.GetEntitiesByEmail("*****@*****.**"); Assert.IsTrue(appeals.ToList().Count() > 1); repos.Delete(appeal); repos.Delete(appeal1); }
public IActionResult EditAppeal(int id, Appeal appeal) { if (id != appeal.Id) { return(NotFound()); } if (ModelState.IsValid) { try { db.Appeals.Update(appeal); db.Save(); } catch (DbUpdateConcurrencyException) { if (!AppealExists(appeal.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(appeal)); }
public IActionResult ChangeStatus(string status) { try { var appeal = new Appeal(); var userId = Convert.ToInt16(User.Claims.Where(x => x.Type == "userId").First().Value); var citizen = db.Citizens.Get(userId); appeal.Id = db.Appeals.GetAll().Count() + 1; appeal.CitizenId = citizen.Id; appeal.PollingStationId = citizen.PollingStationId; appeal.ElectionId = citizen.ElectionId; appeal.Text = status; if (status == "спостерігач") { appeal.AppealTypeId = 4; } if (status == "голова дільниці") { appeal.AppealTypeId = 5; } if (status == "голова округу") { appeal.AppealTypeId = 6; } db.Appeals.Create(appeal); db.Save(); return(RedirectToAction("Index2", "Home")); } catch { return(View("AddAppeal", "Vote")); } }
public async Task <Appeal> GetAppeal(Guid applicationId) { using (var connection = _dbConnectionHelper.GetDatabaseConnection()) { Appeal result = null; await connection.QueryAsync <Appeal, AppealFile, Appeal>( @"SELECT ap.*, apFile.Id, apFile.ApplicationId, apFile.Filename, apFile.ContentType FROM [Appeal] ap LEFT JOIN [AppealFile] apFile on apFile.ApplicationId = ap.ApplicationId where ap.ApplicationId = @applicationId", (appeal, upload) => { if (result == null) { result = appeal; result.AppealFiles = new List <AppealFile>(); } if (upload != null) { result.AppealFiles.Add(upload); } return(result); }, new { applicationId }); return(result); } }
private void VerifyAppealNotSubmitted(Appeal appeal) { if (appeal != null && !string.IsNullOrEmpty(appeal.Status)) { throw new InvalidOperationException($"Unable to create Appeal for Application {appeal.ApplicationId} as Appeal {appeal.Id} already submitted"); } }
/// <exception cref="Bad"> /// <see cref="Bad.AccessError"/> if respondent is not in required role. /// </exception> /// <exception cref="Bad"> /// <see cref="Bad.UselessRequest"/> if appeal is already resolved. /// </exception> /// <exception cref="Bad"> /// <see cref="Bad.NotAllowed"/> if appeal is not assigned or assigned to other respondent. /// </exception> /// <exception cref="Bad"> /// <see cref="Bad.UnknownError"/>. /// </exception> public async Task ResolveAsync(Appeal appeal, AppUser respondent) { if ((await respondent.LoadRoleSetAsync(Db)).IsNotStaffOrAdmin) { throw Bad.AccessError; } if (appeal.DateResolved != null) { throw Bad.UselessRequest; } if (appeal.DateAssigned == null || appeal.RespondentId != respondent.Id) { throw Bad.NotAllowed; } try { appeal.DateResolved = DateTime.UtcNow; await Db.SaveChangesAsync(); } catch (Exception ex) { Logger.LogError(ex, "Appeal resolving error! (appeal #{AppealId}, respondent #{RespondentId})", appeal.Id, respondent.Id); throw Bad.UnknownError; } OnResolve?.Invoke(appeal.Id); }
public async Task <Unit> Handle(CreateAppealCommand request, CancellationToken cancellationToken) { var oversightReview = await GetOversightReview(request.OversightReviewId, request.ApplicationId); await VerifyAppealDoesNotExist(request.OversightReviewId); _auditService.StartTracking(UserAction.CreateAppeal, request.UserId, request.UserName); var appeal = new Appeal { OversightReviewId = request.OversightReviewId, Message = request.Message, UserId = request.UserId, UserName = request.UserName }; _appealRepository.Add(appeal); _auditService.AuditInsert(appeal); var uploads = await _appealUploadRepository.GetByApplicationId(oversightReview.ApplicationId); foreach (var upload in uploads) { _auditService.AuditUpdate(upload); upload.AppealId = appeal.Id; _appealUploadRepository.Update(upload); } _auditService.Save(); return(Unit.Value); }
private void ApplyChanges(Appeal appeal, RecordAppealOutcomeCommand request, bool isNew) { appeal.Status = request.AppealStatus; if (!isNew) { appeal.UpdatedOn = DateTime.UtcNow; } if (request.AppealStatus == AppealStatus.InProgress) { appeal.InProgressDate = DateTime.UtcNow; appeal.InProgressInternalComments = request.InternalComments; appeal.InProgressExternalComments = request.ExternalComments; appeal.InProgressUserId = request.UserId; appeal.InProgressUserName = request.UserName; } if (request.AppealStatus == AppealStatus.Successful || request.AppealStatus == AppealStatus.Unsuccessful || request.AppealStatus == AppealStatus.SuccessfulFitnessForFunding || request.AppealStatus == AppealStatus.SuccessfulAlreadyActive) { appeal.AppealDeterminedDate = DateTime.UtcNow; appeal.InternalComments = request.InternalComments; appeal.ExternalComments = request.ExternalComments; appeal.UserId = request.UserId; appeal.UserName = request.UserName; } }
public async Task <IActionResult> Create([Bind("OrderId,Information")] Models.viewmodels.AppealCreateViewModel appeal) { if (ModelState.IsValid) { var exist = (from p in _context.Appeal where p.OrderId == appeal.OrderId select p); if (exist.Any()) { return(Json("result=\"AlreadyAppeal\"")); } Appeal newAppeal = new Appeal(); newAppeal.Id = appeal.OrderId; newAppeal.OrderId = appeal.OrderId; newAppeal.Date = System.DateTime.Now.ToShortDateString(); newAppeal.Information = appeal.Information; newAppeal.Status = "valid"; _context.Add(newAppeal); var os = (from p in _context.Orders where p.Id == appeal.OrderId select p); var o = os.FirstOrDefault(); o.Status = "appeal"; await _context.SaveChangesAsync(); return(Json("result=\"AppealSuccess\"")); } return(View(appeal)); }
public ActionResult DeleteConfirmed(int id) { Appeal appeal = db.Appeals.Find(id); db.Appeals.Remove(appeal); db.SaveChanges(); return(RedirectToAction("Index")); }
private Appeal CreateAppeal() { var appeal = new Appeal(); appeal.PrisonerId = PrisonerId; return(appeal); }
public ActionResult Appeal(Appeal model) { if (ModelState.IsValid) { Appeals.AadAppeal(model); return(View("ThanksForInserting")); } return(View(model)); }
public IActionResult CreateAppeal(Appeal appeal) { appeal.Id = db.Appeals.Count() + 1; db.Appeals.Add(appeal); db.SaveChanges(); return(View()); }
public async Task <Appeal> AppealAsync(Appeal appeal) { if (appeal == null) { throw new ArgumentNullException(nameof(Appeal)); } logger.LogWarning("Appeal is not implemented"); return(appeal); }
public async Task <IActionResult> Create([Bind("ID,Name,Contact,Text")] Appeal appeal) { if (ModelState.IsValid) { _context.Add(appeal); await _context.SaveChangesAsync(); return(Redirect("~/Home/IndexNew")); } return(View(appeal)); }
public void CreateAppealTest() { var appeal = new Appeal(); appeal.Key = 0001; appeal.Subtype = new SubtypeAppeal(); appeal.Email = "*****@*****.**"; appeal.Text = "Прошу решить проблему"; appeal.Attachment = "path/to/attachment"; Assert.Pass(); }
public ActionResult Edit([Bind(Include = "AppealId,PrisonerId,DateOfAppeal,CourtId,Status,DateOfResult,Description")] Appeal appeal) { if (ModelState.IsValid) { db.Entry(appeal).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ValidationError(); PopulateDropDowns(appeal); return(View(appeal)); }
public void Setup() { var autoFixture = new Fixture(); _query = autoFixture.Create <GetAppealQuery>(); _queryResult = autoFixture.Create <Appeal>(); _appealsQueries = new Mock <IAppealsQueries>(); _appealsQueries.Setup(x => x.GetAppeal(_query.ApplicationId, _query.OversightReviewId)).ReturnsAsync(() => _queryResult); _handler = new GetAppealQueryHandler(_appealsQueries.Object); }
public async Task <IActionResult> AddAppeal([FromBody] Appeal appeal, [FromQuery] string nameClass, [FromQuery] string nameSubtype) { //todo mshuvalov: подумать на передачей контекста using (_uow) { await((AppealRepository)_uow.GetRepositories <Appeal>()).Add(appeal, nameClass, nameSubtype); _uow.Commit(); } return(Ok()); }
public ActionResult RejectAppeal(long appealID) { User admin = UserHelpers.GetCurrentAdmin(Session); if (admin == null) { return(Json(new { state = 0, error = "Require signin!", message = "You are not signed in..." })); } else if (admin.AccountStatus == EventZoneConstants.LockedUser) { return(Json(new { state = 0, error = "Locked account", message = "Your account is locked. You cant use this feature!" })); } else if (admin.UserRoles != EventZoneConstants.RootAdmin && admin.UserRoles != EventZoneConstants.Admin) { return(Json(new { state = 0, error = "Permission denied", message = "This feature not avaiable for you!" })); } if (admin.AccountStatus != EventZoneConstants.LockedUser) { Appeal newAppeal = AdminDataHelpers.Instance.RejectAppeal(admin.UserID, appealID); if (newAppeal != null) { return(Json(new { state = 1, handleDate = newAppeal.SendDate.ToString(), handleBy = admin.UserName })); } } return(Json(new { state = 0, error = "Erorr", message = "Something wrong! Please try again!" })); }
// POST api/<controller> public int Post([FromBody] Appeal value) { try { context.Appeals.Add(value); context.SaveChanges(); return(1); }catch (Exception e) { return(0); } }
/// <summary> /// 申诉反馈 /// </summary> /// <param name="appealId"></param> /// <param name="appealReason"></param> /// <param name="appealUserId"></param> public void AppealFeedBack(Appeal appeal) { Appeal findOne = db.Appeal.Where(x => (x.AppealId == appeal.AppealId)).FirstOrDefault(); if (findOne != null) { findOne.FeedBackStatus = appeal.FeedBackStatus; findOne.FeedBackReason = appeal.FeedBackReason; findOne.FeedBackUserId = appeal.FeedBackUserId; findOne.FeedBackDateTime = DateTime.Now; } db.SaveChanges(); }
private async void AddPhotos(object sender, EventArgs e) { Appeal appeal = new Appeal(); appeal.Text = AppealEditor.Text; if (App.Database.GetItemsByQuery(String.Format("SELECT * FROM Appeals WHERE Text = \"{0}\"", appeal.Text)).Count() == 0) { App.Database.SaveItem("Appeals", appeal); appealsList.ItemsSource = App.Database.GetItems("Appeals"); } _MainModel.selectedAppeal = appeal; await Navigation.PushAsync(new Pages.PhotosPage(_MainModel)); }
public ActionResult Appeal(long eventID, string content) { User user = UserHelpers.GetCurrentUser(Session); if (user == null) { return(Json(new { state = 0, error = "Require Signin", message = "Ops.. It look like you are current is not signed in system! Please sign in first!", })); } else if (user.UserID != EventDatabaseHelper.Instance.GetAuthorEvent(eventID).UserID) { return(Json(new { state = 0, error = "Error", message = "You cant not appeal an event which is created by another users", })); } else { Appeal newAppeal = new Appeal { AppealStatus = EventZoneConstants.Pending, EventID = eventID, SendDate = DateTime.Now, AppealContent = content, }; if (EventDatabaseHelper.Instance.AddNewAppeal(newAppeal)) { return(Json(new { state = 1, eventID = eventID })); } else { return(Json(new { state = 0, error = "error", message = "Something wrong! please try again later! " })); } } }
// GET: Appeal/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Appeal appeal = db.Appeals.Find(id); if (appeal == null) { return(HttpNotFound()); } return(View(appeal)); }
// GET: Appeal/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Appeal appeal = db.Appeals.Find(id); if (appeal == null) { return(HttpNotFound()); } PopulateDropDowns(appeal); return(View(appeal)); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { Appeal ds = new Appeal(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public virtual int Fill(Appeal.AppealActsApplicableDataTable dataTable) { this.Adapter.SelectCommand = this.CommandCollection[0]; if ((this.ClearBeforeFill == true)) { dataTable.Clear(); } int returnValue = this.Adapter.Fill(dataTable); return returnValue; }
public virtual int Update(Appeal.AppealApplicationDataTable dataTable) { return this.Adapter.Update(dataTable); }
public virtual int Update(Appeal dataSet) { return this.Adapter.Update(dataSet, "AppealApplication"); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); Appeal ds = new Appeal(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "AppealActsApplicableDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }
public virtual int Update(Appeal.AppealHearingDataTable dataTable) { return this.Adapter.Update(dataTable); }
public virtual int Update(Appeal dataSet) { return this.Adapter.Update(dataSet, "AppealHearing"); }