Exemple #1
0
        protected void btnUpdateTT_Click(object sender, System.EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            //string Hours = tbTimesheetHours.Text;
            string Hours = String.Format("{0:H:mm}", dtcTimesheetHours.Value);

            if (Hours == "")
            {
                Hours = "0:00";
            }
            string[] parts   = Hours.Split(':');
            int      Minutes = 0;

            Minutes = int.Parse(parts[0]) * 60;
            if (parts.Length > 1)
            {
                Minutes += int.Parse(parts[1]);
            }

            if (Minutes > 0)
            {
                using (IDataReader rdr = ToDo.GetToDo(ToDoID))
                {
                    if (rdr.Read())
                    {
                        if (rdr["ProjectId"] != DBNull.Value)
                        {
                            int DRProjectId = (int)rdr["ProjectId"];
                            if (!TimeTracking.CanUpdate(dtc.SelectedDate, DRProjectId))
                            {
                                CustomValidator3.ErrorMessage = LocRM.GetString("tWrongDate");
                                CustomValidator3.IsValid      = false;
                                return;
                            }
                        }
                    }
                }
            }

            ToDo.AddTimeSheet(ToDoID, Minutes, dtc.SelectedDate);
            //bindHours();
            Response.Redirect(GetLink());
        }