Exemple #1
0
        protected override IEnumerable <string> MergeDependencies(IJsonBoard json)
        {
            var properties = BoardPreferencesContext.Merge(json.Prefs).ToList();

            if (json.Actions != null)
            {
                Actions.Update(json.Actions.Select(a => a.GetFromCache <Action, IJsonAction>(Auth)));
                properties.Add(nameof(Board.Actions));
            }
            if (json.Cards != null)
            {
                Cards.Update(json.Cards.Select(a => a.GetFromCache <Card, IJsonCard>(Auth)));
                properties.Add(nameof(Board.Cards));
            }
            if (json.CustomFields != null)
            {
                CustomFields.Update(json.CustomFields.Select(a => a.GetFromCache <CustomFieldDefinition>(Auth)));
                properties.Add(nameof(Board.CustomFields));
            }
            if (json.Labels != null)
            {
                Labels.Update(json.Labels.Select(a => a.GetFromCache <Label, IJsonLabel>(Auth)));
                properties.Add(nameof(Board.Labels));
            }
            if (json.Lists != null)
            {
                Lists.Update(json.Lists.Select(a => a.GetFromCache <List, IJsonList>(Auth)));
                properties.Add(nameof(Board.Lists));
            }
            if (json.Members != null)
            {
                Members.Update(json.Members.Select(a => a.GetFromCache <Member, IJsonMember>(Auth)));
                properties.Add(nameof(Board.Members));
            }
            if (json.Memberships != null)
            {
                Memberships.Update(json.Memberships.Select(a => a.TryGetFromCache <BoardMembership, IJsonBoardMembership>() ??
                                                           new BoardMembership(a, Data.Id, Auth)));
                properties.Add(nameof(Board.Memberships));
            }
            if (json.PowerUps != null)
            {
                PowerUps.Update(json.PowerUps.Select(a => a.GetFromCache <IPowerUp>(Auth)));
                properties.Add(nameof(Board.PowerUps));
            }
            if (json.PowerUpData != null)
            {
                PowerUpData.Update(json.PowerUpData.Select(a => a.GetFromCache <PowerUpData, IJsonPowerUpData>(Auth)));
                properties.Add(nameof(Board.PowerUpData));
            }

            return(properties);
        }
Exemple #2
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.</param>
 public bool Equals(Group other)
 {
     if (other == null)
     {
         return(false);
     }
     return(Id == other.Id &&
            Name == other.Name &&
            (Users != null ? Users.Equals <GroupUser>(other.Users) : other.Users == null) &&
            (CustomFields != null ? CustomFields.Equals <IssueCustomField>(other.CustomFields) : other.CustomFields == null) &&
            (Memberships != null ? Memberships.Equals <Membership>(other.Memberships) : other.Memberships == null));
 }
        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.Append("class RiskData {\n");
            sb.Append("  ClientData: ").Append(ClientData).Append("\n");
            sb.Append("  CustomFields: ").Append(CustomFields.ToCollectionsString()).Append("\n");
            sb.Append("  FraudOffset: ").Append(FraudOffset).Append("\n");
            sb.Append("  ProfileReference: ").Append(ProfileReference).Append("\n");
            sb.Append("}\n");
            return(sb.ToString());
        }
        public string GetData()
        {
            TicketsViewItem ticket       = TicketsView.GetTicketsViewItem(_command.LoginUser, _ticketID);
            CustomFields    customFields = new CustomFields(_command.LoginUser);

            customFields.LoadByTicketTypeID(_command.Organization.OrganizationID, ticket.TicketTypeID);

            RestXmlWriter writer = new RestXmlWriter("Ticket");

            WriteTicketsViewItemXml(_command, writer.XmlWriter, ticket, customFields);
            return(writer.GetXml());
        }
Exemple #5
0
    private void LoadCustomField(int customFieldID)
    {
        CustomFields fields = new CustomFields(UserSession.LoginUser);

        fields.LoadByCustomFieldID(customFieldID);
        if (fields.IsEmpty)
        {
            return;
        }

        if (fields[0].OrganizationID != UserSession.LoginUser.OrganizationID)
        {
            Response.Write("Invalid Request");
            Response.End();
            return;
        }

        textDescription.Text  = fields[0].Description;
        textName.Text         = fields[0].Name;
        textApiFieldName.Text = fields[0].ApiFieldName;
        textList.Text         = fields[0].ListValues.Replace("|", "\n");
        if (fields[0].ParentCustomFieldID == null)
        {
            comboParentField.SelectedValue = "-1";
        }
        else
        {
            comboParentField.SelectedValue = ((int)fields[0].ParentCustomFieldID).ToString();
            CustomFields parentCustomField = new CustomFields(UserSession.LoginUser);
            parentCustomField.LoadByCustomFieldID((int)fields[0].ParentCustomFieldID);
            LoadParentValues(parentCustomField[0].ListValues);
            if (fields[0].ParentCustomValue != null)
            {
                comboParentValue.SelectedValue = fields[0].ParentCustomValue;
            }
        }
        if (fields[0].ParentProductID == null)
        {
            comboParentProduct.SelectedValue = "-1";
        }
        else
        {
            comboParentProduct.SelectedValue = ((int)fields[0].ParentProductID).ToString();
        }
        comboFieldType.SelectedValue = ((int)fields[0].FieldType).ToString();
        cbIsVisibleOnPortal.Checked  = fields[0].IsVisibleOnPortal == null ? false : (bool)fields[0].IsVisibleOnPortal;
        cbIsRequired.Checked         = fields[0].IsRequired;
        cbFirstSelect.Checked        = fields[0].IsFirstIndexSelect;
        cbIsRequiredToClose.Checked  = fields[0].IsRequiredToClose;
        textMask.Text = fields[0].Mask;
        _refType      = fields[0].RefType;
    }
    protected void btnOk_Click(object sender, EventArgs e)
    {
        ICustomFields CustomFields;

        CustomFields = (ICustomFields)ObjectFactory.CreateInstance("BusinessProcess.Administration.BCustomFields, BusinessProcess.Administration");
        int    CF = CustomFields.RearrangeCustomFields((DataTable)ViewState["tempTable"], Convert.ToInt32(Session["SystemId"].ToString()));
        string theScript;

        theScript  = "<script language='javascript' id='DrgPopup'>\n";
        theScript += "window.close();\n";
        theScript += "</script>\n";
        RegisterStartupScript("DrgPopup", theScript);
    }
    protected void FillDropDownFeatures()
    {
        ICustomFields CustomFields;

        try
        {
            DataTable theDTModule = (DataTable)Session["AppModule"];
            string    theModList  = "";
            foreach (DataRow theDR in theDTModule.Rows)
            {
                if (theModList == "")
                {
                    theModList = theDR["ModuleId"].ToString();
                }
                else
                {
                    theModList = theModList + "," + theDR["ModuleId"].ToString();
                }
            }

            if (theModList == "1,2")
            {
                theModList = "0";
            }
            else if (theModList == "1")
            {
                theModList = "1";
            }
            else
            {
                theModList = "2";
            }


            CustomFields = (ICustomFields)ObjectFactory.CreateInstance("BusinessProcess.Administration.BCustomFields, BusinessProcess.Administration");
            DataSet       theDS       = CustomFields.GetFeatures(Convert.ToInt32(Session["SystemId"]), theModList);
            BindFunctions BindManager = new BindFunctions();
            BindManager.BindCombo(ddlFormName, theDS.Tables[0], "FeatureName", "FeatureID");
        }
        catch (Exception err)
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["MessageText"] = err.Message.ToString();
            IQCareMsgBox.Show("#C1", theBuilder, this);
            return;
        }
        finally
        {
            CustomFields = null;
        }
    }
Exemple #8
0
        public void SaveCustomFields()
        {
            CustomFields fields = new CustomFields(UserSession.LoginUser);

            fields.LoadByReferenceType(UserSession.LoginUser.OrganizationID, _refType, _auxID);

            foreach (CustomField field in fields)
            {
                Control control = GetCustomControl(_table, FieldIDToControlID(field.CustomFieldID));
                if (control != null)
                {
                    CustomValue value = CustomValues.GetValue(UserSession.LoginUser, field.CustomFieldID, _refID);

                    if (control is RadInputControl)
                    {
                        value.Value = (control as RadInputControl).Text;
                    }
                    else if (control is CheckBox)
                    {
                        value.Value = (control as CheckBox).Checked.ToString();
                    }
                    else if (control is RadComboBox)
                    {
                        value.Value = (control as RadComboBox).SelectedValue;
                    }
                    else if (control is RadDatePicker)
                    {
                        if (control is RadTimePicker)
                        {
                            DateTime?selectedNullableDateTime = (control as RadTimePicker).SelectedDate;
                            if (selectedNullableDateTime != null)
                            {
                                DateTime selectedDateTime = (DateTime)selectedNullableDateTime;
                                DateTime timeOnly         = new DateTime(1970, 1, 1, selectedDateTime.Hour, selectedDateTime.Minute, 0, 0, UserSession.LoginUser.CultureInfo.Calendar);
                                value.Value = DataUtils.DateToUtc(UserSession.LoginUser, timeOnly).ToString();
                            }
                        }
                        else
                        {
                            value.Value = DataUtils.DateToUtc(UserSession.LoginUser, (control as RadDatePicker).SelectedDate).ToString();
                        }
                    }
                    else if (control is RadDateTimePicker)
                    {
                        value.Value = DataUtils.DateToUtc(UserSession.LoginUser, (control as RadDateTimePicker).SelectedDate).ToString();
                    }

                    value.Collection.Save();
                }
            }
        }
Exemple #9
0
        internal IEnumerable <EpcisEvent> FormatEvents()
        {
            return(Events.Select(evt =>
            {
                var epcisEvent = evt.ToEpcisEvent();
                epcisEvent.Epcs.AddRange(Epcs.Where(x => x.Matches(evt)).Select(x => x.ToEpc()));
                epcisEvent.CustomFields.AddRange(CreateHierarchy(CustomFields.Where(x => x.Matches(evt))));
                epcisEvent.BusinessTransactions.AddRange(Transactions.Where(x => x.Matches(evt)).Select(x => x.ToBusinessTransaction()));
                epcisEvent.SourceDestinationList.AddRange(SourceDests.Where(x => x.Matches(evt)).Select(x => x.ToSourceDestination()));
                epcisEvent.CorrectiveEventIds.AddRange(CorrectiveIds.Where(x => x.Matches(evt)).Select(x => x.ToCorrectiveId()));

                return epcisEvent;
            }));
        }
