private void deleteProfile(SafetyCheckProfile targetProfile, Action callback) { bool profileWasDeleted = MobileWorkerFlow.MWFServicesCommunication.Client.DeleteSafetyCheckProfile(new Guid(Configuration.BlueSphereCustomerId), targetProfile.ProfileId); deleteProfileError.Visible = !profileWasDeleted; callback(); }
private void rgProfiles_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { string command = e.CommandName.ToUpper(); if (e.Item.ItemIndex > -1) { SafetyCheckProfile selectedRow = ProfileList[e.Item.ItemIndex]; switch (command) { case "EDITPROFILE": // Load up the selected profile details then go to the add/edit page editProfile(selectedRow, () => gotoPanel(SafetyCheckProfileAdminPages.AddOrEditSafetyCheckProfile)); break; case "DELETEPROFILE": // Delete the profile, then reload the profile list deleteProfile(selectedRow, () => gotoPanel(SafetyCheckProfileAdminPages.ListSafetyCheckProfiles)); break; case "ASSIGNPROFILE": // Load up the selected profile details then go to the add/edit page assignProfile(selectedRow, () => gotoPanel(SafetyCheckProfileAdminPages.AssignProfileToVehicles)); break; } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); Orchestrator.WebUI.Security.Authorise.EnforceAuthorisation(eSystemPortion.GeneralUsage, eSystemPortion.AddEditResource); // ListSafetyCheckProfiles events rgProfiles.NeedDataSource += rgProfiles_NeedDataSource; rgProfiles.ItemCommand += rgProfiles_ItemCommand; btnAddNew.Click += btnAddNewProfile_Click; // AddOrEditSafetyCheckProfile events btnAddNewFault.Click += btnAddNewFault_Click; btnCancel.Click += btnCancel_Click; // BEWARE: Same cancel method is used below for panel assignment cancel button btnSaveChanges.Click += btnSaveChanges_Click; repeaterFaultList.ItemCommand += repeaterFaultList_ItemCommand; repeaterFaultList.ItemDataBound += repeaterFaultList_ItemDataBound; // AssignProfileToVehicles btnCancelAssignments.Click += btnCancel_Click; // BEWARE: Same cancel method is used above for add/edit profile panel cancel button btnSaveAssignments.Click += btnSaveAssignments_Click; // TODO: Attach more events ? if (!IsPostBack) { // On initial load make sure objects reflect a new profile CurrentProfile = new SafetyCheckProfile(); CurrentProfileFaultList = new List <SafetyCheckProfileFault>(); AssigningProfile = null; } }
private void editProfile(SafetyCheckProfile targetProfile, Action callback) { CurrentProfile = targetProfile; CurrentProfileFaultList = MobileWorkerFlow.MWFServicesCommunication.Client.GetSafetyCheckProfileFaultList(new Guid(Configuration.BlueSphereCustomerId), CurrentProfile.ProfileId); btnSaveChanges.Text = "Save Changes"; btnCancel.Text = "Cancel Changes"; callback(); }
private void addProfile(Action callback) { CurrentProfile = new SafetyCheckProfile(); CurrentProfileFaultList = new List <SafetyCheckProfileFault>(); btnSaveChanges.Text = "Save New Profile"; btnCancel.Text = "Cancel"; callback(); }
private void assignProfile(SafetyCheckProfile targetProfile, Action callback) { AssigningProfile = targetProfile; lblAssigningProfileTitle.InnerText = AssigningProfile.ProfileTitle; callback(); }