Ejemplo n.º 1
0
 protected void gv_Calculos_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
 {
     if (e.Column.UniqueName == "en_blanco0")
     {
         GridDateTimeColumn boundColumn = e.Column as GridDateTimeColumn;
         //e.Column.ItemStyle.Width = Unit.Pixel(40);
         e.Column.ItemStyle.Width   = Unit.Percentage(40);
         e.Column.HeaderStyle.Width = Unit.Percentage(40);
         //e.Column.HeaderStyle.Width = Unit.Pixel(40);
     }
     if (e.Column.UniqueName == "en_blanco1")
     {
         GridDateTimeColumn boundColumn = e.Column as GridDateTimeColumn;
         e.Column.ItemStyle.Width   = Unit.Pixel(40);
         e.Column.HeaderStyle.Width = Unit.Pixel(40);
     }
     //if (e.Column.UniqueName == "Tipo")
     //{
     //    GridDateTimeColumn boundColumn = e.Column as GridDateTimeColumn;
     //}
     //else
     //{
     //    GridBoundColumn boundColumn = e.Column as GridBoundColumn;
     //    if (boundColumn != null && TipoReporte.Equals("04"))
     //    {
     //        boundColumn.DataFormatString = "{0:C}";
     //    }
     //    if (boundColumn != null && TipoReporte.Equals("05"))
     //    {
     //        boundColumn.DataFormatString = "{0:C}";
     //    }
     //}
 }
Ejemplo n.º 2
0
        public void MontaGrid_Procedimento()
        {
            try
            {
                ////<MasterTableView DataKeyNames="ProductID">
                objGrid.ID = "grdProcedimentos";
                objGrid.AutoGenerateColumns = false;
                objGrid.AllowPaging = true;
                objGrid.AllowSorting = true;
                objGrid.AllowFilteringByColumn = true;

                //objGrid.GridLines = "none";
                objGrid.Skin = "DorSkin";

                //Coluna TextoBox
                GridBoundColumn ColunaTexPRC01 = new GridBoundColumn();
                ColunaTexPRC01.DataField = "DSPRC";
                ColunaTexPRC01.HeaderText = "Descrição";

                objGrid.Columns.Add(ColunaTexPRC01);

                //Coluna DateTime
                GridDateTimeColumn ColunaDtaPRC01 = new GridDateTimeColumn();
                ColunaDtaPRC01.DataField = "DTPRC";
                ColunaDtaPRC01.HeaderText = "Data";

                objGrid.Columns.Add(ColunaDtaPRC01);

            }
            catch
            {

            }
        }
Ejemplo n.º 3
0
        public GridDateTimeColumn AddDateTimeColumn(string dataField, string headerText, bool isReadOnly)
        {
            GridDateTimeColumn c = new GridDateTimeColumn();

            _grid.MasterTableView.Columns.Add(c);
            c.PickerType = GridDateTimeColumnPickerType.DateTimePicker;
            //c.DataFormatString = CommonConst.DateTimeFormatString;
            //c.EditDataFormatString = CommonConst.DateTimeFormatString;
            SetBoundColumn(c, dataField, headerText, isReadOnly);
            return(c);
        }
        private void SetupDataGrid()
        {
            // For demonstration purposes, set the non-default values for the SFDataGrid
            sfDataGridSample.AddNewRowPosition         = RowPosition.Bottom;
            sfDataGridSample.AllowDeleting             = true;
            sfDataGridSample.AllowDraggingColumns      = true;
            sfDataGridSample.AllowGrouping             = false;
            sfDataGridSample.AllowResizingColumns      = true;
            sfDataGridSample.AllowSelectionOnMouseDown = true;
            sfDataGridSample.AutoGenerateColumns       = false;
            sfDataGridSample.EditMode = EditMode.SingleClick;
            sfDataGridSample.EditorSelectionBehavior = EditorSelectionBehavior.SelectAll;
            sfDataGridSample.SelectionUnit           = SelectionUnit.Cell;
            sfDataGridSample.ShowRowHeader           = true;
            sfDataGridSample.AutoSizeColumnsMode     = AutoSizeColumnsMode.Fill;
            sfDataGridSample.ValidationMode          = GridValidationMode.InEdit;

            // Setup our event handler
            sfDataGridSample.SelectionChanged += sfDataGridUpdate_SelectionChanged;

            // For demonstration purposes, set the non-default values for the columns
            GridDateTimeColumn col1 = (GridDateTimeColumn)sfDataGridSample.Columns["DateValue"];

            col1.CellStyle.HorizontalAlignment = HorizontalAlignment.Center;
            col1.Pattern             = DateTimePattern.ShortDate;
            col1.ShowDropDownButton  = false;
            col1.AllowDragging       = true;
            col1.ValidationMode      = GridValidationMode.InView;
            col1.DateTimeEditingMode = DateTimeEditingMode.Default;
            col1.AllowGrouping       = false;
            col1.AllowResizing       = true;

            GridDateTimeColumn col2 = (GridDateTimeColumn)sfDataGridSample.Columns["TimeValue"];

            col2.CellStyle.HorizontalAlignment = HorizontalAlignment.Center;
            col2.Pattern             = DateTimePattern.ShortTime;
            col2.ShowDropDownButton  = false;
            col2.AllowDragging       = true;
            col2.ValidationMode      = GridValidationMode.InView;
            col2.DateTimeEditingMode = DateTimeEditingMode.Default;
            col2.AllowGrouping       = false;
            col2.AllowResizing       = true;

            GridTextColumn col3 = (GridTextColumn)sfDataGridSample.Columns["StringValue"];

            col3.CellStyle.HorizontalAlignment = HorizontalAlignment.Left;
            col3.AllowDragging  = true;
            col3.ValidationMode = GridValidationMode.InEdit;
            col3.AllowGrouping  = false;
            col3.AllowResizing  = true;
        }
