protected override DataTable GetEntityData(int?entityKey) { var scheduleItemdata = new ScheduleItemDataModel(); scheduleItemdata.ScheduleItemId = entityKey; var results = ScheduleItemDataManager.Search(scheduleItemdata, SessionVariables.RequestProfile); return(results); }
private DataTable GetScheduleItemData(int scheduleId) { var dt = ScheduleItemDataManager.GetBySchedule(scheduleId, SessionVariables.RequestProfile); var scheduleItemdt = ScheduleItemDataManager.GetList(SessionVariables.RequestProfile); var resultdt = scheduleItemdt.Clone(); foreach (DataRow row in dt.Rows) { var rows = scheduleItemdt.Select("ScheduleItemId = " + row[ScheduleItemDataModel.DataColumns.ScheduleItemId]); resultdt.ImportRow(rows[0]); } return(resultdt); }
protected void btnDelete_Click(object sender, EventArgs e) { try { string[] deleteIndexList = DeleteIds.Split(','); foreach (string index in deleteIndexList) { var data = new ScheduleItemDataModel(); data.ScheduleItemId = int.Parse(index); ScheduleItemDataManager.Delete(data, SessionVariables.RequestProfile); } DeleteAndRedirect(); } catch (Exception ex) { Response.Write(ex.Message); } }
protected override DataTable UpdateData() { var UpdatedData = new DataTable(); var data = new ScheduleItemDataModel(); UpdatedData = ScheduleItemDataManager.Search(data, SessionVariables.RequestProfile).Clone(); for (var i = 0; i < SelectedData.Rows.Count; i++) { data.ScheduleItemId = Convert.ToInt32(SelectedData.Rows[i][ScheduleItemDataModel.DataColumns.ScheduleItemId].ToString()); data.ScheduleId = !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(ScheduleItemDataModel.DataColumns.ScheduleId)) ? int.Parse(CheckAndGetRepeaterTextBoxValue(ScheduleItemDataModel.DataColumns.ScheduleId).ToString()) : int.Parse(SelectedData.Rows[i][ScheduleItemDataModel.DataColumns.ScheduleId].ToString()); data.TaskFormulationId = !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(ScheduleItemDataModel.DataColumns.TaskFormulationId)) ? int.Parse(CheckAndGetRepeaterTextBoxValue(ScheduleItemDataModel.DataColumns.TaskFormulationId).ToString()) : int.Parse(SelectedData.Rows[i][ScheduleItemDataModel.DataColumns.TaskFormulationId].ToString()); data.TotalTimeSpent = !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(ScheduleItemDataModel.DataColumns.TotalTimeSpent)) ? Decimal.Parse(CheckAndGetRepeaterTextBoxValue(ScheduleItemDataModel.DataColumns.TotalTimeSpent).ToString()) : Decimal.Parse(SelectedData.Rows[i][ScheduleItemDataModel.DataColumns.TotalTimeSpent].ToString()); ScheduleItemDataManager.Update(data, SessionVariables.RequestProfile); data = new ScheduleItemDataModel(); data.ScheduleItemId = Convert.ToInt32(SelectedData.Rows[i][ScheduleItemDataModel.DataColumns.ScheduleItemId].ToString()); var dt = TaskTimeTracker.Components.Module.TimeTracking.ScheduleItemDataManager.Search(data, SessionVariables.RequestProfile); if (dt.Rows.Count == 1) { UpdatedData.ImportRow(dt.Rows[0]); } } return(UpdatedData); }