Exemple #10
0
 private void LoadCustomField()
 {
     if (_customFieldID > -1)
     {
         CustomField customField = (CustomField)CustomFields.GetCustomField(LoginSession.LoginUser, _customFieldID);
         if (customField != null)
         {
             textName.Text         = customField.Name;
             textDescription.Text  = customField.Description;
             textList.Text         = customField.ListValues;
             cmbType.SelectedIndex = (int)customField.FieldType;
         }
     }
 }
Exemple #11
0
        public virtual void SetCustomField(string name, string value)
        {
            var fieldValue = CustomFields.FirstOrDefault(f => f.FieldName == name);

            if (fieldValue != null)
            {
                fieldValue.FieldValue = value;
            }
            else
            {
                fieldValue = new ProductCustomField(name, value);
                CustomFields.Add(fieldValue);
            }
        }
Exemple #12
0
 private void ClearCustomFields(object obj)
 {
     try
     {
         lock (_customFieldsLock)
         {
             CustomFields.Clear();
         }
     }
     catch (Exception e)
     {
         Trace.WriteLine(e.ToString());
     }
 }
Exemple #13
0
        public static string GetCustomFields(RestCommand command)
        {
            CustomFields customFields = new CustomFields(command.LoginUser);

            customFields.LoadByOrganizationID(command.Organization.OrganizationID);

            if (command.Format == RestFormat.XML)
            {
                return(customFields.GetXml("CustomFields", "CustomField", true, command.Filters));
            }
            else
            {
                throw new RestException(HttpStatusCode.BadRequest, "Invalid data format");
            }
        }
Exemple #14
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you would like to delete this custom field?", "Delete Custom Field", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }
            CustomField customField = (CustomField)CustomFields.GetCustomField(LoginSession.LoginUser, GetSelectedFieldID());

            if (customField != null)
            {
                customField.Delete();
                customField.Collection.Save();
                LoadCustomFields();
            }
        }
Exemple #15
0
        public virtual void SetCustomFields(IDictionary <string, string> fieldValues)
        {
            foreach (var fieldValue in CustomFields.ToList())
            {
                if (!fieldValues.ContainsKey(fieldValue.FieldName))
                {
                    CustomFields.Remove(fieldValue);
                }
            }

            foreach (var fieldValue in fieldValues)
            {
                SetCustomField(fieldValue.Key, fieldValue.Value);
            }
        }
        public void EventWithCustomFields()
        {
            var metaData = new CustomFields(new List <CustomField>
            {
                new CustomField("relChan", "Test"),
                new CustomField("version", "17.8.9.beta"),
                new CustomField("rel", "REL1706"),
                new CustomField("role", new List <string>()
                {
                    "service", "rest", "ESB"
                })
            });

            AssertValidJson(log => log.Information("One {Property}", 42), fields: metaData);
        }
Exemple #17
0
        public string CheckRequiredCustomFields()
        {
            CustomFields fields = new CustomFields(UserSession.LoginUser);

            fields.LoadByReferenceType(UserSession.LoginUser.OrganizationID, _refType, _auxID);

            foreach (CustomField field in fields)
            {
                Control control = GetCustomControl(_table, FieldIDToControlID(field.CustomFieldID));
                if (control != null)
                {
                    CustomValue value = CustomValues.GetValue(UserSession.LoginUser, field.CustomFieldID, _refID);
                    if (value.IsRequired)
                    {
                        if (control is RadInputControl)
                        {
                            value.Value = (control as RadInputControl).Text;
                        }
                        else if (control is CheckBox)
                        {
                            value.Value = (control as CheckBox).Checked.ToString();
                        }
                        else if (control is RadComboBox)
                        {
                            if (field.IsFirstIndexSelect && (control as RadComboBox).SelectedIndex == 0)
                            {
                                value.Value = "";
                            }
                            else
                            {
                                value.Value = (control as RadComboBox).SelectedValue;
                            }
                        }
                        else if (control is RadDateTimePicker)
                        {
                            value.Value = DataUtils.DateToUtc(UserSession.LoginUser, (control as RadDateTimePicker).SelectedDate).ToString();
                        }

                        if (value.Value == "" || value.Value == null)
                        {
                            return(value.Name + " is a required value, please enter a value before saving");
                        }
                    }
                }
            }

            return("");
        }
        /// <summary>
        ///     Invoice issue by API asynchronously.
        ///     https://developer.qiwi.com/en/bill-payments/#create
        /// </summary>
        /// <param name="info">The invoice data.</param>
        /// <param name="customFields">The additional info.</param>
        /// <typeparam name="T">The result invoice type.</typeparam>
        /// <returns>The invoice.</returns>
        /// <exception cref="SerializationException">On request body serialization fail.</exception>
        /// <exception cref="HttpClientException">On request fail.</exception>
        /// <exception cref="BadResponseException">On response parse fail.</exception>
        /// <exception cref="BillPaymentsServiceException">On API return error message.</exception>
        public async Task <T> CreateBillAsync <T>(CreateBillInfo info, CustomFields customFields = null)
            where T : BillResponse
        {
            var additional = customFields ?? new CustomFields();

            additional.ApiClient        = _fingerprint.GetClientName();
            additional.ApiClientVersion = _fingerprint.GetClientVersion();
            var response = await _requestMappingIntercessor.RequestAsync <T>(
                "PUT",
                BillsUrl + info.BillId,
                _headers,
                info.GetCreateBillRequest(additional)
                );

            return(null != info.SuccessUrl ? AppendSuccessUrl <T>(response, info.SuccessUrl) : response);
        }
        private Message BuildChinoMessage(List <POChinoOutput> chinoOrders)
        {
            List <Order>            pochinoOrders           = new List <Order>();
            List <LineItem>         pOChinoLineItems        = new List <LineItem>();
            POChinoLineItemQuantity pOChinoLineItemQuantity = new POChinoLineItemQuantity();
            CustomFields            CustomFields            = new CustomFields();

            CustomFields.CustomField = " ";

            chinoOrders.ForEach(x =>
            {
                var counter = 1;
                x.POSkus.ForEach(y =>
                                 pOChinoLineItems.Add(new LineItem
                {
                    Quantity = new POChinoLineItemQuantity
                    {
                        OrderQty = Convert.ToInt32(y.OrderQty).ToString("0.0000"),
                        QtyUOM   = _lineItemSettings.Value.QtyUOM
                    },
                    LineItemId = counter++.ToString(),
                    ItemName   = y.ItemName
                }));



                pochinoOrders.Add(new Order
                {
                    OrderId                    = x.OrderId + "-01",
                    CustomFieldList            = CustomFields,
                    DeliveryEnd                = !string.IsNullOrEmpty(x.DeliveryEnd) ? x.DeliveryEnd : " ",
                    DeliveryStart              = !string.IsNullOrEmpty(x.DeliveryStart) ? x.DeliveryStart : " ",
                    DestinationFacilityAliasId = _chinoOrderSettings.Value.DestinationFacilityAliasId,
                    PickupStart                = !string.IsNullOrEmpty(x.PickupStart) ? x.PickupStart : " ",
                    PODate    = DateTime.Now.ToString("MM/dd/yyyy HH:mm"),
                    LineItems = pOChinoLineItems,
                });
                pOChinoLineItems = new List <LineItem>();
            });

            Message pOChinoOutputMessage = new Message
            {
                Orders = pochinoOrders
            };

            return(pOChinoOutputMessage);
        }
    public override void OnInspectorGUI()
    {
        if (showHelp)
        {
            EditorGUILayout.HelpBox("Use this property to change the color of the objects behind occluders.", MessageType.Info);
        }
        effect.color = EditorGUILayout.ColorField("Color", effect.color);

        if (showHelp)
        {
            EditorGUILayout.HelpBox("Unity's Glow/Bloom effect uses the alpha channel of the frame buffer. This slider determines how much of a glow will be applied to this effect. Note: The glow affecting this effect has to be behind this in the inspector view.", MessageType.Info);
        }
        effect.glowStrength = EditorGUILayout.Slider("Glow Strength", effect.glowStrength, 0.0f, 1.0f);

        if (showHelp)
        {
            EditorGUILayout.HelpBox("This Layer Masks determine which objects will have the outline effect (Visible) when they are behind some other objects (Occluder).", MessageType.Info);
        }
        effect.occluderLayer   = CustomFields.LayerMaskField("Occluder", effect.occluderLayer, true);
        effect.wallVisionLayer = CustomFields.LayerMaskField("Visible", effect.wallVisionLayer, true);

        if (showHelp)
        {
            EditorGUILayout.HelpBox("The visibility curve effects the visibility of the outline. You can set the visibility (vertical axis) at a certain degree (horizontal axis) between the surface normal and the vector to the camera. Both values are normalized between 0.0 und 1.0.", MessageType.Info);
        }
        effect.visibilityCurve = EditorGUILayout.CurveField("Visibility Curve", effect.visibilityCurve);

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("Pattern", EditorStyles.boldLabel);
        if (showHelp)
        {
            EditorGUILayout.HelpBox("You can use a pattern texture to enhance the effect. The pattern affects the opacity of the effect in relation to it's screen position. The texture has to be a grayscale texture, where white means full opacity and black zero opacity. The scale factor is in relation to the screen resolution. 1.0 means one tile of the pattern is scaled over the full screen (with respect to the aspect ratio). The weight parameter defines how much the pattern is affecting the end-result.", MessageType.Info);
        }
        effect.patternTexture = (Texture)EditorGUILayout.ObjectField("Texture", effect.patternTexture, typeof(Texture), true);
        effect.patternScale   = EditorGUILayout.Slider("Scale", effect.patternScale, 0.0f, 5.0f);
        effect.patternWeight  = EditorGUILayout.Slider("Weight", effect.patternWeight, -5.0f, 5.0f);

        EditorGUILayout.Space();
        showHelp = EditorGUILayout.Toggle("Show Help", showHelp);


        if (GUI.changed)
        {
            RampUpdate();
            EditorUtility.SetDirty(target);
        }
    }
