/// <summary>
        /// Updates an existing LookupAttribute record, or inserts new record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void UpdateAttribute(object sender, EventArgs e)
        {
            CaisisTextBox attributeNameField = sender as CaisisTextBox;
            CaisisHidden  attributeIdField   = attributeNameField.NamingContainer.FindControl("AttributeId") as CaisisHidden;

            if (!string.IsNullOrEmpty(attributeNameField.Value))
            {
                // don't inesrt empty attribut names
                LookupAttribute biz = new LookupAttribute();
                // determine if updating or inserting
                if (attributeIdField != null && !string.IsNullOrEmpty(attributeIdField.Value))
                {
                    biz.Get(int.Parse(attributeIdField.Value));
                }
                biz[LookupAttribute.AttributeName] = attributeNameField.Value;
                biz.Save();
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Save's dirty rows (new and existing)
 /// </summary>
 private void Save()
 {
     foreach (GridViewRow row in AttributesGrid.DirtyGridRows)
     {
         BOL.LookupAttribute biz = new LookupAttribute();
         object attributeId      = AttributesGrid.DataKeys[row.RowIndex][BOL.LookupAttribute.AttributeId];
         if (attributeId != null && !string.IsNullOrEmpty(attributeId.ToString()))
         {
             biz.Get(int.Parse(attributeId.ToString()));
         }
         var attributeNameField = row.FindControl("AttributeName") as ICaisisInputControl;
         if (!string.IsNullOrEmpty(attributeNameField.Value))
         {
             biz[BOL.LookupAttribute.AttributeName] = attributeNameField.Value;
             biz.Save();
         }
     }
 }
Esempio n. 3
0
        protected override void Execute(CodeActivityContext eContext)
        {
            var lookup = LookupAttribute.Get(eContext);
            var orgurl = OrgUrl.Get(eContext);
            var context = eContext.GetExtension<IWorkflowContext>();
            var serviceFactory = eContext.GetExtension<IOrganizationServiceFactory>();
            var service = serviceFactory.CreateOrganizationService(context.UserId);

            var reference = GetReference(service, lookup, new EntityReference(context.PrimaryEntityName, context.PrimaryEntityId));
            
            // Update Reference Information
            if (reference == null) return;
            ID.Set(eContext, reference.Id.ToString());
            LogicalName.Set(eContext, reference.LogicalName);

            // Update URL Information
            if (string.IsNullOrWhiteSpace(orgurl)) return;

            var url = CreateUrl(orgurl, reference);
            URL.Set(eContext, url);
            HtmlLink.Set(eContext, CreateHtmlLink(service, reference, url, LinkText.Get(eContext)));
        }