Exemplo n.º 1
0
        private void tsmiView_Click(object sender, EventArgs e)
        {
            if (SelectedFeature == null)
            {
                MessageBox.Show("请选择点进行查看!");
            }
            else
            {
                try
                {
                    Int32     iNDH                 = Convert.ToInt32(SelectedFeature["NDH"]);
                    JKINFOBLL bllJKINFO            = new JKINFOBLL();
                    String    MDBFileName          = (SysInfo.HTDBInfo[cbMaps.Text] as DBInfo).MDBPath;
                    MapApp.Entities.JKINFO oJKINFO = bllJKINFO.GetJKINFO(iNDH, MDBFileName);

                    ViewJKINFO frmViewJKINFO = new ViewJKINFO(oJKINFO);
                    frmViewJKINFO.ShowDialog();
                }
                catch
                {
                    MessageBox.Show("数据异常!");
                }
            }
        }
Exemplo n.º 2
0
        private void tsmiEdit_Click(object sender, EventArgs e)
        {
            if (SelectedFeature == null)
            {
                MessageBox.Show("请选择点进行查看!");
            }
            else
            {
                JKINFOBLL bllJKINFO   = new JKINFOBLL();
                String    MDBFileName = (SysInfo.HTDBInfo[cbMaps.Text] as DBInfo).MDBPath;
                try
                {
                    Int32 iNDH = Convert.ToInt32(SelectedFeature["NDH"]);

                    MapApp.Entities.JKINFO oJKINFO = bllJKINFO.GetJKINFO(iNDH, MDBFileName);

                    EditJKINFO frmEditJKINFO = new EditJKINFO(oJKINFO);
                    if (frmEditJKINFO.ShowDialog() == DialogResult.OK)
                    {
                        if (bllJKINFO.EditJKINFO(frmEditJKINFO.OBJJKINFO, MDBFileName))
                        {
                            SelectedFeature["DW"] = frmEditJKINFO.OBJJKINFO.DW;
                            SelectedFeature["SJ"] = frmEditJKINFO.OBJJKINFO.SJ;

                            SelectedFeature.Style = sDefault;
                            foreach (DataRow dr in SysInfo.TypeDataTable.Rows)
                            {
                                int iType = Convert.ToInt32(dr["JKType"]);
                                if (frmEditJKINFO.OBJJKINFO.SBLX == iType)
                                {
                                    SelectedFeature.Style = new MapInfo.Styles.CompositeStyle(new MapInfo.Styles.BitmapPointStyle(dr["BMPFileName"].ToString(), BitmapStyles.None, Color.Blue, 10));
                                    break;
                                }
                            }

                            SelectedFeature.Table.UpdateFeature(SelectedFeature);
                            MessageBox.Show("保存成功!");
                        }
                        else
                        {
                            MessageBox.Show("保存失败!");
                        }
                    }
                }
                catch
                {
                    AddJKINFO frmAddJKINFO = new AddJKINFO();
                    if (frmAddJKINFO.ShowDialog() == DialogResult.OK)
                    {
                        Table tEditTable = (mapControl1.Map.Layers["JKINFO"] as FeatureLayer).Table;

                        SelectedFeature.Style = sDefault;
                        foreach (DataRow dr in SysInfo.TypeDataTable.Rows)
                        {
                            int iType = Convert.ToInt32(dr["JKType"]);
                            if (frmAddJKINFO.OBJJKINFO.SBLX == iType)
                            {
                                SelectedFeature.Style = new MapInfo.Styles.CompositeStyle(new MapInfo.Styles.BitmapPointStyle(dr["BMPFileName"].ToString(), BitmapStyles.None, Color.Blue, 10));
                            }
                        }
                        SelectedFeature["NDH"] = frmAddJKINFO.OBJJKINFO.NDH;
                        SelectedFeature["SJ"]  = frmAddJKINFO.OBJJKINFO.SJ;
                        SelectedFeature["DW"]  = frmAddJKINFO.OBJJKINFO.DW;
                        tEditTable.UpdateFeature(SelectedFeature);

                        if (bllJKINFO.AddJKINFO(frmAddJKINFO.OBJJKINFO, MDBFileName))
                        {
                            MessageBox.Show("保存成功!");
                        }
                        else
                        {
                            MessageBox.Show("保存失败!");
                        }
                    }
                }
            }
        }