Пример #1
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="campus">The <see cref="Campus"/>.</param>
        private void ShowEditDetails(Campus campus)
        {
            if (campus == null)
            {
                return;
            }

            if (campus.Id == 0)
            {
                lActionTitle.Text = ActionTitle.Add(Campus.FriendlyTypeName).FormatAsHtmlTitle();
                hlStatus.Visible  = false;
            }
            else
            {
                lActionTitle.Text = ActionTitle.Edit(campus.Name).FormatAsHtmlTitle();
                SetStatusLabel(campus);
            }

            SetEditMode(true);
            LoadDropDowns();

            tbCampusName.Text  = campus.Name;
            cbIsActive.Checked = !campus.IsActive.HasValue || campus.IsActive.Value;
            tbDescription.Text = campus.Description;
            dvpCampusStatus.SetValue(campus.CampusStatusValueId);
            dvpCampusType.SetValue(campus.CampusTypeValueId);
            tbCampusCode.Text     = campus.ShortCode;
            urlCampus.Text        = campus.Url;
            pnbPhoneNumber.Number = campus.PhoneNumber;
            lpLocation.Location   = campus.Location;

            ddlTimeZone.SetValue(campus.TimeZoneId);
            ppCampusLeader.SetValue(campus.LeaderPersonAlias != null ? campus.LeaderPersonAlias.Person : null);
            kvlServiceTimes.Value = campus.ServiceTimes;

            campus.LoadAttributes();
            avcAttributes.ExcludedAttributes = campus.Attributes.Where(a => !a.Value.IsAuthorized(Rock.Security.Authorization.EDIT, this.CurrentPerson)).Select(a => a.Value).ToArray();
            avcAttributes.AddEditControls(campus);
        }
Пример #2
0
        /// <summary>
        /// Gs the workflow type attributes_ show edit.
        /// </summary>
        /// <param name="attributeGuid">The attribute GUID.</param>
        protected void gWorkflowTypeAttributes_ShowEdit(Guid attributeGuid)
        {
            pnlDetails.Visible = false;
            vsDetails.Enabled  = false;
            pnlWorkflowTypeAttributes.Visible = true;

            Attribute attribute;

            if (attributeGuid.Equals(Guid.Empty))
            {
                attribute = new Attribute();
                edtWorkflowTypeAttributes.ActionTitle = ActionTitle.Add("attribute for workflow type " + tbName.Text);
            }
            else
            {
                AttributeService attributeService = new AttributeService();
                attribute = attributeService.Get(attributeGuid);
                edtWorkflowTypeAttributes.ActionTitle = ActionTitle.Edit("attribute for workflow type " + tbName.Text);
            }

            edtWorkflowTypeAttributes.SetAttributeProperties(attribute);
        }
Пример #3
0
        /// <summary>
        /// Shows the edit.
        /// </summary>
        /// <param name="report">The data view.</param>
        public void ShowEditDetails(Report report)
        {
            if (report.Id > 0)
            {
                lActionTitle.Text = ActionTitle.Edit(Report.FriendlyTypeName);
            }
            else
            {
                lActionTitle.Text = ActionTitle.Add(Report.FriendlyTypeName);
            }

            LoadDropDowns();
            LoadDataViewDropdown(report.EntityTypeId);

            SetEditMode(true);

            tbName.Text        = report.Name;
            tbDescription.Text = report.Description;
            cpCategory.SetValue(report.CategoryId);
            ddlEntityType.SetValue(report.EntityTypeId);
            ddlDataView.SetValue(report.DataViewId);
        }
Пример #4
0
        /// <summary>
        /// Gs the defined type attributes_ show edit.
        /// </summary>
        /// <param name="attributeGuid">The attribute GUID.</param>
        protected void gDefinedTypeAttributes_ShowEdit(Guid attributeGuid)
        {
            pnlDetails.Visible = false;
            vsDetails.Enabled  = false;
            pnlDefinedTypeAttributes.Visible = true;

            Attribute attribute;

            if (attributeGuid.Equals(Guid.Empty))
            {
                attribute = new Attribute();
                edtDefinedTypeAttributes.ActionTitle = ActionTitle.Add("attribute for defined type " + tbTypeName.Text);
            }
            else
            {
                AttributeService attributeService = new AttributeService();
                attribute = attributeService.Get(attributeGuid);
                edtDefinedTypeAttributes.ActionTitle = ActionTitle.Edit("attribute for defined type " + tbTypeName.Text);
            }

            edtDefinedTypeAttributes.SetAttributeProperties(attribute, typeof(DefinedValue));
        }
Пример #5
0
        /// <summary>
        /// Gs the workflow type attributes_ show edit.
        /// </summary>
        /// <param name="attributeGuid">The attribute GUID.</param>
        protected void gWorkflowTypeAttributes_ShowEdit(Guid attributeGuid)
        {
            pnlDetails.Visible = false;
            pnlWorkflowTypeAttributes.Visible = true;

            Attribute attribute;

            if (attributeGuid.Equals(Guid.Empty))
            {
                attribute             = new Attribute();
                attribute.FieldTypeId = FieldTypeCache.Read(Rock.SystemGuid.FieldType.TEXT).Id;
                edtWorkflowTypeAttributes.ActionTitle = ActionTitle.Add("attribute for workflow type " + tbName.Text);
            }
            else
            {
                AttributeService attributeService = new AttributeService();
                attribute = attributeService.Get(attributeGuid);
                edtWorkflowTypeAttributes.ActionTitle = ActionTitle.Edit("attribute for workflow type " + tbName.Text);
            }

            edtWorkflowTypeAttributes.SetAttributeProperties(attribute, typeof(Workflow));
        }
