public ActionResult Edit(int id) { DefectStatus defectStatus = null; try { using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost:56003/api/"); //HTTP GET var responseTask = client.GetAsync("defectstatus?id=" + id.ToString()); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <DefectStatus>(); readTask.Wait(); defectStatus = readTask.Result; } } return(View(defectStatus)); } catch { return(View("ExceptionPage")); } }
public ActionResult Edit(DefectStatus defectStatus) { try { using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost:56003/api/defectstatus"); //HTTP POST var putTask = client.PutAsJsonAsync <DefectStatus>("defectStatus", defectStatus); putTask.Wait(); var result = putTask.Result; if (result.IsSuccessStatusCode) { return(RedirectToAction("Index")); } } return(View(defectStatus)); } catch { return(View("ExceptionPage")); } }
public string GetName(DefectStatus value) { if (value == DefectStatus.Unknown) { return("?"); } if (value == DefectStatus.Open) { return("Открыт"); } if (value == DefectStatus.InProgress) { return("В работе"); } if (value == DefectStatus.Testing) { return("Тестируется"); } if (value == DefectStatus.Closed) { return("Закрыт"); } if (value == DefectStatus.ReOpen) { return("Открыт повторно"); } return("???"); }
private void BindStatusData(string role) { var listStatus = new List <DefectStatus>(); var status1 = new DefectStatus("New"); listStatus.Add(status1); cmbStatus.DataSource = listStatus; cmbStatus.DisplayMember = "Description"; cmbStatus.ValueMember = "Description"; }
// POST: api/DefectStatus public void Post([FromBody] string value) { var defectstatusQueryObject = new DefectStatusQueryObject(); var defectStatus = new DefectStatus() { Status = value }; defectstatusQueryObject.AddDefectStatus(defectStatus); }
public void SetColor(DefectStatus status) { if (status == DefectStatus.Closed) { SetGreen(); } else { SetRed(); } }
// // GET: /Projects/Defects/ public ActionResult Index(int? projectId, DefectStatus[] defectStatuses) { if (projectId == null) { return View(new List<Defect>()); } Project project = _projectDaoFactory.ProjectDao.Get(projectId.Value); IList<Defect> defect = _projectDaoFactory.DefectDao.GetDefects(project, Enum.GetValues(typeof(DefectStatus)).Cast <DefectStatus>().ToArray()); return View(defect); }
// PUT: api/DefectStatus/5 public IHttpActionResult Put(DefectStatus defectstatus) { if (!ModelState.IsValid) { return(BadRequest("Not a valid data")); } else { var defectstatusQueryObject = new DefectStatusQueryObject(); defectstatusQueryObject.EditDefectStatus(defectstatus); return(Ok(defectstatus)); } }
public void AddDefectStatus(DefectStatus defectStatus) { using (var dbContext = new DefectTrackerContext()) { try { dbContext.DefectStatus.Add(defectStatus); dbContext.SaveChanges(); } catch (Exception ex) { throw ex; } } }
public async Task <ActionResult> CreateAsync(DefectStatus defectStatus) { try { using (var client = new HttpClient()) { HttpResponseMessage response = await client.PostAsJsonAsync("http://localhost:56003/api/defectstatus/", defectStatus.Status); response.EnsureSuccessStatusCode(); return(RedirectToAction("Index")); } } catch { return(View("ExceptionPage")); } }
public void EditDefectStatus(DefectStatus defectStatus) { try { using (var dbContext = new DefectTrackerContext()) { var existingStatus = dbContext.DefectStatus.Where(s => s.Id == defectStatus.Id).FirstOrDefault <DefectStatus>(); if (existingStatus != null) { existingStatus.Status = defectStatus.Status; dbContext.SaveChanges(); } } } catch (Exception ex) { throw ex; } }
public DefectChange ChangeStatus( Guid accountId, Defect defect, DefectStatus status, User user, string comment) { var change = new DefectChange() { Id = Guid.NewGuid(), Status = status, //Defect = defect, //User = user, Comment = comment, Date = DateTime.Now, UserId = user.Id, DefectId = defect.Id }; defect.LastChange = change; // Если дефект закрывается, то нужно внести информацию о версии в тип события if (status == DefectStatus.Closed && defect.EventType != null) { string version; using (var context = AccountDbContext.CreateFromAccountId(accountId)) { var repository = context.GetEventRepository(); var lastEvent = repository.GetLastEventByEndDate(defect.EventType.Id); version = lastEvent != null ? lastEvent.Version : null; } if (!string.IsNullOrEmpty(version)) { defect.EventType.OldVersion = version; defect.EventType.ImportanceForOld = Api.EventImportance.Unknown; } } return(change); }
public DefectResource(string description, DefectStatus status) : this() { Description = description; Status = status; }