Ejemplo n.º 1
0
        public static void SetUltraGridValueList <T>(UltraGridLayout layout, IEnumerable <T> collection,
                                                     UltraGridColumn column, string valueMember, string displayMember, string defaultValue)
        {
            ValueList vl;

            if (!layout.ValueLists.Exists(typeof(T).Name + valueMember + displayMember))
            {
                vl = layout.ValueLists.Add(typeof(T).Name + valueMember + displayMember);
            }

            vl = layout.ValueLists[typeof(T).Name + valueMember + displayMember];
            vl.ValueListItems.Clear();
            if (defaultValue != null)
            {
                vl.ValueListItems.Add(-1, defaultValue);
            }

            foreach (T entity in collection)
            {
                vl.ValueListItems.Add(entity.GetType().GetProperty(valueMember).GetValue(entity, null),
                                      entity.GetType().GetProperty(displayMember).GetValue(entity, null).ToString());
            }

            vl.SelectedItem = -1;
            //column.ButtonDisplayStyle = Infragistics.Win.UltraWinGrid.ButtonDisplayStyle.Always;
            column.ValueList = layout.ValueLists[typeof(T).Name + valueMember + displayMember];
        }
Ejemplo n.º 2
0
        private void grdPrincipal_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];
            int             index  = 0;

            foreach (UltraGridColumn column in band.Columns.Cast <UltraGridColumn>()
                     .Where(x => x.Index >= 4 && int.TryParse(x.Header.Caption, out index)))
            {
                column.Header.Caption = this.lstLines
                                        .Single(x => x.ProductLineId == Convert.ToInt32(column.Header.Caption)).Name.Trim();

                column.Header.TextOrientation = new TextOrientationInfo(65, TextFlowDirection.Horizontal);

                column.PerformAutoResize();
            }

            foreach (UltraGridRow row in this.frmVerticalIntegration.grdPrincipal.Rows.Where(x => x.Cells != null))
            {
                foreach (UltraGridCell cell in row.Cells.Cast <UltraGridCell>().Where(x => x.Column.Index >= 4))
                {
                    if (!Convert.ToBoolean(cell.Value))
                    {
                        cell.Appearance.BackColor = Color.Yellow;
                    }
                }
            }

            band.Columns["CustomerId"].Header.Caption    = "Id Cliente";
            band.Columns["Agent"].Header.Caption         = "Agente";
            band.Columns["CustomerName"].Header.Caption  = "Nombre Cliente";
            band.Columns["ComercialName"].Header.Caption = "Nombre Comercial";

            band.SortedColumns.Add("Agent", false, true);
        }
Ejemplo n.º 3
0
        public static void SetUltraGridValueList(UltraGridLayout layout, DataTable dataTable,
                                                 UltraGridColumn column, string valueMember, string displayMember, string defaultValue)
        {
            ValueList vl;

            if (dataTable.TableName == null)
            {
                dataTable.TableName = string.Empty;
            }

            if (!layout.ValueLists.Exists(dataTable.TableName + valueMember + displayMember))
            {
                vl = layout.ValueLists.Add(dataTable.TableName + valueMember + displayMember);
            }

            vl = layout.ValueLists[dataTable.TableName + valueMember + displayMember];
            vl.ValueListItems.Clear();

            if (defaultValue != null)
            {
                vl.ValueListItems.Add(-1, defaultValue);
            }

            foreach (DataRow row in dataTable.Rows)
            {
                vl.ValueListItems.Add(row[valueMember], row[displayMember].ToString());
            }

            vl.SelectedItem  = -1;
            column.ValueList = layout.ValueLists[dataTable.TableName + valueMember + displayMember];
        }
        private void grdPrincipal_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            WindowsFormsUtil.SetUltraGridValueList(layout, TimeUtil.Months,
                                                   band.Columns["Month"], "Index", "Name", null);
        }
