Beispiel #1
0
        //删除注册信息
        private void buttonDelReg_Click(object sender, EventArgs e)
        {
            var         index = this.gridView2.GetFocusedDataSourceRowIndex();
            DataRowView row   = (DataRowView)this.gridView2.GetRow(index);
            string      val   = row["REG_NAME"].ToString();

            if (val != "")
            {
                DialogResult dr = MessageBox.Show("确定删除?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (dr == DialogResult.OK)
                {
                    ConnectDB   cd     = new ConnectDB();
                    Boolean     result = cd.Delete("DELETE from GISDATA_REGINFO WHERE REG_NAME = '" + val + "'");
                    CommonClass common = new CommonClass();
                    common.deleteXmlNode(val);
                    if (result)
                    {
                        Boolean result1 = cd.Delete("DELETE from GISDATA_MATEDATA WHERE REG_NAME = '" + val + "'");
                        if (result1)
                        {
                            refreshDataGridReg();
                            MessageBox.Show("删除成功!", "提示");
                        }
                    }
                }
            }
        }
Beispiel #2
0
        //删除注册连接
        private void buttonDelConnecte_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("确定删除?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (dr == DialogResult.OK)
            {
                Boolean       result     = false;
                TreeListNodes selectNode = this.treeList1.Nodes;
                foreach (TreeListNode node in selectNode)
                {
                    if (node.Checked)
                    {
                        if (this.treeList1.IsRootNode(node))
                        {
                            DataRowView nodeData = this.treeList1.GetDataRecordByNode(node) as DataRowView;
                            ConnectDB   cd       = new ConnectDB();
                            result = cd.Delete("DELETE from GISDATA_REGCONNECT WHERE ID = " + nodeData["ID"]);
                            if (!result)
                            {
                                break;
                            }
                        }
                    }
                }
                if (result)
                {
                    MessageBox.Show("删除成功!", "提示");
                    refreshTreeViewReg();
                }
            }
        }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Files|*.xls;*.xlsx";                                                   // 设定打开的文件类型
            //openFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;                       // 打开app对应的路径
            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); // 打开桌面

            // 如果选定了文件
            string filePath = "";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                // 取得文件路径及文件名
                filePath = openFileDialog.FileName;
                DataTable excelDataTable = ReadExcelToTable(filePath);      // 读出excel并放入datatable
                DataRow[] dr             = excelDataTable.Select(null);


                ConnectDB db = new ConnectDB();
                db.Delete("delete from GISDATA_TASK");
                for (int i = 1; i < dr.Length; i++)
                {
                    string YZLGLDW = dr[i]["YZLGLDW"].ToString();
                    string ZCSBND  = dr[i]["ZCSBND"].ToString();
                    string YZLFS   = dr[i]["YZLFS"].ToString();
                    string XMMC    = dr[i]["XMMC"].ToString();
                    string RWMJ    = dr[i]["RWMJ"].ToString();
                    db.Insert("INSERT INTO GISDATA_TASK (YZLGLDW,ZCSBND,YZLFS,RWMJ,XMMC) values ('" + YZLGLDW + "','" + ZCSBND + "','" + YZLFS + "','" + RWMJ + "','" + XMMC + "')");
                }
                gridControl1.DataSource = excelDataTable;        // 测试用, 输出到dataGridView
                MessageBox.Show("导入成功");
            }
        }
Beispiel #4
0
        /// <summary>
        /// 删除步骤
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonRemove_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("确定要删除吗?", "删除数据", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                ConnectDB db = new ConnectDB();
                db.Delete("delete from GISDATA_CONFIGSTEP  where STEP_NO = " + this.click_NO + " AND SCHEME ='" + this.comboBoxScheme.Text.ToString() + "'");
                db.Delete("delete from GISDATA_TBATTR  where STEP_NO = " + this.click_NO + " AND SCHEME ='" + this.comboBoxScheme.Text.ToString() + "'");
                db.Delete("delete from GISDATA_TBTOPO  where STEP_NO = " + this.click_NO + " AND SCHEME ='" + this.comboBoxScheme.Text.ToString() + "'");
                db.Update("update GISDATA_CONFIGSTEP SET STEP_NO = STEP_NO -1 WHERE STEP_NO > " + this.click_NO + " AND SCHEME ='" + this.comboBoxScheme.Text.ToString() + "'");
                db.Update("update GISDATA_TBATTR SET STEP_NO = STEP_NO -1 WHERE STEP_NO > " + this.click_NO + " AND SCHEME ='" + this.comboBoxScheme.Text.ToString() + "'");
                db.Update("update GISDATA_TBTOPO SET STEP_NO = STEP_NO -1 WHERE STEP_NO > " + this.click_NO + " AND SCHEME ='" + this.comboBoxScheme.Text.ToString() + "'");
                setMaxNO();
                this.loadStep();
                MessageBox.Show("删除成功!");
            }
        }