Пример #6
0
        /// <summary>
        /// Gs the group type attributes_ show edit.
        /// </summary>
        /// <param name="attributeGuid">The attribute GUID.</param>
        protected void gGroupTypeAttributes_ShowEdit(Guid attributeGuid)
        {
            pnlDetails.Visible            = false;
            pnlGroupTypeAttribute.Visible = true;

            edtGroupTypeAttributes.AttributeEntityTypeId = Rock.Web.Cache.EntityTypeCache.Read(typeof(GroupType)).Id;

            Attribute attribute;

            if (attributeGuid.Equals(Guid.Empty))
            {
                attribute = new Attribute();
                edtGroupTypeAttributes.ActionTitle = ActionTitle.Add("attribute for group type " + tbName.Text);
            }
            else
            {
                attribute = GroupTypeAttributesState.First(a => a.Guid.Equals(attributeGuid));
                edtGroupTypeAttributes.ActionTitle = ActionTitle.Edit("attribute for group type " + tbName.Text);
            }

            edtGroupTypeAttributes.SetAttributeProperties(attribute, typeof(GroupType));
        }
        /// <summary>
        /// Gs the marketing campaign ad attribute type_ show edit.
        /// </summary>
        /// <param name="attributeId">The attribute id.</param>
        protected void gItemAttributes_ShowEdit(Guid attributeGuid)
        {
            Attribute attribute;

            if (attributeGuid.Equals(Guid.Empty))
            {
                attribute                     = new Attribute();
                attribute.FieldTypeId         = FieldTypeCache.Read(Rock.SystemGuid.FieldType.TEXT).Id;
                edtItemAttributes.ActionTitle = ActionTitle.Add(tbName.Text + " Item Attribute");
            }
            else
            {
                attribute = ItemAttributesState.First(a => a.Guid.Equals(attributeGuid));
                edtItemAttributes.ActionTitle = ActionTitle.Edit(tbName.Text + " Item Attribute");
            }

            edtItemAttributes.ReservedKeyNames = ItemAttributesState.Where(a => !a.Guid.Equals(attributeGuid)).Select(a => a.Key).ToList();

            edtItemAttributes.SetAttributeProperties(attribute, typeof(ContentChannelItem));

            ShowDialog("ItemAttributes", true);
        }
Пример #8
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="event">The event.</param>
        private void ShowEditDetails(FollowingEventType followingEvent)
        {
            if (followingEvent.Id == 0)
            {
                lActionTitle.Text = ActionTitle.Add(FollowingEventType.FriendlyTypeName).FormatAsHtmlTitle();
            }
            else
            {
                lActionTitle.Text = followingEvent.Name.FormatAsHtmlTitle();
            }

            hlInactive.Visible = !followingEvent.IsActive;

            SetEditMode(true);

            tbName.Text        = followingEvent.Name;
            cbIsActive.Checked = followingEvent.IsActive;
            tbDescription.Text = followingEvent.Description;
            cpEventType.SetValue(followingEvent.EntityType != null ? followingEvent.EntityType.Guid.ToString().ToUpper() : string.Empty);
            cbSendOnFriday.Checked             = !followingEvent.SendOnWeekends;
            cbIncludeNonPublicRequests.Visible = false;
            cbIncludeNonPublicRequests.Checked = false;

            if (followingEvent.EntityType != null)
            {
                var eventEntityTypeGuid = EntityTypeCache.Get(followingEvent.EntityType.Id)?.Guid.ToString();
                if (string.Equals(eventEntityTypeGuid, Rock.SystemGuid.EntityType.PERSON_PRAYER_REQUEST, StringComparison.OrdinalIgnoreCase))
                {
                    cbIncludeNonPublicRequests.Visible = true;
                    cbIncludeNonPublicRequests.Checked = followingEvent.IncludeNonPublicRequests;
                }
            }

            cbRequireNotification.Checked = followingEvent.IsNoticeRequired;
            ceNotificationFormat.Text     = followingEvent.EntityNotificationFormatLava;

            BuildDynamicControls(followingEvent, true);
        }
Пример #9
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="category">The category.</param>
        private void ShowEditDetails(Category category)
        {
            if (category.Id > 0)
            {
                lActionTitle.Text = ActionTitle.Edit(Category.FriendlyTypeName);
            }
            else
            {
                lActionTitle.Text = ActionTitle.Add(Category.FriendlyTypeName);
            }

            SetEditMode(true);

            tbName.Text = category.Name;

            if (category.EntityTypeId != 0)
            {
                var entityType = EntityTypeCache.Read(category.EntityTypeId);
                lblEntityTypeName.Text = entityType.Name;
            }
            else
            {
                lblEntityTypeName.Text = string.Empty;
            }

            cpParentCategory.EntityTypeId = category.EntityTypeId;
            cpParentCategory.EntityTypeQualifierColumn = category.EntityTypeQualifierColumn;
            cpParentCategory.EntityTypeQualifierValue  = category.EntityTypeQualifierValue;
            cpParentCategory.SetValue(category.ParentCategoryId);

            lblEntityTypeQualifierColumn.Visible = !string.IsNullOrWhiteSpace(category.EntityTypeQualifierColumn);
            lblEntityTypeQualifierColumn.Text    = category.EntityTypeQualifierColumn;
            lblEntityTypeQualifierValue.Visible  = !string.IsNullOrWhiteSpace(category.EntityTypeQualifierValue);
            lblEntityTypeQualifierValue.Text     = category.EntityTypeQualifierValue;
            tbIconCssClass.Text  = category.IconCssClass;
            imgIconSmall.ImageId = category.IconSmallFileId;
            imgIconLarge.ImageId = category.IconLargeFileId;
        }
