示例#1
0
        /*
         * public IEnumerable<LineItem> GetLineItems(PurchaseOrder po)
         * {
         *  foreach (OrderForm orderForm in po.OrderForms)
         *  {
         *      foreach (LineItem lineItem in orderForm.LineItems)
         *      {
         *          yield return lineItem;
         *      }
         *  }
         * }
         * */

        /// <summary>
        /// Binds the form.
        /// </summary>
        private void BindForm()
        {
            GridHelper.BindGrid(DefaultGrid, "Marketing", "PromotionCond-List");

            if (_promotion != null)
            {
                SecurityManager.CheckRolePermission("marketing:expr:mng:edit");

                DataTable table = _promotion.PromotionCondition.Copy();

                table.Columns.Add(new DataColumn(_ExpressionNameString));
                table.Columns.Add(new DataColumn(_CatalogNodeNameString));
                table.Columns.Add(new DataColumn(_CatalogEntryNameString));

                foreach (DataRow row in table.Rows)
                {
                    if (row[_ExpressionIdString] != DBNull.Value && !String.IsNullOrEmpty(row[_ExpressionIdString].ToString()))
                    {
                        row[_ExpressionNameString] = GetExpressionName(Int32.Parse(row[_ExpressionIdString].ToString()));
                    }
                    if (row[_CatalogNodeIdString] != DBNull.Value && !String.IsNullOrEmpty(row[_CatalogNodeIdString].ToString()))
                    {
                        row[_CatalogNodeNameString] = GetCatalogNodeName(row[_CatalogNodeIdString].ToString());
                    }
                    if (row[_CatalogEntryIdString] != DBNull.Value && !String.IsNullOrEmpty(row[_CatalogEntryIdString].ToString()))
                    {
                        row[_CatalogEntryNameString] = GetCatalogEntryName(row[_CatalogEntryIdString].ToString());
                    }
                }

                DefaultGrid.DataSource = table;
                DefaultGrid.DataBind();

                /*
                 * DataTable tbl = _promotion.PromotionCondition.Copy();
                 * DataColumn column = tbl.Columns.Add();
                 * column.ColumnName = _ExpressionNameString;
                 * */
                /*
                 * ArrayList list = new ArrayList();
                 * foreach(LineItem li in GetLineItems(_po))
                 * {
                 *  list.Add(li);
                 * }
                 * DefaultGrid.DataSource = list;
                 * DefaultGrid.DataBind();
                 * */
            }
            else
            {
                SecurityManager.CheckRolePermission("marketing:expr:mng:create");
            }
        }
示例#2
0
        /// <summary>
        /// Binds the grid.
        /// </summary>
        protected void BindGrid()
        {
            GridHelper.BindGrid(DefaultGrid, GridAppId, GridViewId);
            DirectoryInfo dir = new DirectoryInfo(MapPath(Folder));

            FileInfo[] files = dir.GetFiles();
            // sort files by created date desc
            IEnumerable <FileInfo> filesQuery = from file in files orderby file.CreationTime descending select file;

            // set sorted result as datasource
            DefaultGrid.DataSource = filesQuery.ToArray <FileInfo>();
            DefaultGrid.DataBind();
        }
示例#3
0
 void DefaultGrid_NeedRebind(object sender, EventArgs e)
 {
     DefaultGrid.DataBind();
 }