private void BindData()
    {
        CmsDeviceConfiguration cDevice = new CmsDeviceConfiguration(_ContentApi.RequestInformationRef);
        CmsDeviceConfigurationCriteria criteria = new CmsDeviceConfigurationCriteria();
        List<CmsDeviceConfigurationData> cDeviceList;
        StringBuilder sBuilder = new StringBuilder();

        criteria.OrderByField = Ektron.Cms.Device.CmsDeviceConfigurationProperty.Order;
        criteria.OrderByDirection = EkEnumeration.OrderByDirection.Ascending;
        cDeviceList = cDevice.GetList(criteria);
        _ItemCount = cDeviceList.Count;

        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "Device";
        colBound.HeaderStyle.CssClass = "left";
        colBound.ItemStyle.CssClass = "left";
        colBound.HeaderText = _MessageHelper.GetMessage("lbl Device");
        DeviceListGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "Models";
        //colBound.HeaderStyle.CssClass = "center";
        //colBound.ItemStyle.CssClass = "center";
        colBound.HeaderText = _MessageHelper.GetMessage("lbl Device Models");
        DeviceListGrid.Columns.Add(colBound);

        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn("Device", typeof(string)));
        dt.Columns.Add(new DataColumn("Models", typeof(string)));
        for (int i = 0; i <= cDeviceList.Count - 1; i++)
        {
            sBuilder = new StringBuilder();
            dr = dt.NewRow();
            if (_ContentApi.RequestInformationRef.IsDeviceDetectionEnabled)
                dr[0] = "<a href=\'settings.aspx?action=viewdeviceconfiguration&id=" + cDeviceList[i].Id + "\' title=\'" + EkFunctions.HtmlEncode(cDeviceList[i].Name) + "\'>" + EkFunctions.HtmlEncode(cDeviceList[i].Name) + "</a>";
            else
                dr[0] = EkFunctions.HtmlEncode(cDeviceList[i].Name);
            if (cDeviceList[i].Id == 1)
            {
                dr[1] = "Generic";
            }
            else if (cDeviceList[i].Id == 0)
            {
                dr[1] = "Generic Mobile Devices";
            }
            else
            {
                foreach (string cModel in cDeviceList[i].Models)
                {
                    sBuilder.Append(cModel).Append(",");
                    dr[1] = sBuilder.ToString().TrimEnd(new char[] { ',' });
                }
            }

            dt.Rows.Add(dr);
        }
        DataView dv = new DataView(dt);
        DeviceListGrid.DataSource = dv;
        DeviceListGrid.DataBind();
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _MessageHelper = _ContentApi.EkMsgRef;
         Utilities.ValidateUserLogin();

        if(!String.IsNullOrEmpty(Request.QueryString["cid"]))
        {
            _ContentID = Convert.ToInt64(Request.QueryString["cid"]);
        }

        if (!String.IsNullOrEmpty(Request.QueryString["fid"]))
        {
            _FolderID = Convert.ToInt64(Request.QueryString["fid"]);
            _FolderData = _ContentApi.GetFolderById(_FolderID);
        }

        CmsDeviceConfiguration cDevice = new CmsDeviceConfiguration(_ContentApi.RequestInformationRef);
        criteria.OrderByField = Ektron.Cms.Device.CmsDeviceConfigurationProperty.Order;
        criteria.OrderByDirection = EkEnumeration.OrderByDirection.Ascending;
        dList = cDevice.GetList(criteria);

        if (!Page.IsPostBack)
        {
            if (_FolderData != null)
            {
                if (dList.Count > 0)
                {
                    ddlDevices.Items.Clear();

                    foreach (CmsDeviceConfigurationData dItem in dList)
                    {
                        ddlDevices.Items.Add(new ListItem(dItem.Name, dItem.Id.ToString()));
                    }
                    if (!(ddlDevices.Items.Count > 0))
                        Response.Redirect(ContentLink().Replace("ekfrm", "id"), false);
                }
                else
                {
                    Response.Redirect(ContentLink().Replace("ekfrm", "id"), false);
                }
            }
        }
    }
    private void BindData()
    {
        CmsDeviceConfiguration cDevice = new CmsDeviceConfiguration(_ContentApi.RequestInformationRef);
        CmsDeviceConfigurationCriteria criteria = new CmsDeviceConfigurationCriteria();
        List<CmsDeviceConfigurationData> cDeviceList;
        StringBuilder sBuilder = new StringBuilder();

        criteria.AddFilter(Ektron.Cms.Device.CmsDeviceConfigurationProperty.Id, CriteriaFilterOperator.GreaterThan, 1);
        criteria.OrderByField = Ektron.Cms.Device.CmsDeviceConfigurationProperty.Order;
        criteria.OrderByDirection = EkEnumeration.OrderByDirection.Ascending;
        cDeviceList = cDevice.GetList(criteria);

        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "Delete";
        colBound.ItemStyle.Width = Unit.Percentage(3);
        colBound.HeaderStyle.CssClass = "left";
        colBound.ItemStyle.CssClass = "left";
        colBound.HeaderText = _MessageHelper.GetMessage("lbl Delete");
        DeviceListGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "Device";
        colBound.HeaderStyle.CssClass = "left";
        colBound.ItemStyle.CssClass = "left";
        colBound.HeaderText = _MessageHelper.GetMessage("lbl Device");
        DeviceListGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "Models";
        colBound.HeaderStyle.CssClass = "center";
        colBound.ItemStyle.CssClass = "center";
        colBound.HeaderText = _MessageHelper.GetMessage("lbl Device Models");
        DeviceListGrid.Columns.Add(colBound);

        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn("Delete", typeof(string)));
        dt.Columns.Add(new DataColumn("Device", typeof(string)));
        dt.Columns.Add(new DataColumn("Models", typeof(string)));

        for (int i = 0; i <= cDeviceList.Count - 1; i++)
        {
            sBuilder = new StringBuilder();
            dr = dt.NewRow();
            dr[0] = "<input type=\"checkbox\" name=\"deleteConfigurationId\" value=\"" + cDeviceList[i].Id + "\">";
            dr[1] = "<a href=\'settings.aspx?action=viewdeviceconfiguration&id=" + cDeviceList[i].Id + "\' title=\'" + EkFunctions.HtmlEncode(cDeviceList[i].Name) + "\'>" + EkFunctions.HtmlEncode(cDeviceList[i].Name) + "</a>";

            foreach (string cModel in cDeviceList[i].Models)
            {
                sBuilder.Append(cModel).Append(",");
            }
            dr[2] = sBuilder.ToString().TrimEnd(new char[] { ',' });

            dt.Rows.Add(dr);
        }
        DataView dv = new DataView(dt);
        DeviceListGrid.DataSource = dv;
        DeviceListGrid.DataBind();
    }