Пример #10
0
        private void ShowDefinedValueEdit(int valueId)
        {
            var          definedType = DefinedTypeCache.Get(hfDefinedTypeId.ValueAsInt());
            DefinedValue definedValue;

            modalValue.SubTitle = String.Format("Id: {0}", valueId);

            if (!valueId.Equals(0))
            {
                definedValue = new DefinedValueService(new RockContext()).Get(valueId);
                if (definedType != null)
                {
                    lActionTitleDefinedValue.Text = ActionTitle.Edit("defined value for " + definedType.Name);
                }
            }
            else
            {
                definedValue = new DefinedValue {
                    Id = 0
                };
                definedValue.DefinedTypeId = hfDefinedTypeId.ValueAsInt();
                if (definedType != null)
                {
                    lActionTitleDefinedValue.Text = ActionTitle.Add("defined value for " + definedType.Name);
                }
            }


            hfDefinedValueId.SetValue(definedValue.Id);
            tbValueName.Text        = definedValue.Value;
            tbValueDescription.Text = definedValue.Description;
            cbValueActive.Checked   = definedValue.IsActive;

            avcDefinedValueAttributes.ValidationGroup = modalValue.ValidationGroup;
            avcDefinedValueAttributes.AddEditControls(definedValue);

            modalValue.Show();
        }
Пример #11
0
        /// <summary>
        /// Gs the binary file attributes_ show edit.
        /// </summary>
        /// <param name="attributeGuid">The attribute GUID.</param>
        protected void gBinaryFileAttributes_ShowEdit(Guid attributeGuid)
        {
            pnlDetails.Visible             = false;
            pnlBinaryFileAttribute.Visible = true;

            Attribute attribute;

            if (attributeGuid.Equals(Guid.Empty))
            {
                attribute             = new Attribute();
                attribute.FieldTypeId = FieldTypeCache.Get(Rock.SystemGuid.FieldType.TEXT).Id;
                edtBinaryFileAttributes.ActionTitle = ActionTitle.Add("attribute for binary files of type " + tbName.Text);
            }
            else
            {
                attribute = BinaryFileAttributesState.First(a => a.Guid.Equals(attributeGuid));
                edtBinaryFileAttributes.ActionTitle = ActionTitle.Edit("attribute for binary files of type " + tbName.Text);
            }

            edtBinaryFileAttributes.ReservedKeyNames = BinaryFileAttributesState.Where(a => !a.Guid.Equals(attributeGuid)).Select(a => a.Key).ToList();

            edtBinaryFileAttributes.SetAttributeProperties(attribute, typeof(BinaryFile));
        }
Пример #12
0
        /// <summary>
        /// Gs the marketing campaign ad attribute type_ show edit.
        /// </summary>
        /// <param name="attributeId">The attribute id.</param>
        protected void gMarketingCampaignAdAttributeType_ShowEdit(Guid attributeGuid)
        {
            pnlDetails.Visible         = false;
            pnlAdTypeAttribute.Visible = true;

            Attribute attribute;

            if (attributeGuid.Equals(Guid.Empty))
            {
                attribute                       = new Attribute();
                attribute.FieldTypeId           = FieldTypeCache.Read(Rock.SystemGuid.FieldType.TEXT).Id;
                edtAdTypeAttributes.ActionTitle = ActionTitle.Add("attribute for ad type " + tbName.Text);
            }
            else
            {
                attribute = AttributesState.First(a => a.Guid.Equals(attributeGuid));
                edtAdTypeAttributes.ActionTitle = ActionTitle.Edit("attribute for ad type " + tbName.Text);
            }

            edtAdTypeAttributes.ReservedKeyNames = AttributesState.Where(a => !a.Guid.Equals(attributeGuid)).Select(a => a.Key).ToList();

            edtAdTypeAttributes.SetAttributeProperties(attribute, typeof(MarketingCampaignAd));
        }
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="fileFormat">The file format.</param>
        private void ShowEditDetails(ImageCashLetterFileFormat fileFormat)
        {
            if (fileFormat.Id == 0)
            {
                lActionTitle.Text = ActionTitle.Add("File Format");
            }
            else
            {
                lActionTitle.Text = fileFormat.Name.FormatAsHtmlTitle();
            }

            hlInactive.Visible = !fileFormat.IsActive;

            SetEditMode(true);

            tbName.Text             = fileFormat.Name;
            cbIsActive.Checked      = fileFormat.IsActive;
            tbDescription.Text      = fileFormat.Description;
            tbFileNameTemplate.Text = fileFormat.FileNameTemplate;
            cpFileFormatType.SetValue(fileFormat.EntityType != null ? fileFormat.EntityType.Guid.ToString().ToUpper() : string.Empty);

            BuildDynamicControls(fileFormat, true);
        }
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="groupMember">The group member.</param>
        private void ShowEditDetails(GroupMember groupMember)
        {
            if (groupMember.Id.Equals(0))
            {
                lActionTitle.Text = ActionTitle.Add("Group Member to " + groupMember.Group.Name);
            }
            else
            {
                lActionTitle.Text = ActionTitle.Edit("Group Member for " + groupMember.Group.Name);
            }

            SetEditMode(true);

            LoadDropDowns();

            ppGroupMemberPerson.SetValue(groupMember.Person);
            ddlGroupRole.SetValue(groupMember.GroupRoleId);
            ddlGroupMemberStatus.SetValue((int)groupMember.GroupMemberStatus);

            phAttributes.Controls.Clear();
            groupMember.LoadAttributes();
            Rock.Attribute.Helper.AddEditControls(groupMember, phAttributes, true);
        }