Ejemplo n.º 5
0
        public override View GetSampleContent(Context context)
        {
            sfGrid    = new SfDataGrid(context);
            viewmodel = new EditingViewModel();
            sfGrid.AutoGenerateColumns    = false;
            sfGrid.RowHeight              = 50;
            sfGrid.AllowEditing           = true;
            sfGrid.EditTapAction          = TapAction.OnTap;
            sfGrid.ColumnSizer            = ColumnSizer.Star;
            sfGrid.SelectionMode          = SelectionMode.Single;
            sfGrid.NavigationMode         = NavigationMode.Cell;
            sfGrid.HeaderRowHeight        = 40;
            sfGrid.ItemsSource            = viewmodel.DealerInformation;
            sfGrid.VerticalOverScrollMode = VerticalOverScrollMode.None;

            GridNumericColumn productPrice = new GridNumericColumn();

            productPrice.MappingName         = "ProductPrice";
            productPrice.HeaderText          = "Product Price";
            productPrice.HeaderTextAlignment = GravityFlags.Center;

            GridDateTimeColumn shippedDate = new GridDateTimeColumn();

            shippedDate.MappingName         = "ShippedDate";
            shippedDate.HeaderText          = "Shipped Date";
            shippedDate.HeaderTextAlignment = GravityFlags.Center;
            shippedDate.Format = "d";

            GridPickerColumn dealerName = new GridPickerColumn();

            dealerName.MappingName         = "DealerName";
            dealerName.HeaderText          = "Dealer Name";
            dealerName.ItemsSource         = viewmodel.CustomerNames;
            dealerName.HeaderTextAlignment = GravityFlags.Center;

            GridTextColumn productNo = new GridTextColumn();

            productNo.MappingName         = "ProductNo";
            productNo.HeaderText          = "Product No";
            productNo.HeaderTextAlignment = GravityFlags.Center;

            sfGrid.Columns.Add(productNo);
            sfGrid.Columns.Add(dealerName);
            sfGrid.Columns.Add(shippedDate);
            sfGrid.Columns.Add(productPrice);

            return(sfGrid);
        }
        public override void AttachProperties(GridColumn gridColumn)
        {
            base.AttachProperties(gridColumn);
            GridDateTimeColumn column = (GridDateTimeColumn)gridColumn;

            column.PickerType     = GridDateTimeColumnPickerType.TimePicker;
            column.AllowFiltering = false;
            if (TimeFormatString != null)
            {
                column.DataFormatString = TimeFormatString;
            }
            else
            {
                column.DataFormatString = UIConst.TimeFormatString;
            }
        }
Ejemplo n.º 7
0
        public Editing()
        {
            sfGrid    = new SfDataGrid();
            viewmodel = new EditingViewModel();
            sfGrid.AutoGenerateColumns = false;
            sfGrid.RowHeight           = 50;
            sfGrid.AllowEditing        = true;
            sfGrid.SelectionMode       = SelectionMode.Single;
            sfGrid.NavigationMode      = NavigationMode.Cell;
            sfGrid.EditTapAction       = TapAction.OnTap;
            sfGrid.ColumnSizer         = ColumnSizer.Star;
            sfGrid.HeaderRowHeight     = 40;
            sfGrid.ItemsSource         = viewmodel.DealerInformation;

            GridNumericColumn productPrice = new GridNumericColumn();

            productPrice.MappingName         = "ProductPrice";
            productPrice.HeaderText          = "Product Price";
            productPrice.HeaderTextAlignment = UIKit.UITextAlignment.Center;

            GridDateTimeColumn shippedDate = new GridDateTimeColumn();

            shippedDate.MappingName         = "ShippedDate";
            shippedDate.HeaderText          = "Shipped Date";
            shippedDate.Format              = "d";
            shippedDate.HeaderTextAlignment = UIKit.UITextAlignment.Center;

            GridPickerColumn dealerName = new GridPickerColumn();

            dealerName.MappingName         = "DealerName";
            dealerName.HeaderText          = "Dealer Name";
            dealerName.ItemsSource         = viewmodel.CustomerNames;
            dealerName.HeaderTextAlignment = UIKit.UITextAlignment.Center;

            GridTextColumn productNo = new GridTextColumn();

            productNo.MappingName         = "ProductNo";
            productNo.HeaderText          = "Product No";
            productNo.HeaderTextAlignment = UIKit.UITextAlignment.Center;

            sfGrid.Columns.Add(productNo);
            sfGrid.Columns.Add(dealerName);
            sfGrid.Columns.Add(shippedDate);
            sfGrid.Columns.Add(productPrice);
            this.AddSubview(sfGrid);
        }
