Пример #1
0
    private void Display_PropertiesTab(ContentData data)
    {
        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "NAME";
        colBound.ItemStyle.CssClass = "label";
        PropertiesGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "TITLE";
        PropertiesGrid.Columns.Add(colBound);
        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn("NAME", typeof(string)));
        dt.Columns.Add(new DataColumn("TITLE", typeof(string)));
        int i = 0;
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("generic title");
        dr[1] = entry_edit_data.Title;
        dt.Rows.Add(dr);
        dr = dt.NewRow();

        content_title.Value = data.Title;

        dr[0] = m_refMsg.GetMessage("generic id");
        dr[1] = entry_edit_data.Id;
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("generic language");
        dr[1] = LanguageName;
        dt.Rows.Add(dr);

        // commerce

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl product type xml config");
        dr[1] = entry_edit_data.ProductType.Title;
        xml_id = entry_edit_data.ProductType.Id;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl calatog entry sku");
        dr[1] = entry_edit_data.Sku;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl number of units");
        dr[1] = entry_edit_data.QuantityMultiple;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl tax class");
        dr[1] = (new TaxClass(m_refContentApi.RequestInformationRef)).GetItem(entry_edit_data.TaxClassId).Name;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl archived");
        dr[1] = "<input type=\"checkbox\" " + (entry_edit_data.IsArchived ? "checked=\"checked\" " : "") + "disabled=\"disabled\" />";
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl buyable");
        dr[1] = "<input type=\"checkbox\" " + (entry_edit_data.IsBuyable ? "checked=\"checked\" " : "") + "disabled=\"disabled\" />";
        dt.Rows.Add(dr);

        // dimensions

        string sizeMeasure = m_refMsg.GetMessage("lbl inches");
        string weightMeasure = m_refMsg.GetMessage("lbl pounds");

        if (m_refContentApi.RequestInformationRef.MeasurementSystem == Ektron.Cms.Common.EkEnumeration.MeasurementSystem.Metric)
        {

            sizeMeasure = m_refMsg.GetMessage("lbl centimeters");
            weightMeasure = m_refMsg.GetMessage("lbl kilograms");

        }

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl tangible");
        dr[1] = "<input type=\"checkbox\" " + (entry_edit_data.IsTangible ? "checked=\"checked\" " : "") + "disabled=\"disabled\" />";
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl height");
        dr[1] = entry_edit_data.Dimensions.Height + " " + sizeMeasure;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl width");
        dr[1] = entry_edit_data.Dimensions.Width + " " + sizeMeasure;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl length");
        dr[1] = entry_edit_data.Dimensions.Length + " " + sizeMeasure;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl weight");
        dr[1] = entry_edit_data.Weight.Amount + " " + weightMeasure;
        dt.Rows.Add(dr);

        // dimensions

        // inventory
        InventoryApi inventoryApi = new InventoryApi();
        InventoryData inventoryData = inventoryApi.GetInventory(entry_edit_data.Id);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl disable inventory");
        dr[1] = "<input type=\"checkbox\" " + (entry_edit_data.DisableInventoryManagement ? "checked=\"checked\" " : "") + "disabled=\"disabled\" />";
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl in stock");
        dr[1] = inventoryData.UnitsInStock;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl on order");
        dr[1] = inventoryData.UnitsOnOrder;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("lbl reorder");
        dr[1] = inventoryData.ReorderLevel;
        dt.Rows.Add(dr);

        // inventory

        // end commerce

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("content status label");
        switch (entry_edit_data.ContentStatus.ToLower())
        {
            case "a":
                dr[1] = m_refMsg.GetMessage("status:Approved (Published)");
                break;
            case "o":
                dr[1] = m_refMsg.GetMessage("status:Checked Out");
                break;
            case "i":
                dr[1] = m_refMsg.GetMessage("status:Checked In");
                break;
            case "p":
                dr[1] = m_refMsg.GetMessage("status:Approved (PGLD)");
                break;
            case "m":
                dr[1] = "<font color=\"Red\">" + m_refMsg.GetMessage("status:Submitted for Deletion") + "</font>";
                break;
            case "s":
                dr[1] = "<font color=\"Red\">" + m_refMsg.GetMessage("status:Submitted for Approval") + "</font>";
                break;
            case "t":
                dr[1] = m_refMsg.GetMessage("status:Waiting Approval");
                break;
            case "d":
                dr[1] = "Deleted (Pending Start Date)";
                break;
        }
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("content LUE label");
        dr[1] = entry_edit_data.LastEditorFirstName + " " + entry_edit_data.LastEditorLastName;
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("content LED label");
        dr[1] = entry_edit_data.DateModified;
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("generic start date label");
        if (entry_edit_data.GoLive == DateTime.MinValue || entry_edit_data.GoLive == DateTime.MaxValue)
        {
            dr[1] = m_refMsg.GetMessage("none specified msg");
        }
        else
        {
            dr[1] = entry_edit_data.GoLive.ToLongDateString() + " " + entry_edit_data.GoLive.ToShortTimeString();
        }
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("generic end date label");
        if (entry_edit_data.EndDate == DateTime.MinValue || entry_edit_data.EndDate == DateTime.MaxValue)
        {
            dr[1] = m_refMsg.GetMessage("none specified msg");
        }
        else
        {
            dr[1] = entry_edit_data.EndDate.ToLongDateString() + " " + entry_edit_data.EndDate.ToShortTimeString();
        }
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("End Date Action Title");
        if (!(entry_edit_data.EndDate == DateTime.MinValue || entry_edit_data.EndDate == DateTime.MaxValue))
        {
            if (entry_edit_data.EndDateAction == Ektron.Cms.Common.EkConstants.EndDateActionType_archive_display)
            {
                dr[1] = m_refMsg.GetMessage("Archive display descrp");
            }
            else if (entry_edit_data.EndDateAction == Ektron.Cms.Common.EkConstants.EndDateActionType_refresh)
            {
                dr[1] = m_refMsg.GetMessage("Refresh descrp");
            }
            else
            {
                dr[1] = m_refMsg.GetMessage("Archive expire descrp");
            }
        }
        else
        {
            dr[1] = m_refMsg.GetMessage("none specified msg");
        }
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("content DC label");
        dr[1] = data.DateCreated; //DisplayDateCreated
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = this.m_refMsg.GetMessage("lbl approval method");
        if (data.ApprovalMethod == 1)
        {
            dr[1] = m_refMsg.GetMessage("display for force all approvers");
        }
        else
        {
            dr[1] = m_refMsg.GetMessage("display for do not force all approvers");
        }
        dt.Rows.Add(dr);
        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("content approvals label");
        System.Text.StringBuilder approvallist = new System.Text.StringBuilder();
        if (approvaldata == null)
        {
            approvaldata = m_refContentApi.GetCurrentApprovalInfoByID(m_intId);
        }
        approvallist.Append(m_refMsg.GetMessage("none specified msg"));
        if (!(approvaldata == null))
        {
            if (approvaldata.Length > 0)
            {
                approvallist.Length = 0;
                for (i = 0; i <= approvaldata.Length - 1; i++)
                {
                    if (approvaldata[i].Type.ToLower() == "user")
                    {
                        approvallist.Append("<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/user.png\" align=\"absbottom\" alt=\"" + m_refMsg.GetMessage("approver is user") + "\" title=\"" + m_refMsg.GetMessage("approver is user") + "\">");
                    }
                    else
                    {
                        approvallist.Append("<img src=\"" + m_refContentApi.AppPath + "images/UI/Icons/users.png\" align=\"absbottom\" alt=\"" + m_refMsg.GetMessage("approver is user group") + "\" title=\"" + m_refMsg.GetMessage("approver is user group") + "\">");
                    }
                    if (approvaldata[i].IsCurrentApprover)
                    {
                        approvallist.Append("<span class=\"important\">");
                    }
                    else
                    {
                        approvallist.Append("<span>");
                    }
                    if (approvaldata[i].Type.ToLower() == "user")
                    {
                        approvallist.Append(approvaldata[i].DisplayUserName);
                    }
                    else
                    {
                        approvallist.Append(approvaldata[i].DisplayUserName);
                    }
                    approvallist.Append("</span>");
                }
            }
        }
        dr[1] = approvallist.ToString();
        dt.Rows.Add(dr);

        if (folder_data == null)
        {
            folder_data = m_refContentApi.EkContentRef.GetFolderById(entry_edit_data.FolderId);
        }

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("template label");

        if (m_refContent.MultiConfigExists(entry_edit_data.Id, m_refContentApi.RequestInformationRef.ContentLanguage))
        {
            TemplateData t_templateData = m_refContent.GetMultiTemplateASPX(entry_edit_data.Id);
            if (t_templateData != null)
            {
                dr[1] = t_templateData.FileName;
            }
            else
            {
                dr[1] = folder_data.TemplateFileName;
            }
        }
        else
        {
            dr[1] = folder_data.TemplateFileName;
        }

        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("generic Path");
        dr[1] = data.Path;
        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = m_refMsg.GetMessage("rating label");

        Collection dataCol = m_refContentApi.GetContentRatingStatistics(entry_edit_data.Id, 0, null);
        int total = 0;
        int sum = 0;
        int hits = 0;
        if (dataCol.Count > 0)
        {
            total = Convert.ToInt32 (dataCol["total"]);
            sum = Convert.ToInt32 (dataCol["sum"]);
            hits = Convert.ToInt32 (dataCol["hits"]);
        }

        if (total == 0)
        {
            dr[1] = m_refMsg.GetMessage("content not rated");
        }
        else
        {
            dr[1] = Math.Round(System.Convert.ToDouble(Convert.ToDouble((short)sum) / total), 2);
        }

        dt.Rows.Add(dr);

        //dr = dt.NewRow()
        //dr(0) = "Content Hits:"
        //dr(1) = hits

        //dt.Rows.Add(dr)

        dr = dt.NewRow();
        dr[0] = this.m_refMsg.GetMessage("lbl content searchable");
        dr[1] = data.IsSearchable.ToString();
        dt.Rows.Add(dr);

        DataView dv = new DataView(dt);
        PropertiesGrid.DataSource = dv;
        PropertiesGrid.DataBind();
    }
