Exemplo n.º 1
0
        protected void btnUpdateTimeTracking_ServerClick(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 && !TimeTracking.CanUpdate(dtc.SelectedDate, Task.GetProject(TaskID)))
            {
                CustomValidator3.ErrorMessage = LocRM.GetString("tWrongDate");
                CustomValidator3.IsValid      = false;
                return;
            }

            Task.AddTimeSheet(TaskID, Minutes, dtc.SelectedDate);
            bindHours();

            Response.Redirect(GetLink());
        }
Exemplo n.º 2
0
        private void ibUpdate_ServerClick(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            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 && !TimeTracking.CanUpdate(dtc.SelectedDate, Document.GetProject(DocumentID)))
            {
                cvHours.ErrorMessage = LocRM2.GetString("tWrongDate");
                cvHours.IsValid      = false;
                return;
            }

            Document.AddTimeSheet(DocumentID, Minutes, dtc.SelectedDate);
            bindHours();

            Response.Redirect(GetLink());
        }
Exemplo n.º 3
0
        protected void btnUpdateOS_ServerClick(object sender, System.EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            ListItem li = ddPercentOS.SelectedItem;

            if (li != null)
            {
                int percent = int.Parse(li.Value);

                //string Hours = tbTTOS.Text;
                string Hours = String.Format("{0:H:mm}", dtcTimesheetHoursOS.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(dtcOS.SelectedDate, DRProjectId))
                                {
                                    CustomValidator2.ErrorMessage = LocRM.GetString("tWrongDate");
                                    CustomValidator2.IsValid      = false;
                                    return;
                                }
                            }
                        }
                    }
                }

                ToDo.UpdatePercent(ToDoID, percent, Minutes, dtcOS.SelectedDate);
            }
            CheckCompleted();
            //bindHours();
            Response.Redirect(GetLink());
        }
Exemplo n.º 4
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());
        }
Exemplo n.º 5
0
        protected void btnUpdatePS_ServerClick(object sender, System.EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            ListItem li = ddPercentPS.SelectedItem;

            if (li != null)
            {
                int percent = int.Parse(li.Value);

                //string Hours = tbTTPS.Text;
                string Hours = String.Format("{0:H:mm}", dtcTimesheetHoursPS.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 && !TimeTracking.CanUpdate(dtcPS.SelectedDate, Task.GetProject(TaskID)))
                {
                    CustomValidator1.ErrorMessage = LocRM.GetString("tWrongDate");
                    CustomValidator1.IsValid      = false;
                    return;
                }

                Task.UpdateResourcePercent(TaskID, percent, Minutes, dtcPS.SelectedDate);
            }
            CheckCompleted();
            //bindHours();
            Response.Redirect(GetLink());
        }