Exemple #21
0
    protected void ddlFormName_SelectedIndexChanged(object sender, EventArgs e)
    {
        ICustomFields CustomFields;

        CustomFields = (ICustomFields)ObjectFactory.CreateInstance("BusinessProcess.Administration.BCustomFields, BusinessProcess.Administration");
        DataSet  theDS     = CustomFields.GetRearrangeCustomFields(Convert.ToInt32(Session["SystemId"].ToString()));
        DataView theDSView = new DataView();

        theDSView.Table = theDS.Tables[0];
        string[] strValue = ddlFormName.SelectedItem.Text.ToString().Split('-');
        theDSView.RowFilter = "FeatureName=" + "'" + strValue[0] + "'";
        theDT = theDSView.ToTable();
        BindFunctions BindManager = new BindFunctions();

        BindManager.BindList(lstRearrangeListItems, theDT, "Label", "CustomFieldId");
        ViewState["tempTable"] = theDT;
    }
        public async Task <IActionResult> Delete(int id, CustomFields data)
        {
            if (id <= 0)
            {
                return(RedirectToAction(nameof(Index)));
            }
            try
            {
                await _customFieldsRepository.DeleteAsync(data);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View(nameof(Index)));
            }
        }
Exemple #23
0
        public void Delete()
        {
            // Arrange
            var fieldId = 1;

            var mockClient = new Mock <IClient>(MockBehavior.Strict);

            mockClient.Setup(c => c.DeleteAsync($"{ENDPOINT}/{fieldId}", It.IsAny <CancellationToken>()))
            .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.Accepted));

            var customFields = new CustomFields(mockClient.Object);

            // Act
            customFields.DeleteAsync(fieldId, CancellationToken.None).Wait(CancellationToken.None);

            // Assert
        }
Exemple #24
0
        private Client(string apiKey, string username, string password, string baseUri, string apiVersion, HttpClient httpClient)
        {
            _mustDisposeHttpClient = httpClient == null;
            _httpClient            = httpClient;

            Version = typeof(Client).GetTypeInfo().Assembly.GetName().Version.ToString();

            _fluentClient = new FluentClient(new Uri($"{baseUri.TrimEnd('/')}/{apiVersion.TrimStart('/')}"), httpClient)
                            .SetUserAgent($"StrongGrid/{Version} (+https://github.com/Jericho/StrongGrid)")
                            .SetRequestCoordinator(new SendGridRetryStrategy());

            _fluentClient.Filters.Remove <DefaultErrorFilter>();
            _fluentClient.Filters.Add(new SendGridErrorHandler());

            if (!string.IsNullOrEmpty(apiKey))
            {
                _fluentClient.SetBearerAuthentication(apiKey);
            }
            if (!string.IsNullOrEmpty(username))
            {
                _fluentClient.SetBasicAuthentication(username, password);
            }

            Alerts             = new Alerts(_fluentClient);
            ApiKeys            = new ApiKeys(_fluentClient);
            Batches            = new Batches(_fluentClient);
            Blocks             = new Blocks(_fluentClient);
            Campaigns          = new Campaigns(_fluentClient);
            Categories         = new Categories(_fluentClient);
            Contacts           = new Contacts(_fluentClient);
            CustomFields       = new CustomFields(_fluentClient);
            GlobalSuppressions = new GlobalSuppressions(_fluentClient);
            InvalidEmails      = new InvalidEmails(_fluentClient);
            Lists             = new Lists(_fluentClient);
            Mail              = new Mail(_fluentClient);
            Segments          = new Segments(_fluentClient);
            SenderIdentities  = new SenderIdentities(_fluentClient);
            Settings          = new Settings(_fluentClient);
            SpamReports       = new SpamReports(_fluentClient);
            Statistics        = new Statistics(_fluentClient);
            Suppressions      = new Suppressions(_fluentClient);
            Templates         = new Templates(_fluentClient);
            UnsubscribeGroups = new UnsubscribeGroups(_fluentClient);
            User              = new User(_fluentClient);
            Whitelabel        = new Whitelabel(_fluentClient);
        }
Exemple #25
0
        /// <summary>
        ///     Adds a sink that writes log events as to a Splunk instance via the HTTP Event Collector.
        /// </summary>
        /// <param name="configuration">The logger config</param>
        /// <param name="splunkHost">The Splunk host that is configured with an Event Collector</param>
        /// <param name="eventCollectorToken">The token provided to authenticate to the Splunk Event Collector</param>
        /// <param name="uriPath">Change the default endpoint of the Event Collector e.g. services/collector/event</param>
        /// <param name="index">The Splunk index to log to</param>
        /// <param name="source">The source of the event</param>
        /// <param name="sourceType">The source type of the event</param>
        /// <param name="host">The host of the event</param>
        /// <param name="restrictedToMinimumLevel">The minimum log event level required in order to write an event to the sink.</param>
        /// <param name="outputTemplate">The output template to be used when logging</param>
        /// <param name="formatProvider">Supplies culture-specific formatting information, or null.</param>
        /// <param name="renderTemplate">If ture, the message template will be rendered</param>
        /// <param name="batchIntervalInSeconds">The interval in seconds that the queue should be instpected for batching</param>
        /// <param name="batchSizeLimit">The size of the batch</param>
        /// <param name="messageHandler">The handler used to send HTTP requests</param>
        /// <param name="levelSwitch">A switch allowing the pass-through minimum level to be changed at runtime.</param>
        /// <param name="fields">Customfields that will be indexed in splunk with this event</param>
        /// <returns></returns>
        public static LoggerConfiguration EventCollector(
            this LoggerSinkConfiguration configuration,
            string splunkHost,
            string eventCollectorToken,
            CustomFields fields,
            string uriPath    = "services/collector",
            string source     = DefaultSource,
            string sourceType = DefaultSourceType,
            string host       = DefaultHost,
            string index      = DefaultIndex,
            LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
            string outputTemplate             = DefaultOutputTemplate,
            IFormatProvider formatProvider    = null,
            bool renderTemplate               = true,
            int batchIntervalInSeconds        = 2,
            int batchSizeLimit                = 100,
            HttpMessageHandler messageHandler = null,
            LoggingLevelSwitch levelSwitch    = null)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (outputTemplate == null)
            {
                throw new ArgumentNullException(nameof(outputTemplate));
            }

            var eventCollectorSink = new EventCollectorSink(
                splunkHost,
                eventCollectorToken,
                uriPath,
                source,
                sourceType,
                host,
                index,
                fields,
                batchIntervalInSeconds,
                batchSizeLimit,
                formatProvider,
                renderTemplate,
                messageHandler
                );

            return(configuration.Sink(eventCollectorSink, restrictedToMinimumLevel, levelSwitch));
        }
Exemple #26
0
        private void FillOldData(Int32 PatID)
        {
            DataSet       dsvalues = null;
            ICustomFields CustomFields;

            try
            {
                DataSet theCustomFields = (DataSet)ViewState["CustomFieldsDS"];
                string  theTblName      = "";
                if (theCustomFields.Tables[0].Rows.Count > 0)
                {
                    theTblName = theCustomFields.Tables[0].Rows[0]["FeatureName"].ToString().Replace(" ", "_");
                }
                string theColName = "";
                foreach (DataRow theDR in theCustomFields.Tables[0].Rows)
                {
                    if (theDR["ControlId"].ToString() != "9")
                    {
                        if (theColName == "")
                        {
                            theColName = theDR["Label"].ToString();
                        }
                        else
                        {
                            theColName = theColName + "," + theDR["Label"].ToString();
                        }
                    }
                }

                CustomFields = (ICustomFields)ObjectFactory.CreateInstance("BusinessProcess.Administration.BCustomFields, BusinessProcess.Administration");
                dsvalues     = CustomFields.GetCustomFieldValues("dtl_CustomField_" + theTblName.ToString().Replace("-", "_"), theColName, Convert.ToInt32(PatID.ToString()), 0, Convert.ToInt32(ViewState["visitPk"]), 0, 0, Convert.ToInt32(ApplicationAccess.PMTCTEnrollment));
                CustomFieldClinical theCustomManager = new CustomFieldClinical();
                theCustomManager.FillCustomFieldData(theCustomFields, dsvalues, pnlCustomList, "PMTCTEnroll");
            }
            catch (Exception err)
            {
                MsgBuilder theBuilder = new MsgBuilder();
                theBuilder.DataElements["MessageText"] = err.Message.ToString();
                IQCareMsgBox.Show("#C1", theBuilder, this);
            }
            finally
            {
                CustomFields = null;
            }
        }
Exemple #27
0
        public PwEntryViewModel(PwEntry model)
        {
            Model = model;

            // Check custom fields in the strings model
            foreach (var field in Model.Strings)
            {
                if (!CustomFieldsExcludedValues.Contains(field.Key))
                {
                    // This fields is a custom field
                    CustomFields.Add(new KeyValuePair <string, string>(field.Key, field.Value.ReadString()));
                }
            }

            CopyUsernameCommand = new RelayCommand(CopyUsernameAction);
            CopyPasswordCommand = new RelayCommand(CopyPasswordAction);
            CopyUrlCommand      = new RelayCommand(CopyUrlAction);
        }
Exemple #28
0
        private Client(string apiKey, string username, string password, string baseUri, string apiVersion, HttpClient httpClient, IRetryStrategy retryStrategy)
        {
            _baseUri       = new Uri(string.Format("{0}/{1}", baseUri, apiVersion));
            _retryStrategy = retryStrategy ?? new SendGridRetryStrategy();

            Alerts             = new Alerts(this);
            ApiKeys            = new ApiKeys(this);
            Batches            = new Batches(this);
            Blocks             = new Blocks(this);
            Campaigns          = new Campaigns(this);
            Categories         = new Categories(this);
            Contacts           = new Contacts(this);
            CustomFields       = new CustomFields(this);
            GlobalSuppressions = new GlobalSuppressions(this);
            InvalidEmails      = new InvalidEmails(this);
            Lists             = new Lists(this);
            Mail              = new Mail(this);
            Segments          = new Segments(this);
            SenderIdentities  = new SenderIdentities(this);
            Settings          = new Settings(this);
            SpamReports       = new SpamReports(this);
            Statistics        = new Statistics(this);
            Suppressions      = new Suppressions(this);
            Templates         = new Templates(this);
            UnsubscribeGroups = new UnsubscribeGroups(this);
            User              = new User(this);
            Version           = typeof(Client).GetTypeInfo().Assembly.GetName().Version.ToString();
            Whitelabel        = new Whitelabel(this);

            _mustDisposeHttpClient  = httpClient == null;
            _httpClient             = httpClient ?? new HttpClient();
            _httpClient.BaseAddress = _baseUri;
            _httpClient.DefaultRequestHeaders.Accept.Clear();
            _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(MEDIA_TYPE));
            if (!string.IsNullOrEmpty(apiKey))
            {
                _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
            }
            if (!string.IsNullOrEmpty(username))
            {
                _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Concat(username, ":", password))));
            }
            _httpClient.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", string.Format("StrongGrid/{0}", Version));
        }