Ejemplo n.º 8
0
        private GridColumn CreateSfColumn(Field field, int i)
        {
            GridColumn result;

            DataType t = field.SchemaType == SchemaType.Data
            ? ((DataField)field).DataType
            : DataType.String;

            if (t == DataType.Int32 ||
                t == DataType.Float ||
                t == DataType.Double ||
                t == DataType.Decimal)
            {
                result = new GridNumericColumn();
            }
            else if (t == DataType.DateTimeOffset)
            {
                result = new GridDateTimeColumn();
            }
            else if (t == DataType.Boolean)
            {
                result = new GridCheckBoxColumn();
            }
            else
            {
                result = new GridTextColumn()
                {
                    TextWrapping = TextWrapping.NoWrap
                };
            }

            result.MappingName    = $"[{i}]";
            result.HeaderText     = field.Name;
            result.AllowFiltering = false;
            result.AllowFocus     = true;
            result.AllowResizing  = true;
            result.AllowSorting   = true;
            result.FilterBehavior = FilterBehavior.StronglyTyped;
            result.AllowEditing   = true;

            return(result);
        }
        internal static string DateTimeFormatString(GridDateTimeColumn column, DateTime columnValue)
        {
            switch (column.pattern)
            {
            case DateTimePattern.ShortDate:
                return(columnValue.ToString("d", column.dateTimeFormat));

            case DateTimePattern.LongDate:
                return(columnValue.ToString("D", column.dateTimeFormat));

            case DateTimePattern.LongTime:
                return(columnValue.ToString("T", column.dateTimeFormat));

            case DateTimePattern.ShortTime:
                return(columnValue.ToString("t", column.dateTimeFormat));

            case DateTimePattern.FullDateTime:
                return(columnValue.ToString("F", column.dateTimeFormat));

            case DateTimePattern.RFC1123:
                return(columnValue.ToString("R", column.dateTimeFormat));

            case DateTimePattern.SortableDateTime:
                return(columnValue.ToString("s", column.dateTimeFormat));

            case DateTimePattern.UniversalSortableDateTime:
                return(columnValue.ToString("u", column.dateTimeFormat));

            case DateTimePattern.YearMonth:
                return(columnValue.ToString("Y", column.dateTimeFormat));

            case DateTimePattern.MonthDay:
                return(columnValue.ToString("M", column.dateTimeFormat));

            case DateTimePattern.CustomPattern:
                return(columnValue.ToString(column.customPattern, column.dateTimeFormat));

            default:
                return(columnValue.ToString("MMMM", column.dateTimeFormat));
            }
        }
Ejemplo n.º 10
0
        private GridColumn CreateSfColumn(Series s, int i)
        {
            GridColumn result;

            if (s.DataType == typeof(int) ||
                s.DataType == typeof(float) ||
                s.DataType == typeof(double) ||
                s.DataType == typeof(decimal))
            {
                result = new GridNumericColumn();
            }
            else if (s.DataType == typeof(DateTime) ||
                     s.DataType == typeof(DateTimeOffset))
            {
                result = new GridDateTimeColumn();
            }
            else if (s.DataType == typeof(bool))
            {
                result = new GridCheckBoxColumn();
            }
            else
            {
                result = new GridTextColumn();
            }

            result.MappingName    = $"[{i}]";
            result.HeaderText     = s.Name;
            result.AllowFiltering = false;
            result.AllowFocus     = true;
            result.AllowResizing  = true;
            result.AllowSorting   = true;
            result.FilterBehavior = FilterBehavior.StronglyTyped;
            result.AllowEditing   = true;

            result.ShowToolTip = false;

            result.ShowHeaderToolTip     = true;
            result.HeaderToolTipTemplate = _headerTooltipTemplate;

            return(result);
        }
        public Form1()
        {
            InitializeComponent();

            this.sfDataGrid.AutoGenerateColumns = false;
            this.sfDataGrid.DataSource          = new ViewModel().Orders;
            this.sfDataGrid.LiveDataUpdateMode  = LiveDataUpdateMode.AllowDataShaping;

            GridNumericColumn gridTextColumn1 = new GridNumericColumn()
            {
                MappingName = "OrderID", HeaderText = "Order ID"
            };
            GridTextColumn gridTextColumn2 = new GridTextColumn()
            {
                MappingName = "CustomerID", HeaderText = "Customer ID"
            };
            GridTextColumn gridTextColumn3 = new GridTextColumn()
            {
                MappingName = "CustomerName", HeaderText = "Customer Name"
            };
            GridTextColumn gridTextColumn4 = new GridTextColumn()
            {
                MappingName = "Country", HeaderText = "Country"
            };
            GridDateTimeColumn gridDateTimeColumn = new GridDateTimeColumn()
            {
                MappingName = "Date", Width = 130, HeaderText = "Date", Pattern = Syncfusion.WinForms.Input.Enums.DateTimePattern.Custom, Format = "MM/dd/yyyy hh:mm"
            };

            this.sfDataGrid.Columns.Add(gridDateTimeColumn);
            this.sfDataGrid.Columns.Add(gridTextColumn1);
            this.sfDataGrid.Columns.Add(gridTextColumn2);
            this.sfDataGrid.Columns.Add(gridTextColumn3);
            this.sfDataGrid.Columns.Add(gridTextColumn4);

            this.sfDataGrid.CellRenderers.Remove("DateTime");
            this.sfDataGrid.CellRenderers.Add("DateTime", new GridDateTimeCellRendererExt());
        }
        private GridColumn CreateSfColumn(SchemaElement se, int i)
        {
            GridColumn result;

            if (se.ElementType == typeof(int) ||
                se.ElementType == typeof(float) ||
                se.ElementType == typeof(double) ||
                se.ElementType == typeof(decimal))
            {
                result = new GridNumericColumn();
            }
            else if (se.ElementType == typeof(DateTime) ||
                     se.ElementType == typeof(DateTimeOffset))
            {
                result = new GridDateTimeColumn();
            }
            else if (se.ElementType == typeof(bool))
            {
                result = new GridCheckBoxColumn();
            }
            else
            {
                result = new GridTextColumn();
            }

            result.MappingName    = $"[{i}]";
            result.HeaderText     = se.Name;
            result.AllowFiltering = false;
            result.AllowFocus     = true;
            result.AllowResizing  = true;
            result.AllowSorting   = true;
            result.FilterBehavior = FilterBehavior.StronglyTyped;
            result.AllowEditing   = true;

            return(result);
        }
        public override GridColumn CreateColumn()
        {
            GridDateTimeColumn column = new GridDateTimeColumn();

            return(column);
        }
