コード例 #1
0
ファイル: TaskDB.cs プロジェクト: tsubik/SFASystem
        internal static void UpdateTask(Task task)
        {
            if (task == null)
                return;
            if (task.TaskID == Guid.Empty)
                return;
            string sqlQuery = "UPDATE Task SET Name=@Name, CreatedBy=@CreatedBy, AssignedTo=@AssignedTo, " +
                "GivenBy=@GivenBy, ApprovedBy=@ApprovedBy, FullDescription=@FullDescription, " +
                "DateCreated=@DateCreated, DateModified=@DateModified, DateExecuted=@DateExecuted, " +
                "DateToEndTask=@DateToEndTask, IsApproved=@IsApproved, TaskStatus=@TaskStatus WHERE TaskID=@TaskID";

            DbCommand dbCommand = DBHelper.GetDBCommand(sqlQuery);
            DBHelper.AddInParameter(dbCommand, "TaskID", DbType.Guid, task.TaskID);
            DBHelper.AddInParameter(dbCommand, "Name", DbType.String, task.Name);
            DBHelper.AddInParameter(dbCommand, "CreatedBy", DbType.Guid, task.CreatedByID);
            DBHelper.AddInParameter(dbCommand, "AssignedTo", DbType.Guid, task.AssignedToID);
            DBHelper.AddInParameter(dbCommand, "GivenBy", DbType.Guid, task.GivenByID);
            if(task.ApprovedByID != Guid.Empty)
                DBHelper.AddInParameter(dbCommand, "ApprovedBy", DbType.Guid, task.ApprovedByID);
            else
                DBHelper.AddInParameter(dbCommand, "ApprovedBy", DbType.Guid, DBNull.Value);
            DBHelper.AddInParameter(dbCommand, "FullDescription", DbType.String, task.FullDescription);
            DBHelper.AddInParameter(dbCommand, "DateCreated", DbType.DateTime, task.DateCreated);
            DBHelper.AddInParameter(dbCommand, "DateModified", DbType.DateTime, task.DateModified);
            if(task.DateExecuted.HasValue)
                DBHelper.AddInParameter(dbCommand, "DateExecuted", DbType.DateTime, task.DateExecuted);
            else
                DBHelper.AddInParameter(dbCommand, "DateExecuted", DbType.DateTime, DBNull.Value);
            DBHelper.AddInParameter(dbCommand, "DateToEndTask", DbType.DateTime, task.DateToEndTask);
            DBHelper.AddInParameter(dbCommand, "IsApproved", DbType.Boolean, task.IsApproved);
            DBHelper.AddInParameter(dbCommand, "TaskStatus", DbType.Guid, task.TaskStatusID);
            DBHelper.ExecuteNonQuery(dbCommand);
        }
コード例 #2
0
ファイル: TaskDetails.cs プロジェクト: tsubik/SFASystem
        private void BindData(Task t)
        {
            task = t;
            lblName.Text = t.Name;
            lblDescription.Text = t.FullDescription;
            lblDateCreated.Text = t.DateCreated.ToString("dd/mm/yyyy hh:mm");
            lblCreatedBy.Text = t.CreatedBy.ToString();
            lblAssignedBy.Text = t.AssignedTo.ToString();
            IList<Employee> employees = EmployeeManager.GetEmployees(true);
            if (t.GivenByID == ApplicationManager.Instance.CurrentEmployee.EmployeeID
                && (t.TaskStatus.DictionaryNumber == (int)TaskStatusEnum.Zakonczone
                || t.TaskStatus.DictionaryNumber == (int)TaskStatusEnum.Anulowane))
            {
                chxApproved.Enabled = true;
            }
            else
                chxApproved.Enabled = false;

            selectEmployee.SelectedEmployeeId = t.AssignedToID;
            selectEmployee.EmptyTextVisible = false;
            selectEmployee.BindData(employees);
            selectTaskStatus.EmptyTextVisible = false;
            selectTaskStatus.SelectedTaskStatusID = t.TaskStatusID;
            selectTaskStatus.BindData();
            chxApproved.Checked = t.IsApproved;
        }
コード例 #3
0
ファイル: ctrlTaskLine.cs プロジェクト: tsubik/SFASystem
 public void BindData(Task t)
 {
     task = t;
     this.lblName.Text = t.Name;
     this.lblDate.Text = t.DateCreated.Day + "/" + t.DateCreated.Month + "/" + t.DateCreated.Year;
     int cutTo = t.FullDescription.Length;
     if (cutTo > 100)
         cutTo = 100;
     this.lblText.Text = t.FullDescription.Substring(0, cutTo);
     if (t.FullDescription.Length > cutTo)
         this.lblText.Text += "...";
     if (t.IsApproved)
     {
         this.lblText.Font = new Font("Tahoma", 8, FontStyle.Strikeout);
     }
     if (t.TaskStatus.DictionaryNumber == (int)TaskStatusEnum.Nowe)
     {
         lblStatus.Text = "Status: Nowe";
         lblStatus.ForeColor = Color.Green;
     }
     if (t.TaskStatus.DictionaryNumber == (int)TaskStatusEnum.Rozpoczete)
     {
         lblStatus.Text = "Status: Rozpoczęte";
         lblStatus.ForeColor = Color.Red;
     }
     if (t.TaskStatus.DictionaryNumber == (int)TaskStatusEnum.Zakonczone)
     {
         lblStatus.Text = "Status: Zakończone";
         lblStatus.ForeColor = Color.Black;
     }
     if (t.TaskStatus.DictionaryNumber == (int)TaskStatusEnum.Anulowane)
     {
         lblStatus.Text = "Status: Anulowane";
         lblStatus.ForeColor = Color.Black;
     }
 }
コード例 #4
0
ファイル: TaskDB.cs プロジェクト: tsubik/SFASystem
 private static Task GetTaskFromReader(IDataReader dataReader)
 {
     Task task = new Task();
     task.TaskID = DBHelper.GetGuid(dataReader, "TaskID");
     task.Name = DBHelper.GetString(dataReader, "Name");
     task.CreatedByID = DBHelper.GetGuid(dataReader, "CreatedBy");
     task.AssignedToID = DBHelper.GetGuid(dataReader, "AssignedTo");
     task.GivenByID = DBHelper.GetGuid(dataReader, "GivenBy");
     task.ApprovedByID = DBHelper.GetGuid(dataReader, "ApprovedBy");
     task.FullDescription = DBHelper.GetString(dataReader, "FullDescription");
     task.DateCreated = DBHelper.GetDateTime(dataReader, "DateCreated");
     task.DateModified = DBHelper.GetNullableDateTime(dataReader, "DateModified");
     task.DateExecuted = DBHelper.GetNullableDateTime(dataReader, "DateExecuted");
     task.DateToEndTask = DBHelper.GetNullableDateTime(dataReader, "DateToEndTask");
     task.IsApproved = DBHelper.GetBoolean(dataReader, "IsApproved");
     task.TaskStatusID = DBHelper.GetGuid(dataReader, "TaskStatus");
     return task;
 }
コード例 #5
0
ファイル: TaskManager.cs プロジェクト: tsubik/SFASystem
 public static void UpdateTask(Task task)
 {
     task.DateModified = DateTime.Now;
     TaskDB.UpdateTask(task);
 }
コード例 #6
0
ファイル: TaskDetails.cs プロジェクト: tsubik/SFASystem
 public void Show(Task task)
 {
     BindData(task);
     Show();
 }