Ejemplo n.º 1
0
        private void LoadOrganisation()
        {
            // Retrieve the organisation and place it in viewstate
            Facade.IOrganisation facOrganisation = new Facade.Organisation();
            m_organisation               = facOrganisation.GetForIdentityId(m_identityId);
            m_organisationName           = m_organisation.OrganisationName;
            ViewState[C_ORGANISATION_VS] = m_organisation;

            txtOrganisationName.Text = m_organisation.OrganisationName;

            ddStatuses.SelectedValue          = ((int)m_organisation.IdentityStatus).ToString();
            m_originalStatus                  = m_organisation.IdentityStatus;
            ViewState[C_ORIGINALSTATUS_ID_VS] = m_originalStatus;

            // Set the update buttons and labels
            btnAddLocation.Enabled = true;
            btnAdd.Text            = "Update";

            PopulateLocations();

            Repositories.DTOs.GeofenceNotificationSettings settings = facOrganisation.GetSettings(m_identityId);
            if (settings != null)
            {
                cbNotifyWhen_ItemsRequested(cbNotifyWhen, null);

                chkBoxEnableNotification.Checked = settings.Enabled;
                cbNotificationType.SelectedValue = settings.NotificationType.ToString();
                cbNotifyWhen.SelectedValue       = settings.NotifyWhen.ToString();
                txtContactDetail.Text            = settings.Recipient;
            }
        }
Ejemplo n.º 2
0
        private bool AddOrganisation()
        {
            int  identityId = 0;
            bool success    = false;

            Entities.FacadeResult retVal = new Entities.FacadeResult(0);

            Facade.IOrganisation facOrganisation = new Facade.Organisation();
            string userId = ((Entities.CustomPrincipal)Page.User).UserName;

            retVal = facOrganisation.Create(m_organisation, userId);

            if (!retVal.Success)
            {
                infringementDisplay.Infringements = retVal.Infringements;
                infringementDisplay.DisplayInfringments();
                infringementDisplay.Visible = true;

                lblConfirmation.Text      = "There was an error adding the clients customer, please try again.";
                lblConfirmation.Visible   = true;
                lblConfirmation.ForeColor = Color.Red;
                success = false;
            }
            else
            {
                identityId = retVal.ObjectId;
                success    = true;
            }

            Repositories.DTOs.GeofenceNotificationSettings settings = new Repositories.DTOs.GeofenceNotificationSettings();
            settings.IdentityId = m_organisation.IdentityId;
            settings.Enabled    = chkBoxEnableNotification.Checked;
            if (chkBoxEnableNotification.Checked)
            {
                settings.NotificationType = Convert.ToInt32(cbNotificationType.SelectedValue);
                settings.NotifyWhen       = Convert.ToInt32(cbNotifyWhen.SelectedValue);
                settings.Recipient        = txtContactDetail.Text;
            }
            facOrganisation.AddOrUpdate(settings, userId);

            return(success);
        }
Ejemplo n.º 3
0
        private bool UpdateOrganisation()
        {
            Facade.IOrganisation facOrganisaton = new Facade.Organisation();
            string userId = ((Entities.CustomPrincipal)Page.User).UserName;

            if (m_organisation.IdentityStatus == eIdentityStatus.Active && m_originalStatus == eIdentityStatus.Unapproved)
            {
                // Approve all the Points for this Client Customer too.
                Facade.IPoint facPoint = new Facade.Point();
                bool          success  = facPoint.ApproveAllPointsForOganisation(m_organisation.IdentityId);
            }


            Entities.FacadeResult retVal = facOrganisaton.Update(m_organisation, userId);

            if (!retVal.Success)
            {
                infringementDisplay.Infringements = retVal.Infringements;
                infringementDisplay.DisplayInfringments();
                infringementDisplay.Visible = true;
            }

            if (Globals.Configuration.ClientCustomerDeliveryNotificationEnabled)
            {
                Repositories.DTOs.GeofenceNotificationSettings settings = new Repositories.DTOs.GeofenceNotificationSettings();
                settings.IdentityId = m_organisation.IdentityId;
                settings.Enabled    = chkBoxEnableNotification.Checked;

                if (chkBoxEnableNotification.Checked)
                {
                    settings.NotificationType = Convert.ToInt32(cbNotificationType.SelectedValue);
                    settings.NotifyWhen       = Convert.ToInt32(cbNotifyWhen.SelectedValue);
                    settings.Recipient        = txtContactDetail.Text;
                }

                facOrganisaton.AddOrUpdate(settings, userId);
            }

            return(retVal.Success);
        }