Пример #15
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="prayerRequest">The prayer request.</param>
        private void ShowEditDetails(PrayerRequest prayerRequest)
        {
            SetEditMode(true);

            lActionTitle.Text = (prayerRequest.Id > 0) ?
                                ActionTitle.Edit(PrayerRequest.FriendlyTypeName) : ActionTitle.Add(PrayerRequest.FriendlyTypeName);

            pnlDetails.Visible = true;

            cpCategory.SetValue(prayerRequest.Category);

            tbFirstName.Text = prayerRequest.FirstName;
            tbLastName.Text  = prayerRequest.LastName;
            tbText.Text      = prayerRequest.Text;
            tbAnswer.Text    = prayerRequest.Answer;

            ShowStatus(prayerRequest, this.CurrentPerson, lFlaggedMessage);

            cbIsPublic.Checked      = prayerRequest.IsPublic ?? false;
            cbIsUrgent.Checked      = prayerRequest.IsUrgent ?? false;
            cbIsActive.Checked      = prayerRequest.IsActive ?? false;
            cbAllowComments.Checked = prayerRequest.AllowComments ?? false;
        }
Пример #16
0
        /// <summary>
        /// Shows the mode where the user can edit an existing streak type
        /// </summary>
        private void ShowEditMode()
        {
            if (!IsEditMode())
            {
                return;
            }

            pnlEditDetails.Visible = true;
            pnlViewDetails.Visible = false;
            HideSecondaryBlocks(true);
            pdAuditDetails.Visible = true;

            var enrollment = GetStreak();

            lReadOnlyTitle.Text = ActionTitle.Edit(Streak.FriendlyTypeName).FormatAsHtmlTitle();

            rppPerson.Visible = false;
            divPerson.Visible = true;
            lPersonName.Text  = enrollment.PersonAlias.Person.FullName;

            rdpEnrollmentDate.SelectedDate = enrollment.EnrollmentDate;
            rlpLocation.Location           = enrollment.Location;
        }
Пример #17
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="gateway">The gateway.</param>
        private void ShowEditDetails(FinancialGateway gateway)
        {
            if (gateway.Id == 0)
            {
                lActionTitle.Text = ActionTitle.Add(FinancialGateway.FriendlyTypeName).FormatAsHtmlTitle();
            }
            else
            {
                lActionTitle.Text = gateway.Name.FormatAsHtmlTitle();
            }

            hlInactive.Visible = !gateway.IsActive;

            SetEditMode(true);

            tbName.Text        = gateway.Name;
            cbIsActive.Checked = gateway.IsActive;
            tbDescription.Text = gateway.Description;
            cpGatewayType.SetValue(gateway.EntityType != null ? gateway.EntityType.Guid.ToString().ToUpper() : string.Empty);
            tpBatchTimeOffset.SelectedTime = gateway.GetBatchTimeOffset();

            BuildDynamicControls(gateway, true);
        }
Пример #18
0
        /// <summary>
        /// Show the mode where a user can add a new achievement type
        /// </summary>
        private void ShowAddMode()
        {
            if (!IsAddMode())
            {
                return;
            }

            pnlEditDetails.Visible = true;
            pnlViewDetails.Visible = false;
            HideSecondaryBlocks(true);
            spstStepType.Enabled = true; // Can only set this when adding a new achievement type

            lReadOnlyTitle.Text = ActionTitle.Add(AchievementType.FriendlyTypeName).FormatAsHtmlTitle();

            nbMaxAccomplishments.IntegerValue = 1;
            cbActive.Checked   = true;
            cbIsPublic.Checked = true;

            SyncStepControls();
            SyncOverAchievementAndMaxControls();
            RenderComponentAttributeControls();
            SyncPrerequisiteList();
        }
Пример #19
0
        /// <summary>
        /// Shows the edit modal.
        /// </summary>
        /// <param name="valueId">The value unique identifier.</param>
        protected void ShowEdit(int valueId)
        {
            var metricId = hfMetricId.ValueAsInt();
            var metric   = new MetricService().Get(metricId);

            MetricValue metricValue = null;

            if (!valueId.Equals(0))
            {
                metricValue = new MetricValueService().Get(valueId);
                if (metric != null)
                {
                    lActionTitle.Text = ActionTitle.Edit("metric value for " + metric.Title);
                }
            }
            else
            {
                metricValue = new MetricValue {
                    Id = 0
                };
                metricValue.MetricId = metricId;
                if (metric != null)
                {
                    lActionTitle.Text = ActionTitle.Add("metric value for " + metric.Title);
                }
            }

            hfMetricValueId.SetValue(metricValue.Id);
            ddlMetricFilter.SelectedValue = hfMetricId.Value;
            tbValue.Text            = metricValue.Value;
            tbValueDescription.Text = metricValue.Description;
            tbXValue.Text           = metricValue.xValue;
            tbLabel.Text            = metricValue.Label;
            cbIsDateBased.Checked   = metricValue.isDateBased;

            modalValue.Show();
        }
