Esempio n. 1
0
        private void OnCustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
        {
            GridView view = sender as GridView;

            if (view.OptionsFind.HighlightFindResults && !view.FindFilterText.Equals(string.Empty))
            {
                CriteriaOperator op = ConvertFindPanelTextToCriteriaOperator(view.FindFilterText, view, false);
                if (op is GroupOperator)
                {
                    string findText = view.FindFilterText;
                    if (HiglightSubString(e, findText))
                    {
                        e.Handled = true;
                    }
                }
                else if (op is FunctionOperator)
                {
                    FunctionOperator func            = op as FunctionOperator;
                    CriteriaOperator colNameOperator = func.Operands[0];
                    string           colName         = colNameOperator.LegacyToString().Replace("[", string.Empty).Replace("]", string.Empty);
                    if (!e.Column.FieldName.StartsWith(colName))
                    {
                        return;
                    }

                    CriteriaOperator valueOperator = func.Operands[1];
                    string           findText      = valueOperator.LegacyToString().ToLower().Replace("'", "");
                    if (HiglightSubString(e, findText))
                    {
                        e.Handled = true;
                    }
                }
            }
        }
    protected void Grid_ProcessColumnAutoFilter(object sender, ASPxGridViewAutoFilterEventArgs e)
    {
        if (e.Column.FieldName == "Numbers")
        {
            switch (e.Kind)
            {
            case GridViewAutoFilterEventKind.CreateCriteria:
                CriteriaOperator co = CriteriaOperator.Parse(Grid.FilterExpression);
                if (co is GroupOperator)
                {
                    GroupOperator    go      = co as GroupOperator;
                    CriteriaOperator operand = go.Operands.Find(op => op.LegacyToString().Contains("MyNewFunction"));
                    if (operand is CriteriaOperator)
                    {
                        go.Operands.Remove(operand);
                    }
                    Grid.FilterExpression = go.LegacyToString();
                }
                else if (co is CriteriaOperator)
                {
                    string filter = co.LegacyToString();
                    if (filter.Contains("MyNewFunction"))
                    {
                        Grid.FilterExpression = string.Empty;
                    }
                }
                if (e.Value.Contains('-'))
                {
                    CriteriaOperator cop = new FunctionOperator(FunctionOperatorType.Custom, "MyNewFunction", e.Value, new OperandProperty("Numbers"));
                    e.Criteria = cop;
                }
                break;

            case GridViewAutoFilterEventKind.ExtractDisplayText:
            default:
                break;
            }
        }
    }
Esempio n. 3
0
        private void SetFilter()
        {
            GridView         gridView    = (GridView)_listView.ObjectGridView;
            CriteriaOperator queryFilter = _queryFilter;

            if ((object)queryFilter != null && (object)_objectTypeFilter != null)
            {
                queryFilter &= _objectTypeFilter;
            }
            else if ((object)_objectTypeFilter != null)
            {
                queryFilter = _objectTypeFilter;
            }
            if ((object)queryFilter != null)
            {
                gridView.ActiveFilterString = queryFilter.LegacyToString();
            }
            else
            {
                gridView.ActiveFilterString = string.Empty;
            }
        }
Esempio n. 4
0
        private void TreeListView_CustomNodeFilter(object sender, DevExpress.Xpf.Grid.TreeList.TreeListNodeFilterEventArgs e)
        {
            #region 方法一
            var view = (TreeListView)sender;
            if (string.IsNullOrEmpty(view.SearchString))
            {
                return;
            }

            if (e.Node.HasChildren)
            {
                SearchControl searchControl  = view.SearchControl;
                string        criteriaString = CriteriaOperator.LegacyToString(searchControl.FilterCriteria).Replace("DxFts_", "");
                var           ee             = new ExpressionEvaluator(TypeDescriptor.GetProperties(typeof(Employee)), criteriaString, false);

                e.Visible = ee.Fit(e.Node.Content) || new TreeListNodeIterator(e.Node).Select(x => x.Content).Any(ee.Fit);
                e.Handled = true;
            }
            #endregion


            #region 方法二(有缺陷)
            //TreeListNode node = e.Node;
            //TreeListNode parentNode = e.Node.ParentNode;
            //if (parentNode == null)
            //{
            //    e.Visible = true;
            //    e.Handled = true;
            //    return;
            //}
            //if (parentNode != null && node.IsExpanded)
            //{
            //    e.Visible = true;
            //    e.Handled = true;
            //}
            #endregion
        }
