Exemplo n.º 1
0
        private void JKINFOList_Load(object sender, EventArgs e)
        {
            JKINFOBLL bllJKINFO = new JKINFOBLL();

            try
            {
                dataGridView1.DataSource = bllJKINFO.GetList(_MDBFileName, "").Tables[0].Copy();
            }
            catch
            {
                MessageBox.Show("¼ÓÔØÊý¾Ý³ö´í£¡");
            }
        }
Exemplo n.º 2
0
        private static void RewNew()
        {
            while (true)
            {
                JKINFOBLL bllJKINFO   = new JKINFOBLL();
                String    MDBFileName = (SysInfo.HTDBInfo[sMapName] as DBInfo).MDBPath;
                DataTable dtAllRow    = bllJKINFO.GetList(MDBFileName, "").Tables[0].Copy();

                if (dtAllRow.Rows.Count <= 0)
                {
                    return;
                }


                if (ifs.Count <= 0)
                {
                    return;
                }
                else
                {
                    //FeatureLayer lyrTemp = (FeatureLayer)mapControl1.Map.Layers["JKINFO"];
                    //if (lyrTemp != null)
                    //{
                    //    IFeatureEnumerator fen = (lyrTemp.Table as IFeatureCollection).GetFeatureEnumerator();
                    //    while (fen.MoveNext())
                    //    {
                    //        Feature ftemp = fen.Current;
                    //        try
                    //        {
                    //            Int32 iNDH = -1;
                    //            if (ftemp["NDH"] == null)
                    //                continue;
                    //            try
                    //            {
                    //                iNDH = Convert.ToInt32(ftemp["NDH"]);
                    //                foreach (DataRow dr in dtAllRow.Rows)
                    //                {
                    //                    try
                    //                    {
                    //                        if (iNDH == Convert.ToInt32(dr["NDH"]))
                    //                        {
                    //                            ftemp["SJ"] = dr["SJ"];
                    //                            ftemp["DW"] = dr["DW"];
                    //                            ftemp.Table.UpdateFeature(ftemp);
                    //                            break;
                    //                        }
                    //                    }
                    //                    catch
                    //                    { }
                    //                }
                    //            }
                    //            catch
                    //            {
                    //            }
                    //        }
                    //        catch (Exception ex)
                    //        {
                    //            MessageBox.Show("更新中发生错误:" + ex.Message);
                    //        }
                    //    }
                    //}



                    for (int i = 0; i < ifs.Count; i++)
                    {
                        Feature ftemp = ifs[i];
                        try
                        {
                            Int32 iNDH = -1;
                            if (ftemp["NDH"] == null)
                            {
                                continue;
                            }
                            try
                            {
                                iNDH = Convert.ToInt32(ftemp["NDH"]);
                                foreach (DataRow dr in dtAllRow.Rows)
                                {
                                    try
                                    {
                                        if (iNDH == Convert.ToInt32(dr["NDH"]))
                                        {
                                            ftemp["SJ"] = dr["SJ"];
                                            ftemp["DW"] = dr["DW"];
                                            ftemp.Table.UpdateFeature(ftemp);
                                            break;
                                        }
                                    }
                                    catch
                                    { }
                                }
                            }
                            catch
                            {
                            }
                        }
                        catch //(Exception ex)
                        {
                            //MessageBox.Show("更新中发生错误:" + ex.Message);
                        }
                    }
                }
                Thread.Sleep(3000);
            }
        }