Пример #20
0
        /// <summary>
        /// Shows the edit.
        /// </summary>
        /// <param name="accountId">The account id.</param>
        protected void ShowEdit(int accountId)
        {
            var accountModel = new FinancialAccountService().Get(accountId);

            hfAccountId.Value = accountId.ToString();
            string actionTitle;

            if (accountModel == null)
            {
                accountModel              = new Rock.Model.FinancialAccount();
                actionTitle               = ActionTitle.Add(Rock.Model.Attribute.FriendlyTypeName);
                tbName.Text               = string.Empty;
                tbPublicName.Text         = string.Empty;
                tbDescription.Text        = string.Empty;
                tbOrder.Text              = string.Empty;
                tbGLCode.Text             = string.Empty;
                cbIsActive.Checked        = false;
                cbIsTaxDeductible.Checked = false;
            }
            else
            {
                actionTitle               = ActionTitle.Edit(Rock.Model.Attribute.FriendlyTypeName);
                tbName.Text               = accountModel.Name ?? string.Empty;
                tbPublicName.Text         = accountModel.PublicName ?? string.Empty;
                tbDescription.Text        = accountModel.Description ?? string.Empty;
                tbOrder.Text              = accountModel.Order.ToString();
                tbGLCode.Text             = accountModel.GlCode ?? string.Empty;
                cbIsActive.Checked        = accountModel.IsActive;
                cbIsTaxDeductible.Checked = accountModel.IsTaxDeductible;
                dtpStartDate.SelectedDate = accountModel.StartDate;
                dtpEndDate.SelectedDate   = accountModel.EndDate;
                apParentAccount.SetValue(accountModel.ParentAccount);
            }

            pnlAccountList.Visible    = false;
            pnlAccountDetails.Visible = true;
        }
Пример #21
0
        /// <summary>
        /// Shows the edit.
        /// </summary>
        /// <param name="emailTemplateId">The email template id.</param>
        protected void ShowEdit(int emailTemplateId)
        {
            pnlList.Visible    = false;
            pnlDetails.Visible = true;

            EmailTemplateService emailTemplateService = new EmailTemplateService();
            EmailTemplate        emailTemplate        = emailTemplateService.Get(emailTemplateId);

            if (emailTemplate != null)
            {
                lActionTitle.Text       = ActionTitle.Edit(EmailTemplate.FriendlyTypeName);
                hfEmailTemplateId.Value = emailTemplate.Id.ToString();

                tbCategory.Text = emailTemplate.Category;
                tbTitle.Text    = emailTemplate.Title;
                tbFrom.Text     = emailTemplate.From;
                tbTo.Text       = emailTemplate.To;
                tbCc.Text       = emailTemplate.Cc;
                tbBcc.Text      = emailTemplate.Bcc;
                tbSubject.Text  = emailTemplate.Subject;
                tbBody.Text     = emailTemplate.Body;
            }
            else
            {
                lActionTitle.Text       = ActionTitle.Add(EmailTemplate.FriendlyTypeName);
                hfEmailTemplateId.Value = 0.ToString();

                tbCategory.Text = string.Empty;
                tbTitle.Text    = string.Empty;
                tbFrom.Text     = string.Empty;
                tbTo.Text       = string.Empty;
                tbCc.Text       = string.Empty;
                tbBcc.Text      = string.Empty;
                tbSubject.Text  = string.Empty;
                tbBody.Text     = string.Empty;
            }
        }
Пример #22
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="account">The account.</param>
        private void ShowEditDetails(FinancialAccount account)
        {
            if (account.Id == 0)
            {
                lActionTitle.Text = ActionTitle.Add(FinancialAccount.FriendlyTypeName).FormatAsHtmlTitle();

                // hide the panel drawer that show created and last modified dates
                pdAuditDetails.Visible = false;
            }
            else
            {
                lActionTitle.Text = account.Name.FormatAsHtmlTitle();
            }

            hlInactive.Visible = !account.IsActive;

            SetEditMode(true);

            LoadDropDowns();

            tbName.Text              = account.Name;
            cbIsActive.Checked       = account.IsActive;
            cbIsPublic.Checked       = account.IsPublic.HasValue ? account.IsPublic.Value : false;
            tbDescription.Text       = account.Description;
            cePublicDescription.Text = account.PublicDescription;

            apParentAccount.SetValue(account.ParentAccount);
            ddlAccountType.SetValue(account.AccountTypeValueId);
            tbPublicName.Text         = account.PublicName;
            tbUrl.Text                = account.Url;
            cpCampus.SelectedCampusId = account.CampusId;

            tbGLCode.Text             = account.GlCode;
            cbIsTaxDeductible.Checked = account.IsTaxDeductible;
            dtpStartDate.SelectedDate = account.StartDate;
            dtpEndDate.SelectedDate   = account.EndDate;
        }