Esempio n. 5
0
        private string SearchCriteriaBuilder()
        {
            CriteriaOperator searchCriteriaObjectBuilder = SearchCriteriaObjectBuilder();

            return((object.ReferenceEquals(searchCriteriaObjectBuilder, null)) ? "" : searchCriteriaObjectBuilder.LegacyToString());
        }
Esempio n. 6
0
        private string SearchCriteriaBuilder()
        {
            //string res = "";

            /*
             * CriteriaOperator criteria = null;
             * criteria = new GroupOperator();
             * ((GroupOperator)criteria).OperatorType = GroupOperatorType.And;
             *
             * if (this.DateBegin != System.DateTime.MinValue) {
             *  CriteriaOperator criteriathisDateBegin = new BinaryOperator("Date", this.DateBegin, BinaryOperatorType.GreaterOrEqual);
             *  ((GroupOperator)criteria).Operands.Add(criteriathisDateBegin);
             * }
             *
             * if (this.DateEnd != System.DateTime.MinValue) {
             *  CriteriaOperator criteriathisDateEnd = new BinaryOperator("Date", this.DateEnd, BinaryOperatorType.LessOrEqual);
             *  ((GroupOperator)criteria).Operands.Add(criteriathisDateEnd);
             * }
             *
             *
             * CriteriaOperator criteriaDepartment = null;
             * if (this.Department != null) {
             *  criteriaDepartment = new BinaryOperator("DepartmentRegistrator.Oid", this.Department.Oid, BinaryOperatorType.Equal);
             *  ((GroupOperator)criteria).Operands.Add(criteriaDepartment);
             * }
             *
             * if (((GroupOperator)criteria).Operands.Count > 0) res = criteria.LegacyToString();
             */


            /*
             * if (this.DateBegin != System.DateTime.MinValue) {
             *  res += ((res == "") ? "" : " AND ") + "DateBegin >= " + this.DateBegin;
             * }
             *
             * if (this.DateEnd != System.DateTime.MinValue) {
             *  res += ((res == "") ? "" : " AND ") + "DateBegin  " + this.DateBEgin;
             * }
             *
             * if (this.Department != null) {
             *  res += ((res == "") ? "" : " AND ") + "DepartmentRegistrator.Oid = " + this.Department.Oid.ToString();
             * }
             * //if (!(string.IsNullOrEmpty(this.SupplierName))) {
             * //    res += ((res == "") ? "" : " AND ") + "Current.Supplier.Name" + " like '%" + this.SupplierName + "%'";
             * //    res += ((res == "") ? "" : " AND ") + "Current.crmWorkPlan.Current.Supplier.Name" + " like '%" + this.SupplierName + "%'";
             * //}
             */

            CriteriaOperator searchCriteriaObjectBuilder = SearchCriteriaObjectBuilder();

            return((object.ReferenceEquals(searchCriteriaObjectBuilder, null)) ? "" : searchCriteriaObjectBuilder.LegacyToString());
        }
        private string SearchCriteriaBuilder()
        {
            CriteriaOperator criteria = SearchCriteriaObjectBuilder();

            return(((object)criteria) == null ? "" : criteria.LegacyToString());
        }
