protected void BindGrid()
    {
        DataSet   DsXML = new DataSet();
        DataTable dt    = new DataTable();


        DsXML.ReadXml(filePath, XmlReadMode.ReadSchema);
        dt = DsXML.Tables[0].Clone();
        dt.Columns[2].DataType     = System.Type.GetType("System.DateTime");
        dt.Columns[2].DateTimeMode = System.Data.DataSetDateTime.UnspecifiedLocal;

        if (DsXML.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < DsXML.Tables[0].Rows.Count; i++)
            {
                DataRow dr = dt.NewRow();
                for (int j = 0; j < DsXML.Tables[0].Columns.Count; j++)
                {
                    dr[j] = DsXML.Tables[0].Rows[i][j];
                }
                dt.Rows.Add(dr);
            }
        }


        Session["XMLDS"]   = dt;
        GridLog.DataSource = dt;
        GridLog.DataBind();
    }
        /// <summary>
        /// Triangulates the given object and parses the result to the builder.
        /// </summary>
        /// <param name="autoOptimize">Determine weather or not to use grid refinement, lazy cube evaluation and another sized grid - based on the given SDF.</param>
        /// <returns></returns>
        public virtual IPolygon Run(SDF obj, IPolygonBuilder builder, bool autoOptimize)
        {
            /// Setup!
            if (autoOptimize)
            {
                Optimize(obj);
            }

            _obj     = obj;
            _builder = builder;

            if (builder is GridLog)
            {
                _log        = builder as GridLog;
                _useLogging = true;
            }

            if (useRefinement)
            {
                GridRefinement();
            }
            else
            {
                _halfStep = new Vec3(_step / 2, _step / 2, _step / 2);
                _lazy     = _halfStep.Magnitude() * 1.001f;
                Initialize();
                GridLoop();
            }

            return(_builder.Build());
        }
Exemple #3
0
        protected void GridLog_Sort(object sender, FineUIPro.GridSortEventArgs e)
        {
            DataView view1 = dtData.DefaultView;

            view1.Sort = String.Format("{0} {1}", e.SortField, e.SortDirection);

            GridLog.DataSource = view1;
            GridLog.DataBind();
        }
Exemple #4
0
    private void LogGrid(Direction direction)
    {
        if (lastLoggedGrid != null)
        {
            bool flag = true;
            // dumbass tile check. wrote this when i was drunk or something and dont feel like making it not bad
            for (int y = 0; y < Size; y++)
            {
                for (int x = 0; x < Size; x++)
                {
                    if (grid.Cells[y, x] == null && lastLoggedGrid[y, x] != null || grid.Cells[y, x] != null && lastLoggedGrid[y, x] == null || grid.Cells[y, x] != null && lastLoggedGrid[y, x] != null && grid.Cells[y, x].Value != lastLoggedGrid[y, x].Value)
                    {
                        flag = false;
                    }
                }
            }
            if (flag)
            {
                return;
            }
        }

        lastLoggedGrid = new DigTile[Size, Size];
        for (int y = 0; y < Size; y++)
        {
            for (int x = 0; x < Size; x++)
            {
                lastLoggedGrid[y, x] = grid.Cells[y, x] ?? null;
            }
        }


        GridLog log = new GridLog(CurrentScore, direction);

        grid.EachCell(delegate(int x, int y, DigTile tile)
        {
            if (tile != null)
            {
                log.tiles.Add(new GridLog.GridLogTile(tile));
            }
        });

        Log("Current grid: {0}", JsonConvert.SerializeObject(log, Formatting.None, new JsonSerializerSettings
        {
            NullValueHandling = NullValueHandling.Ignore
        }));
    }
Exemple #5
0
        private void dataSearch()
        {
            if (lstLRRQ1.SelectedDate == null || lstLRRQ2.SelectedDate == null)
            {
                Alert.Show("请输入条件【录入日期】!");
                return;
            }
            else if (lstLRRQ1.SelectedDate > lstLRRQ2.SelectedDate)
            {
                Alert.Show("开始日期大于结束日期,请重新输入!");
                return;
            }
            string strUser, strSQL = @"select USERID,MEMO,STATION,RQSJ from sys_operlog 
                                where TYPE='ERR' AND USERID like '%{0}%' AND  RQSJ>=to_date('{1}','yyyy-mm-dd') and RQSJ< to_date('{2}','yyyy-mm-dd') + 1 
                                 order by SEQNO desc";

            strUser            = PubFunc.StrIsEmpty(lstAccount.Text) ? "%" : lstAccount.Text;
            GridLog.DataSource = DbHelperOra.Query(string.Format(strSQL, strUser, lstLRRQ1.Text, lstLRRQ2.Text));
            GridLog.DataBind();
        }
        protected Tuple <Log, IPolygon, string, long>[] TriangulateWithLog(ITriangulator[] triangulator, SDF[] obj)
        {
            Program.PrintTitle("TRIANGULATING...");
            var result = new Tuple <Log, IPolygon, string, long> [triangulator.Length];

            Parallel.For(0, triangulator.Length, i => {
                Stopwatch t     = new Stopwatch();
                GridLog builder = new GridLog();
                t.Start();
                var mesh = triangulator[i].Run(obj[i], builder);
                t.Stop();
                var name  = $"[{obj[i].ToString()}] {triangulator[i].ToString()}";
                var time  = t.ElapsedMilliseconds;
                result[i] = Tuple.Create((mesh as LogPolygon).GetLog(), mesh, name, time);
                Console.WriteLine($"\n{name} took {time}ms\nCreated {mesh.VertexCount} vertices and {mesh.TriangleCount} triangles");
            });
            Console.WriteLine("\nPRESS ANY KEY TO CONTINUE");
            Console.ReadKey();
            return(result);
        }
