private void lblInsert_DragDrop(object sender, DragEventArgs e) { if (_draggingLabel != null) { FlowLayoutPanel flp = sender as FlowLayoutPanel; TaskLogBusiness tlBuss = new TaskLogBusiness(); Entity.TaskLog taskLog = new Entity.TaskLog(); //e.Effect = DragDropEffects.Copy; taskLog.TaskID = (int)_draggingLabel.Tag; taskLog.TaskDate = DateTime.Now; int flpId = int.Parse(flp.Tag.ToString()); if (flpId == 1) { taskLog.TaskStatusID = 2; } else if (flpId == 2 && _user.RoleID == 5) { taskLog.TaskStatusID = 3; } else if (flpId == 2 && _user.RoleID == 4) { taskLog.TaskStatusID = 5; } else if (flpId == 3 && _user.RoleID == 5) { taskLog.TaskStatusID = 4; } else if (flpId == 3 && _user.RoleID == 4) { taskLog.TaskStatusID = 6; } bool result = false; try { result = tlBuss.Add(taskLog); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (result == true) { ((FlowLayoutPanel)(_draggingLabel.Parent)).Controls.Remove(_draggingLabel); flp.Controls.Add(_draggingLabel); } _draggingLabel = null; } }
public void RefreshDGV() { TaskLogBusiness taskLogBussiness = new TaskLogBusiness(); dgvTask.DataSource = null; try { dgvTask.DataSource = taskLogBussiness.GetAll(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSearch_Click(object sender, EventArgs e) { string filter = txtSearch.Text.Trim(); if (!string.IsNullOrEmpty(filter)) { TaskLogBusiness taskLogBussiness = new TaskLogBusiness(); dgvTask.DataSource = null; try { dgvTask.DataSource = taskLogBussiness.GetAllFiltered(filter); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void FillContainers() { TaskLogBusiness taskLogBuss = new TaskLogBusiness(); List <TaskLog> tlList = taskLogBuss.GetAllByEmployeeId(_user.ID); foreach (TaskLog item in tlList) { string lblText = string.Format("Görev: {0}\nOluşturulma tarihi: {1}\nDurum tarihi: {2}", item.Task.Description, item.TaskDate, item.Task.CreatedDate); Label lbl = CreateLabel(lblText, (int)item.TaskID); if (item.TaskStatusID == 2) { flpAssigned.Controls.Add(lbl); } if (item.TaskStatusID == 3 || item.TaskStatusID == 5) { flpInProgress.Controls.Add(lbl); } if (item.TaskStatusID == 4 || item.TaskStatusID == 6) { flpDone.Controls.Add(lbl); } } }