Пример #23
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="tag">The tag.</param>
        private void ShowEditDetails( Tag tag )
        {

            if ( tag.Id == 0 )
            {
                lReadOnlyTitle.Text = ActionTitle.Add( Tag.FriendlyTypeName ).FormatAsHtmlTitle();
            }
            else
            {
                lReadOnlyTitle.Text = tag.Name.FormatAsHtmlTitle();
            }

            SetEditMode( true );

            tbName.Text = tag.Name;
            tbDescription.Text = tag.Description;
            if ( tag.OwnerPersonAlias != null )
            {
                rblScope.SelectedValue = "Personal";
                ppOwner.SetValue( tag.OwnerPersonAlias.Person );
            }
            else
            {
                rblScope.SelectedValue = "Organization";
                ppOwner.SetValue( null );
            }

            ddlEntityType.Items.Clear();
            new EntityTypeService( new RockContext() ).GetEntityListItems().ForEach( l => ddlEntityType.Items.Add( l ) );
            ddlEntityType.SelectedValue = tag.EntityTypeId.ToString();
            tbEntityTypeQualifierColumn.Text = tag.EntityTypeQualifierColumn;
            tbEntityTypeQualifierValue.Text = tag.EntityTypeQualifierValue;

            rblScope.Visible = _canConfigure;
            ppOwner.Visible = _canConfigure;
        }
Пример #24
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="competency">The residency competency.</param>
        private void ShowEditDetails(Competency competency)
        {
            if (competency.Id > 0)
            {
                lActionTitle.Text = ActionTitle.Edit(Competency.FriendlyTypeName);
            }
            else
            {
                lActionTitle.Text = ActionTitle.Add(Competency.FriendlyTypeName);
            }

            SetEditMode(true);

            tbName.Text        = competency.Name;
            tbDescription.Text = competency.Description;
            lblPeriod.Text     = competency.Track.Period.Name;
            lblTrack.Text      = competency.Track.Name;
            ppTeacherOfRecord.SetValue(competency.TeacherOfRecordPerson);
            ppFacilitator.SetValue(competency.FacilitatorPerson);
            tbGoals.Text               = competency.Goals;
            tbCreditHours.Text         = competency.CreditHours.ToString();
            tbSupervisionHours.Text    = competency.SupervisionHours.ToString();
            tbImplementationHours.Text = competency.ImplementationHours.ToString();
        }
Пример #25
0
        /// <summary>
        /// Shows all the edit details for this signal type.
        /// </summary>
        private void ShowDetail()
        {
            var rockContext = new RockContext();
            var signalType  = new SignalTypeService(rockContext).Get(SignalTypeId);

            if (signalType == null)
            {
                signalType             = new SignalType();
                pdAuditDetails.Visible = false;
                lActionTitle.Text      = ActionTitle.Add(signalType.Name).FormatAsHtmlTitle();
            }
            else
            {
                lActionTitle.Text = ActionTitle.Edit(signalType.Name).FormatAsHtmlTitle();
            }

            //
            // Switch everything to read-only if user not allowed to administrate.
            //
            if (!signalType.IsAuthorized(Authorization.ADMINISTRATE, CurrentPerson) || !IsUserAuthorized(Authorization.EDIT))
            {
                tbName.Enabled         = false;
                tbDescription.Enabled  = false;
                cpColor.Enabled        = false;
                tbIconCssClass.Enabled = false;

                nbEditModeMessage.Text = EditModeMessage.NotAuthorizedToEdit(SignalType.FriendlyTypeName);
            }

            tbName.Text         = signalType.Name;
            tbDescription.Text  = signalType.Description;
            cpColor.Text        = signalType.SignalColor;
            tbIconCssClass.Text = signalType.SignalIconCssClass;

            pdAuditDetails.SetEntity(signalType, ResolveRockUrl("~"));
        }
Пример #26
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="schedule">The schedule.</param>
        public void ShowEditDetails(Schedule schedule)
        {
            if (schedule.Id > 0)
            {
                lActionTitle.Text = ActionTitle.Edit(Schedule.FriendlyTypeName);
            }
            else
            {
                lActionTitle.Text = ActionTitle.Add(Schedule.FriendlyTypeName);
            }

            SetEditMode(true);

            tbScheduleName.Text        = schedule.Name;
            tbScheduleDescription.Text = schedule.Description;

            sbSchedule.iCalendarContent = schedule.iCalendarContent;
            UpdateHelpText();

            cpCategory.SetValue(schedule.CategoryId);

            nbStartOffset.Text = schedule.CheckInStartOffsetMinutes.HasValue ? schedule.CheckInStartOffsetMinutes.ToString() : string.Empty;
            nbEndOffset.Text   = schedule.CheckInEndOffsetMinutes.HasValue ? schedule.CheckInEndOffsetMinutes.Value.ToString() : string.Empty;
        }