Exemple #29
0
        public async Task DeleteAsync()
        {
            // Arrange
            var fieldId = 1;

            var mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect(HttpMethod.Delete, Utils.GetSendGridApiUri(ENDPOINT, fieldId)).Respond(HttpStatusCode.Accepted);

            var client       = Utils.GetFluentClient(mockHttp);
            var customFields = new CustomFields(client);

            // Act
            await customFields.DeleteAsync(fieldId, CancellationToken.None).ConfigureAwait(false);

            // Assert
            mockHttp.VerifyNoOutstandingExpectation();
            mockHttp.VerifyNoOutstandingRequest();
        }
Exemple #30
0
        public async Task GetAllAsync()
        {
            // Arrange
            var mockHttp = new MockHttpMessageHandler();

            mockHttp.Expect(HttpMethod.Get, Utils.GetSendGridApiUri(ENDPOINT)).Respond("application/json", MULTIPLE_CUSTOM_FIELDS_JSON);

            var client       = Utils.GetFluentClient(mockHttp);
            var customFields = new CustomFields(client);

            // Act
            var result = await customFields.GetAllAsync(CancellationToken.None).ConfigureAwait(false);

            // Assert
            mockHttp.VerifyNoOutstandingExpectation();
            mockHttp.VerifyNoOutstandingRequest();
            result.ShouldNotBeNull();
            result.Length.ShouldBe(3);
        }
Exemple #31
0
        internal Issue(RedmineServiceContext context, XmlNode node)
            : base(context, node)
        {
            _parent			= RedmineUtility.LoadObject(node[ParentProperty.XmlNodeName],				context.Issues.Lookup);

            _project		= RedmineUtility.LoadNamedObject(node[ProjectProperty.XmlNodeName],			context.Projects.Lookup);
            _tracker		= RedmineUtility.LoadNamedObject(node[TrackerProperty.XmlNodeName],			context.Trackers.Lookup);
            _status			= RedmineUtility.LoadNamedObject(node[StatusProperty.XmlNodeName],			context.IssueStatuses.Lookup);
            _priority		= RedmineUtility.LoadNamedObject(node[PriorityProperty.XmlNodeName],		context.IssuePriorities.Lookup);

            _author			= RedmineUtility.LoadNamedObject(node[AuthorProperty.XmlNodeName],			context.Users.Lookup);
            _assignedTo		= RedmineUtility.LoadNamedObject(node[AssignedToProperty.XmlNodeName],		context.Users.Lookup);

            _category		= RedmineUtility.LoadNamedObject(node[CategoryProperty.XmlNodeName],		context.IssueCategories.Lookup);
            _fixedVersion	= RedmineUtility.LoadNamedObject(node[FixedVersionProperty.XmlNodeName],	context.ProjectVersions.Lookup);

            _subject		= RedmineUtility.LoadString(node[SubjectProperty.XmlNodeName]);
            _description	= RedmineUtility.LoadString(node[DescriptionProperty.XmlNodeName]);

            _startDate		= RedmineUtility.LoadDate(node[StartDateProperty.XmlNodeName]);
            _dueDate		= RedmineUtility.LoadDate(node[DueDateProperty.XmlNodeName]);

            _doneRatio		= RedmineUtility.LoadDouble(node[DoneRatioProperty.XmlNodeName]);
            _estimatedHours	= RedmineUtility.LoadDouble(node[EstimatedHoursProperty.XmlNodeName]);

            _customFields	= RedmineUtility.LoadCustomFields(node[CustomFieldsProperty.XmlNodeName],	context.CustomFields.Lookup);

            _createdOn		= RedmineUtility.LoadDateForSure(node[CreatedOnProperty.XmlNodeName]);
            _updatedOn		= RedmineUtility.LoadDateForSure(node[UpdatedOnProperty.XmlNodeName]);
        }
        private void button2_Click(object sender, EventArgs e)
        {
            /*LJOVi9A95Y3r6TqlFmxS314v6ox4xaPf*/
            int success = 0,fail=0;
            var client = new RestClient("http://api.cloud.appcelerator.com/v1/users/login.json");
            client.CookieContainer = new System.Net.CookieContainer();
            var request = new RestRequest("?key="+textBox2.Text, Method.POST);
            request.RequestFormat = DataFormat.Json;
            request.AddParameter("login",textBox3.Text);
            request.AddParameter("password", textBox4.Text);
            IRestResponse response = client.Execute(request);

            var client1 = new RestClient("http://api.cloud.appcelerator.com/v1/users/create.json");
            client1.CookieContainer = new System.Net.CookieContainer();
            var request1 = new RestRequest("?key="+textBox2.Text, Method.POST);
            request1.RequestFormat = DataFormat.Json;

            string con = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + openFileDialog1.FileName + ";Extended Properties='Excel 8.0;HDR=Yes;'";
            using (OleDbConnection connection = new OleDbConnection(con))
            {
                connection.Open();
                OleDbCommand command = new OleDbCommand("select * from [Sheet1$]", connection);
                using (OleDbDataReader dr = command.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        CustomFields pd = new CustomFields()
                        {
                            securitycode = dr["securitycode"].ToString(),
                            email2 = dr["email"].ToString(),
                            emailprivateflag = dr["emailprivateflag"].ToString(),
                            isspeaker = dr["isspeaker"].ToString(),
                            allowaccess = dr["allowaccess"].ToString(),
                            linkedinurl = dr["linkedinurl"].ToString(),
                            twitterhandle = dr["twitterhandle"].ToString(),
                            companyname = dr["companyname"].ToString(),
                            companyurl = dr["companyurl"].ToString(),
                            designation = dr["designation"].ToString(),
                            location = dr["location"].ToString(),
                        };

                      //  var row1Col0 = dr["last_name"];
                        //MessageBox.Show(row1Col0.ToString());
                       request1.AddParameter("email", dr["email"]);
                        request1.AddParameter("password","12345");
                        request1.AddParameter("password_confirmation", "12345");
                        request1.AddParameter("first_name", dr["fname"]);
                        request1.AddParameter("last_name", dr["last_name"]);
                        request1.AddParameter( "custom_fields",request1.JsonSerializer.Serialize(pd));

                        IRestResponse response1 = client1.Execute(request1);
                        var json = response1.Content;
                        JObject jb = JObject.Parse(json);
                      // MessageBox.Show(jb["meta"].ToString());
                       if (jb["response"]!= null)
                            success++;
                        else
                            fail++;

                        label2.Text = success.ToString();
                        label4.Text = fail.ToString();
                    }
                }
                connection.Close();
            }
        }
Exemple #33
0
        /// <summary>
        /// Deletes envelope custom fields for draft and in-process envelopes. Deletes envelope custom fields for draft and in-process envelopes.
        /// </summary>
	    ///<param name="accountId">The external account number (int) or account ID Guid.</param><param name="envelopeId">The envelopeId Guid of the envelope being accessed.</param> <param name="customFields">TBD Description</param>
		/// <returns>8Task of ApiResponse (CustomFields)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CustomFields>> DeleteCustomFieldsAsyncWithHttpInfo (string accountId, string envelopeId, CustomFields customFields)
        {
            // verify the required parameter 'accountId' is set
            if (accountId == null) throw new ApiException(400, "Missing required parameter 'accountId' when calling DeleteCustomFields");
            // verify the required parameter 'envelopeId' is set
            if (envelopeId == null) throw new ApiException(400, "Missing required parameter 'envelopeId' when calling DeleteCustomFields");
            
    
            var path_ = "/v2/accounts/{accountId}/envelopes/{envelopeId}/custom_fields";
    
            var pathParams = new Dictionary<String, String>();
            var queryParams = new Dictionary<String, String>();
            var headerParams = new Dictionary<String, String>(Configuration.DefaultHeader);
            var formParams = new Dictionary<String, String>();
            var fileParams = new Dictionary<String, FileParameter>();
            String postBody = null;

            // to determine the Accept header
            String[] http_header_accepts = new String[] {
                "application/json"
            };
            String http_header_accept = Configuration.ApiClient.SelectHeaderAccept(http_header_accepts);
            if (http_header_accept != null)
                headerParams.Add("Accept", Configuration.ApiClient.SelectHeaderAccept(http_header_accepts));

            // set "format" to json by default
            // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
            pathParams.Add("format", "json");
            if (accountId != null) pathParams.Add("accountId", Configuration.ApiClient.ParameterToString(accountId)); // path parameter
            if (envelopeId != null) pathParams.Add("envelopeId", Configuration.ApiClient.ParameterToString(envelopeId)); // path parameter
            

						
			
			

            
            
            postBody = Configuration.ApiClient.Serialize(customFields); // http body (model) parameter
            

            

            // make the HTTP request
            IRestResponse response = (IRestResponse) await Configuration.ApiClient.CallApiAsync(path_, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, pathParams);

            int statusCode = (int) response.StatusCode;
 
            if (statusCode >= 400)
                throw new ApiException (statusCode, "Error calling DeleteCustomFields: " + response.Content, response.Content);
            else if (statusCode == 0)
                throw new ApiException (statusCode, "Error calling DeleteCustomFields: " + response.ErrorMessage, response.ErrorMessage);

            return new ApiResponse<CustomFields>(statusCode,
                response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CustomFields) Configuration.ApiClient.Deserialize(response, typeof(CustomFields)));
            
        }
Exemple #34
0
        /// <summary>
        /// Deletes envelope custom fields for draft and in-process envelopes. Deletes envelope custom fields for draft and in-process envelopes.
        /// </summary>
 	    ///<param name="accountId">The external account number (int) or account ID Guid.</param><param name="envelopeId">The envelopeId Guid of the envelope being accessed.</param> <param name="customFields">TBD Description</param>
		/// <returns>7Task of CustomFields</returns>
        public async System.Threading.Tasks.Task<CustomFields> DeleteCustomFieldsAsync (string accountId, string envelopeId, CustomFields customFields)
        {
             ApiResponse<CustomFields> response = await DeleteCustomFieldsAsyncWithHttpInfo(accountId, envelopeId, customFields);
             return response.Data;

        }
Exemple #35
0
        /// <summary>
        /// Deletes envelope custom fields for draft and in-process envelopes. Deletes envelope custom fields for draft and in-process envelopes.
        /// </summary>
 	    ///<param name="accountId">The external account number (int) or account ID Guid.</param><param name="envelopeId">The envelopeId Guid of the envelope being accessed.</param> <param name="customFields">TBD Description</param>
		/// <returns>5CustomFields</returns>
        public CustomFields DeleteCustomFields (string accountId, string envelopeId, CustomFields customFields)
        {
             ApiResponse<CustomFields> response = DeleteCustomFieldsWithHttpInfo(accountId, envelopeId, customFields);
             return response.Data;
        }