Ejemplo n.º 5
0
        private void grdPrincipal_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            WindowsFormsUtil.SetUltraGridValueList(layout, this.srvGeneric.GetListByParameters <BusinessType>(null),
                                                   band.Columns["BusinessTypeId"], "BusinessTypeId", "Name", "Seleccione");
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Handles the InitializeLayout event of the gridInventory control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs"/> instance containing the event data.</param>
        private void gridInventory_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;

            layout.AutoFitStyle             = AutoFitStyle.ResizeAllColumns;
            layout.Override.CellClickAction = CellClickAction.RowSelect;
            layout.LoadStyle             = LoadStyle.LoadOnDemand;
            layout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
            layout.Override.RowSizing    = RowSizing.Fixed;
            layout.Override.CellAppearance.TextHAlign = Infragistics.Win.HAlign.Center;
            layout.Override.CellAppearance.TextVAlign = Infragistics.Win.VAlign.Middle;
            layout.Override.HeaderClickAction         = HeaderClickAction.SortMulti;
            layout.Override.CellSpacing = 3;
            UltraGridBand band = layout.Bands[0];

            if (band.Key == "Deliveries")
            {
                band.Columns["EndDateTime"].Hidden         = true;
                band.Columns["AllDayEvent"].Hidden         = true;
                band.Columns["Category"].Hidden            = true;
                band.Columns["DataKey"].Header.Caption     = Properties.Resources.PartNumber;
                band.Columns["Weight"].Header.Caption      = Properties.Resources.TotalWeightLbs;
                band.Columns["Cost"].Header.Caption        = Properties.Resources.TotalDue;
                band.Columns["Subject"].Header.Caption     = Properties.Resources.Subject;
                band.Columns["Description"].Header.Caption = Properties.Resources.Description;
                band.Columns["Count"].Header.Caption       = Properties.Resources.Count;

                UltraGridColumn column = band.Columns["StartDateTime"];
                column.Header.Caption = Properties.Resources.DeliveryDate;
                column.Style          = Infragistics.Win.UltraWinGrid.ColumnStyle.DateWithoutDropDown;
                band.SortedColumns.Add(column, false);
            }
            else
            {
                UltraGridColumn column = band.Columns["WeightPerItem"];
                column.Header.Caption = Properties.Resources.WeightLbs;
                column.Format         = "F1";

                column = band.Columns["PricePerItem"];
                column.Header.Caption = Properties.Resources.PricePerItem;
                column.Format         = "C";

                band.Columns["PartNumber"].Header.Caption   = Properties.Resources.PartNumber;
                band.Columns["InStock"].Header.Caption      = Properties.Resources.InStock;
                band.Columns["Manufacturer"].Header.Caption = Properties.Resources.Manufacturer;
                band.Columns["Component"].Header.Caption    = Properties.Resources.Component;

                // Add a column for the Orders ("Order Part", "View Shipment") button
                if (band.Columns.IndexOf("Orders") == -1)
                {
                    UltraGridColumn deliveries = band.Columns.Add("Orders");
                    deliveries.Header.Caption     = Properties.Resources.Availability;
                    deliveries.DataType           = typeof(string);
                    deliveries.Style              = Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
                    deliveries.ButtonDisplayStyle = ButtonDisplayStyle.Always;
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InitializeLayoutEventArgs"/> class.
        /// </summary>
        /// <param name="layout">The layout.</param>
        /// <exception cref="System.ArgumentNullException">the layout is null</exception>
        public InitializeLayoutEventArgs(UltraGridLayout layout)
        {
            if (layout == null)
            {
                throw new ArgumentNullException(nameof(layout));
            }

            this.Layout = layout;
        }
Ejemplo n.º 8
0
        private void grdRegionOption_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout      = e.Layout;
            UltraGridBand   band        = layout.Bands[0];
            UltraGridColumn imageColumn = band.Columns.Add("Delete");

            imageColumn.DataType = typeof(Image);
            imageColumn.Style    = Infragistics.Win.UltraWinGrid.ColumnStyle.Image;
        }
Ejemplo n.º 9
0
        private void grdDetSummary_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            layout.Override.AllowUpdate = DefaultableBoolean.False;
            layout.Override.AllowMultiCellOperations = AllowMultiCellOperation.All;
            layout.AutoFitStyle = AutoFitStyle.ExtendLastColumn;

            band.Override.RowSizing = RowSizing.AutoFixed;

            band.Columns["Description"].CellMultiLine = DefaultableBoolean.True;
        }
Ejemplo n.º 10
0
        private void grdCredits_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            e.Layout.Override.AllowUpdate       = DefaultableBoolean.False;
            e.Layout.Override.HeaderClickAction = HeaderClickAction.Select;

            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["movimiento"],
                                                  TextFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["importe"],
                                                  TextFormatEnum.Currency);
        }