Ejemplo n.º 14
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {

                GridEditCommandColumn GEC = new GridEditCommandColumn();
                this.RadGrid1.MasterTableView.Columns.Add(GEC);
                GEC.UniqueName = "EditCommandColumn";
                GEC.ButtonType = GridButtonColumnType.ImageButton;
                GEC.ItemStyle.Width = 20;
                GEC.OrderIndex = 0;

                GridButtonColumn GBC = new GridButtonColumn();
                this.RadGrid1.MasterTableView.Columns.Add(GBC);
                GBC.CommandName = "Delete";
                GBC.Text = "Delete";
                GBC.ItemStyle.Width = 20;
                GBC.ButtonType = GridButtonColumnType.ImageButton;

                BLL.CustomFilteringColumn gridColumn2 = new BLL.CustomFilteringColumn();
                this.RadGrid1.MasterTableView.Columns.Add(gridColumn2);
                gridColumn2.DataField = "FirstName";
                gridColumn2.HeaderText = "First Name";
                gridColumn2.ItemStyle.CssClass = "UseHand";

                BLL.CustomFilteringColumn gridColumn3 = new BLL.CustomFilteringColumn();
                this.RadGrid1.MasterTableView.Columns.Add(gridColumn3);
                gridColumn3.DataField = "LastName";
                gridColumn3.HeaderText = "Last Name";

                BLL.CustomFilteringColumn gridColumn4 = new BLL.CustomFilteringColumn();
                this.RadGrid1.MasterTableView.Columns.Add(gridColumn4);
                gridColumn4.DataField = "Email";
                gridColumn4.HeaderText = "Email";
                gridColumn4.ItemStyle.Width = 400;

                GridDateTimeColumn gridColumn5 = new GridDateTimeColumn();
                this.RadGrid1.MasterTableView.Columns.Add(gridColumn5);
                gridColumn5.DataField = "Birthday";
                gridColumn5.HeaderText = "Birthday";
                gridColumn5.ItemStyle.Width = 200;
                gridColumn5.AllowFiltering = false;

                GridCheckBoxColumn gridColumn6 = new GridCheckBoxColumn();
                this.RadGrid1.MasterTableView.Columns.Add(gridColumn6);
                gridColumn6.DataField = "IsLockedOut";
                gridColumn6.HeaderText = "Locked Out";
                gridColumn6.AllowFiltering = false;

                //BLL.CustomFilteringColumn gridColumn7 = new BLL.CustomFilteringColumn();
                //this.RadGrid1.MasterTableView.Columns.Add(gridColumn7);
                //gridColumn7.DataField = "Gender";
                //gridColumn7.HeaderText = "Gender";
                //gridColumn7.AllowFiltering = false;

                //RadComboBox gridColumn7 = new RadComboBox();
                //this.RadGrid1.MasterTableView.Columns.Add(gridColumn7);

                //gridColumn7.Items[0].Text = "Male";
                //gridColumn7.Items[0].Value = "Male";

                //gridColumn7.Items[1].Text = "Female";
                //gridColumn7.Items[1].Value = "Female";

            }
        }
