/// <summary> /// 게시글 삭제 버튼클릭 이벤트. /// 1. 파라미터 게시글 번호, 제목, 내용, 작성일, 작성자, 수정일 => st /// 2. DB의 DeleteBoard(st) 수행하여 bool타입으로 받아 true/ false /// 3. true = 삭제완료/ false = 삭제불가 메세지 출력 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { try { frmDelete frm = new frmDelete(); if (frm.ShowDialog() == DialogResult.OK) { BoardDB db = new BoardDB(); SetBoardText st = new SetBoardText(int.Parse(lblBoardID.Text), txtBoardName.Text, txtBoardContent.Text, lblpostingDate.Text, lblStaffID.Text, lblcorrectDate.Text); bool bFlag; bFlag = db.DeleteBoard(st); if (bFlag) { MessageBox.Show("정보 삭제가 완료되었습니다."); SetData(); } else { MessageBox.Show("형식을 잘못 입력하였거나 빈 항목이 있습니다."); } db.Dispose(); } else { frm.Close(); } } catch (Exception err) { MessageBox.Show(err.Message); } }
/// <summary> /// 게시글 수정 버튼클릭 이벤트. /// 1. 작성자는 전역변수로 두었던 staffID(로그인계정) /// 2. 수정일은 현재시간 기준 (yyyy-MM-dd HH:mm:ss) 형식으로 저장 /// 3. 파라미터 게시글 번호, 제목, 내용, 작성일, 작성자, 수정일 => st /// 3. DB의 UpdateBoard(st) 수행하여 bool타입으로 받아 true/ false /// 3. true = 저장완료/ false = 저장불가 메세지 출력 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUpdate_Click(object sender, EventArgs e) { try { BoardDB db = new BoardDB(); lblStaffID.Text = staffID; lblcorrectDate.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); SetBoardText st = new SetBoardText(int.Parse(lblBoardID.Text), txtBoardName.Text, txtBoardContent.Text, lblpostingDate.Text, lblStaffID.Text, lblcorrectDate.Text); bool bFlag; bFlag = db.UpdateBoard(st); if (bFlag) { MessageBox.Show("정보 저장이 완료되었습니다."); SetData(); } else { MessageBox.Show("형식을 잘못 입력하였거나 빈 항목이 있습니다."); } db.Dispose(); } catch (Exception err) { MessageBox.Show(err.Message); } }
public JsonResult ControlIfExistInPano(int _sprintId) { try { var result = BoardDB.GetInstance().ControlIfExistInPano(_sprintId); return(Json(result)); } catch (System.Exception exc) { throw exc; } }
public JsonResult GetStepHoverInfo(int _stepId, int _boardId) { try { var str = BoardDB.GetInstance().GetStepHoverInfo(_stepId, _boardId); return(Json(str)); } catch (Exception exc) { throw exc; } }
public JsonResult FinishSprint() { try { var result = BoardDB.GetInstance().FinishSprint(JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("SelectedProject")).Id); return(Json(result)); } catch (Exception exc) { throw exc; } }
public JsonResult DeletePano(int _panoId) { try { var result = BoardDB.GetInstance().DeletePano(_panoId); return(Json(result)); } catch (System.Exception exc) { throw exc; } }
public JsonResult SaveBoardStepBySprintId(int _sprintId) { try { var userId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; var result = BoardDB.GetInstance().SaveBoardStepBySprintId(_sprintId, JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("SelectedProject")).Id, userId); return(Json(result)); } catch (System.Exception exc) { throw exc; } }
public JsonResult GetPanoById(int _boardId) { try { var board = BoardDB.GetInstance().GetPanoById(_boardId); return(Json(board)); } catch (System.Exception exc) { throw exc; } }
public JsonResult GetAllBoardByProjectId() { try { var _projectId = JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("SelectedProject")).Id; var board = BoardDB.GetInstance().GetAllBoardByProjectId(_projectId); board = board.OrderBy(x => x.Id).ToList(); return(Json(board)); } catch (System.Exception exc) { throw exc; } }
/// <summary> /// 1. DB에 있는 LoadBoardData() 호출 /// 2. DataTable에 담아 DataView로 /// 3. DataGridView의 DataSource를 Dataview로 /// </summary> private void SetData() { try { BoardDB db = new BoardDB(); DataTable dt = db.LoadBoardData(); db.Dispose(); DataView dataView = new DataView(dt); BoardDataGridView.DataSource = dataView; } catch (Exception err) { MessageBox.Show(err.Message); } }
/// <summary> /// 게시글 검색 버튼클릭 이벤트. /// 2. DB의 SearchBoard(txtSearch) 수행하여 DataTable dt 로 받아서 /// 3. 정보 바인딩 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button4_Click(object sender, EventArgs e) { try { BoardDB db = new BoardDB(); DataTable dt = db.SearchBoard(txtSearch.Text); db.Dispose(); DataView dataView = new DataView(dt); BoardDataGridView.DataSource = dataView; } catch (Exception err) { MessageBox.Show(err.Message); } }
public JsonResult UpdateBoardStep(int _stepId, int _boardId, string _desc) { _desc = _desc == null ? "" : _desc; try { using (var context = new ProjectManagementEntities()) { var personId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; var _projectId = JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("SelectedProject")).Id; var _projectName = JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("SelectedProject")).Name; var updatedBoard = BoardDB.GetInstance().UpdateBoardStep(_stepId, _boardId, _projectId, personId, _desc); if (updatedBoard == true) { var personEmail = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Email; var stepName = context.Step.FirstOrDefault(x => x.Id == _stepId).Name; var stepPersons = context.StepPerson.Where(x => x.StepId == _stepId).Select(x => x.PersonId).ToList(); var projectPerson = context.ProjectPerson.Where(x => x.ProjectId == _projectId).Select(x => x.PersonId).ToList(); var projectPersonMail = context.Person.FirstOrDefault(x => projectPerson.Contains(x.Id)).Email; var personsMails = context.Person.Where(x => stepPersons.Contains(x.Id)).Select(x => x.Email).ToList(); var personName = context.Person.FirstOrDefault(x => x.Id == personId).Name; var personSurname = context.Person.FirstOrDefault(x => x.Id == personId).Surname; var boardName = context.Board.FirstOrDefault(x => x.Id == _boardId).Name; var message = ""; if (_desc != "") { message = _projectName + " adlı projenin " + stepName + " adlı görevi " + _desc + " açıklamasıyla " + boardName + " panosuna " + personName + " " + personSurname + " tarafından " + DateTime.Now.ToString("dd.MM.yyyy HH:mm") + " tarihinde taşındı."; } else { message = _projectName + " adlı projenin " + stepName + " adlı görevi " + boardName + " panosuna " + personName + " " + personSurname + " tarafından " + DateTime.Now.ToString("dd.MM.yyyy HH:mm") + " tarihinde taşındı."; } personsMails.Add(personEmail); personsMails.Add(projectPersonMail); personsMails = personsMails.Distinct().ToList(); SendEmail(message, personsMails); return(Json(updatedBoard)); } return(Json(updatedBoard)); } } catch (System.Exception exc) { throw exc; } }
public JsonResult GetAllStepForPano() { try { var _projectId = JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("SelectedProject")).Id; var boardList = BoardDB.GetInstance().GetBoardByProjectId(_projectId); var boardDetailList = new List <BoardRepo>(); var personId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; foreach (var item in boardList) { var stepList = BoardDB.GetInstance().GetStepByBoardId(item.Id, personId); foreach (var step in stepList) { var assigneeUser = PersonDB.GetInstance().GetPersonById(step.AssigneeUser); var milestone = MilestoneDB.GetInstance().GetMilestoneById(step.MilestoneId); if (milestone == null) { continue; } boardDetailList.Add(new BoardRepo() { SprintId = step.SprintId, AssigneeUserName = $"{assigneeUser.Name} {assigneeUser.Surname}", Descripton = step.Description, DetailName = step.Name, MilestoneName = milestone.Name, AssignedPersonNames = StepDB.GetInstance().GetStepPersonsByStepId(step.Id), StepId = step.Id, BoardId = item.Id }); } } return(Json(boardDetailList)); } catch (System.Exception exc) { throw exc; } }
public JsonResult SavePano(string _panoAdi, int _panoId, bool _isDescRequired) { var _projectId = JsonConvert.DeserializeObject <Project>(HttpContext.Session.GetString("SelectedProject")).Id; try { if (_panoId == 0) { var pano = new Board() { Name = _panoAdi, ProjectId = _projectId, Status = 1, IsDescriptionRequired = _isDescRequired ? 1 : 0 }; var result = BoardDB.GetInstance().SavePano(pano); return(Json(result != null)); } else { var pano = new Board() { Name = _panoAdi, Id = _panoId, ProjectId = _projectId, IsDescriptionRequired = _isDescRequired ? 1 : 0 }; var result = BoardDB.GetInstance().UpdatePano(pano); return(Json(result != null)); } } catch (System.Exception exc) { throw exc; } }
public JsonResult SaveProject(string _titleProject, string _code, string _shortname, string _description, int _personId, int _projectId, List <int> _projeKisi) { try { if (_projectId == 0) { var project = new Project() { Name = _titleProject, Code = _code, ShortName = _shortname, Description = _description, ProjectLeader = _personId, Status = 1 }; var result = ProjectDB.GetInstance().SaveProject(project); var currentPersonId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; if (!_projeKisi.Contains(currentPersonId)) { _projeKisi.Add(currentPersonId); } for (int i = 0; i < _projeKisi.Count; i++) { var projeKisi = new ProjectPerson() { ProjectId = result.Id, PersonId = _projeKisi[i] }; var ppResult = ProjectDB.GetInstance().SaveProjectPerson(projeKisi); } Board b = new Board() { Name = "YAPILACAK", ProjectId = result.Id, Status = 1 }; BoardDB.GetInstance().SavePano(b); b = new Board() { Name = "YAPILIYOR", ProjectId = result.Id, Status = 1 }; BoardDB.GetInstance().SavePano(b); b = new Board() { Name = "TAMAMLANDI", ProjectId = result.Id, Status = 1 }; BoardDB.GetInstance().SavePano(b); return(Json(result != null)); } else { var project = new Project() { Name = _titleProject, Code = _code, ShortName = _shortname, Description = _description, ProjectLeader = _personId, Id = _projectId, Status = 1 }; var delete = ProjectDB.GetInstance().DeleteProjectPersonByProjectId(_projectId); var currentPersonId = JsonConvert.DeserializeObject <Person>(HttpContext.Session.GetString("ActivePerson")).Id; if (!_projeKisi.Contains(currentPersonId)) { _projeKisi.Add(currentPersonId); } for (int i = 0; i < _projeKisi.Count; i++) { var projeKisi = new ProjectPerson() { ProjectId = _projectId, PersonId = _projeKisi[i] }; var ppResult = ProjectDB.GetInstance().SaveProjectPerson(projeKisi); } var result = ProjectDB.GetInstance().UpdateProject(project); return(Json(result != null)); } } catch (Exception exc) { throw exc; } }