Ejemplo n.º 11
0
        private void clbColumnas_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            UltraGridLayout layout = this.grdDetalleQuincena.DisplayLayout;
            UltraGridBand   band   = layout.Bands[0];

            if (this.grdDetalleQuincena.DisplayLayout.Bands[0].Columns.Count > 0)
            {
                band.Columns[e.Index].Hidden = this.clbColumnas.GetItemChecked(e.Index);
                checkedColumns[band.Columns[e.Index].Header.Caption]
                    = band.Columns[e.Index].Hidden ? "0" : "1";
            }

            FileUtils.Write(checkedColumns, "dictionary.bin");
        }
Ejemplo n.º 12
0
        private void grdMultiquotaSchemes_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            layout.Override.AllowUpdate = DefaultableBoolean.False;

            band.Columns["esquema"].Hidden                 = true;
            band.Columns["agente"].Hidden                  = true;
            band.Columns["nombre"].Header.Caption          = "Esquema";
            band.Columns["nombre"].Width                   = 200;
            band.Columns["fecha"].Header.Caption           = "Fecha de inicio";
            band.Columns["cuota_servicios"].Header.Caption = "Cuota de servicios";
            band.Columns["cuota_productos"].Header.Caption = "Cuota de productos";
            band.Columns["comisiona_servicios"].Hidden     = true;
        }
Ejemplo n.º 13
0
        private void grdDetLog_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = this.frmOpportunity.grdDetLog.DisplayLayout;
            UltraGridBand   band   = layout.Bands[0];

            layout.AutoFitStyle                 = AutoFitStyle.ExtendLastColumn;
            band.Override.MinRowHeight          = 3;
            band.Override.DefaultRowHeight      = 3;
            band.Override.RowSizing             = RowSizing.AutoFree;
            band.Override.RowSizingAutoMaxLines = 5;

            band.Columns["Description"].CellMultiLine       = DefaultableBoolean.True;
            band.Columns["Description"].VertScrollBar       = true;
            band.Columns["OpportunityLogId"].CellActivation = Activation.ActivateOnly;
            band.Columns["LogDate"].CellActivation          = Activation.ActivateOnly;
        }
Ejemplo n.º 14
0
        private void grdLines_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            e.Layout.Override.AllowUpdate       = DefaultableBoolean.False;
            e.Layout.Override.HeaderClickAction = HeaderClickAction.Select;

            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["numero_linea"],
                                                  TextFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["precio_pactado"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["costo_promedio"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["cantidad"],
                                                  TextFormatEnum.NaturalQuantity);
        }
Ejemplo n.º 15
0
        private void grdAgentSegments_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            layout.Override.AllowUpdate = DefaultableBoolean.False;

            band.Columns["id"].Hidden      = true;
            band.Columns["esquema"].Hidden = true;
            band.Columns["utilidad_inicial"].Header.Caption = "Utilidad inicial";
            band.Columns["comision"].Header.Caption         = "Comisión";

            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["utilidad_inicial"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["comision"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Percentage);
        }
Ejemplo n.º 16
0
        private void grdFacturasPendientes_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            e.Layout.Override.AllowUpdate       = DefaultableBoolean.False;
            e.Layout.Override.HeaderClickAction = HeaderClickAction.Select;

            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["fiscal"],
                                                  TextFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["factura"],
                                                  TextFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["utilidad"],
                                                  TextFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["total_acumulado"],
                                                  TextFormatEnum.Currency);
        }