Esempio n. 8
0
        private void createkml(string nombrefile, string tipo_eje)
        {
            string ad = "RUTERO COMPLETO";



            //Definimos el archivo XML
            XmlTextWriter writer = new
                                   XmlTextWriter(nombrefile, Encoding.UTF8);

            // Empezamos a escribir
            writer.WriteStartDocument();
            writer.WriteStartElement("kml");
            writer.WriteAttributeString("xmlns", "http://earth.google.com/kml/2.0");
            writer.WriteStartElement("Folder");
            writer.WriteStartElement("description");


            CriteriaOperator op            = gridView1.ActiveFilterCriteria;
            string           filterStnring = DevExpress.Data.Filtering.CriteriaToWhereClauseHelper.GetDataSetWhere(op);

            //  string filterStnring2 = DevExpress.Data.Filtering.Crite;

            if (filterStnring == "")
            {
            }
            else
            {
                ad = op.LegacyToString();
            }



            //Descripcion del Conjunto de Datos,puede ser texto o HTML
            writer.WriteCData("Puntos" + ad + "");
            writer.WriteEndElement();
            writer.WriteElementString("name", ad);
            writer.WriteElementString("visibility", "0");
            writer.WriteElementString("open", "1");
            writer.WriteStartElement("Folder");


            //   for (int i = 0; i < gridView1.DataRowCount; i++)
            //   {
            //       string v = "";

            //       v = gridView1.GetRowCellValue(i, "LATITUD").ToString();

            ////do something
            //     }



            for (int i = 0; i < gridView1.DataRowCount; i++)
            {
                // DataRow dtr = dt.Rows[i];


                string lat = gridView1.GetRowCellValue(i, "LATITUD").ToString();
                string lon = gridView1.GetRowCellValue(i, "LONGITUD").ToString();
                writer.WriteStartElement("Placemark");
                writer.WriteStartElement("description");

                writer.WriteCData("" + "RUTA:" + gridView1.GetRowCellValue(i, "RUTA").ToString() + "<br />" + "SEMANA: " + gridView1.GetRowCellValue(i, "SEMANA").ToString() + "  <br />  " + "DIA: " + gridView1.GetRowCellValue(i, "DIAVISITA").ToString() + " <br />" + "NOMBRE: " + gridView1.GetRowCellValue(i, "NOMBRE").ToString() + " <br />" + "DIRECCION: " + gridView1.GetRowCellValue(i, "DIRECCION").ToString());

                writer.WriteEndElement();
                writer.WriteElementString("name", gridView1.GetRowCellValue(i, "CLIENTE").ToString());
                writer.WriteElementString("visibility", "1");

                writer.WriteStartElement("Style");
                writer.WriteStartElement("IconStyle");
                writer.WriteStartElement("Icon");
                switch (gridView1.GetRowCellValue(i, "DIAVISITA").ToString())
                {
                case "LUNES":
                    writer.WriteElementString("href", "http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png");
                    break;

                case "MARTES":
                    writer.WriteElementString("href", "http://maps.google.com/mapfiles/kml/pushpin/blue-pushpin.png");
                    break;

                case "MIERCOLES":
                    writer.WriteElementString("href", "http://maps.google.com/mapfiles/kml/pushpin/red-pushpin.png");
                    break;

                case "JUEVES":
                    writer.WriteElementString("href", "http://maps.google.com/mapfiles/kml/pushpin/grn-pushpin.png");
                    break;

                case "VIERNES":
                    writer.WriteElementString("href", "http://maps.google.com/mapfiles/kml/pushpin/pink-pushpin.png");
                    break;

                case "SABADO":
                    writer.WriteElementString("href", "http://maps.google.com/mapfiles/kml/pushpin/wht-pushpin.png");
                    break;

                case "ESPECIAL":
                    writer.WriteElementString("href", "http://maps.google.com/mapfiles/kml/pushpin/ltblu-pushpin.png");
                    break;

                default:
                    writer.WriteElementString("href", "http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png");
                    break;
                }
                writer.WriteEndElement();
                writer.WriteEndElement();
                writer.WriteEndElement();


                writer.WriteStartElement("LookAt");
                writer.WriteElementString("longitude", lon);
                writer.WriteElementString("latitude", lat);
                writer.WriteElementString("range", "3000");
                writer.WriteElementString("tilt", "60");
                writer.WriteElementString("heading", "0");
                writer.WriteEndElement();
                writer.WriteStartElement("Point");
                writer.WriteElementString("extrude", "1");
                writer.WriteElementString("altitudeMode", "relativeToGround");
                writer.WriteElementString("coordinates", lon + "," + lat + ",3");
                writer.WriteEndElement();
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
            writer.WriteEndElement();
            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Close();



            if (tipo_eje == "ver")
            {
                System.Diagnostics.Process.Start(nombrefile);
            }
            else
            {
                MessageBox.Show(nombrefile, "Archivo Guardado Corectamente");
            }

            //MessageBoxButtons bt1 = MessageBoxButtons.YesNo;
            //DialogResult result = MessageBox.Show("Desea ver los puntos en GoogleEarth", "PUNTEO", bt1, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
            //if (result == DialogResult.Yes)
            //{
            //    try
            //    {
            //        try
            //        {
            //            System.Diagnostics.Process.Start(nombrefile);

            //        }
            //        catch
            //        {

            //        }
            //    }
            //    catch
            //    {
            //        MessageBox.Show("ERROR GOOGLE EARTH NO ESTA INSTALADO", "ERROR");
            //    }
            //}
            //else
            //{

            //    MessageBox.Show(nombrefile, "Archivo Guardado Corectamente");
            //}
        }