private void InputTemplate_DeleteItemClicked(object sender, object e) { OperationType = Lib.UI.InputTemplate.OperationType.DeleteItem; try { switch (sender.ToString()) { case "Component": //_datasource.DeleteProgress(SelectedGroupIndex, e as RevealProjectSvc.MTODTO); break; case "Crew": //_datasource.DeleteTimeSheet(SelectedGroupIndex, e as RevealProjectSvc.TimesheetDTO); break; } } catch (Exception ee) { WinAppLibrary.Utilities.Helper.SimpleMessage(ee.Message, "Caution!"); } }
private async void EditTimeSheetAndProgress(Lib.UI.InputTemplate selectedgroup, Lib.UI.InputTemplate.OperationType type) { if (OperationType == Lib.UI.InputTemplate.OperationType.Normal) { _selectedgroup = selectedgroup; if (_selectedgroup != null) { SelectedGroupIndex = (_selectedgroup.DataContext as TimesheetAndProgress).DataID; _selectedgroup.EnableInputTemplate(true); OperationType = type; } else SelectedGroupIndex = -1; } else { bool excute = false; if (_selectedgroup == null) excute = true; else if (await WinAppLibrary.Utilities.Helper.YesOrNoMessage("If you don't save previous work you will lose all of them. Would you like to proceed?", "Caution!") == true) { //_datasource.RollBack(SelectedGroupIndex); _selectedgroup.EnableInputTemplate(false); excute = true; } if (excute) { _selectedgroup = selectedgroup; if (_selectedgroup != null) { SelectedGroupIndex = (_selectedgroup.DataContext as TimesheetAndProgress).DataID; _selectedgroup.EnableInputTemplate(true); OperationType = type; } else SelectedGroupIndex = -1; } } }
private async void InputTemplate_OperationClicked(object sender, object e) { var type = (Lib.UI.InputTemplate.OperationType)e; var selectedgroup = sender as Lib.UI.InputTemplate; switch (type) { case Lib.UI.InputTemplate.OperationType.Edit: EditTimeSheetAndProgress(selectedgroup, type); break; case Lib.UI.InputTemplate.OperationType.Add: //OpenAddingTimeSheetAndProgress(type); break; case Lib.UI.InputTemplate.OperationType.DeleteAll: if (SelectedGroupIndex > -1) { if (await WinAppLibrary.Utilities.Helper.YesOrNoMessage("You can't recover once removing all data. Would you like to proceed?", "Caution!") == true) DeleteTimeSheetAndProgress(SelectedGroupIndex); } break; case Lib.UI.InputTemplate.OperationType.Save: if (SelectedGroupIndex > -1) { OperationType = type; //SaveTimeSheetAndProgress(SelectedGroupIndex); } break; case Lib.UI.InputTemplate.OperationType.Cancel: if (selectedgroup != null && !(selectedgroup.DataContext as TimesheetAndProgress).Updated) { //_datasource.RollBack(SelectedGroupIndex); selectedgroup.EnableInputTemplate(false); SelectedGroupIndex = -1; OperationType = Lib.UI.InputTemplate.OperationType.Normal; } break; } }
private async Task<bool> InitiateList() { bool retValue = false; try { retValue = await _datasource.ReloadTimeSheetProgress(selectedDateTime, _departstructure, 0, Login.UserAccount.CurProjectID, Login.UserAccount.CurModuleID); } catch (Exception e) { (new WinAppLibrary.Utilities.Helper()).ExceptionHandler(e, "InputTimeProgress _InitiateList", "There was an error to reload timesheet and component. \n Please contact administrator", "Error"); } _selectedgroup = null; SelectedGroupIndex = -1; OperationType = Lib.UI.InputTemplate.OperationType.Normal; SelectComponentCrew.RefreshData = true; return retValue; }
private void DoBeforeBack() { OperationType = Lib.UI.InputTemplate.OperationType.Normal; Login.MasterPage.DoBeforeBack -= MasterPage_DoBeforeBack; Login.MasterPage.GoBack(); }
private void OpenAddingTimeSheetAndProgress(Lib.UI.InputTemplate.OperationType type) { if (SelectedGroupIndex > -1) { OperationType = type; var components = _datasource.GetAddingComponents(SelectedGroupIndex, Lib.DataSource.ComponentCrewDataSource.Component.ToList()); var crews = _datasource.GetAddingCrews(SelectedGroupIndex, Lib.DataSource.ComponentCrewDataSource.ForemanCrew.ToList()); _pop = WinAppLibrary.Utilities.Helper.GetPopupPane(); Lib.UI.ProgressCrewAdd progresscrew = new Lib.UI.ProgressCrewAdd(); progresscrew.OperationClick += ProgressCrewAdd_OperationClick; progresscrew.SetLayout(Window.Current.Bounds.Width, Window.Current.Bounds.Height); progresscrew.SetItemsSource(components, crews); _pop.Child = progresscrew; _pop.IsOpen = true; } }
private void ProgressCrewAdd_OperationClick(object sender, object e) { Lib.UI.ProgressCrewAdd progresscrew = sender as Lib.UI.ProgressCrewAdd; if (e.ToString().Equals("Add")) { var selectedcomp = progresscrew.GetSelectedComponents(); var selectedcrew = progresscrew.GetSelectedCrews(); AddTimeSheetAndProgress(SelectedGroupIndex, selectedcomp, selectedcrew); OperationType = Lib.UI.InputTemplate.OperationType.Edit; } progresscrew.ClearItemsSource(); progresscrew.OperationClick -= ProgressCrewAdd_OperationClick; _pop.IsOpen = false; }