Ejemplo n.º 17
0
        private void grdPrincipal_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];
            int             index  = 0;

            foreach (UltraGridColumn column in band.Columns.Cast <UltraGridColumn>()
                     .Where(x => x.Index >= 4))
            {
                if (!int.TryParse(column.Header.Caption.Split(' ').First(), out index))
                {
                    continue;
                }

                column.Header.Caption = TimeUtil.MonthName((TimeUtil.MonthEnum)index);
            }

            foreach (UltraGridColumn column in band.Columns
                     .Cast <UltraGridColumn>().Where(x => x.Index >= 4))
            {
                WindowsFormsUtil.SetUltraColumnFormat(column, TextFormatEnum.Currency);
                column.Width = 100;
            }

            foreach (UltraGridRow row in this.frmHorizontalIntegration.grdPrincipal.Rows.Where(x => x.Cells != null))
            {
                foreach (UltraGridCell cell in row.Cells.Cast <UltraGridCell>().Where(x => x.Column.Index >= 4))
                {
                    if (Convert.ToDecimal(cell.Value) == 0M)
                    {
                        cell.Appearance.BackColor = Color.Yellow;
                    }
                }
            }

            band.Columns["CustomerId"].Header.Caption    = "Id Cliente";
            band.Columns["Agent"].Header.Caption         = "Agente";
            band.Columns["CustomerName"].Header.Caption  = "Nombre Cliente";
            band.Columns["ComercialName"].Header.Caption = "Nombre Comercial";

            band.SortedColumns.Add("Agent", false, true);
        }
        private void grdRelations_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            band.Override.AllowUpdate = DefaultableBoolean.False;

            layout.AutoFitStyle                 = AutoFitStyle.ExtendLastColumn;
            band.Override.MinRowHeight          = 3;
            band.Override.RowSizing             = RowSizing.AutoFixed;
            band.Override.RowSizingAutoMaxLines = 5;

            band.Columns["TenderLineId"].CellActivation = Activation.ActivateOnly;
            band.Columns["Description"].CellMultiLine   = DefaultableBoolean.True;
            band.Columns["Description"].VertScrollBar   = true;
            band.Columns["Concept"].CellMultiLine       = DefaultableBoolean.True;
            band.Columns["Concept"].VertScrollBar       = true;

            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["Quantity"],
                                                  TextFormatEnum.NaturalQuantity);
        }
Ejemplo n.º 19
0
 /// <summary>
 /// 设置中文文本
 /// </summary>
 /// <param name="gridlayout"></param>
 /// <param name="ColumnsName"></param>
 /// <param name="CaptionName"></param>
 void SetUltragridCaption(UltraGridLayout gridlayout, string ColumnsName, string CaptionName)
 {
     gridlayout.Bands[0].Columns[ColumnsName].Header.Caption = CaptionName;
 }
