// ////////////////////////////////////////////////////////////////////////
        // PUBLIC METHODS
        //
        /// <summary>
        /// Load all TeamProjectTimeDetails by TeamProjectTimeId
        /// </summary>
        /// <param name="teamProjectTimeId">teamProjectTimeId</param>
        public void LoadAllByTeamProjectTimeId(int teamProjectTimeId)
        {
            Table.Rows.Clear();

            TeamProjectTime2DetailGateway teamProjectTime2DetailGateway = new TeamProjectTime2DetailGateway(Data);
            teamProjectTime2DetailGateway.LoadAllByTeamProjectTimeId(teamProjectTimeId);

            foreach (TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_DETAILRow row in ((TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_DETAILDataTable)teamProjectTime2DetailGateway.Table))
            {
                TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_DETAIL_TEMPRow newRow = ((TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_DETAIL_TEMPDataTable)Table).NewLFS_TEAM_PROJECT_TIME_DETAIL_TEMPRow();

                newRow.TeamProjectTimeID = row.TeamProjectTimeID;
                newRow.DetailID = row.DetailID;
                newRow.EmployeeID = row.EmployeeID;
                newRow.CompaniesID = row.CompaniesID;
                newRow.ProjectID = row.ProjectID;
                newRow.Date_ = row.Date_;
                if (row.IsStartTimeNull()) newRow.SetStartTimeNull(); else newRow.StartTime = row.StartTime;
                if (row.IsEndTimeNull()) newRow.SetEndTimeNull(); else newRow.EndTime = row.EndTime;
                if (row.IsOffsetNull()) newRow.SetOffsetNull(); else newRow.Offset = row.Offset;
                newRow.ProjectTime = row.ProjectTime;
                if (row.IsWorkingDetailsNull()) newRow.SetWorkingDetailsNull(); else newRow.WorkingDetails = row.WorkingDetails;
                if (row.IsLocationNull()) newRow.SetLocationNull(); else newRow.Location = row.Location;
                if (row.IsMealsCountryNull()) newRow.SetMealsCountryNull(); else newRow.MealsCountry = row.MealsCountry;
                newRow.MealsAllowance = false; if (row.MealsAllowance > 0) newRow.MealsAllowance = true;
                if (row.IsUnitIDNull()) newRow.SetUnitIDNull(); else newRow.UnitID = row.UnitID;
                if (row.IsTowedUnitIDNull()) newRow.SetTowedUnitIDNull(); else newRow.TowedUnitID = row.TowedUnitID;
                newRow.ProjectTimeState = row.ProjectTimeState;
                if (row.IsCommentsNull()) newRow.SetCommentsNull(); else newRow.Comments = row.Comments;
                newRow.Deleted = row.Deleted;

                newRow.SetWork_Null(); if (!row.IsNull("Work_")) newRow.Work_ = row.Work_;
                newRow.SetFunction_Null(); if (!row.IsNull("Function_")) newRow.Function_ = row.Function_;
                newRow.SetWorkFunctionConcatNull();

                if ((!row.IsNull("Work_")) && (!row.IsNull("Function_")))
                {
                    newRow.WorkFunctionConcat = row.Work_ + " . " + row.Function_;
                }

                newRow.FairWage = row.FairWage;
                if(row.IsJobClassTypeNull()) newRow.SetJobClassTypeNull(); else newRow.JobClassType = row.JobClassType;

                ((TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_DETAIL_TEMPDataTable)Table).AddLFS_TEAM_PROJECT_TIME_DETAIL_TEMPRow(newRow);
            }
        }
        /// <summary>
        /// Update TeamProjectTime and TeamProjectTimeDetails
        /// </summary>
        public void UpdateForTemplate()
        {
            TeamProjectTime2DetailGateway teamProjectTime2DetailGateway = new TeamProjectTime2DetailGateway(Data);

            DataTable teamProjectTime2Changes = Table.GetChanges();
            DataTable teamProjectTime2DetailChanges = teamProjectTime2DetailGateway.Table.GetChanges();

            if ((teamProjectTime2Changes == null) && (teamProjectTime2DetailChanges == null)) return;

            try
            {
                DB.Open();
                DB.BeginTransaction();

                Adapter.InsertCommand.Transaction = DB.Transaction;
                Adapter.UpdateCommand.Transaction = DB.Transaction;
                Adapter.DeleteCommand.Transaction = DB.Transaction;

                teamProjectTime2DetailGateway.Adapter.InsertCommand.Transaction = DB.Transaction;
                teamProjectTime2DetailGateway.Adapter.UpdateCommand.Transaction = DB.Transaction;
                teamProjectTime2DetailGateway.Adapter.DeleteCommand.Transaction = DB.Transaction;

                if ((teamProjectTime2Changes != null) && (teamProjectTime2Changes.Rows.Count > 0))
                {
                    Adapter.Update(teamProjectTime2Changes);
                }

                if ((teamProjectTime2DetailChanges != null) && (teamProjectTime2DetailChanges.Rows.Count > 0))
                {
                    teamProjectTime2DetailGateway.Adapter.Update(teamProjectTime2DetailChanges);
                }

                DB.CommitTransaction();
            }
            catch (DBConcurrencyException dBConcurrencyException)
            {
                DB.RollbackTransaction();
                throw new Exception("Concurrency error: Another user already updated the data you are working on.  Your operation has been cancelled.", dBConcurrencyException);
            }
            catch (SqlException sqlException)
            {
                DB.RollbackTransaction();
                byte severityLevel = sqlException.Class;
                if (severityLevel <= 16)
                {
                    throw new Exception("Low severity error. Your operation has been cancelled.  SQL Error " + severityLevel + ".");
                }
                if ((severityLevel >= 17) && (severityLevel <= 19))
                {
                    throw new Exception("Mid severity error. Your operation has been cancelled.  SQL Error " + severityLevel + ".");
                }
                if (severityLevel >= 20)
                {
                    throw new Exception("High severity error. Your operation has been cancelled.  SQL Error " + severityLevel + ".");
                }
            }
            catch (Exception e)
            {
                DB.RollbackTransaction();
                throw new Exception("Unknow error. Your operation has been cancelled.", e);
            }
            finally
            {
                DB.Close();
            }
        }
        /// <summary>
        /// Update TeamProjectTime, TeamProjectTimeDetail and ProjectTimes
        /// </summary>
        /// <param name="projectTime2TDS">ProjectTime2TDS</param>
        public void Update(ProjectTimeTDS projectTime2TDS)
        {
            TeamProjectTime2DetailGateway teamProjectTime2DetailGateway = new TeamProjectTime2DetailGateway(Data);
            ProjectTimeGateway projectTime2Gateway = new ProjectTimeGateway(projectTime2TDS);
            ProjectTimeSectionGateway projectTime2SectionGateway = new ProjectTimeSectionGateway(projectTime2TDS);

            DataTable teamProjectTime2Changes = Table.GetChanges();
            DataTable teamProjectTime2DetailChanges = teamProjectTime2DetailGateway.Table.GetChanges();
            DataTable projectTime2Changes = projectTime2Gateway.Table.GetChanges();
            DataTable projectTime2SectionChanges = projectTime2SectionGateway.Table.GetChanges();

            if ((teamProjectTime2Changes == null) && (teamProjectTime2DetailChanges == null) && (projectTime2Changes == null)) return;

            try
            {
                DB.Open();
                DB.BeginTransaction();

                Adapter.InsertCommand.Transaction = DB.Transaction;
                Adapter.UpdateCommand.Transaction = DB.Transaction;
                Adapter.DeleteCommand.Transaction = DB.Transaction;

                teamProjectTime2DetailGateway.Adapter.InsertCommand.Transaction = DB.Transaction;
                teamProjectTime2DetailGateway.Adapter.UpdateCommand.Transaction = DB.Transaction;
                teamProjectTime2DetailGateway.Adapter.DeleteCommand.Transaction = DB.Transaction;

                projectTime2Gateway.Adapter.InsertCommand.Transaction = DB.Transaction;
                projectTime2Gateway.Adapter.UpdateCommand.Transaction = DB.Transaction;
                projectTime2Gateway.Adapter.DeleteCommand.Transaction = DB.Transaction;

                projectTime2SectionGateway.Adapter.InsertCommand.Transaction = DB.Transaction;
                projectTime2SectionGateway.Adapter.UpdateCommand.Transaction = DB.Transaction;
                projectTime2SectionGateway.Adapter.DeleteCommand.Transaction = DB.Transaction;

                if ((teamProjectTime2Changes != null) && (teamProjectTime2Changes.Rows.Count > 0))
                {
                    int lastTeamProjectTimeId = DB.GetIdentCurrent("LFS_TEAM_PROJECT_TIME", DB.Transaction);
                    Adapter.Update(teamProjectTime2Changes);
                    int newTeamProjectTimeId = DB.GetIdentCurrent("LFS_TEAM_PROJECT_TIME", DB.Transaction);
                    if (lastTeamProjectTimeId != newTeamProjectTimeId)
                    {
                        TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIMERow row = ((TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIMEDataTable)Table).FindByTeamProjectTimeID(0);
                        row.TeamProjectTimeID = newTeamProjectTimeId;
                        teamProjectTime2DetailChanges = teamProjectTime2DetailGateway.Table.GetChanges();
                    }
                }

                if ((teamProjectTime2DetailChanges != null) && (teamProjectTime2DetailChanges.Rows.Count > 0))
                {
                    teamProjectTime2DetailGateway.Adapter.Update(teamProjectTime2DetailChanges);
                }

                if ((projectTime2Changes != null) && (projectTime2Changes.Rows.Count > 0))
                {
                    projectTime2Gateway.Adapter.Update(projectTime2Changes);
                }

                if ((projectTime2SectionChanges != null) && (projectTime2SectionChanges.Rows.Count > 0))
                {
                    projectTime2SectionGateway.Adapter.Update(projectTime2SectionChanges);
                }

                DB.CommitTransaction();
            }
            catch (DBConcurrencyException dBConcurrencyException)
            {
                DB.RollbackTransaction();
                throw new Exception("Concurrency error: Another user already updated the data you are working on.  Your operation has been cancelled.", dBConcurrencyException);
            }
            catch (SqlException sqlException)
            {
                DB.RollbackTransaction();
                byte severityLevel = sqlException.Class;
                if (severityLevel <= 16)
                {
                    throw new Exception("Low severity error. Your operation has been cancelled.  SQL Error " + severityLevel + ".");
                }
                if ((severityLevel >= 17) && (severityLevel <= 19))
                {
                    throw new Exception("Mid severity error. Your operation has been cancelled.  SQL Error " + severityLevel + ".");
                }
                if (severityLevel >= 20)
                {
                    throw new Exception("High severity error. Your operation has been cancelled.  SQL Error " + severityLevel + ".");
                }
            }
            catch (Exception e)
            {
                DB.RollbackTransaction();
                throw new Exception("Unknow error. Your operation has been cancelled.", e);
            }
            finally
            {
                DB.Close();
            }
        }
        /// <summary>
        /// Update
        /// </summary>
        /// <param name="teamProjectTimeId">teamProjectTimeId</param>
        /// <param name="teamProjectTimeIdForReplace">teamProjectTimeIdForReplace</param>
        /// <param name="teamProjectTime2TDSToSave">teamProjectTime2TDSToSave</param>
        public void Update(int teamProjectTimeId, int teamProjectTimeIdForReplace, TeamProjectTime2TDS teamProjectTime2TDSToSave)
        {
            // Load existing rows
            TeamProjectTime2DetailGateway teamProjectTime2DetailGateway = new TeamProjectTime2DetailGateway(teamProjectTime2TDSToSave);
            teamProjectTime2DetailGateway.LoadAllByTeamProjectTimeId(teamProjectTimeIdForReplace);

            // Delete existing rows
            foreach (TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_DETAILRow detailExistingRow in ((TeamProjectTime2TDS)teamProjectTime2DetailGateway.Data).LFS_TEAM_PROJECT_TIME_DETAIL)
            {
                detailExistingRow.Deleted = true;
            }

            // Insert or update detail rows
            foreach (TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_DETAILRow detailRow in ((TeamProjectTime2TDS)Data).LFS_TEAM_PROJECT_TIME_DETAIL)
            {
                int detailId = detailRow.DetailID;
                int employeeId = detailRow.EmployeeID;
                int companiesId = detailRow.CompaniesID;
                int projectId = detailRow.ProjectID;
                DateTime date_ = detailRow.Date_;
                string startTimeDetail = ""; if (!detailRow.IsNull("StartTime")) startTimeDetail = detailRow.StartTime;
                string endTimeDetail = null; if (!detailRow.IsNull("EndTime")) endTimeDetail = detailRow.EndTime;
                double? offset = null; if (!detailRow.IsNull("Offset")) offset = detailRow.Offset;
                double projectTime = detailRow.ProjectTime;
                string workingDetails = ""; if (!detailRow.IsNull("WorkingDetails")) workingDetails = detailRow.WorkingDetails;
                string location = ""; if (!detailRow.IsNull("Location")) location = detailRow.Location;
                Int64? mealsCountry = null; if (!detailRow.IsNull("MealsCountry")) mealsCountry = detailRow.MealsCountry;
                string mealsAllowanceType = ""; if (!detailRow.IsNull("MealsAllowanceType")) mealsAllowanceType = detailRow.MealsAllowanceType;
                decimal mealsAllowance = detailRow.MealsAllowance;
                int? unitId = null; if (!detailRow.IsNull("UnitID")) unitId = detailRow.UnitID;
                int? towedUnitId = null; if (!detailRow.IsNull("TowedUnitID")) towedUnitId = detailRow.TowedUnitID;
                string ProjectTimeState = detailRow.ProjectTimeState;
                string comments = ""; if (!detailRow.IsNull("Comments")) comments = detailRow.Comments;
                bool deleted = detailRow.Deleted;
                bool fairWage = detailRow.FairWage;
                string jobClassType = ""; if (!detailRow.IsNull("JobClassType")) jobClassType = detailRow.JobClassType;

                // ... Get row if exists
                TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_DETAILRow oldDetailRow = null;

                try
                {
                    oldDetailRow = (TeamProjectTime2TDS.LFS_TEAM_PROJECT_TIME_DETAILRow)teamProjectTime2DetailGateway.GetRow(teamProjectTimeIdForReplace, detailId);
                }
                catch
                {
                    oldDetailRow = null;
                }

                // ... Row check
                TeamProjectTime2Detail teamProjectTime2DetailToSave = new TeamProjectTime2Detail(teamProjectTime2TDSToSave);
                if (oldDetailRow != null)
                {
                    teamProjectTime2DetailToSave.Update(teamProjectTimeIdForReplace, detailId, employeeId, companiesId, projectId, date_, startTimeDetail, endTimeDetail, offset, projectTime, workingDetails, location, mealsCountry, mealsAllowanceType, mealsAllowance, unitId, towedUnitId, ProjectTimeState, comments, deleted, fairWage, jobClassType);
                }
                else
                {
                    teamProjectTime2DetailToSave.Insert(teamProjectTimeIdForReplace, employeeId, companiesId, projectId, date_, startTimeDetail, endTimeDetail, offset, workingDetails, location, mealsCountry, mealsAllowanceType, mealsAllowance, ProjectTimeState, comments, fairWage, jobClassType);
                }
            }
        }
        private void DeleteTemplate(int teamProjectTimeId)
        {
            // Create TDS to save
            teamProjectTime2TDSToSave = new TeamProjectTime2TDS();

            // Delete Template
            TeamProjectTime2Template teamProjectTime2Template = new TeamProjectTime2Template(teamProjectTime2TDS);
            teamProjectTime2Template.Delete(teamProjectTimeId);

            // ... Store datasets for teplate
            Session.Remove("templateDummy");
            Session["teamProjectTime2TDS"] = teamProjectTime2TDS;
            template = teamProjectTime2TDS.Template;
            Session["template"] = teamProjectTime2TDS.Template;

            // Delete associated TeamProjectTime to Template
            // ... load TeamProjectTime
            TeamProjectTime2Gateway teamProjectTime2Gateway = new TeamProjectTime2Gateway(teamProjectTime2TDSToSave);
            teamProjectTime2Gateway.LoadByTeamProjectTimeId(teamProjectTimeId);

            // ... delete TeamProjectTime
            TeamProjectTime2 teamProjectTime2 = new TeamProjectTime2(teamProjectTime2TDSToSave);
            teamProjectTime2.Delete(teamProjectTimeId);

            // Delete associated TeamProjectTimeDetails to Template
            // ... load TeamProjectTimeDetails
            TeamProjectTime2DetailGateway teamProjectTime2DetailGateway = new TeamProjectTime2DetailGateway(teamProjectTime2TDSToSave);
            teamProjectTime2DetailGateway.LoadByTeamProjectTimeId(teamProjectTimeId);

            // ... delete TeamProjectTimeDetails
            TeamProjectTime2Detail teamProjectTime2Detail = new TeamProjectTime2Detail(teamProjectTime2TDSToSave);
            teamProjectTime2Detail.Delete(teamProjectTimeId);
        }
        protected void grdProjectTime_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                // For Start Time
                if (!string.IsNullOrEmpty(hdfStartTime.Value))
                {
                    string startTime = DateTime.Parse(hdfStartTime.Value).ToString("H:mm");
                    if (startTime != "")
                    {
                        string[] hoursMin1 = startTime.Split(':');
                        ((DropDownList)e.Row.FindControl("ddlStartTimeHourFooter")).SelectedValue = hoursMin1[0].Trim();
                        ((DropDownList)e.Row.FindControl("ddlStartTimeMinuteFooter")).SelectedValue = hoursMin1[1].Trim();
                    }
                }

                // For End Time
                if (!string.IsNullOrEmpty(hdfEndTime.Value))
                {
                    string endTime = DateTime.Parse(hdfEndTime.Value).ToString("H:mm");
                    if (endTime != "")
                    {
                        string[] endHoursMin1 = endTime.Split(':');
                        ((DropDownList)e.Row.FindControl("ddlEndTimeHourFooter")).SelectedValue = endHoursMin1[0].Trim();
                        ((DropDownList)e.Row.FindControl("ddlEndTimeMinuteFooter")).SelectedValue = endHoursMin1[1].Trim();
                    }
                }

                // For Lunch
                string lunch = hdfOffset.Value;
                if (lunch != "")
                {
                    ((DropDownList)e.Row.FindControl("ddlLunchFooter")).SelectedValue = lunch;
                }

                // For Type Of Work
                string workFunctionConcat = hdfWorkFunctionConcat.Value;
                ((DropDownList)e.Row.FindControl("ddlTypeOfWorkFooter")).SelectedValue = workFunctionConcat;

                // For Meals Allowance
                //string isMealsAllowance = hdfIsMealsAllowance.Value;
                //((CheckBox)e.Row.FindControl("ckbxMealsAllowanceFooter")).Checked = Boolean.Parse(isMealsAllowance);

                // For Job Class
                ProjectGateway projectGateway = new ProjectGateway();
                projectGateway.LoadByProjectId(Int32.Parse(ddlProject.SelectedValue));

                if (projectGateway.GetFairWageApplies(int.Parse(ddlProject.SelectedValue)))
                {
                    int employeeId = Int32.Parse(((DropDownList)e.Row.FindControl("ddlEmployeesFooter")).SelectedValue);

                    EmployeeInformationBasicInformationGateway employeeInformationBasicInformation = new EmployeeInformationBasicInformationGateway();
                    employeeInformationBasicInformation.LoadByEmployeeId(employeeId);
                    string jobClassType = employeeInformationBasicInformation.GetJobClassType(employeeId);

                    if (jobClassType != "")
                    {
                        ((DropDownList)e.Row.FindControl("ddlJobClassTypeFooter")).SelectedValue = jobClassType;
                    }
                }
            }

            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate))))
            {
                int teamProjectTimeId = Int32.Parse(((Label)e.Row.FindControl("lblTeamProjectTimeIdEdit")).Text.Trim());
                int detailId = Int32.Parse(((Label)e.Row.FindControl("lblDetailIdEdit")).Text.Trim());
                TeamProjectTime2DetailGateway teamProjectTime2DetailGateway = new TeamProjectTime2DetailGateway(teamProjectTime2TDS);

                // For employee
                int employeeId = 0; if (teamProjectTime2DetailGateway.GetEmployeeId(teamProjectTimeId, detailId) != -1) employeeId = teamProjectTime2DetailGateway.GetEmployeeId(teamProjectTimeId, detailId);
                if (employeeId != -1)
                {
                    ((DropDownList)e.Row.FindControl("ddlEmployeesEdit")).SelectedValue = employeeId.ToString();
                }

                // For Start Time
                string startTime = ""; if (teamProjectTime2DetailGateway.GetStartTime(teamProjectTimeId, detailId) != "") startTime = DateTime.Parse(teamProjectTime2DetailGateway.GetStartTime(teamProjectTimeId, detailId)).ToString("H:mm"); ;
                if (startTime != "")
                {
                    string[] hoursMin1 = startTime.Split(':');
                    ((DropDownList)e.Row.FindControl("ddlStartTimeHourEdit")).SelectedValue = hoursMin1[0].Trim();
                    ((DropDownList)e.Row.FindControl("ddlStartTimeMinuteEdit")).SelectedValue = hoursMin1[1].Trim();
                }

                // For End Time
                string endTime = ""; if (teamProjectTime2DetailGateway.GetEndTime(teamProjectTimeId, detailId) != "") endTime = DateTime.Parse(teamProjectTime2DetailGateway.GetEndTime(teamProjectTimeId, detailId)).ToString("H:mm");;
                if (endTime != "")
                {
                    string[] endHoursMin1 = endTime.Split(':');
                    ((DropDownList)e.Row.FindControl("ddlEndTimeHourEdit")).SelectedValue = endHoursMin1[0].Trim();
                    ((DropDownList)e.Row.FindControl("ddlEndTimeMinuteEdit")).SelectedValue = endHoursMin1[1].Trim();
                }

                // For Type Of Work
                string work_ = teamProjectTime2DetailGateway.GetWork(teamProjectTimeId, detailId);
                string function_ = teamProjectTime2DetailGateway.GetFunction(teamProjectTimeId, detailId);
                ((DropDownList)e.Row.FindControl("ddlTypeOfWorkFunctionEdit")).SelectedValue = work_ + " . " + function_;

                string jobClass = teamProjectTime2DetailGateway.GetJobClassType(teamProjectTimeId, detailId);
                ((DropDownList)e.Row.FindControl("ddlJobClassTypeEdit")).SelectedValue = jobClass;

                // For Unit
                int? unitId = null; if (teamProjectTime2DetailGateway.GetUnitId(teamProjectTimeId, detailId).HasValue) unitId = (int)teamProjectTime2DetailGateway.GetUnitId(teamProjectTimeId, detailId);
                if (unitId.HasValue)
                {
                    ((DropDownList)e.Row.FindControl("ddlUnitEdit")).SelectedValue = ((int)unitId).ToString();
                }

                // For Towed
                int? towedId = null; if (teamProjectTime2DetailGateway.GetTowedUnitId(teamProjectTimeId, detailId).HasValue) towedId = (int)teamProjectTime2DetailGateway.GetTowedUnitId(teamProjectTimeId, detailId);
                if (towedId.HasValue)
                {
                    ((DropDownList)e.Row.FindControl("ddlTowedEdit")).SelectedValue = ((int)towedId).ToString();
                }
            }

            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == (DataControlRowState.Normal | DataControlRowState.Alternate))))
            {
                int teamProjectTimeId = Int32.Parse(((Label)e.Row.FindControl("lblTeamProjectTimeId")).Text.Trim());
                int detailId = Int32.Parse(((Label)e.Row.FindControl("lblDetailId")).Text.Trim());
                TeamProjectTime2DetailGateway teamProjectTime2DetailGateway = new TeamProjectTime2DetailGateway(teamProjectTime2TDS);

                // For Start Time
                string startTime = "";
                try
                {
                    if (teamProjectTime2DetailGateway.GetStartTime(teamProjectTimeId, detailId) != "") startTime = DateTime.Parse(teamProjectTime2DetailGateway.GetStartTime(teamProjectTimeId, detailId)).ToString("H:mm"); ;
                }
                catch
                {
                }
                if (startTime != "")
                {
                    ((TextBox)e.Row.FindControl("tbxStartTime")).Text = startTime;
                }

                // For End Time
                string endTime = "";
                try
                {
                    if (teamProjectTime2DetailGateway.GetEndTime(teamProjectTimeId, detailId) != "") endTime = DateTime.Parse(teamProjectTime2DetailGateway.GetEndTime(teamProjectTimeId, detailId)).ToString("H:mm"); ;
                }
                catch
                {
                }
                if (endTime != "")
                {
                    ((TextBox)e.Row.FindControl("tbxEndTime")).Text = endTime;
                }
            }
        }