Beispiel #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            ConnectDB db = new ConnectDB();

            int[] selectRows = this.gridView1.GetSelectedRows();
            foreach (int itemRow in selectRows)
            {
                DataRow row = this.gridView1.GetDataRow(itemRow);
                int     ID  = int.Parse(row["ID"].ToString());
                db.Delete("delete from GISDATA_REPORT WHERE ID = " + ID);
            }
            bindData();
        }
Beispiel #6
0
        private void DeleteStep_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("确定要删除吗?", "删除数据", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                DataGridViewRow row = this.dataGridViewCheck.CurrentRow;
                if (row != null)
                {
                    string    id = row.Cells["ID"].Value.ToString();
                    ConnectDB db = new ConnectDB();
                    db.Delete("delete from GISDATA_TBTOPO where id = " + id);
                    refushTable();
                }
            }
        }
Beispiel #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("确定要删除吗?", "删除数据", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                var       index    = gridView1.GetFocusedDataSourceRowIndex();          //获取数据行的索引值,从0开始
                string    selectID = gridView1.GetRowCellValue(index, "ID").ToString(); //获取选中行的那个单元格的值
                ConnectDB db       = new ConnectDB();
                Boolean   result   = db.Delete("delete from GISDATA_USER where ID =" + selectID);
                if (result)
                {
                    bindData();
                }
            }
        }
Beispiel #8
0
        private void 属性删除_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("确定要删除吗?", "删除数据", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                DeleteNodes.Clear();
                DeleteList.Clear();
                ConnectDB     db         = new ConnectDB();
                TreeListNodes selectNode = this.treeList1.Nodes;
                deleteNode(selectNode);
                string  idstr  = string.Join(",", DeleteList.ToArray());
                Boolean result = db.Delete("delete from GISDATA_TBATTR where id in (" + idstr + ")");
                if (result)
                {
                    foreach (TreeListNode itemNode in DeleteNodes)
                    {
                        this.treeList1.DeleteNode(itemNode);
                    }
                }
            }
        }
Beispiel #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Files|*.xls;*.xlsx";                                                   // 设定打开的文件类型
            //openFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;                       // 打开app对应的路径
            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); // 打开桌面

            // 如果选定了文件
            string filePath = "";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                // 取得文件路径及文件名
                filePath = openFileDialog.FileName;
                DataTable excelDataTable = ReadExcelToTable(filePath);      // 读出excel并放入datatable
                DataRow[] dr             = excelDataTable.Select(null);

                ConnectDB db = new ConnectDB();
                db.Delete("delete from GISDATA_GLDW");
                for (int i = 0; i < dr.Length; i++)
                {
                    string GLDW      = dr[i]["GLDW"].ToString();
                    string GLDWNAME  = dr[i]["GLDWNAME"].ToString();
                    string CONTACTS  = dr[i]["CONTACTS"].ToString();
                    string TEL       = dr[i]["TEL"].ToString();
                    string STARTTIME = dr[i]["STARTTIME"].ToString();
                    string STATE     = dr[i]["STATE"].ToString();
                    string ENDTIME   = dr[i]["ENDTIME"].ToString();
                    string OTHER     = dr[i]["OTHER"].ToString();
                    string SPATIALR  = dr[i]["SPATIALR"].ToString();
                    db.Insert("INSERT INTO GISDATA_GLDW (GLDW,GLDWNAME,CONTACTS,TEL,STARTTIME,STATE,ENDTIME,OTHER,SPATIALR) values ('" + GLDW + "','" + GLDWNAME + "','" + CONTACTS + "','" + TEL + "','" + STARTTIME + "','" + STATE + "','" + ENDTIME + "','" + OTHER + "','" + SPATIALR + "')");
                }
                gridControlGLDW.DataSource = excelDataTable;        // 测试用, 输出到dataGridView
                MessageBox.Show("导入成功");
            }
        }
Beispiel #10
0
        private void button2_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Files|*.xls;*.xlsx";                                                   // 设定打开的文件类型
            //openFileDialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;                       // 打开app对应的路径
            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); // 打开桌面

            // 如果选定了文件
            string filePath = "";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    filePath = openFileDialog.FileName;
                    Workbook book = new Workbook();
                    book.LoadFromFile(filePath);
                    DataTable excelDataTable = book.Worksheets[0].ExportDataTable();

                    ConnectDB db = new ConnectDB();
                    db.Delete("delete from GISDATA_TASK");
                    int result = db.Save2MySqlDB(excelDataTable, "GISDATA_TASK");

                    gridControl1.DataSource = excelDataTable;        // 测试用, 输出到dataGridView

                    if (result > 1)
                    {
                        MessageBox.Show("导入成功");
                    }
                }catch (Exception ex)
                {
                    LogHelper.WriteLog(typeof(FormTaskManage), ex);
                }
            }
        }
Beispiel #11
0
 public void WipeDB()
 {
     ConnectDB.Delete();
 }