예제 #1
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            PromotionDto dto = PromotionManager.GetPromotionDto();

            if (dto.Promotion != null)
            {
                PromotionDto.PromotionDataTable table = dto.Promotion;
                table.Columns.Add(new DataColumn("TotalUsed", typeof(Int32)));

                // Get existing statistics
                DataTable usageStatistics = PromotionManager.GetPromotionUsageStatistics();

                // Populate extra column that can be used for display purpose
                foreach (PromotionDto.PromotionRow row in table)
                {
                    int totalUsed = 0;
                    System.Data.DataRow[] rows = usageStatistics.Select(String.Format("PromotionId = {0}", row.PromotionId));
                    if (rows != null && rows.Length > 0)
                    {
                        totalUsed = (int)rows[0]["TotalUsed"];
                    }

                    row["TotalUsed"] = totalUsed;
                }

                DataView view = table.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("PromotionId");
            MyListView.DataBind();
        }
예제 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable            dataTable = LoadDataSource();
        IEnumerable <string> columns   = dataTable.Columns.Cast <DataColumn>().Select(column => column.ColumnName);

        MyListView.LayoutTemplate = new MyLayoutTemplate(columns);
        MyListView.ItemTemplate   = new MyItemTemplate(columns);
        MyListView.DataSource     = dataTable;
        MyListView.DataBind();
    }
예제 #3
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("VersionId");
            DataTable dtPV;

            dtPV = PageVersion.GetWorkVersionByUserId(Page.User.Identity.Name);

            if (dtPV != null && dtPV.Rows.Count > 0)
            {
                DataView dv = dtPV.DefaultView;

                //APPLY FILTER
                int DefaultWorkflowId = -1;
                using (IDataReader reader = Mediachase.Cms.Workflow.LoadDefault())
                {
                    if (reader.Read())
                    {
                        DefaultWorkflowId = (int)reader["WorkflowId"];
                    }
                    reader.Close();
                }
                int PublishId = WorkflowStatus.GetLastByWorkflowId(DefaultWorkflowId);
                int DraftId   = WorkflowStatus.DraftId;

                string filter = Parameters["filter"];
                if (!String.IsNullOrEmpty(filter))
                {
                    if (filter.Equals("draft"))
                    {
                        dv.RowFilter = String.Format("StateId = 1 AND StatusId = {0}", DraftId);
                    }
                    else if (filter.Equals("approve"))
                    {
                        dv.RowFilter = String.Format("StateId = 1 AND StatusId NOT IN (-1, {0}, {1})", PublishId, DraftId);
                    }
                    else if (filter.Equals("reject"))
                    {
                        dv.RowFilter = String.Format("StateId = 2 AND StatusId NOT IN (-1, {0})", PublishId);
                    }
                }
                else
                {
                    dv.RowFilter = String.Format("StateId = 1 AND StatusId NOT IN (-1, {0}, {1})", PublishId, DraftId);;
                }
                //END:APPLY FILTER

                dv.Sort = sortExpression;
                MyListView.DataSource = dv;
            }

            MyListView.DataBind();
        }
예제 #4
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            ShippingMethodDto dto = ShippingManager.GetShippingPackages();

            if (dto.Package != null)
            {
                DataView view = dto.Package.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("PackageId");
            MyListView.DataBind();
        }
예제 #5
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            SegmentDto dto = SegmentManager.GetSegmentDto();

            if (dto.Segment != null)
            {
                DataView view = dto.Segment.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("SegmentId");
            MyListView.DataBind();
        }
예제 #6
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            ExpressionDto dto = ExpressionManager.GetExpressionDto(ExpressionCategory);

            if (dto.Expression != null)
            {
                DataView view = dto.Expression.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("ExpressionId");
            MyListView.DataBind();
        }
예제 #7
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            WarehouseDto dto = WarehouseManager.GetWarehouseDto();

            if (dto.Warehouse != null)
            {
                DataView view = dto.Warehouse.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("WarehouseId");
            MyListView.DataBind();
        }
예제 #8
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            CatalogTaxDto dto = CatalogTaxManager.GetTaxCategories();

            if (dto.TaxCategory != null)
            {
                DataView view = dto.TaxCategory.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("TaxCategoryId");
            MyListView.DataBind();
        }