Ejemplo n.º 15
0
        private void setupGridColumns(DataSet DS, CswNbtView View)
        {
            _Grid.Columns.Clear();

            // Edit column
            GridBoundColumn EditColumn = new GridBoundColumn();

            EditColumn.UniqueName = "EditColumn";
            EditColumn.HeaderText = "Edit";
            EditColumn.DataField  = "Edit";
            EditColumn.Display    = ShowActionColumns;
            _Grid.Columns.Add(EditColumn);

            // Node column
            GridBoundColumn NodeNameColumn = new GridBoundColumn();

            NodeNameColumn.UniqueName = "NodeName";
            NodeNameColumn.HeaderText = "Node Name";
            NodeNameColumn.DataField  = "NodeName";
            // BZ 6704
            NodeNameColumn.Visible = false;
            NodeNameColumn.Display = false;
            _Grid.Columns.Add(NodeNameColumn);

            // NodeKey column
            GridBoundColumn NodeKeyColumn = new GridBoundColumn();

            NodeKeyColumn.UniqueName = "NodeKey";
            NodeKeyColumn.HeaderText = "NodeKey";
            NodeKeyColumn.DataField  = "NodeKey";
            NodeKeyColumn.Display    = false;
            _Grid.Columns.Add(NodeKeyColumn);

            foreach (DataTable Table in DS.Tables)
            {
                foreach (DataColumn Column in Table.Columns)
                {
                    string ColumnName = Column.ColumnName;
                    if (ColumnName.Length > PropColumnPrefix.Length && ColumnName.Substring(0, PropColumnPrefix.Length) == PropColumnPrefix)
                    {
                        string NoPrefixColumnName = ColumnName.Substring(PropColumnPrefix.Length);
                        //Int32 CurrentNodeTypePropId = CswConvert.ToInt32( NoPrefixColumnName.Substring( 0, NoPrefixColumnName.IndexOf( '_' ) ) );
                        string RealColumnName = CswTools.XmlRealAttributeName(NoPrefixColumnName);   //.Substring( NoPrefixColumnName.IndexOf( '_' ) + 1 ) );
                        //CswNbtMetaDataNodeTypeProp CurrentNodeTypeProp = _CswNbtResources.MetaData.getNodeTypeProp( CurrentNodeTypePropId );
                        //CswNbtViewProperty CurrentViewProp = View.FindPropertyById( CswNbtPropType.NodeTypePropId, CurrentNodeTypePropId );
                        CswNbtViewProperty CurrentViewProp = View.findPropertyByName(RealColumnName);
                        //if( CurrentViewProp == null )
                        //    CurrentViewProp = View.FindPropertyByName( CurrentNodeTypeProp.PropName );
                        CswEnumNbtFieldType ColFieldType = CswNbtResources.UnknownEnum;
                        if (CurrentViewProp != null)
                        {
                            if (((CswNbtViewRelationship)CurrentViewProp.Parent).SecondType == CswEnumNbtViewRelatedIdType.NodeTypeId)
                            {
                                CswNbtMetaDataNodeType     CurrentNT  = _CswNbtResources.MetaData.getNodeType(((CswNbtViewRelationship)CurrentViewProp.Parent).SecondId);
                                CswNbtMetaDataNodeTypeProp CurrentNTP = CurrentNT.getNodeTypeProp(RealColumnName);
                                if (CurrentNTP != null)
                                {
                                    ColFieldType = CurrentNTP.getFieldTypeValue();
                                }
                            }
                            else if (((CswNbtViewRelationship)CurrentViewProp.Parent).SecondType == CswEnumNbtViewRelatedIdType.ObjectClassId)
                            {
                                CswNbtMetaDataObjectClass CurrentOC = _CswNbtResources.MetaData.getObjectClass(((CswNbtViewRelationship)CurrentViewProp.Parent).SecondId);
                                foreach (CswNbtMetaDataNodeType CurrentNT in CurrentOC.getNodeTypes())
                                {
                                    CswNbtMetaDataNodeTypeProp CurrentNTP = CurrentNT.getNodeTypeProp(RealColumnName);
                                    if (CurrentNTP != null)
                                    {
                                        ColFieldType = CurrentNTP.getFieldTypeValue();
                                    }
                                }
                            }
                        }

                        GridBoundColumn thisColumn = null;
                        //switch( CurrentNodeTypeProp.FieldType.FieldType )
                        switch (ColFieldType)
                        {
                        case CswEnumNbtFieldType.DateTime:
                            thisColumn = new GridDateTimeColumn();
                            thisColumn.DataFormatString = "{0:M/d/yyyy}";
                            thisColumn.DataType         = typeof(DateTime);
                            break;

                        //case CswEnumNbtFieldType.Time:
                        //    thisColumn = new GridDateTimeColumn();
                        //    thisColumn.DataFormatString = "{0:H:mm:ss}";
                        //    thisColumn.DataType = typeof( DateTime );
                        //    break;
                        default:
                            thisColumn = new GridBoundColumn();
                            break;
                        }
                        thisColumn.UniqueName = ColumnName;
                        thisColumn.HeaderText = RealColumnName;
                        thisColumn.DataField  = ColumnName;
                        if (CurrentViewProp != null && CurrentViewProp.Width != Int32.MinValue)
                        {
                            thisColumn.HeaderStyle.Width = Unit.Parse((CswConvert.ToInt32(CurrentViewProp.Width * 7)).ToString() + "px");        // average pixel width per character
                        }
                        //thisColumn.OrderIndex = CurrentViewProp.Order;
                        //Telerik.Web.UI.GridTableView GTV = new GridTableView( _Grid );
                        if (CurrentViewProp != null && CurrentViewProp.Order > 0 && _Grid.Columns.Count >= CurrentViewProp.Order)
                        {
                            _Grid.Columns.AddAt(CurrentViewProp.Order, thisColumn);
                        }
                        else
                        {
                            _Grid.Columns.Add(thisColumn);
                        }
                    }
                }
            }

            // Delete column
            GridBoundColumn DeleteColumn = new GridBoundColumn();

            DeleteColumn.UniqueName = "DeleteColumn";
            DeleteColumn.HeaderText = "Delete";
            DeleteColumn.DataField  = "Delete";
            DeleteColumn.Display    = ShowActionColumns;
            _Grid.Columns.Add(DeleteColumn);
        } // setupGridColumns()
    private void CreateColumns(Report report)
    {
        DataTable table = new DataTable();

        using (SqlCommand command = new SqlCommand())
        {
            command.CommandText = report.GetSqlOld(true, filterControl.ReportConditions);
            command.CommandType = CommandType.Text;
            Report.CreateParameters(UserSession.LoginUser, command, UserSession.LoginUser.UserID);

            using (SqlConnection connection = new SqlConnection(GetReportConnectionString()))
            {
                connection.Open();
                command.Connection = connection;
                using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                {
                    adapter.FillSchema(table, SchemaType.Source);
                    adapter.Fill(table);
                }
                connection.Close();
            }
        }

        ReportFields fields = new ReportFields(UserSession.LoginUser);

        fields.LoadByReportID(_reportID);
        foreach (ReportField field in fields)
        {
            if (field.IsCustomField == false && (field.LinkedFieldID == 30 || field.LinkedFieldID == 146))
            {
                GridButtonColumn column = new GridButtonColumn();
                gridReport.MasterTableView.Columns.Add(column);
                column.ButtonType        = GridButtonColumnType.ImageButton;
                column.ImageUrl          = "../images/icons/open.png";
                column.UniqueName        = "ButtonOpen";
                column.CommandName       = "OpenItem";
                column.HeaderStyle.Width = new Unit(32, UnitType.Pixel);
                column.Resizable         = false;
                break;
            }
        }

        if (fields.IsEmpty)
        {
            if (table.Columns.Contains("Ticket_Number"))
            {
                GridButtonColumn column = new GridButtonColumn();
                gridReport.MasterTableView.Columns.Add(column);
                column.ButtonType        = GridButtonColumnType.ImageButton;
                column.ImageUrl          = "../images/icons/open.png";
                column.UniqueName        = "ButtonOpen";
                column.CommandName       = "OpenItem";
                column.HeaderStyle.Width = new Unit(32, UnitType.Pixel);
                column.Resizable         = false;
            }
        }



        foreach (DataColumn dataColumn in table.Columns)
        {
            GridBoundColumn gridColumn;
            if (dataColumn.DataType == typeof(System.DateTime))
            {
                gridColumn = new GridDateTimeColumn();
                gridColumn.DataFormatString = "{0:MM/dd/yyyy hh:mm tt}";
            }
            else if (dataColumn.DataType == typeof(System.Decimal) ||
                     dataColumn.DataType == typeof(System.Double)
                     )
            {
                gridColumn = new GridNumericColumn();
                gridColumn.DataFormatString = "{0:0.00}";
            }
            else if (dataColumn.DataType == typeof(System.Int16) ||
                     dataColumn.DataType == typeof(System.Int32) ||
                     dataColumn.DataType == typeof(System.Int64))
            {
                gridColumn = new GridNumericColumn();
                gridColumn.DataFormatString = "{0:0}";
            }
            else
            {
                gridColumn = new GridBoundColumn();
            }


            gridReport.MasterTableView.Columns.Add(gridColumn);
            gridColumn.DataType          = dataColumn.DataType;
            gridColumn.DataField         = dataColumn.ColumnName.Replace(' ', '_');
            gridColumn.UniqueName        = gridColumn.DataField;
            gridColumn.HeaderText        = dataColumn.ColumnName.Replace('_', ' ');
            gridColumn.HeaderStyle.Width = new Unit(200, UnitType.Pixel);
        }
    }