Пример #2
0
        private void Display_EntryTab()
        {
            System.Collections.Generic.List<TaxClassData> TaxClassList = new System.Collections.Generic.List<TaxClassData>();
            Ektron.Cms.Common.Criteria<TaxClassProperty> criteria = new Ektron.Cms.Common.Criteria<TaxClassProperty>(TaxClassProperty.Id, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);

            //Excluding the shipping Tax class that comes in to the system.5 is the shipping tax id.
            criteria.AddFilter(TaxClassProperty.Id, CriteriaFilterOperator.NotEqualTo, 5);
            m_refTaxClass = new TaxClass(this.m_refContentApi.RequestInformationRef);
            TaxClassList = m_refTaxClass.GetList(criteria);

            drp_taxclass.DataTextField = "name";
            drp_taxclass.DataValueField = "id";
            drp_taxclass.DataSource = TaxClassList;
            drp_taxclass.DataBind();

            if (m_refContentApi.RequestInformationRef.MeasurementSystem == Ektron.Cms.Common.EkEnumeration.MeasurementSystem.English)
            {

                ltr_heightmeasure.Text = GetMessage("lbl inches");
                ltr_lengthmeasure.Text = GetMessage("lbl inches");
                ltr_widthmeasure.Text = GetMessage("lbl inches");
                ltr_weightmeasure.Text = GetMessage("lbl pounds");

            }
            else
            {

                ltr_heightmeasure.Text = GetMessage("lbl centimeters");
                ltr_lengthmeasure.Text = GetMessage("lbl centimeters");
                ltr_widthmeasure.Text = GetMessage("lbl centimeters");
                ltr_weightmeasure.Text = GetMessage("lbl kilograms");

            }

            Util_BindFieldList();

            if (entry_edit_data != null)
            {
                txt_sku.Text = entry_edit_data.Sku;
                txt_quantity.Text = entry_edit_data.QuantityMultiple.ToString();
                drp_taxclass.SelectedValue = entry_edit_data.TaxClassId.ToString();
                chk_avail.Checked = entry_edit_data.IsArchived;
                // chk_markdel.Checked = entry_edit_data.IsMarkedForDeletion
                if (entry_edit_data.Id == 0)
                {
                    chk_buyable.Checked = true;
                }
                if (entry_edit_data.IsArchived)
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "chk_buyable", "document.getElementById(\'chk_buyable\').disabled = true;", true);
                }
                if (!entry_edit_data.IsArchived)
                {
                    chk_buyable.Checked = entry_edit_data.IsBuyable;
                }
                else
                {
                    chk_buyable.Checked = false;
                }

                chk_tangible.Checked = entry_edit_data.IsTangible;
                chk_disableInv.Enabled = Util_IsEditable();
                if (Util_IsEditable() == false || !entry_edit_data.IsTangible)
                {
                    txt_height.Enabled = false;
                    txt_length.Enabled = false;
                    txt_width.Enabled = false;
                    txt_weight.Enabled = false;
                }

                txt_height.Text = entry_edit_data.Dimensions.Height.ToString();
                txt_length.Text = entry_edit_data.Dimensions.Length.ToString();
                txt_width.Text = entry_edit_data.Dimensions.Width.ToString();
                txt_weight.Text = entry_edit_data.Weight.Amount.ToString();

                InventoryApi inventoryApi = new InventoryApi();
                InventoryData inventoryData = inventoryApi.GetInventory(entry_edit_data.Id);

                chk_disableInv.Checked = entry_edit_data.DisableInventoryManagement;
                chk_disableInv.Enabled = Util_IsEditable();
                if (Util_IsEditable() == false || entry_edit_data.DisableInventoryManagement)
                {
                    txt_instock.Enabled = false;
                    txt_onorder.Enabled = false;
                    txt_reorder.Enabled = false;
                }

                txt_instock.Text = inventoryData.UnitsInStock.ToString();
                txt_onorder.Text = inventoryData.UnitsOnOrder.ToString();
                txt_reorder.Text = inventoryData.ReorderLevel.ToString();
            }
            else
            {

                txt_height.Enabled = false;
                txt_length.Enabled = false;
                txt_width.Enabled = false;
                txt_weight.Enabled = false;

                txt_instock.Enabled = false;
                txt_onorder.Enabled = false;
                txt_reorder.Enabled = false;

            }

            Util_ToggleProperties(Util_IsEditable());
        }