Exemple #7
0
        private void dataSearch()
        {
            if (lstLRRQ1.SelectedDate == null || lstLRRQ2.SelectedDate == null)
            {
                Alert.Show("请输入条件【录入日期】!");
                return;
            }
            else if (lstLRRQ1.SelectedDate > lstLRRQ2.SelectedDate)
            {
                Alert.Show("开始日期大于结束日期,请重新输入!");
                return;
            }
            string strOrder = " ORDER BY RQSJ DESC";

            string strSearch = "";

            if (!string.IsNullOrWhiteSpace(trbSearch.Text))
            {
                strSearch += string.Format(" AND DBMS_LOB.INSTR(MEMO, '{0}', 1, 1) > 0", trbSearch.Text);
            }
            if (!string.IsNullOrWhiteSpace(lstFuncid.SelectedValue))
            {
                strSearch += string.Format(" AND FUNCID='{0}' ", lstFuncid.SelectedValue);
            }
            if (lstLRRQ1.SelectedDate != null || lstLRRQ2.SelectedDate != null)
            {
                strSearch += string.Format(" AND  RQSJ>=to_date('{0}','yyyy-mm-dd') and RQSJ< to_date('{1}','yyyy-mm-dd') + 1", lstLRRQ1.Text, lstLRRQ2.Text);
            }

            strSql += strSearch;
            strSql += strOrder;
            PageContext.RegisterStartupScript(GridLog.GetRejectChangesReference());
            int       total = 0;
            DataTable dt    = PubFunc.DbGetPage(GridLog.PageIndex, GridLog.PageSize, strSql, ref total);

            GridLog.DataSource  = dt;
            GridLog.RecordCount = total;
            //GridLog.DataSource = DbHelperOra.Query(strSql);
            GridLog.DataBind();
        }
    protected void btnGo_Click(object sender, EventArgs e)
    {
        trLabel.Visible = false;

        DataSet   DsXML;
        DateTime  dt     = Convert.ToDateTime(txtFrom.Text);
        DataTable dtable = new DataTable();

        dtable = ((DataTable)Session["XMLDS"]).Clone();
        dtable.Columns[2].DataType     = System.Type.GetType("System.DateTime");
        dtable.Columns[2].DateTimeMode = System.Data.DataSetDateTime.UnspecifiedLocal;


        if (dt.Month == DateTime.Now.Month)
        {
            dtable = (DataTable)Session["XMLDS"];
        }
        else if (dt.Month < DateTime.Now.Month)
        {
            for (int k = dt.Month; k <= DateTime.Now.Month; k++)
            {
                DsXML    = new DataSet();
                filePath = HttpContext.Current.Server.MapPath("./ErrorLog/" + "Error_" + k.ToString() + "_" + dt.Year.ToString() + "_Log.XML");
                if (System.IO.File.Exists(filePath))
                {
                    DsXML.ReadXml(filePath, XmlReadMode.ReadSchema);
                }
                else
                {
                    break;
                }

                if (DsXML.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < DsXML.Tables[0].Rows.Count; i++)
                    {
                        DataRow dr = dtable.NewRow();
                        for (int j = 0; j < DsXML.Tables[0].Columns.Count; j++)
                        {
                            dr[j] = DsXML.Tables[0].Rows[i][j];
                        }
                        dtable.Rows.Add(dr);
                    }
                }
            }
            Session["XMLDS"] = dtable;
        }



        if (txtFrom.Text != "")
        {
            string str = dt.ToString().Substring(0, 10);
            // string rowFilter = "Error_DateTime LIKE '" + str + "*'";
            // string rowFilter = "{2} > '#" + Convert.ToDateTime(txtFrom.Text) + "#' and {2}<'#" + Convert.ToDateTime(txtTo.Text) + "#'";
            string rowFilter = "[Error_DateTime] >=# " + Convert.ToDateTime(txtFrom.Text) + "# and [Error_DateTime] <= #" + Convert.ToDateTime(txtTo.Text) + "#";

            dtable.DefaultView.RowFilter = rowFilter;


            // Session["XMLDS"] = DsXML;
            if (dtable.DefaultView.Count > 0)
            {
                GridLog.DataSource = dtable.DefaultView;
                GridLog.DataBind();
                lblNoRec.Visible = false;
            }
            else
            {
                GridLog.DataSource = dtable.DefaultView;
                GridLog.DataBind();
                lblNoRec.Visible = true;
            }
        }
        else
        {
            BindGrid();
        }
    }
 protected void GridLog_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GridLog.PageIndex  = e.NewPageIndex;
     GridLog.DataSource = (DataTable)Session["XMLDS"];
     GridLog.DataBind();
 }