示例#1
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);
        }
示例#2
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);
        }