Esempio n. 1
0
 private void deleteProfile(Fleetwood.BlueSphere.BusinessLogic.SafetyCheckProfile targetProfile, Action callback)
 {
     CurrentProfile           = targetProfile;
     CurrentProfile.IsDeleted = true;
     CurrentProfile.Update();
     callback();
 }
Esempio n. 2
0
        private void rgProfiles_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            string command = e.CommandName.ToUpper();

            if (e.Item.ItemIndex > -1)
            {
                Fleetwood.BlueSphere.BusinessLogic.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;
                }
            }
        }
Esempio n. 3
0
 private void editProfile(Fleetwood.BlueSphere.BusinessLogic.SafetyCheckProfile targetProfile, Action callback)
 {
     CurrentProfile          = targetProfile;
     CurrentProfileFaultList = CurrentProfile.FaultTypeList;
     btnSaveChanges.Text     = "Save Changes";
     btnCancel.Text          = "Cancel Changes";
     callback();
 }
Esempio n. 4
0
 private void addProfile(Action callback)
 {
     CurrentProfile            = new Fleetwood.BlueSphere.BusinessLogic.SafetyCheckProfile();
     CurrentProfile.CustomerID = BSCustomer.ID;
     CurrentProfileFaultList   = new Fleetwood.BlueSphere.BusinessLogic.FaultTypeList(false);
     btnSaveChanges.Text       = "Save New Profile";
     btnCancel.Text            = "Cancel";
     callback();
 }
Esempio n. 5
0
        /// <summary>
        /// On save click - beware some funky logic included here if user is trying to UPDATE an existing profile...
        /// </summary>
        private void btnSaveChanges_Click(object sender, EventArgs e)
        {
            updateProfileDataSource();
            updateFaultListDataSource();

            Page.Validate("MinimumProfileDetails");
            if (Page.IsValid)
            {
                try
                {
                    // get the currently Assigned vehicles (if any)
                    Fleetwood.BlueSphere.BusinessLogic.VehicleList assignedVehicles = CurrentProfile.VehicleList;

                    //when profiels are updated this actually creates a new one
                    Guid newProfileID = CurrentProfile.Update();
                    CurrentProfile = new Fleetwood.BlueSphere.BusinessLogic.SafetyCheckProfile(newProfileID);
                    foreach (Fleetwood.BlueSphere.BusinessLogic.FaultType item in CurrentProfileFaultList)
                    {
                        if (item.SafetyCheckProfileID != new Guid("00000000-0000-0000-0000-000000000000"))
                        {
                            Fleetwood.BlueSphere.BusinessLogic.FaultType clonedFault = item.Clone();
                            clonedFault.SafetyCheckProfileID = CurrentProfile.ID;
                            clonedFault.IsDeleted            = false;
                            clonedFault.Update();
                        }
                        else
                        {
                            item.SafetyCheckProfileID = CurrentProfile.ID;
                            item.Update();
                        }
                    }

                    // Now we need to re-ssign any vehicles that had the old Id to the new one.
                    ArrayList assignments = new ArrayList();
                    foreach (Fleetwood.BlueSphere.BusinessLogic.Vehicle v in assignedVehicles)
                    {
                        assignments.Add(v.ID);
                    }

                    CurrentProfile.AssignVehicles(assignments);

                    saveProfileError.Visible = false;
                    Response.Redirect(Request.RawUrl);
                }
                catch (Exception ex)
                {
                    saveProfileError.Visible   = true;
                    saveProfileError.InnerText = ex.Message;
                }
            }
        }
Esempio n. 6
0
 private void assignProfile(Fleetwood.BlueSphere.BusinessLogic.SafetyCheckProfile targetProfile, Action callback)
 {
     this.CurrentProfile = targetProfile;
     lblAssigningProfileTitle.InnerText = targetProfile.Title;
     callback();
 }