Exemple #36
0
    private void Display_ViewLibraryItem()
    {
        ViewLibraryItemPanel.Visible = true;
        FolderData folder_data;
        PermissionData security_data;
        LibraryData library_data;
        librarytoolbar m_libraryToolBar;
        _Id = Convert.ToInt64(Request.QueryString["id"]);
        _FolderId = Convert.ToInt64(Request.QueryString["parent_id"]);
        folder_data = _ContentApi.GetFolderById(_FolderId);
        security_data = _ContentApi.LoadPermissions(_FolderId, "folder", 0);
        library_data = _ContentApi.GetLibraryItemByID(_Id, _FolderId);

        //StagingFileName property would be empty for non-multisite links and as well as when the site is not in Staging Mode
        if (library_data.StagingFileName == "")
        {
            library_data.StagingFileName = library_data.FileName;
        }

        if (!(library_data == null))
        {
            _Type = library_data.Type;
        }
        else
        {
            //ErrorString = "Item not found -HC"
        }

        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TITLE";
        colBound.ItemStyle.CssClass = "label";
        ViewLibraryItemGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TEXT";
        System.Web.UI.WebControls.Unit percUnit;
        percUnit = System.Web.UI.WebControls.Unit.Percentage(95);
        colBound.HeaderStyle.Width = percUnit;
        ViewLibraryItemGrid.Columns.Add(colBound);
        percUnit = System.Web.UI.WebControls.Unit.Empty;

        DataTable dt = new DataTable();
        DataRow dr;
        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        dt.Columns.Add(new DataColumn("TEXT", typeof(string)));

        if (!(library_data == null))
        {
            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("generic title label") + "</span>";
            dr[1] = library_data.Title;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            if (library_data.Type == "quicklinks" || library_data.Type == "hyperlinks")
            {
                dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("url link label") + "</span>";
            }
            else
            {
                dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("filename label") + "</span>";
            }
            dr[1] = library_data.FileName;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("library id label") + "</span>";
            dr[1] = library_data.Id;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("parent folder label") + "</span>";
            dr[1] = library_data.FolderName;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("content LUE label") + "</span>";
            dr[1] = library_data.EditorLastName + ", " + library_data.EditorFirstName;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("content LED label") + "</span>";
            dr[1] = library_data.DisplayLastEditDate;
            dt.Rows.Add(dr);

            dr = dt.NewRow();
            dr[0] = "<span class=\"label\">" + _MessageHelper.GetMessage("content DC label") + "</span>";
            dr[1] = library_data.DisplayDateCreated;

            dt.Rows.Add(dr);
        }
        // Don't tbind the data yet, may have teaser data to include...

        //SEARCH METADATA''''''''''''
        ContentData content_data = null;
        if (_Type != "quicklinks" && _Type != "forms")
        {
            bool bManagedAsset = false;

            ContentAPI m_refcontentapi = new ContentAPI();
            CustomFields cFieldsO = new CustomFields();
            ContentMetaData[] meta_data;

            if (_ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
            {
                m_refcontentapi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
            }
            else
            {
                m_refcontentapi.ContentLanguage = _ContentLanguage;
            }

            if (library_data.ContentId != 0)
            {
                content_data = m_refcontentapi.GetContentById(library_data.ContentId, 0);
            }
            if (!(content_data == null))
            {
                meta_data = content_data.MetaData;
                _ContentTeaser = content_data.Teaser;
                _ContentTeaser = _ContentTeaser.Replace("<p> </p>", string.Empty);
                if (content_data.Type != Ektron.Cms.Common.EkConstants.CMSContentType_Library)
                {
                    bManagedAsset = true;
                }
            }
            else
            {
                meta_data = m_refcontentapi.GetMetaDataTypes("id");
            }

            // Add the Teaser-Data for this Library item:
            dr = dt.NewRow();
            dr[0] = _MessageHelper.GetMessage("description label");
            dr[1] = _ContentTeaser;
            dt.Rows.Add(dr);

            if (meta_data != null)
            {
                if (meta_data.Length > 0)
                {
                    if (!bManagedAsset)
                    {
                        //ViewLibraryMeta.Text = cFieldsO.WriteMetadataForView(meta_data).ToString
                        if (m_refcontentapi.ContentLanguage != Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
                        {
                            ViewLibraryMeta.Text = CustomFields.WriteFilteredMetadataForView(meta_data, _FolderId, true).ToString();

                            // display tag info for this library item
                            System.Text.StringBuilder taghtml = new System.Text.StringBuilder();
                            taghtml.Append("<fieldset style=\"margin:10px\">");
                            taghtml.Append("<legend>" + _MessageHelper.GetMessage("lbl personal tags") + "</legend>");
                            taghtml.Append("<div style=\"height: 80px; overflow: auto;\" >");
                            if (library_data.Id > 0)
                            {
                                LocalizationAPI localizationApi = new LocalizationAPI();
                                TagData[] tdaUser;
                                tdaUser = (new Ektron.Cms.Community.TagsAPI()).GetTagsForObject(library_data.Id, EkEnumeration.CMSObjectTypes.Library, m_refcontentapi.ContentLanguage);

                                if (tdaUser != null && tdaUser.Length > 0)
                                {

                                    foreach (TagData td in tdaUser)
                                    {
                                        taghtml.Append("<input disabled=\"disabled\" checked=\"checked\" type=\"checkbox\" id=\"userPTagsCbx_" + td.Id.ToString() + "\" name=\"userPTagsCbx_" + td.Id.ToString() + "\" />&#160;");
                                        taghtml.Append("<img src=\'" + localizationApi.GetFlagUrlByLanguageID(td.LanguageId) + "\' />");
                                        taghtml.Append("&#160;" + td.Text + "<br />");
                                    }
                                }
                                else
                                {
                                    taghtml.Append(_MessageHelper.GetMessage("lbl notagsselected"));
                                }
                            }
                            taghtml.Append("</div>");
                            taghtml.Append("</fieldset>");
                            ViewLibraryTags.Text = taghtml.ToString();
                        }
                        else
                        {
                            string strLink;
                            strLink = "<a href=\"library.aspx?LangType=" + meta_data[0].Language.ToString() + "&action=" + _PageAction + "&id=" + _Id + "&parent_id=" + _FolderId + "\">";
                            ViewLibraryMeta.Text = "<span style=\"COLOR: red\">*Note - Related metadata/tags will be displayed only if a specific language was selected on the previous page. You may either go back to the previous page to select a language, or click " + strLink + "here</a> to view the metadata with the language selected automatically.</span>";
                        }
                    }
                }
            }
        }
        ///'''''''''''''''''''''''''

        //Binding the Taxonomy
        if (_Type != "quicklinks" && _Type != "forms")
        {
            if (library_data.ContentId != 0)
            {
                TaxonomyBaseData[] data = null;
                ContentAPI m_refcontentapi = new ContentAPI();
                Ektron.Cms.Content.EkContent cref;
                cref = m_refcontentapi.EkContentRef;
                data = cref.ReadAllAssignedCategory(library_data.ContentId);
                ViewTaxonomy.Text = "<fieldset style=\"margin: 10px;\"><legend>Category</legend>";
                ViewTaxonomy.Text += "<table width=\"100%\">";
                ViewTaxonomy.Text += "<tr><td>";
                if ((data != null) && data.Length > 0)
                {
                    foreach (TaxonomyBaseData tax_data in data)
                    {
                        ViewTaxonomy.Text = ViewTaxonomy.Text + "<li>" + tax_data.TaxonomyPath.Remove(0, 1).Replace("\\", ">") + "</li>";
                    }
                }
                else
                {
                    ViewTaxonomy.Text += _MessageHelper.GetMessage("lbl nocatselected");
                }
                ViewTaxonomy.Text += "</td>" + "</tr>" + "</table>" + "</fieldset>";
            }
        }

        // now bind data, possibly with teaser:
        DataView dv = new DataView(dt);
        ViewLibraryItemGrid.DataSource = dv;
        ViewLibraryItemGrid.DataBind();

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "LINK";
        colBound.HeaderStyle.Width = Unit.Empty;
        colBound.HeaderStyle.Height = Unit.Empty;
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        ViewLibraryItemLinkGrid.Columns.Add(colBound);
        ViewLibraryItemLinkGrid.BorderColor = System.Drawing.Color.White;
        dt = new DataTable();
        dt.Columns.Add(new DataColumn("LINK", typeof(string)));

        if (!(library_data == null))
        {
            library_data.FileName = Server.HtmlDecode(library_data.FileName);
            if (library_data.TypeId == 1 || library_data.TypeId == 2)
            {
                library_data.FileName = library_data.FileName.Replace("%", "%25");
                library_data.FileName = library_data.FileName.Replace("#", "%23");
                library_data.FileName = library_data.FileName.Replace("$", "%24");
                library_data.FileName = library_data.FileName.Replace("&", "%26");
                library_data.FileName = library_data.FileName.Replace("^", "%5E");
            }

            dr = dt.NewRow();
            if (library_data.Type == "images")
            {
                Random r = new Random(System.DateTime.Now.Millisecond);
                if (content_data != null)
                {
                    if (content_data.AssetData.Id != "" && content_data.Status == "I")
                    {
                        dr[0] = content_data.Html;
                    }
                    else
                    {
                        dr[0] = "<img src=\"" + library_data.StagingFileName.Replace(" ", "%20") + "?n=" + r.Next(1, 5000) + "\">";
                    }
                }
                else
                {
                    dr[0] = "<img src=\"" + library_data.FileName.Replace(" ", "%20") + "?n=" + r.Next(1, 5000) + "\">";
                }

            }
            else if (library_data.Type == "quicklinks")
            {
                if (Ektron.Cms.Common.EkConstants.IsAssetContentType(library_data.ContentType, true) && library_data.ContentType != Ektron.Cms.Common.EkConstants.CMSContentType_Media)
                {
                    if ((library_data.FileName.ToString().ToLower().IndexOf("javascript:") == -1) && library_data.FileName.ToString().ToLower().IndexOf("downloadasset.aspx") == -1)
                    {
                        library_data.FileName = this._SiteApi.SitePath + library_data.FileName;
                    }
                    dr[0] = "<a href=\"" + library_data.StagingFileName.Replace(" ", "%20") + "&LangType=" + library_data.LanguageId + "\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
                }
                else if ((library_data.FileName.IndexOf("?") + 1) > 0)
                {
                    if (library_data.FileName.ToString().ToLower().IndexOf("downloadasset.aspx") > -1)
                    {
                        dr[0] = "<a href=\"" + library_data.StagingFileName.Replace(" ", "%20") + "&LangType=" + library_data.LanguageId + "\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
                    }
                    else
                    {
                        dr[0] = "<a href=\"" + ((library_data.StagingFileName.Replace(" ", "%20").StartsWith(_SitePath)) ? (library_data.StagingFileName.Replace(" ", "%20")) : (((library_data.StagingFileName.Substring(0, 7) != "http://") && (library_data.StagingFileName.Substring(0, 8) != "https://")) ? _SitePath + library_data.StagingFileName.Replace(" ", "%20") : library_data.StagingFileName.Replace(" ", "%20"))) + "\"&Preview=True&LangType=" + library_data.LanguageId + "\" target=\"Preview\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
                    }
                }
                else
                {
                    dr[0] = "<a href=\"" + library_data.StagingFileName.Replace(" ", "%20") + "\"&Preview=True&LangType=" + library_data.LanguageId + "\" target=\"Preview\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
                }
            }
            else if (library_data.Type == "forms")
            {
                if ((library_data.FileName.IndexOf("?") + 1) > 0)
                {
                    dr[0] = "<a href=\"" + library_data.StagingFileName.Replace(" ", "%20") + "\"&Preview=True&LangType=" + library_data.LanguageId + "\" target=\"Preview\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
                }
                else
                {
                    dr[0] = "<a href=\"" + library_data.StagingFileName.Replace(" ", "%20") + "\"&Preview=True&LangType=" + library_data.LanguageId + "\" target=\"Preview\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
                }
            }
            else if ((library_data.Type == "hyperlinks") && (!library_data.FileName.Contains("http://")) && (!library_data.FileName.Contains("https://")))
            {
                dr[0] = "<a href=\"" + library_data.FileName.Replace(" ", "%20") + "\" target=\"Preview\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";
            }
            else
            {

                dr[0] = "<a href=\"" + library_data.StagingFileName.Replace(" ", "%20") + "\" target=\"Preview\" title=\"" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "\">" + _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title + "</a>";

            }
            dt.Rows.Add(dr);
        }

        dv = new DataView(dt);
        ViewLibraryItemLinkGrid.DataSource = dv;
        ViewLibraryItemLinkGrid.DataBind();

        m_libraryToolBar = (librarytoolbar)(LoadControl("controls/library/librarytoolbar.ascx"));
        ToolBarHolder.Controls.Add(m_libraryToolBar);
        m_libraryToolBar.AppImgPath = _AppImgPath;
        m_libraryToolBar.PageAction = _PageAction;
        m_libraryToolBar.FolderInfo = folder_data;
        m_libraryToolBar.SecurityInfo = security_data;
        m_libraryToolBar.FolderId = _FolderId;
        m_libraryToolBar.LibType = _Type;
        m_libraryToolBar.ContentLanguage = _ContentLanguage;
        m_libraryToolBar.ContentType = library_data.ContentType;
        m_libraryToolBar.LibraryInfo = library_data;
    }
        public static DataTable GetGovernanceReport(string SiteUrl, Guid CurrentUserUID)
        {
            var ResultDataTable = new DataTable();
            ResultDataTable.Columns.Add("Title");
            ResultDataTable.Columns.Add("Start");
            ResultDataTable.Columns.Add("Finish");
            ResultDataTable.Columns.Add("Type");
            try
            {
                //User Impersionation
                WindowsImpersonationContext wik = null;
                SPSecurity.RunWithElevatedPrivileges(delegate
                {
                    using (var Site = new SPSite(SiteUrl))
                    {
                        SiteUrl = Utilities.GetDefaultZoneUri(Site);

                        try
                        {
                            wik = WindowsIdentity.Impersonate(IntPtr.Zero);
                        }
                        catch (Exception)
                        { }

                        ModifyConnectionString(SiteUrl);

                        using (IObjectScope scope = ObjectScopeProvider1.GetNewObjectScope())
                        {
                            // Adding the current user if not exits
                            int count = (from c in scope.GetOqlQuery<Users>().ExecuteEnumerable()
                                         where c.ResourceUID.Equals(CurrentUserUID.ToString())
                                         select c).Count();
                            if (count == 0)
                            {
                                scope.Transaction.Begin();
                                var user = new Users();
                                user.ResourceUID = CurrentUserUID.ToString();
                                scope.Add(user);
                                scope.Transaction.Commit();
                            }

                            List<Users> users = (from c in scope.GetOqlQuery<Users>().ExecuteEnumerable()
                                                 where c.ResourceUID.Equals(CurrentUserUID.ToString())
                                                 select c).ToList();

                            var Project_Svc = new Project()
                                                  {
                                                      AllowAutoRedirect = true,
                                                      Url = SiteUrl + "/_vti_bin/psi/project.asmx",
                                                      UseDefaultCredentials = true
                                                  };

                            var CustomField_Svc = new CustomFields()
                                                      {
                                                          AllowAutoRedirect = true,
                                                          Url = SiteUrl + "/_vti_bin/psi/customfields.asmx",
                                                          UseDefaultCredentials = true
                                                      };

                            if (Utilities.IsCustomFieldFound(CustomField_Svc, CustomFieldName))
                            {
                                var ProjectIDs = Utilities.GetProjectUIDList(Project_Svc, false, false);

                                string ProjectsList = string.Empty;
                                foreach (var projectID in ProjectIDs)
                                {
                                    if (projectID != Guid.Empty)
                                    {
                                        if (ProjectsList == string.Empty)
                                            ProjectsList += "('" + projectID;
                                        else
                                            ProjectsList += "','" + projectID;
                                    }
                                }
                                ProjectsList += "')";
                                string Qry =
                                     @"SELECT  puv.ProjectUID,puv." + Project_Stream_Fieldname + @", puv.ProjectName, puv.ProjectStartDate, puv.ProjectFinishDate, '0' as [Type]
                                into #t1
                                FROM         MSP_EpmProject_UserView as puv
                                WHERE      (puv.[" + Project_Status_Fieldname + @"] <> N'[Closed]') AND (puv.[" + Project_Status_Fieldname + @"] <> N'[Cancelled]') AND (puv.[" + Project_Status_Fieldname + @"] <> N'[Replaced]')
                                SELECT     tuv.ProjectUID, puv." + Project_Stream_Fieldname + @", " +
                                 CustomFieldName +
                                 @" AS Title, MIN(tuv.TaskStartDate) AS Start, MAX(tuv.TaskFinishDate) AS [End], '1' as [Type]
                                into #t2
                                FROM        MSP_EpmTask_UserView AS tuv INNER JOIN
                                            MSP_EpmProject_UserView AS puv ON tuv.ProjectUID = puv.ProjectUID
                                WHERE      (puv.[" + Project_Status_Fieldname + @"] <> N'[Closed]') AND (puv.[" + Project_Status_Fieldname + @"] <> N'[Cancelled]') AND (puv.[" + Project_Status_Fieldname + @"] <> N'[Replaced]')
                                GROUP BY " + CustomFieldName + @", puv.Program_Code, tuv.ProjectUID HAVING (CIMBTaskType IS NOT NULL)
                                INSERT into #t2
                                select #t1.ProjectUID,#t1.Program_Code, #t1.ProjectName, #t1.ProjectStartDate, #t1.ProjectFinishDate, #t1.[Type]
                                FROM #t1 INNER JOIN (SELECT DISTINCT #t2.ProjectUID from #t2) AS t2temp ON t2temp.ProjectUID =#t1.ProjectUID
                                SELECT     *
                                FROM         [#t2]
                                where ProjectUID in " +
                                 ProjectsList +
                                 @"
                                ORDER BY ProjectUID,[Type], Start
                                drop table #t1
                                drop table #t2";

                                var Conn = new SqlConnection(GetDataBaseConnectionString(SiteUrl));
                                Conn.Open();

                                var Result_set = new DataSet();
                                var Adapter = new SqlDataAdapter(new SqlCommand(Qry, Conn));
                                Adapter.Fill(Result_set);

                                DataRow newrow;
                                var grouptable = new Hashtable();
                                var datarows = new List<datarow>();
                                string groupname = string.Empty;
                                foreach (DataRow row in Result_set.Tables[0].Rows)
                                {
                                    if (row["Type"].ToString() == "0")
                                    {
                                        List<Groups> groups =
                                            (from c in scope.GetOqlQuery<Users>().ExecuteEnumerable()
                                             from d in c.groups
                                             from e in d.projects
                                             where
                                                 c.ResourceUID.Equals(CurrentUserUID.ToString()) &&
                                                 e.uid.Equals(row["ProjectUID"].ToString())
                                             select d).ToList();
                                        if (groups.Count > 0)
                                        {
                                            groupname = groups[0].name;
                                            var drow = new datarow();
                                            drow.type = "Group";
                                            drow.title = groupname;
                                            drow.startdate = DateTime.MinValue;
                                            drow.enddate = DateTime.MaxValue;
                                            if (grouptable.ContainsKey(groupname))
                                            {
                                                datarows = (List<datarow>)grouptable[groupname];

                                                drow = new datarow();
                                                drow.type = "Project";
                                                drow.startdate = Convert.ToDateTime(row["Start"]);
                                                drow.enddate = Convert.ToDateTime(row["End"]);
                                                drow.title = row["Title"].ToString();

                                                datarows.Add(drow);
                                                grouptable[groupname] = datarows;
                                            }
                                            else
                                            {
                                                datarows = new List<datarow>();
                                                datarows.Add(drow);

                                                drow = new datarow();
                                                drow.type = "Project";
                                                drow.startdate = Convert.ToDateTime(row["Start"]);
                                                drow.enddate = Convert.ToDateTime(row["End"]);
                                                drow.title = row["Title"].ToString();

                                                datarows.Add(drow);
                                                grouptable.Add(groupname, datarows);
                                            }
                                        }
                                        else
                                        {
                                            groupname = string.Empty;
                                            string[] streams = row["Program_Code"].ToString().Split('.');
                                            if (streams.Length > 3)
                                                groupname = streams[4];
                                            else if (streams.Length > 0)
                                                groupname = streams[streams.Length - 1];
                                            if (groupname == string.Empty)
                                                groupname = "Not Configured.";

                                            groups =
                                                (from c in scope.GetOqlQuery<Users>().ExecuteEnumerable()
                                                 from d in c.groups
                                                 where
                                                     c.ResourceUID.Equals(CurrentUserUID.ToString()) &&
                                                     d.name.Equals(groupname)
                                                 select d).ToList();
                                            if (groups.Count == 0)
                                            {
                                                scope.Transaction.Begin();
                                                var group = new Groups();
                                                group.name = groupname;
                                                group.UID = Guid.NewGuid().ToString();
                                                var project = new Projects();
                                                project.name = row["Title"].ToString();
                                                project.uid = row["ProjectUID"].ToString();
                                                group.projects.Add(project);
                                                users[0].groups.Add(group);
                                                scope.Add(users[0]);
                                                scope.Transaction.Commit();
                                            }
                                            else
                                            {
                                                scope.Transaction.Begin();
                                                var project = new Projects();
                                                project.name = row["Title"].ToString();
                                                project.uid = row["ProjectUID"].ToString();
                                                groups[0].projects.Add(project);
                                                scope.Add(groups[0]);
                                                scope.Transaction.Commit();
                                            }

                                            var drow = new datarow();
                                            drow.type = "Group";
                                            drow.title = groupname;
                                            drow.startdate = DateTime.MinValue;
                                            drow.enddate = DateTime.MaxValue;
                                            if (grouptable.ContainsKey(groupname))
                                            {
                                                datarows = (List<datarow>)grouptable[groupname];
                                                drow = new datarow();
                                                drow.type = "Project";
                                                drow.startdate = Convert.ToDateTime(row["Start"]);
                                                drow.enddate = Convert.ToDateTime(row["End"]);
                                                drow.title = row["Title"].ToString();
                                                datarows.Add(drow);
                                                grouptable[groupname] = datarows;
                                            }
                                            else
                                            {
                                                datarows = new List<datarow>();
                                                datarows.Add(drow);
                                                drow = new datarow();
                                                drow.type = "Project";
                                                drow.startdate = Convert.ToDateTime(row["Start"]);
                                                drow.enddate = Convert.ToDateTime(row["End"]);
                                                drow.title = row["Title"].ToString();
                                                datarows.Add(drow);
                                                grouptable.Add(groupname, datarows);
                                            }
                                        }
                                    }
                                    else if (groupname != string.Empty)
                                    {
                                        datarows =
                                            (List<datarow>)
                                            grouptable[groupname];
                                        var drow = new datarow();
                                        drow.title = row["Title"].ToString();
                                        drow.startdate =
                                            Convert.ToDateTime(row["Start"]);
                                        drow.enddate =
                                            Convert.ToDateTime(row["End"]);
                                        drow.type = "CF";
                                        datarows.Add(drow);
                                        grouptable[groupname] = datarows;
                                    }
                                }

                                // Adding the rows into datatable
                                foreach (DictionaryEntry drws in grouptable)
                                {
                                    foreach (datarow drow in (List<datarow>)drws.Value)
                                    {
                                        DataRow row = ResultDataTable.NewRow();
                                        row["Title"] = drow.title;
                                        row["Start"] = drow.startdate;
                                        row["Finish"] = drow.enddate;
                                        row["Type"] = drow.type;
                                        ResultDataTable.Rows.Add(row);
                                    }
                                }
                            }
                            else
                            {
                                ErrorLog(
                                    "The Custom field called " + CustomFieldName + " is not found in the instanse " +
                                    Site.Url, EventLogEntryType.FailureAudit);
                            }
                        }
                    }
                }
                    );
            }
            catch (Exception ex)
            {
                ErrorLog("Error at loading project list due to " + ex.Message, EventLogEntryType.Error);
            }
            return ResultDataTable;
        }
Exemple #38
0
    private void Display_EditLibraryItem()
    {
        EditLibraryItemPanel.Visible = true;
        FolderData folder_data;
        PermissionData security_data;
        LibraryData library_data;
        librarytoolbar m_libraryToolBar;
        string strPath = "";
        string[] tmpAr;
        _Id = Convert.ToInt64(Request.QueryString["id"]);
        _FolderId = Convert.ToInt64(Request.QueryString["parent_id"]);
        folder_data = _ContentApi.GetFolderById(_FolderId);
        security_data = _ContentApi.LoadPermissions(_FolderId, "folder", 0);
        library_data = _ContentApi.GetLibraryItemByID(_Id, _FolderId);
        if (!(library_data == null))
        {
            _Type = library_data.Type;
        }
        else
        {
            //ErrorString = "Item not found -HC"
        }

        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TITLE";
        colBound.HeaderText = _MessageHelper.GetMessage("generic Title");
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.HeaderStyle.CssClass = "title-header";
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        EditLibraryItemGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "ID";
        colBound.HeaderText = _MessageHelper.GetMessage("generic ID");
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.CssClass = "title-header";
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        EditLibraryItemGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TYPE";
        if ((_Type == "files") || (_Type == "images"))
        {
            colBound.HeaderText = _MessageHelper.GetMessage("generic Filename");
        }
        else
        {
            colBound.HeaderText = _MessageHelper.GetMessage("generic URL Link");
        }
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.CssClass = "title-header";
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        EditLibraryItemGrid.Columns.Add(colBound);

        if (_Type == "quicklinks")
        {
            colBound = new System.Web.UI.WebControls.BoundColumn();
            colBound.DataField = "CONTENTID";
            colBound.HeaderText = _MessageHelper.GetMessage("generic Content ID");
            colBound.ItemStyle.Wrap = false;
            colBound.HeaderStyle.CssClass = "title-header";
            colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
            colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
            EditLibraryItemGrid.Columns.Add(colBound);
        }

        DataTable dt = new DataTable();
        DataRow dr;
        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        dt.Columns.Add(new DataColumn("ID", typeof(string)));
        dt.Columns.Add(new DataColumn("TYPE", typeof(string)));
        if (_Type == "quicklinks")
        {
            dt.Columns.Add(new DataColumn("CONTENTID", typeof(string)));
        }
        if (!(library_data == null))
        {
            dr = dt.NewRow();
            dr[0] = "<input type=\"text\" size=\"25\" maxlength=\"200\" name=\"frm_title\"  id=\"frm_title\" value=\"" + library_data.Title + "\" onkeypress = \"javascript:return CheckKeyValue(event, \'34,13\');\"/>";
            dr[1] = library_data.Id;

            if (_Type == "hyperlinks")
            {
                dr[2] = "<input type=\"text\" size=\"50\" maxlength=\"255\" name=\"frm_filename\" value=\"" + library_data.FileName + "\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
            }
            else if (((_Type == "quicklinks") || (_Type == "forms")) && (Ektron.Cms.Common.EkConstants.IsAssetContentType(library_data.ContentType, true) == false)) //   (library_data.FileName.IndexOf("javascript:void window.open") < 0) Then
            {
                if (folder_data.IsDomainFolder || folder_data.DomainProduction != "")
                {
                    tmpAr = library_data.FileName.Split(folder_data.DomainProduction.ToCharArray()[0]);
                    dr[2] = strPath + "<input type=\"text\" size=\"50\" maxlength=\"255\" name=\"frm_filename\" value=\"" + tmpAr[1] + "\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
                }
                else
                {
                    if (_SitePath == "/")
                    {
                        tmpAr = Strings.Split(library_data.FileName, _SitePath, 2, 0);
                    }
                    else
                    {
                        tmpAr = Strings.Split(library_data.FileName, _SitePath);
                    }

                    strPath = (string)(tmpAr[0] + _SitePath);
                    dr[2] = strPath + "<input type=\"text\" size=\"50\" maxlength=\"255\" name=\"frm_filename\" value=\"" + tmpAr[1] + "\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
                }
            }
            else
            {
                // dr(2) = library_data.FileName
                dr[2] += "<input type=\"text\" disabled=\"true\" size=\"50\" maxlength=\"255\" name=\"frm_filename\" value=\"" + library_data.FileName + "\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
            }

            if (_Type == "quicklinks")
            {
                dr[3] = "<input type=\"hidden\" size=\"9\" maxlength=\"19\" name=\"frm_content_id\" value=\"" + library_data.ContentId + "\"/>" + library_data.ContentId;
            }
            else
            {
                dr[2] += "<input type=\"hidden\" name=\"frm_content_id\" value=\"\"/>";
            }
            dr[2] += "<input type=hidden name=frm_libtype id=frm_libtype value=\"" + _Type + "\"/>";
            dt.Rows.Add(dr);
        }

        DataView dv = new DataView(dt);
        EditLibraryItemGrid.DataSource = dv;
        EditLibraryItemGrid.DataBind();

        m_libraryToolBar = (librarytoolbar)(LoadControl("controls/library/librarytoolbar.ascx"));
        ToolBarHolder.Controls.Add(m_libraryToolBar);
        m_libraryToolBar.AppImgPath = _AppImgPath;
        m_libraryToolBar.PageAction = _PageAction;
        m_libraryToolBar.FolderInfo = folder_data;
        m_libraryToolBar.SecurityInfo = security_data;
        m_libraryToolBar.FolderId = _FolderId;
        m_libraryToolBar.LibType = _Type;
        m_libraryToolBar.ContentLanguage = _ContentLanguage;
        m_libraryToolBar.LibraryInfo = library_data;
        if (_Type != "quicklinks" && _Type != "forms")
        {
            editTabs.Visible = true;
            dvSummary.Attributes.Add("class", _SelectedDivStyleClass);
            bool bManagedAsset = false;
            ContentData content_data = null;
            ContentAPI m_refcontentapi = new ContentAPI();
            CustomFields cFieldsO = new CustomFields();
            ContentMetaData[] meta_data;

            if (_ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
            {
                m_refcontentapi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
            }
            else
            {
                m_refcontentapi.ContentLanguage = _ContentLanguage;
            }

            if (library_data.ContentId != 0)
            {
                content_data = m_refcontentapi.GetContentById(library_data.ContentId, 0);
            }
            if (!(content_data == null))
            {
                meta_data = content_data.MetaData;
                _ContentTeaser = content_data.Teaser;
                if (content_data.Type != Ektron.Cms.Common.EkConstants.CMSContentType_Library)
                {
                    bManagedAsset = true;
                }
            }
            else
            {
                meta_data = m_refcontentapi.GetMetaDataTypes("id");
            }

            // Setting the titles for tabs
            EditdvSummaryTxt.Text = _MessageHelper.GetMessage("Summary text");
            EditdvMetadataTxt.Text = _MessageHelper.GetMessage("metadata text");
            EditdvCategoryTxt.Text = _MessageHelper.GetMessage("viewtaxonomytabtitle");

            RenderSummaryEditor();

            //Populating the category
            string Action = "Edit";
            PopulateCategory(Action);

            if (meta_data != null)
            {
                if (meta_data.Length > 0)
                {
                    if (!bManagedAsset)
                    {
                        if (m_refcontentapi.ContentLanguage != Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES)
                        {
                            int v = 0;
                            ShowMeta.Text = CustomFields.WriteFilteredMetadataForEdit(meta_data, true, "update", _FolderId, ref v, null).ToString();

                            ShowTagEditArea(m_refcontentapi, library_data);
                        }
                        else
                        {
                            string strLink;
                            strLink = "<a href=\"library.aspx?LangType=" + meta_data[0].Language.ToString() + "&action=" + _PageAction + "&id=" + _Id + "&parent_id=" + _FolderId + "\">";
                            ShowMeta.Text = "<span style=\"COLOR: red\">*Note - Related metadata/tags will be displayed only if a specific language was selected. You may either go back to the page and select a language, or click " + strLink + "here</a> to view the metadata with the language selected automatically.</span>";
                        }
                    }

                }
            }
        }
    }
Exemple #39
0
 internal Issue(RedmineServiceContext context, int id)
     : base(context, id)
 {
     _customFields	= new CustomFields();
 }
Exemple #40
0
    private void Display_AddLibraryItem()
    {
        FolderData folder_data = null;
        PermissionData security_data = null;
        LibraryData library_data = null;
        LibraryConfigData lib_setting_data = null;
        librarytoolbar m_libraryToolBar = null;
        //int i = 0;
        string Action = "add";
        EditLibraryItemPanel.Visible = true;

        //Id, FolderId differes in this action
        if (!string.IsNullOrEmpty(Request.QueryString["id"]))
        {
            _Id = Convert.ToInt64(Request.QueryString["id"]);
        }
        if (!string.IsNullOrEmpty(Request.QueryString["folder"]))
        {
            _FolderId = Convert.ToInt64(Request.QueryString["folder"]);
        }
        if (_Type == "images" || _Type == "files")
        {
            LibraryItem.Enctype = "multipart/form-data";
        }

        if (!string.IsNullOrEmpty(Request.QueryString["operation"]))
        {
            _Operation = Request.QueryString["operation"].ToLower();
        }
        folder_data = _ContentApi.GetFolderById(_FolderId);
        security_data = _ContentApi.LoadPermissions(_FolderId, "folder", 0);
        if (_Operation == "overwrite")
        {
            library_data = _ContentApi.GetLibraryItemByID(_Id, _FolderId);
        }
        lib_setting_data = _ContentApi.GetLibrarySettings(_FolderId);
        jsImageExtension.Text = lib_setting_data.ImageExtensions;
        jsFileExtension.Text = lib_setting_data.FileExtensions;
        if (security_data.CanAddToFileLib)
        {
            jsAddToFileLib.Text = "true";
        }
        else
        {
            jsAddToFileLib.Text = "true";
        }
        if (security_data.CanAddToImageLib)
        {
            jsAddToImageLib.Text = "true";
        }
        else
        {
            jsAddToImageLib.Text = "true";
        }
        frm_folder_id.Value = Convert.ToString(_FolderId);
        frm_libtype.Value = _Type;
        frm_operation.Value = _Operation;
        frm_library_id.Value = Convert.ToString(_Id);
        if (_Type == "images")
        {
            upload_directory.Value = lib_setting_data.ImageDirectory;
        }
        else if (_Type == "files")
        {
            upload_directory.Value = lib_setting_data.FileDirectory;
        }
        m_libraryToolBar = (librarytoolbar)(LoadControl("controls/library/librarytoolbar.ascx"));
        ToolBarHolder.Controls.Add(m_libraryToolBar);
        m_libraryToolBar.AppImgPath = _AppImgPath;
        m_libraryToolBar.PageAction = _PageAction;
        m_libraryToolBar.FolderInfo = folder_data;
        m_libraryToolBar.SecurityInfo = security_data;
        m_libraryToolBar.FolderId = _FolderId;
        m_libraryToolBar.LibType = _Type;
        m_libraryToolBar.ContentLanguage = _ContentLanguage;
        m_libraryToolBar.Operation = _Operation;
        AddLibraryItemPanel.Visible = true;

        tr1_td1_ali.InnerHtml = _MessageHelper.GetMessage("generic Title");
        if ((_Type == "files") || (_Type == "images"))
        {
            tr1_td2_ali.InnerHtml = _MessageHelper.GetMessage("generic Filename");
        }
        else
        {
            tr1_td2_ali.InnerHtml = _MessageHelper.GetMessage("generic URL Link");
        }
        if (_Type == "quicklinks")
        {
            tr1_td3_ali.InnerHtml = _MessageHelper.GetMessage("generic Content ID");
        }
        else
        {
            tr1_td3_ali.Visible = false;
        }
        if ((_Type == "quicklinks") || (_Type == "Forms"))
        {
            tr2_td3_ali.InnerHtml = "<input type=\"text\" style=\"width:75px\" size=\"9\" maxlength=\"19\" name=\"frm_content_id\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
        }
        else
        {
            tr2_td3_ali.InnerHtml = "<input type=\"hidden\" name=\"frm_content_id\" value=\"\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
            tr2_td3_ali.Attributes.Add("style", "display:none;");
        }

        if (_Operation == "overwrite")
        {
            tr2_td1_ali.InnerHtml = library_data.Title + "<input type=\"hidden\" size=\"25\" maxlength=\"200\" name=\"frm_title\" value=\"" + library_data.Title + "\"/>";
        }
        else
        {
            tr2_td1_ali.InnerHtml = "<input type=\"text\" size=\"15\" maxlength=\"200\" name=\"frm_title\"  id=\"frm_title\" onkeypress = \"javascript:return CheckKeyValue(event, \'34,13\');\"/>";
        }

        if (_Operation == "overwrite")
        {
            frm_oldfilename.Value = library_data.FileName;
            OverwriteSubPanel1.Visible = true;
            OverwriteSubPanel2.Visible = true;
            TD_filename.InnerHtml = "<input type=\"file\" size=\"40\" maxlength=\"255\" id=\"frm_filename\" name=\"frm_filename\"/>";
            tr2_td2_ali_controls.Text = library_data.FileName;
            if (library_data.Type == "images")
            {
                Overwrite_Image.ImageUrl = library_data.FileName.Replace(" ", "%20");
                Overwrite_Image.ImageUrl += "?id=" + EkFunctions.Random(1, 1000).ToString();
                Overwrite_Image.Visible = true;
            }
            else
            {
                Overwrite_link.Visible = true;
                Overwrite_link.Text = _MessageHelper.GetMessage("generic Preview title") + " " + library_data.Title;
                Overwrite_link.NavigateUrl = library_data.FileName;
                Overwrite_link.Target = "CurrentPreview";
                Overwrite_link.ToolTip = _MessageHelper.GetMessage("generic Preview title");
            }
            AddItemFocus.Text = "document.forms[0].frm_filename.focus();";
        }
        else
        {
            OverwriteSubPanel0.Visible = true;

            if (_Type == "hyperlinks")
            {
                tr2_td2_ali_controls.Text = "<input type=\"text\" size=\"50\" maxlength=\"255\" name=\"frm_filename\" value=\"http://\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/>";
                frm_filename.Visible = false;
            }
            else if (_Type == "quicklinks")
            {
                tr2_td2_ali_controls.Text = "<span style=\"white-space:nowrap;\">" + _SitePath + "<input type=\"text\" size=\"" + (50 - Strings.Len(_SitePath)) + "\" maxlength=\"255\" name=\"frm_filename\" value=\"\" onkeypress=\"javascript:return CheckKeyValue(event,\'34\');\"/></span>";
                frm_filename.Visible = false;
            }
            AddItemFocus.Text = "document.forms[0].frm_title.focus();";
        }

        if (_Type != "quicklinks" && _Type != "forms")
        {
            addTabs.Visible = false;
            editTabs.Visible = true;

            dvSummary.Attributes.Add("class", _SelectedDivStyleClass);
            CustomFields cFieldsO = new CustomFields();
            ContentMetaData[] meta_data = null;
            ContentAPI m_refcontentapi = new ContentAPI();
            ContentData content_data = new ContentData();
            bool bManagedAsset = false;
            string ty = "";

            if (_ContentLanguage == Ektron.Cms.Common.EkConstants.CONTENT_LANGUAGES_UNDEFINED)
            {
                m_refcontentapi.ContentLanguage = Ektron.Cms.Common.EkConstants.ALL_CONTENT_LANGUAGES;
            }
            else
            {
                m_refcontentapi.ContentLanguage = _ContentLanguage;
            }

            if (_Operation == "overwrite")
            {
                Action = "Edit";
                ty = "update";
                if (library_data.ContentId != 0)
                {
                    content_data = m_refcontentapi.GetContentById(library_data.ContentId, 0);

                    if (!(content_data == null))
                    {
                        meta_data = content_data.MetaData;
                        _ContentTeaser = content_data.Teaser;
                        if (content_data.Type != Ektron.Cms.Common.EkConstants.CMSContentType_Library)
                        {
                            bManagedAsset = true;
                        }
                    }
                    else
                    {
                        meta_data = m_refcontentapi.GetMetaDataTypes("id");
                    }
                }
            }
            else
            {
                if (_PageAction == "addlibraryitem")
                {
                    ty = "add";
                }
                meta_data = m_refcontentapi.GetMetaDataTypes("id");
            }

            RenderSummaryEditor();
            // Setting the titles for tabs
            AdddvSummaryTxt.Text = _MessageHelper.GetMessage("Summary text");
            AdddvMetadataTxt.Text = _MessageHelper.GetMessage("metadata text");
            AdddvCategoryTxt.Text = _MessageHelper.GetMessage("viewtaxonomytabtitle");

            EditdvSummaryTxt.Text = _MessageHelper.GetMessage("Summary text");
            EditdvMetadataTxt.Text = _MessageHelper.GetMessage("metadata text");
            EditdvCategoryTxt.Text = _MessageHelper.GetMessage("viewtaxonomytabtitle");

            //Populating the category Tab

            PopulateCategory(Action);

            if (meta_data != null)
            {
                if (meta_data.Length > 0)
                {
                    if (!bManagedAsset)//  bManagedAsset)
                    {
                        int c = 0;
                        ShowMeta.Text = CustomFields.WriteFilteredMetadataForEdit(meta_data, true, ty, _FolderId, ref c, null).ToString();

                        ShowTagEditArea(m_refcontentapi, library_data);
                    }
                }
            }
        }
    }