예제 #9
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            CountryDto dto = CountryManager.GetCountries(true);

            if (dto.Country != null)
            {
                DataView view = dto.Country.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("CountryId");
            MyListView.DataBind();
        }
예제 #10
0
파일: List.ascx.cs 프로젝트: hdgardner/ECF
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            int       totalRecords = 0;
            DataTable table        = GetDataSource(out totalRecords);
            DataView  view         = table.DefaultView;

            view.Sort = sortExpression;
            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("ID", "Type", "OutlineNumber");
            MyListView.DataSource = view;
            MyListView.DataBind();

            m_TotalRecords = totalRecords;
            //MyListView.Grid.RecordCount = totalRecords;
        }
예제 #11
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            JurisdictionDto dto = JurisdictionManager.GetJurisdictionGroups(JurisdictionType);

            if (dto.Jurisdiction != null)
            {
                DataView view = dto.JurisdictionGroup.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("JurisdictionGroupId", "JurisdictionType");
            MyListView.DataBind();
        }
예제 #12
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            CampaignDto dto = CampaignManager.GetCampaignDto();

            if (dto.Campaign != null)
            {
                DataView view = dto.Campaign.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("CampaignId");
            MyListView.DataBind();
        }
예제 #13
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            TemplateDto templates    = DictionaryManager.GetTemplateDto(0);
            DataView    templateView = templates.main_Templates.DefaultView;

            templateView.Sort      = sortExpression;
            templateView.RowFilter = String.Format("LanguageCode LIKE '{0}'", LanguageCode);

            MyListView.DataSource = templateView;

            MyListView.CurrentListView.SetSortProperties(sortExpression);
            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("TemplateId");
            MyListView.DataBind();
        }
예제 #14
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            ShippingMethodDto dto = ShippingManager.GetShippingMethods(LanguageCode, true);

            if (dto.ShippingMethod != null)
            {
                DataView view = dto.ShippingMethod.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("ShippingMethodId", "LanguageId");
            MyListView.DataBind();
        }
예제 #15
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            DataTable table = mc.Workflow.LoadAllDT();

            if (table != null)
            {
                DataView view = table.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("WorkflowId");
            MyListView.DataBind();
        }
예제 #16
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            PolicyDto dto = PolicyManager.GetPolicyDto();

            if (dto.Policy != null && dto.Policy.Count > 0)
            {
                DataView view = null;
                if (String.IsNullOrEmpty(Group))
                {
                    view                  = dto.Policy.DefaultView;
                    view.Sort             = sortExpression;
                    MyListView.DataSource = view;
                }
                else
                {
                    // filter dto by specified group
                    PolicyDto.GroupPolicyRow[] gpRows = (PolicyDto.GroupPolicyRow[])dto.GroupPolicy.Select(String.Format("GroupName = '{0}'", Group));

                    string query = "";
                    foreach (PolicyDto.GroupPolicyRow gpRow in gpRows)
                    {
                        query = String.Concat(query, String.Format("OR PolicyId={0}", gpRow.PolicyId));
                    }
                    if (query.StartsWith("OR "))
                    {
                        query = query.Substring(3);
                    }
                    else
                    {
                        query = "1 = 0";
                    }

                    dto.Policy.DefaultView.Sort = sortExpression;

                    PolicyDto.PolicyRow[] policyRows = (PolicyDto.PolicyRow[])dto.Policy.Select(query);

                    MyListView.DataSource = policyRows;
                }
            }
            else
            {
                MyListView.DataSource = null;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("PolicyId");
            MyListView.DataBind();
        }
예제 #17
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            IDataReader reader = mc.WorkflowStatus.LoadByWorkflowId(WorkflowId);
            DataTable   table  = ManagementHelper.ConvertToTable(reader);

            reader.Close();

            MyListView.DataSource = table.DefaultView;
            if (table != null)
            {
                DataView view = table.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("StatusId");
            MyListView.DataBind();
        }
예제 #18
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        private void LoadDataAndDataBind(string sortExpression)
        {
            DataTable dt = NavigationManager.GetByPageId(PageId);

            dt.Columns.Add(new DataColumn("Name", typeof(string)));

            foreach (DataRow row in dt.Rows)
            {
                row["Name"] = NavigationManager.GetItemNameById((int)row["ItemId"]);
            }

            DataView view = dt.DefaultView;

            view.Sort = sortExpression;

            MyListView.DataSource = view;

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("Id", "UrlUID");
            MyListView.DataBind();
        }