Ejemplo n.º 20
0
        private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
        {
            UltraGridLayout gridLayout = e.Layout;

            switch (this.contentType)
            {
            case Enums.ContentType.Customers:
                #region Customers
                // use fixed headers.
                gridLayout.UseFixedHeaders = true;
                // turn off the fixed header indicator so the user cannot change them.
                gridLayout.Override.FixedHeaderIndicator = FixedHeaderIndicator.None;
                // turn off the border that draws between fixed cells and non-fixed cells.
                gridLayout.Override.FixedCellSeparatorColor = Color.Transparent;
                // hide the customer id column.
                gridLayout.Bands[0].Columns["CustomerID"].Hidden = true;

                // add an unbound column for an image.
                if (!gridLayout.Bands[0].Columns.Contains("CustomerImage"))
                {
                    UltraGridColumn col = gridLayout.Bands[0].Columns.Insert(0, "CustomerImage");
                    col.DataType       = typeof(Image);
                    col.Style          = ColumnStyle.Image;
                    col.Header.Caption = string.Empty;
                    col.Header.Fixed   = true;
                }
                #endregion     // Customers
                break;

            case Enums.ContentType.Orders:
                #region Orders
                // hide the order id column.
                gridLayout.Bands[0].Columns["OrderID"].Hidden = true;
                // set the caption of the other id fields to a ui friendly string.
                gridLayout.Bands[0].Columns["CustomerID"].Header.Caption = Utilities.GetLocalizedString("Customer");
                gridLayout.Bands[0].Columns["EmployeeID"].Header.Caption = Utilities.GetLocalizedString("Employee");

                // An example to show a combo editor in a cell instead of showing the id.
                Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor = new UltraComboEditor();
                this.Controls.Add(ultraComboEditor);
                ultraComboEditor.DataSource = this.nWind1.Tables["Employees"];

                ultraComboEditor.DisplayMember                            = "LastName";
                ultraComboEditor.ValueMember                              = "EmployeeID";
                ultraComboEditor.ValueList.ItemHeight                     = 35;
                gridLayout.Bands[0].Columns["EmployeeID"].Style           = ColumnStyle.DropDownList;
                gridLayout.Bands[0].Columns["EmployeeID"].EditorComponent = ultraComboEditor;

                // An example to show a combo editor in a cell instead of showing the id.
                Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor2 = new UltraComboEditor();
                this.Controls.Add(ultraComboEditor2);
                ultraComboEditor2.DataSource                              = this.nWind1.Tables["Customers"];
                ultraComboEditor2.DisplayMember                           = "CompanyName";
                ultraComboEditor2.ValueMember                             = "CustomerID";
                ultraComboEditor2.ValueList.ItemHeight                    = 35;
                gridLayout.Bands[0].Columns["CustomerID"].Style           = ColumnStyle.DropDownList;
                gridLayout.Bands[0].Columns["CustomerID"].EditorComponent = ultraComboEditor2;

                // An example to show a combo editor in a cell instead of showing the id.
                Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor3 = new UltraComboEditor();
                this.Controls.Add(ultraComboEditor3);
                ultraComboEditor3.DataSource                           = this.nWind1.Tables["Shippers"];
                ultraComboEditor3.DisplayMember                        = "CompanyName";
                ultraComboEditor3.ValueMember                          = "ShipperID";
                ultraComboEditor3.ValueList.ItemHeight                 = 35;
                gridLayout.Bands[0].Columns["ShipVia"].Style           = ColumnStyle.DropDownList;
                gridLayout.Bands[0].Columns["ShipVia"].EditorComponent = ultraComboEditor3;

                // An example to show a calendar combo in a cell instead of showing the DateTimeEditor and the .net month calendar.
                Infragistics.Win.UltraWinSchedule.UltraCalendarCombo ultraCalendarCombo = new UltraCalendarCombo();
                this.Controls.Add(ultraCalendarCombo);
                gridLayout.Bands[0].Columns["OrderDate"].EditorComponent = ultraCalendarCombo;

                Infragistics.Win.UltraWinSchedule.UltraCalendarCombo ultraCalendarCombo2 = new UltraCalendarCombo();
                this.Controls.Add(ultraCalendarCombo2);
                gridLayout.Bands[0].Columns["RequiredDate"].EditorComponent = ultraCalendarCombo2;

                Infragistics.Win.UltraWinSchedule.UltraCalendarCombo ultraCalendarCombo3 = new UltraCalendarCombo();
                this.Controls.Add(ultraCalendarCombo3);
                gridLayout.Bands[0].Columns["ShippedDate"].EditorComponent = ultraCalendarCombo3;
                #endregion     // Orders
                break;

            case Enums.ContentType.OrderDetails:
                #region OrderDetails
                // set the caption of the other id fields to a ui friendly string.
                gridLayout.Bands[0].Columns["OrderID"].Header.Caption   = Utilities.GetLocalizedString("Order");
                gridLayout.Bands[0].Columns["ProductID"].Header.Caption = Utilities.GetLocalizedString("Product");
                // give ProductID a MinWidth so it looks nice.
                gridLayout.Bands[0].Columns["ProductID"].MinWidth = 200;

                // An example to show a combo editor in a cell instead of showing the id.
                Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor4 = new UltraComboEditor();
                this.Controls.Add(ultraComboEditor4);
                ultraComboEditor4.DataSource    = this.nWind1.Tables["Products"];
                ultraComboEditor4.DisplayMember = "ProductName";
                ultraComboEditor4.ValueMember   = "ProductID";
                gridLayout.Bands[0].Columns["ProductID"].Style           = ColumnStyle.DropDownList;
                gridLayout.Bands[0].Columns["ProductID"].EditorComponent = ultraComboEditor4;

                // UnitPrice can pick up local currency symbols and display styles.
                gridLayout.Bands[0].Columns["UnitPrice"].Style           = ColumnStyle.Currency;
                gridLayout.Bands[0].Columns["UnitPrice"].MaskDisplayMode = MaskMode.IncludeLiterals;

                // make this grid show in OutlookGroupBy mode.
                gridLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
                // make the OrderID column the GroupBy column.
                gridLayout.Bands[0].SortedColumns.Add("OrderID", false, true);
                #endregion     // OrderDetails
                break;

            case Enums.ContentType.QuarterlyOrders:
                break;

            case Enums.ContentType.ProductSales:
                #region Products
                // hide the product id and supplier id columns.
                gridLayout.Bands[0].Columns["ProductID"].Hidden  = true;
                gridLayout.Bands[0].Columns["SupplierID"].Hidden = true;
                // set the caption of the other id fields to a ui friendly string.
                gridLayout.Bands[0].Columns["CategoryID"].Header.Caption = Utilities.GetLocalizedString("Category");

                // An example to show a combo editor in a cell instead of showing the id.
                Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor5 = new UltraComboEditor();
                this.Controls.Add(ultraComboEditor5);
                ultraComboEditor5.DataSource    = this.nWind1.Tables["Categories"];
                ultraComboEditor5.DisplayMember = "CategoryName";
                ultraComboEditor5.ValueMember   = "CategoryID";
                gridLayout.Bands[0].Columns["CategoryID"].Style           = ColumnStyle.DropDownList;
                gridLayout.Bands[0].Columns["CategoryID"].EditorComponent = ultraComboEditor5;

                // UnitPrice can pick up local currency symbols and display styles.
                gridLayout.Bands[0].Columns["UnitPrice"].Style           = ColumnStyle.Currency;
                gridLayout.Bands[0].Columns["UnitPrice"].MaskDisplayMode = MaskMode.IncludeLiterals;
                #endregion     // Products
                break;

            case Enums.ContentType.SalesByCategory:
                #region Categories
                // hide the category id and the hideous NorthWind picture columns.
                gridLayout.Bands[0].Columns["CategoryID"].Hidden = true;
                gridLayout.Bands[0].Columns["Picture"].Hidden    = true;
                #endregion     // Categories
                break;

            case Enums.ContentType.SalesByQuarter:
                break;

            case Enums.ContentType.SalesByYear:
                break;

            case Enums.ContentType.Shippers:
                #region Shippers
                // hide the shipper id column
                gridLayout.Bands[0].Columns["ShipperID"].Hidden = true;
                #endregion     // Shippers
                break;

            case Enums.ContentType.Suppliers:
                break;

            default:
                break;
            }

            #region UI friendly column headers
            // give the column headers more readable strings instead of mushed camel casing text.
            foreach (UltraGridBand ultraGridBand in gridLayout.Bands)
            {
                foreach (UltraGridColumn column in ultraGridBand.Columns)
                {
                    Utilities.SetUIFriendlyString(column.Header);
                }
            }
            #endregion //UI friendly column headers
        }
        /// <summary>
        /// Handles the InitializeLayot of the grid.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void grdCashflowSources_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
        {
            // Store some useful variable refernences.
            UltraGridLayout   layout = e.Layout;
            UltraGridBand     band   = layout.Bands[0];
            UltraGridOverride ov     = layout.Override;

            // This grid needs no selection.
            ov.HeaderClickAction = HeaderClickAction.Default;
            ov.SelectTypeCell    = SelectType.None;
            ov.SelectTypeRow     = SelectType.None;
            ov.SelectTypeCol     = SelectType.None;
            ov.CellClickAction   = CellClickAction.CellSelect;

            // No row selectors or borders.
            ov.RowSelectors      = DefaultableBoolean.False;
            ov.BorderStyleCell   = UIElementBorderStyle.None;
            ov.BorderStyleRow    = UIElementBorderStyle.None;
            ov.BorderStyleHeader = UIElementBorderStyle.None;

            // Set the BackColor and ForeColor of the row so that the rows look like the same
            // color as the background.
            ov.RowAppearance.BackColor = Color.FromArgb(235, 233, 234);
            ov.RowAppearance.ForeColor = Color.FromArgb(154, 154, 154);

            // Set up the header colors so that like the rows, the headers also blend
            // into the background.
            ov.HeaderAppearance.BackColor     = Color.FromArgb(235, 233, 234);
            ov.HeaderAppearance.ForeColor     = Color.FromArgb(102, 102, 102);
            ov.HeaderAppearance.FontData.Bold = DefaultableBoolean.True;

            // Align the text in all cells and headers to the left.
            ov.CellAppearance.TextHAlign   = HAlign.Left;
            ov.HeaderAppearance.TextHAlign = HAlign.Left;

            // Put a little space in between rows.
            ov.RowSpacingBefore = 4;

            // Don't let the user change anything.
            ov.AllowUpdate    = DefaultableBoolean.False;
            ov.AllowDelete    = DefaultableBoolean.False;
            ov.AllowColMoving = AllowColMoving.NotAllowed;

            // The data source has a whole bunch of fields in it and we only want to display
            // a small few. So start off hiding them all, and then we will make the ones we want visible.
            foreach (UltraGridColumn column in band.Columns)
            {
                column.Hidden = true;
            }

            // Label Column
            // This column shows the legend.
            //
            #region Label Column
            UltraGridColumn labelColumn = CashflowDetails.GetOrCreateUnboundColumn(band, "label", typeof(Image), null);
            labelColumn.Header.VisiblePosition = 0;
            labelColumn.Header.Caption         = this.GetLocalizedGridHeaderCaption(labelColumn.Key);
            labelColumn.Hidden = false;
            #endregion // Label Column

            // Source Column
            // This column shows the source of the inflow / outflow.
            //
            #region Source Column
            UltraGridColumn sourceColumn = band.Columns["Source"];
            sourceColumn.Header.VisiblePosition = 1;
            sourceColumn.Header.Caption         = this.GetLocalizedGridHeaderCaption(sourceColumn.Key);
            sourceColumn.Hidden = false;

            // Loop through each source.
            Source[]  sources          = (Source[])Enum.GetValues(typeof(Source));
            ValueList sourcesValueList = new ValueList();
            foreach (Source source in sources)
            {
                string resourceName = string.Format("Source_Text_{0}", source.ToString());
                sourcesValueList.ValueListItems.Add(source, Utilities.LocalizeString(resourceName));
            }
            sourceColumn.ValueList = sourcesValueList;
            #endregion // Source Column

            // Value Column
            // Show the value (inflow or outflow) for the current selected month.
            //
            #region Value Column
            // The key of the value column will vary depending on whether this is Inflow or Outflow
            // so get the key and store it here.
            string valueColumnKey = this.GetValueColumnKey();

            UltraGridColumn valueColumn = band.Columns[valueColumnKey];
            valueColumn.Header.VisiblePosition = 2;
            valueColumn.Header.Caption         = this.GetLocalizedGridHeaderCaption("value");
            valueColumn.Hidden = false;

            // Give this column a nice currently format.
            valueColumn.Format = "c0";
            #endregion // Value Column

            // LastMonth column
            // This column shows the value from last month and also a little indicator and a percentage
            // of how much we went up or down from the previous month.
            //
            #region LastMonth Column
            UltraGridColumn lastMonthColumn = CashflowDetails.GetOrCreateUnboundColumn(band, "last month", typeof(string), null);
            lastMonthColumn.Header.VisiblePosition = 3;
            lastMonthColumn.Header.Caption         = this.GetLocalizedGridHeaderCaption(lastMonthColumn.Key);
            lastMonthColumn.Hidden = false;
            #endregion // LastMonth Column

            // LastYear column
            // This column shows the value from last year and also a little indicator and a percentage
            // of how much we went up or down from the previous year.
            //
            #region LastYear Column
            UltraGridColumn lastYearColumn = CashflowDetails.GetOrCreateUnboundColumn(band, "last year", typeof(string), null);
            lastYearColumn.Header.VisiblePosition = 4;
            lastYearColumn.Header.Caption         = this.GetLocalizedGridHeaderCaption(lastYearColumn.Key);
            lastYearColumn.Hidden = false;
            #endregion // LastYear Column

            // Projected column
            // This column shows the project value (inflow or outflow) for the selected month and
            // also a little indicator and a percentage of how the actual value differs from the
            // projection
            //
            #region Projected column
            UltraGridColumn projectedColumn = CashflowDetails.GetOrCreateUnboundColumn(band, "projected", typeof(string), null);
            projectedColumn.Header.VisiblePosition = 5;
            projectedColumn.Header.Caption         = this.GetLocalizedGridHeaderCaption(projectedColumn.Key);
            projectedColumn.Hidden = false;
            #endregion // Projected column

            // Make the visible columns fill the available width of the grid.
            layout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;
        }