Пример #27
0
        /// <summary>
        /// Shows the edit details.
        /// </summary>
        /// <param name="location">The location.</param>
        private void ShowEditDetails(Location location)
        {
            divAdvSettings.Visible  = !_personId.HasValue;
            cbIsActive.Visible      = !_personId.HasValue;
            geopFence.Visible       = !_personId.HasValue;
            nbSoftThreshold.Visible = !_personId.HasValue;
            nbFirmThreshold.Visible = !_personId.HasValue;

            if (location.Id == 0)
            {
                lReadOnlyTitle.Text = ActionTitle.Add(Location.FriendlyTypeName).FormatAsHtmlTitle();
                hlInactive.Visible  = false;
            }
            else
            {
                if (_personId.HasValue)
                {
                    hlInactive.Visible = false;
                }

                if (string.IsNullOrWhiteSpace(location.Name))
                {
                    lReadOnlyTitle.Text = location.ToString().FormatAsHtmlTitle();
                }
                else
                {
                    lReadOnlyTitle.Text = location.Name.FormatAsHtmlTitle();
                }
            }

            SetEditMode(true);

            imgImage.BinaryFileId = location.ImageId;
            imgImage.NoPictureUrl = System.Web.VirtualPathUtility.ToAbsolute("~/Assets/Images/no-picture.svg?");

            tbName.Text        = location.Name;
            cbIsActive.Checked = location.IsActive;
            acAddress.SetValues(location);
            ddlPrinter.SetValue(location.PrinterDeviceId);
            geopPoint.SetValue(location.GeoPoint);
            geopFence.SetValue(location.GeoFence);

            cbGeoPointLocked.Checked = location.IsGeoPointLocked ?? false;

            nbSoftThreshold.Text = location.SoftRoomThreshold.HasValue ? location.SoftRoomThreshold.Value.ToString() : "";
            nbFirmThreshold.Text = location.FirmRoomThreshold.HasValue ? location.FirmRoomThreshold.Value.ToString() : "";

            Guid mapStyleValueGuid = GetAttributeValue("MapStyle").AsGuid();

            geopPoint.MapStyleValueGuid = mapStyleValueGuid;
            geopFence.MapStyleValueGuid = mapStyleValueGuid;

            var rockContext      = new RockContext();
            var locationService  = new LocationService(rockContext);
            var attributeService = new AttributeService(rockContext);

            dvpLocationType.DefinedTypeId = DefinedTypeCache.Get(Rock.SystemGuid.DefinedType.LOCATION_TYPE.AsGuid()).Id;

            gpParentLocation.Location = location.ParentLocation ?? locationService.Get(location.ParentLocationId ?? 0);

            // LocationType depends on Selected ParentLocation
            if (location.Id == 0 && dvpLocationType.Items.Count > 1)
            {
                // if this is a new location
                dvpLocationType.SelectedIndex = 0;
            }
            else
            {
                dvpLocationType.SetValue(location.LocationTypeValueId);
            }

            location.LoadAttributes(rockContext);
        }
Пример #28
0
        /// <summary>
        /// Shows the edit.
        /// </summary>
        /// <param name="DeviceId">The device identifier.</param>
        public void ShowDetail(int signId)
        {
            pnlDetails.Visible = true;
            Sign sign = null;

            var rockContext = new RockContext();

            if (!signId.Equals(0))
            {
                sign = new SignService(rockContext).Get(signId);
                lActionTitle.Text = ActionTitle.Edit(Sign.FriendlyTypeName).FormatAsHtmlTitle();
                SignCategories    = new Dictionary <int, string>();
                foreach (var signCategory in sign.SignCategories)
                {
                    SignCategories.Add(signCategory.Id, signCategory.Name);
                }
            }

            if (sign == null)
            {
                sign = new Sign {
                    Id = 0
                };
                lActionTitle.Text = ActionTitle.Add(Sign.FriendlyTypeName).FormatAsHtmlTitle();
                sign.Port         = "9107";
            }

            hfSignId.Value = sign.Id.ToString();

            tbName.Text        = sign.Name;
            tbPIN.Text         = sign.PIN;
            tbDescription.Text = sign.Description;
            tbIPAddress.Text   = sign.IPAddress;

            if (sign.Port.IsNullOrWhiteSpace())
            {
                sign.Port = "9107";
            }
            tbPort.Text = sign.Port;

            // render UI based on Authorized and IsSystem
            bool readOnly = false;

            nbEditModeMessage.Text = string.Empty;
            if (!IsUserAuthorized(Authorization.EDIT))
            {
                readOnly = true;
                nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(Sign.FriendlyTypeName);
            }

            if (readOnly)
            {
                lActionTitle.Text = ActionTitle.View(Sign.FriendlyTypeName);
                btnCancel.Text    = "Close";
            }

            tbName.ReadOnly        = readOnly;
            tbPIN.ReadOnly         = readOnly;
            tbDescription.ReadOnly = readOnly;

            btnSave.Visible = !readOnly;

            BindSignCategories();
        }
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="serviceJobId">The service job identifier.</param>
        public void ShowDetail(int serviceJobId)
        {
            pnlDetails.Visible = true;
            LoadDropDowns();

            // Load depending on Add(0) or Edit
            ServiceJob job = null;

            if (!serviceJobId.Equals(0))
            {
                job = new ServiceJobService(new RockContext()).Get(serviceJobId);
                lActionTitle.Text = ActionTitle.Edit(ServiceJob.FriendlyTypeName).FormatAsHtmlTitle();
            }

            if (job == null)
            {
                job = new ServiceJob {
                    Id = 0, IsActive = true
                };
                lActionTitle.Text = ActionTitle.Add(ServiceJob.FriendlyTypeName).FormatAsHtmlTitle();
            }

            hfId.Value                = job.Id.ToString();
            tbName.Text               = job.Name;
            tbDescription.Text        = job.Description;
            cbActive.Checked          = job.IsActive.HasValue ? job.IsActive.Value : false;
            ddlJobTypes.SelectedValue = job.Class;
            tbNotificationEmails.Text = job.NotificationEmails;
            ddlNotificationStatus.SetValue((int)job.NotificationStatus);
            tbCronExpression.Text = job.CronExpression;

            if (job.Id == 0)
            {
                job.Class = ddlJobTypes.SelectedValue;
                lCronExpressionDesc.Visible = false;
                lLastStatusMessage.Visible  = false;
            }
            else
            {
                lCronExpressionDesc.Text = ExpressionDescriptor.GetDescription(job.CronExpression, new Options {
                    ThrowExceptionOnParseError = false
                });
                lCronExpressionDesc.Visible = true;

                lLastStatusMessage.Text    = job.LastStatusMessage.ConvertCrLfToHtmlBr();
                lLastStatusMessage.Visible = true;
            }

            job.LoadAttributes();
            phAttributes.Controls.Clear();
            Rock.Attribute.Helper.AddEditControls(job, phAttributes, true, BlockValidationGroup);

            // render UI based on Authorized and IsSystem
            bool readOnly = false;

            nbEditModeMessage.Text = string.Empty;
            if (!IsUserAuthorized(Authorization.EDIT))
            {
                readOnly = true;
                nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(ServiceJob.FriendlyTypeName);
            }

            if (job.IsSystem)
            {
                readOnly = true;
                nbEditModeMessage.Text = EditModeMessage.ReadOnlySystem(ServiceJob.FriendlyTypeName);
            }

            if (readOnly)
            {
                lActionTitle.Text = ActionTitle.View(ServiceJob.FriendlyTypeName).FormatAsHtmlTitle();
                btnCancel.Text    = "Close";
                Rock.Attribute.Helper.AddDisplayControls(job, phAttributesReadOnly);
                phAttributesReadOnly.Visible = true;
                phAttributes.Visible         = false;
                tbCronExpression.Text        = job.CronExpression;
            }


            tbName.ReadOnly               = readOnly;
            tbDescription.ReadOnly        = readOnly;
            cbActive.Enabled              = !readOnly;
            ddlJobTypes.Enabled           = !readOnly;
            tbNotificationEmails.ReadOnly = readOnly;
            ddlNotificationStatus.Enabled = !readOnly;
            tbCronExpression.ReadOnly     = readOnly;

            btnSave.Visible = !readOnly;
        }