Ejemplo n.º 17
0
        public static void GenerateColumnsSfDataGrid(SfDataGrid dataGrid, DataTable table, string prefab)
        {
            using (var conn = new SqlConnection(App.ConnectionString))
            {
                conn.Open();
                if (!string.IsNullOrEmpty(prefab))
                {
                    DataTable prefabTable = App.GetPrefabDataTable(conn, $"{Settings.Default.Schema}_PREFABS", prefab);
                    DataTable comboTable  =
                        App.GetPrefabDataTable(conn, $"{Settings.Default.Schema}_COMBOBOXES", prefab);

                    //could loop by table.ColumnNames.Count; but if prebab is changed... problems; maybe not all columns showing
                    for (var i = 0; i < table.Columns.Count; i++)
                    {
                        GridColumn column;

                        try
                        {
                            if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("autocomplete"))
                            {
                                column = new GridTemplateColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                var comboStrings = new HashSet <string>();
                                for (var j = 0; j < comboTable.Rows.Count; j++)
                                {
                                    if (!string.IsNullOrEmpty(
                                            comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()].ToString()))
                                    {
                                        comboStrings.Add(comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()]
                                                         .ToString());
                                    }
                                }

                                var autoCompleteElem = new FrameworkElementFactory(typeof(AutoComplete));

                                var autoCompleteItemsBind = new Binding
                                {
                                    Source = comboStrings,
                                    UpdateSourceTrigger   = UpdateSourceTrigger.PropertyChanged,
                                    BindsDirectlyToSource = true
                                };

                                var autoCompleteBind =
                                    new Binding(table.Columns[i].ColumnName)
                                {
                                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                                    Mode = BindingMode.TwoWay,
                                    BindsDirectlyToSource = true
                                };

                                autoCompleteElem.SetValue(UIElement.FocusableProperty, true);
                                autoCompleteElem.SetValue(AutoComplete.IsDropDownOpenProperty, true);
                                autoCompleteElem.SetValue(ItemsControl.IsTextSearchEnabledProperty, true);
                                autoCompleteElem.SetValue(AutoComplete.IsAutoAppendProperty, true);
                                autoCompleteElem.SetValue(ItemsControl.IsTextSearchCaseSensitiveProperty, false);
                                autoCompleteElem.SetValue(AutoComplete.CustomSourceProperty, autoCompleteItemsBind);
                                autoCompleteElem.SetValue(AutoComplete.TextProperty, autoCompleteBind);
                                autoCompleteElem.SetValue(AutoComplete.CanResizePopupProperty, false);
                                //autoCompleteElem.SetValue(AutoComplete.IsFilterProperty, true);
                                autoCompleteElem.SetValue(AutoComplete.EnableSortingProperty, false);

                                var cellEditingTemplate =
                                    new DataTemplate(typeof(AutoComplete))
                                {
                                    VisualTree = autoCompleteElem
                                };
                                ((GridTemplateColumn)column).EditTemplate = cellEditingTemplate;

                                var defaultElement = new FrameworkElementFactory(typeof(TextBlock));

                                var bind = new Binding(table.Columns[i].ColumnName)
                                {
                                    UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                                    Mode = BindingMode.TwoWay,
                                    BindsDirectlyToSource = true
                                };

                                defaultElement.SetValue(TextBlock.TextProperty, bind);
                                defaultElement.SetValue(FrameworkElement.VerticalAlignmentProperty,
                                                        VerticalAlignment.Center);

                                var defaultTemplate = new DataTemplate(typeof(TextBlock))
                                {
                                    VisualTree = defaultElement
                                };
                                ((GridTemplateColumn)column).CellTemplate = defaultTemplate;

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("datepicker"))
                            {
                                column = new GridDateTimeColumn
                                {
                                    MappingName            = table.Columns[i].ColumnName,
                                    Pattern                = DateTimePattern.ShortDate,
                                    CanEdit                = true,
                                    AllowNullValue         = true,
                                    NullText               = string.Empty,
                                    AllowScrollingOnCircle = true,
                                    EnableBackspaceKey     = true,
                                    EnableDeleteKey        = true,
                                    ShowRepeatButton       = true,
                                    HeaderText             = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("checkbox"))
                            {
                                column = new GridCheckBoxColumn
                                {
                                    MappingName  = table.Columns[i].ColumnName,
                                    IsThreeState = false,
                                    HeaderText   = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("numeric"))
                            {
                                column = new GridNumericColumn
                                {
                                    MappingName          = table.Columns[i].ColumnName,
                                    HeaderText           = prefabTable.Rows[i]["COLUMNS"].ToString(),
                                    NumberDecimalDigits  = 3,
                                    NumberGroupSeparator = ","
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("currency"))
                            {
                                column = new GridCurrencyColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("hyperlink"))
                            {
                                column = new GridHyperlinkColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("percentage"))
                            {
                                column = new GridPercentColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("combobox"))
                            {
                                var comboStrings = new HashSet <string>();
                                for (var j = 0; j < comboTable.Rows.Count; j++)
                                {
                                    if (!string.IsNullOrEmpty(
                                            comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()].ToString()))
                                    {
                                        comboStrings.Add(comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()]
                                                         .ToString());
                                    }
                                }

                                column = new GridComboBoxColumn
                                {
                                    MappingName     = table.Columns[i].ColumnName,
                                    ItemsSource     = comboStrings,
                                    StaysOpenOnEdit = true,
                                    IsEditable      = true,
                                    HeaderText      = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else
                            {
                                column = new GridTextColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                        }
                        catch
                        {
                            column = new GridTextColumn
                            {
                                MappingName = table.Columns[i].ColumnName,
                                HeaderText  = table.Columns[i].ColumnName
                            };

                            dataGrid.Columns.Add(column);
                        }
                    }
                }
                else
                {
                    foreach (DataColumn column in table.Columns)
                    {
                        GridColumn gridColumn = new GridTextColumn
                        {
                            MappingName = column.ColumnName,
                            HeaderText  = column.ColumnName
                        };

                        dataGrid.Columns.Add(gridColumn);
                    }
                }

                conn.Close();
            }
        }
Ejemplo n.º 18
0
        public static void GenerateColumnsSfDataGrid(SfDataGrid dataGrid, DataTable table, string prefab)
        {
            using (var conn = new SqlConnection(App.ConnectionString))
            {
                conn.Open();
                if (!string.IsNullOrEmpty(prefab))
                {
                    DataTable prefabTable = App.GetPrefabDataTable(conn, $"{App.Settings["Schema"]}_PREFABS", prefab);
                    DataTable comboTable  =
                        App.GetPrefabDataTable(conn, $"{App.Settings["Schema"]}_COMBOBOXES", prefab);

                    //could loop by table.ColumnNames.Count; but if prebab is changed... problems; maybe not all columns showing
                    for (var i = 0; i < table.Columns.Count; i++)
                    {
                        GridColumn column;

                        try
                        {
                            if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("autocomplete"))
                            {
                                var comboStrings = new HashSet <string>();
                                for (var j = 0; j < comboTable.Rows.Count; j++)
                                {
                                    if (!string.IsNullOrEmpty(
                                            comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()].ToString()))
                                    {
                                        comboStrings.Add(comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()]
                                                         .ToString());
                                    }
                                }

                                StringBuilder sb1 = new StringBuilder();
                                sb1.AppendLine(
                                    "<DataTemplate xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\">");
                                sb1.AppendLine("<ComboBox PlaceholderText=\"{Binding " + prefabTable.Rows[i]["COLUMNS"] +
                                               ", Mode=TwoWay}\" IsEditable=\"True\" IsTextSearchEnabled=\"True\" IsDropDownOpen=\"True\" >");
                                foreach (var comboString in comboStrings)
                                {
                                    sb1.AppendLine($"<x:String>{comboString}</x:String>");
                                }
                                sb1.AppendLine("</ComboBox>");
                                sb1.AppendLine("</DataTemplate>");
                                DataTemplate cellTemplate = (DataTemplate)XamlReader.Load(sb1.ToString());
                                column = new GridTemplateColumn
                                {
                                    MappingName  = table.Columns[i].ColumnName,
                                    HeaderText   = prefabTable.Rows[i]["COLUMNS"].ToString(),
                                    EditTemplate = cellTemplate
                                };
                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("datepicker"))
                            {
                                column = new GridDateTimeColumn
                                {
                                    MappingName        = table.Columns[i].ColumnName,
                                    FormatString       = "MM/dd/yyyy",
                                    AllowInlineEditing = true,
                                    AllowNullValue     = true,
                                    HeaderText         = prefabTable.Rows[i]["COLUMNS"].ToString(),
                                    WaterMark          = string.Empty
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("checkbox"))
                            {
                                column = new GridCheckBoxColumn
                                {
                                    MappingName  = table.Columns[i].ColumnName,
                                    IsThreeState = false,
                                    HeaderText   = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("numeric"))
                            {
                                column = new GridNumericColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString(),
                                    MaximumNumberDecimalDigits = 3
                                };

                                dataGrid.Columns.Add(column);
                            }                            /*
                                                          * else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("currency"))
                                                          * {
                                                          *     column = new GridCurrencyColumn
                                                          *     {
                                                          *             MappingName = table.Columns[i].ColumnName,
                                                          *             HeaderText = prefabTable.Rows[i]["COLUMNS"].ToString()
                                                          *     };
                                                          *
                                                          *     dataGrid.Columns.Add(column);
                                                          * }*/
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("hyperlink"))
                            {
                                column = new GridHyperlinkColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }                            /*
                                                          * else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("percentage"))
                                                          * {
                                                          *     column = new GridPercentColumn
                                                          *     {
                                                          *             MappingName = table.Columns[i].ColumnName,
                                                          *             HeaderText = prefabTable.Rows[i]["COLUMNS"].ToString()
                                                          *     };
                                                          *
                                                          *     dataGrid.Columns.Add(column);
                                                          * }*/
                            else if (prefabTable.Rows[i]["TYPES"].ToString().ToLower().Equals("combobox"))
                            {
                                var comboStrings = new HashSet <string>();
                                for (var j = 0; j < comboTable.Rows.Count; j++)
                                {
                                    if (!string.IsNullOrEmpty(
                                            comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()].ToString()))
                                    {
                                        comboStrings.Add(comboTable.Rows[j][prefabTable.Rows[i]["COLUMNS"].ToString()]
                                                         .ToString());
                                    }
                                }

                                column = new GridComboBoxColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    ItemsSource = comboStrings,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }
                            else
                            {
                                column = new GridTextColumn
                                {
                                    MappingName = table.Columns[i].ColumnName,
                                    HeaderText  = prefabTable.Rows[i]["COLUMNS"].ToString()
                                };

                                dataGrid.Columns.Add(column);
                            }                             //TODO: More? CalendarDatePicker, TimePicker, DatePicker, Slider, ToggleSwitch, RichEditBox, PasswordBox, ColorPicker, ComboBox, RatingControl
                        }
                        catch
                        {
                            column = new GridTextColumn
                            {
                                MappingName = table.Columns[i].ColumnName,
                                HeaderText  = table.Columns[i].ColumnName
                            };

                            dataGrid.Columns.Add(column);
                        }
                    }
                }
                else
                {
                    foreach (DataColumn column in table.Columns)
                    {
                        GridColumn gridColumn = new GridTextColumn
                        {
                            MappingName = column.ColumnName,
                            HeaderText  = column.ColumnName
                        };

                        dataGrid.Columns.Add(gridColumn);
                    }
                }

                conn.Close();
            }
        }