Ejemplo n.º 22
0
        public void LoadData()
        {
            UltraGridLayout layout = this.grdDetalleQuincena.DisplayLayout;
            UltraGridBand   band   = layout.Bands[0];

            try
            {
                this.LlenaDicMeses();

                if (this.DtDetalleComisiones == null)
                {
                    return;
                }

                this.Text = this.Title;

                try
                {
                    checkedColumns = FileUtils.Read("dictionary.bin");
                }
                catch
                {
                    checkedColumns = new Dictionary <string, string>();
                }

                try
                {
                    this.grdDetalleQuincena.DataSource = this.DtDetalleComisiones.AsEnumerable()
                                                         .AsParallel().Where(x => Convert.ToInt32(x["mes"]) == this.Mes &&
                                                                             this.Q == x["Q"].ToString().Trim() &&
                                                                             Convert.ToInt32(x["anio"]) == this.Año).OrderBy(x => x["es_servicio"]).ThenBy(x => x["factura"]).CopyToDataTable();

                    this.tcFacturasPagadas.TabPages["FacturasPagadas"].Text = "Facturas Pagadas [" +
                                                                              this.grdDetalleQuincena.Rows.Count + "]";
                }
                catch
                {
                    this.tcFacturasPagadas.TabPages["FacturasPagadas"].Text = "Facturas Pagadas [0]";
                }

                try
                {
                    this.grdFacturasCanceladas.DataSource = this.DtFacturasCanceladas.AsEnumerable()
                                                            .AsParallel().Where(x => this.dicMeses[x["mes"].ToString()] == this.Mes &&
                                                                                this.Q == x["Q"].ToString().Trim() &&
                                                                                Convert.ToInt32(x["anio"]) == this.Año).OrderBy(x => x["factura"]).CopyToDataTable();

                    this.tcComplemento.TabPages["FacturasCanceladas"].Text = "Facturas Canceladas [" +
                                                                             this.grdFacturasCanceladas.Rows.Count + "]";
                }
                catch
                {
                    this.tcComplemento.TabPages["FacturasCanceladas"].Text = "Facturas Canceladas [0]";
                }

                try
                {
                    this.grdFacturasPendientes.DataSource = this.DtFacturasPendientes.AsEnumerable()
                                                            .AsParallel().Where(x => this.dicMeses[x["mes"].ToString()] == this.Mes &&
                                                                                this.Q == x["Q"].ToString().Trim() &&
                                                                                Convert.ToInt32(x["anio"]) == this.Año).OrderBy(x => x["factura"]).CopyToDataTable();

                    this.tcComplemento.TabPages["FacturasPendientes"].Text = "Facturas Pendientes [" +
                                                                             this.grdFacturasPendientes.Rows.Count + "]";
                }
                catch
                {
                    this.tcComplemento.TabPages["FacturasPendientes"].Text = "Facturas Pendientes [0]";
                }

                foreach (string columName in this.DtDetalleComisiones.Columns.Cast <DataColumn>()
                         .Select(x => x.ColumnName))
                {
                    this.clbColumnas.Items.Add(columName);
                    this.columnIndexes.Add(columName, this.clbColumnas.Items.Count - 1);
                    if (checkedColumns.ContainsKey(columName))
                    {
                        this.clbColumnas.SetItemChecked(this.clbColumnas.Items.Count - 1,
                                                        checkedColumns[columName] == "1");
                        band.Columns[columName].Hidden = checkedColumns[columName] == "0";
                    }
                    else
                    {
                        this.checkedColumns.Add(columName, "1");
                        this.clbColumnas.SetItemChecked(this.clbColumnas.Items.Count - 1, true);
                    }
                }
            }
            catch (Exception ex) { ex.ToString(); }
        }