Пример #30
0
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="metricValueId">The metric value identifier.</param>
        /// <param name="metricId">The metric identifier.</param>
        public void ShowDetail(int metricValueId, int?metricId)
        {
            pnlDetails.Visible = true;

            // Load depending on Add(0) or Edit
            MetricValue metricValue = null;

            if (!metricValueId.Equals(0))
            {
                metricValue       = new MetricValueService(new RockContext()).Get(metricValueId);
                lActionTitle.Text = ActionTitle.Edit(MetricValue.FriendlyTypeName).FormatAsHtmlTitle();
                pdAuditDetails.SetEntity(metricValue, ResolveRockUrl("~"));
            }

            if (metricValue == null && metricId.HasValue)
            {
                metricValue = new MetricValue {
                    Id = 0, MetricId = metricId.Value
                };
                metricValue.Metric = metricValue.Metric ?? new MetricService(new RockContext()).Get(metricValue.MetricId);
                lActionTitle.Text  = ActionTitle.Add(MetricValue.FriendlyTypeName).FormatAsHtmlTitle();
                // hide the panel drawer that show created and last modified dates
                pdAuditDetails.Visible = false;
            }

            hfMetricValueId.Value = metricValue.Id.ToString();

            LoadDropDowns();

            ddlMetricValueType.SelectedValue = metricValue.MetricValueType.ConvertToInt().ToString();
            tbXValue.Text    = metricValue.XValue;
            tbYValue.Text    = metricValue.YValue.ToString();
            hfMetricId.Value = metricValue.MetricId.ToString();
            tbNote.Text      = metricValue.Note;
            dpMetricValueDateTime.SelectedDate = metricValue.MetricValueDateTime;

            // render UI based on Authorized and IsSystem
            bool readOnly = false;

            nbEditModeMessage.Text = string.Empty;

            bool canEdit = UserCanEdit;

            if (!canEdit && metricId.HasValue && metricId.Value > 0)
            {
                var metric = new MetricService(new RockContext()).Get(metricId.Value);
                if (metric != null && metric.IsAuthorized(Authorization.EDIT, CurrentPerson))
                {
                    canEdit = true;
                }
            }

            if (!canEdit)
            {
                readOnly = true;
                nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(MetricValue.FriendlyTypeName);
            }

            if (readOnly)
            {
                lActionTitle.Text = ActionTitle.View(MetricValue.FriendlyTypeName);
                btnCancel.Text    = "Close";
            }

            CreateDynamicControls(metricValue, true, readOnly);

            ddlMetricValueType.Enabled    = !readOnly;
            tbXValue.ReadOnly             = readOnly;
            tbYValue.ReadOnly             = readOnly;
            tbNote.ReadOnly               = readOnly;
            dpMetricValueDateTime.Enabled = !readOnly;

            btnSave.Visible = !readOnly;
        }