Exemplo n.º 3
0
        void t_Tick(object sender, EventArgs e)
        {
            JKINFOBLL bllJKINFO   = new JKINFOBLL();
            String    MDBFileName = (SysInfo.HTDBInfo[cbMaps.Text] as DBInfo).MDBPath;

            dtAllRow = bllJKINFO.GetList(MDBFileName, "").Tables[0].Copy();

            if (dtAllRow.Rows.Count <= 0)
            {
                return;
            }

            SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchWhere("1=1");

            si.QueryDefinition.Columns = new string[] { "*" };// new string[] { "NDH" }; //null
            IResultSetFeatureCollection ifs = MapInfo.Engine.Session.Current.Catalog.Search("JKINFO", si);

            foreach (MapInfo.Data.Feature f in ifs)
            {
                try
                {
                    Int32 iNDH = -1;
                    if (f["NDH"] != null)
                    {
                        try
                        {
                            iNDH = Convert.ToInt32(f["NDH"]);
                            foreach (DataRow dr in dtAllRow.Rows)
                            {
                                try
                                {
                                    if (iNDH == Convert.ToInt32(dr["NDH"]))
                                    {
                                        f["SJ"] = dr["SJ"];
                                        f["DW"] = dr["DW"];
                                        f.Table.UpdateFeature(f);
                                        break;
                                    }
                                }
                                catch
                                { }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                catch //(Exception ex)
                {
                    //MessageBox.Show("更新中发生错误:" + ex.Message);
                }
            }

            //SearchInfo si = MapInfo.Data.SearchInfoFactory.SearchWhere("1=1");
            //si.QueryDefinition.Columns = new string[] { "*" } ;// new string[] { "NDH" }; //null
            //IResultSetFeatureCollection ifs = MapInfo.Engine.Session.Current.Catalog.Search("JKINFO", si);
            //if (ifs.Count <= 0)
            //{
            //    return;
            //}
            //else
            //{
            //    //FeatureLayer lyrTemp = (FeatureLayer)mapControl1.Map.Layers["JKINFO"];
            //    //if (lyrTemp != null)
            //    //{
            //    //    IFeatureEnumerator fen = (lyrTemp.Table as IFeatureCollection).GetFeatureEnumerator();
            //    //    while (fen.MoveNext())
            //    //    {
            //    //        Feature ftemp = fen.Current;
            //    //        try
            //    //        {
            //    //            Int32 iNDH = -1;
            //    //            if (ftemp["NDH"] == null)
            //    //                continue;
            //    //            try
            //    //            {
            //    //                iNDH = Convert.ToInt32(ftemp["NDH"]);
            //    //                foreach (DataRow dr in dtAllRow.Rows)
            //    //                {
            //    //                    try
            //    //                    {
            //    //                        if (iNDH == Convert.ToInt32(dr["NDH"]))
            //    //                        {
            //    //                            ftemp["SJ"] = dr["SJ"];
            //    //                            ftemp["DW"] = dr["DW"];
            //    //                            ftemp.Table.UpdateFeature(ftemp);
            //    //                            break;
            //    //                        }
            //    //                    }
            //    //                    catch
            //    //                    { }
            //    //                }
            //    //            }
            //    //            catch
            //    //            {
            //    //            }
            //    //        }
            //    //        catch (Exception ex)
            //    //        {
            //    //            MessageBox.Show("更新中发生错误:" + ex.Message);
            //    //        }
            //    //    }
            //    //}

            //    for (int i = 0; i < ifs.Count; i++)
            //    {
            //        try
            //        {
            //            Int32 iNDH = -1;
            //            if (ifs[i]["NDH"] != null)
            //            {
            //                try
            //                {
            //                    iNDH = Convert.ToInt32(ifs[i]["NDH"]);
            //                    foreach (DataRow dr in dtAllRow.Rows)
            //                    {
            //                        try
            //                        {
            //                            if (iNDH == Convert.ToInt32(dr["NDH"]))
            //                            {
            //                                ifs[i]["SJ"] = dr["SJ"];
            //                                ifs[i]["DW"] = dr["DW"];
            //                                ifs[i].Table.UpdateFeature(ifs[i]);
            //                                break;
            //                            }
            //                        }
            //                        catch
            //                        { }
            //                    }
            //                }
            //                catch
            //                {
            //                }
            //            }
            //        }
            //        catch //(Exception ex)
            //        {
            //            //MessageBox.Show("更新中发生错误:" + ex.Message);
            //        }

            //    }
            //}
        }