Ejemplo n.º 23
0
        private void grdDetalleQuincena_InitializeLayout(object sender, InitializeLayoutEventArgs e)
        {
            UltraGridLayout layout = e.Layout;
            UltraGridBand   band   = layout.Bands[0];

            e.Layout.Override.AllowUpdate       = DefaultableBoolean.False;
            e.Layout.Override.HeaderClickAction = HeaderClickAction.Select;

            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["fiscal"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["factura"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["factura_original"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Integer);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["importe"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["costo"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["utilidad"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["utilidad_comisionable"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["margen_utilidad"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Percentage);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["total_acumulado"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["acumulado_cuota"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["acumulado_comision"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["acumulado_comision_agente"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["total"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["total_pagado"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Currency);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["porcentaje_comision"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Percentage);
            WindowsFormsUtil.SetUltraColumnFormat(band.Columns["cuota"],
                                                  WindowsFormsUtil.TextMaskFormatEnum.Currency);

            Parallel.ForEach(this.grdDetalleQuincena.Rows, row =>
            {
                if (row.Cells["pendiente_pago"].Value.ToString() == "Si")
                {
                    row.CellAppearance.BackColor = Color.LightGreen;
                }

                decimal utilidad = Convert.ToDecimal(row.Cells["utilidad_comisionable"].Value);
                decimal utilidadComissionable = Convert.ToDecimal(row.Cells["utilidad_comisionable"].Value);

                if (utilidad - utilidadComissionable > 0.01M || utilidadComissionable <= 0)
                {
                    if (row.CellAppearance.BackColor == Color.LightGreen)
                    {
                        row.CellAppearance.BackColor = Color.YellowGreen;
                    }
                    else
                    {
                        row.CellAppearance.BackColor = Color.Yellow;
                    }
                }
            });
        }