예제 #19
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            DataTable table = new DataTable();

            table.Columns.Add(new DataColumn("Name", typeof(string)));

            string[] roles = Roles.GetAllRoles();
            if (roles != null && roles.Length > 0)
            {
                foreach (string role in roles)
                {
                    DataRow row = table.NewRow();
                    row[0] = role;
                    table.Rows.Add(row);
                }

                DataView view = table.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("Name");
            MyListView.DataBind();
        }
예제 #20
0
        /// <summary>
        /// Loads the data and data bind.
        /// </summary>
        /// <param name="sortExpression">The sort expression.</param>
        private void LoadDataAndDataBind(string sortExpression)
        {
            TaxDto dto = TaxManager.GetTaxDto(null);

            if (dto.Tax != null)
            {
                //string taxCategoryColumnKey = "TaxCategory";
                //string percentageColumnKey = "Percentage";
                string taxTypeNameColumnKey = "TaxTypeName";

                DataTable taxesTable = dto.Tax;
                //taxesTable.Columns.Add(percentageColumnKey, typeof(double));
                //taxesTable.Columns.Add(taxCategoryColumnKey, typeof(string));
                taxesTable.Columns.Add(taxTypeNameColumnKey, typeof(string));

                /*var tbl1 = from tax in dto.Tax
                 *                 join taxValue in dto.TaxValue
                 *                 on tax.TaxId equals taxValue.TaxId
                 *                 select new { tax.TaxId, tax.Name, tax.TaxType, tax.SortOrder, Percentage = taxValue.Percentage, TaxCategory = taxValue.TaxCategory };*/

                for (int i = 0; i < dto.Tax.Rows.Count; i++)
                {
                    TaxDto.TaxRow currentTaxRow = (TaxDto.TaxRow)dto.Tax.Rows[i];
                    switch ((TaxType)currentTaxRow.TaxType)
                    {
                    case TaxType.SalesTax:
                        currentTaxRow[taxTypeNameColumnKey] = Resources.SharedStrings.Sales;
                        break;

                    case TaxType.ShippingTax:
                        currentTaxRow[taxTypeNameColumnKey] = Resources.SharedStrings.Shipping;
                        break;

                    default:
                        currentTaxRow[taxTypeNameColumnKey] = String.Empty;
                        break;
                    }
                }

                //for (int i = 0; i < dto.Tax.Rows.Count; i++)
                //{
                //    TaxDto.TaxRow currentTaxRow = (TaxDto.TaxRow)dto.Tax.Rows[i];
                //    var valueRow = from taxValue in dto.TaxValue where taxValue.TaxId == currentTaxRow.TaxId select taxValue;
                //    bool fillWithEmptyValues = true;
                //    if (valueRow != null)
                //    {
                //        DataView dv = valueRow.AsDataView();
                //        if (dv.Count > 0) // must be 1
                //        {
                //            taxesTable.Rows[i][percentageColumnKey] = dv[0]["Percentage"];
                //            taxesTable.Rows[i][taxCategoryColumnKey] = dv[0]["TaxCategory"];
                //            fillWithEmptyValues = false;
                //        }
                //    }

                //    if (fillWithEmptyValues)
                //    {
                //        taxesTable.Rows[i][percentageColumnKey] = 0;
                //        taxesTable.Rows[i][taxCategoryColumnKey] = "";
                //    }
                //}

                DataView view = taxesTable.DefaultView;
                view.Sort             = sortExpression;
                MyListView.DataSource = view;
            }

            MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("TaxId");
            MyListView.DataBind();
        }
예제 #21
0
 /// <summary>
 /// Loads the data and data bind.
 /// </summary>
 /// <param name="sortExpression">The sort expression.</param>
 private void LoadDataAndDataBind(string sortExpression)
 {
     MyListView.CurrentListView.PrimaryKeyId = EcfListView.MakePrimaryKeyIdString("Id");
     MyListView.DataSource = MetaField.GetList(ProfileContext.MetaDataContext, FieldNamespace);
     MyListView.DataBind();
 }