Ejemplo n.º 19
0
        protected void gv_presencia_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
        {
            if (e.Column.UniqueName == "nodocomercial")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
                //boundColumn.DataFormatString = "{0:d}";
            }
            else if (e.Column.UniqueName == "Ciudad")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Mercaderista")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Supervisoras")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Direccion")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Distrito")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Dni/Ruc")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Telefono")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Distribuidora")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "CodDistrib")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "opreport")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "id_mercaderista")
            {
                e.Column.Visible = false;
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "PDV_Client")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Total Dis")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "% Distb")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "% Distb  ")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "01 A 07 SKUs")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "08 A 13 SKUs")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "14 A 17 SKUs")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "18 A Más SKUs")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "18 A 20 SKUs ")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Mercado")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Cliente")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "createby")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "dateby")
            {
                GridDateTimeColumn boundColumn = e.Column as GridDateTimeColumn;
                boundColumn.ReadOnly = true;
                if (boundColumn != null)
                {
                    boundColumn.DataFormatString = "{0:dd/MM/yy}";
                }
            }
            else if (e.Column.UniqueName == "modiby")
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "datemodiby")
            {
                GridDateTimeColumn boundColumn = e.Column as GridDateTimeColumn;
                boundColumn.ReadOnly = true;
                if (boundColumn != null)
                {
                    boundColumn.DataFormatString = "{0:dd/MM/yy}";
                }
            }
            else if (e.Column.UniqueName == "validado")
            {
                e.Column.Visible = false;
                GridCheckBoxColumn boundColumn = e.Column as GridCheckBoxColumn;
                boundColumn.ReadOnly = true;
            }
            else if (e.Column.UniqueName == "Fecha")
            {
                GridDateTimeColumn boundColumn = e.Column as GridDateTimeColumn;
                if (boundColumn != null)
                {
                    boundColumn.DataFormatString = "{0:dd/MM/yy}";
                }
            }
            else
            {
                GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                if (boundColumn != null && TipoReporte.Equals("04"))
                {
                    boundColumn.DataFormatString = "{0:C}";
                }

                if (boundColumn != null && TipoReporte.Equals("05"))
                {
                    boundColumn.DataFormatString = "{0:C}";
                }
                //boundColumn.DataFormatString = "{0:S/.####.##}";
            }
            #region Presencia_Colgate
            if (TipoReporte.Equals("04") || TipoReporte.Equals("0"))
            {
                if (e.Column.UniqueName == "nodocomercial_Calc")
                {
                    e.Column.Visible = false;
                    GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                    boundColumn.ReadOnly = true;
                }
                else if (e.Column.UniqueName == "PDV_Client_Calc")
                {
                    e.Column.Visible = false;
                    GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                    boundColumn.ReadOnly = true;
                }
                else if (e.Column.UniqueName == "fec_reg_cel_Calc")
                {
                    e.Column.Visible = false;
                    GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                    boundColumn.ReadOnly = true;
                }
                else if (e.Column.UniqueName == "id_mercaderista_Calc")
                {
                    e.Column.Visible = false;
                    GridBoundColumn boundColumn = e.Column as GridBoundColumn;
                    boundColumn.ReadOnly = true;
                }
            }
            #endregion
            //else if (e.Column.UniqueName == "createby")
            //{
            //    e.Column.OrderIndex = 1;
            //}
            //else if (e.Column.UniqueName == "Colgate Ultra 12 x 14")
            //{
            //    GridBoundColumn colTelephone =
            //     gv_presencia.Columns.FindByUniqueName("Colgate Ultra 12 x 14") as GridBoundColumn;
            //    colTelephone.DataFormatString = "{0:$####.##}";
            //}

            //else if (e.Column.UniqueName == "createby")
            //{

            //    "{0:$####.##}"
            //}
            ////DataFormatString="{0:C}"
        }