Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count == 0)
                return;
            if (this.isDetail)
            {
                //this.oneCollectDataSet.AcceptChanges();
                //foreach (DataRow row in this.oneCollectDataSet.Tables[0].Rows)
                //{
                //    if (row.RowState == DataRowState.Modified)
                //    {
                //        string CollectId = row["Datable.CollectId"].ToString();
                //        string DataTime = row["DataTime"].ToString();
                //        string DataValue = row["DataValue"].ToString();
                //        OleHelper.ExecuteNonQuery(OleHelper.Conn, CommandType.Text, "update DataTable set CollectId='" + CollectId + "',DataTime=#" + DataTime + "#,DataValue=" + DataValue + " where DataId=" + row["DataId"].ToString());
                //    }
                //}
                //this.dataGridView1.DataSource = this.oneCollectDataSet.Tables[0];
                int DataId = Convert.ToInt32(this.dataGridView1.SelectedRows[0].Cells["DataId"].Value.ToString());
                ModifyData m = new ModifyData(DataId);
                if (m.ShowDialog() == DialogResult.OK)
                {
                    DataSet ds= OleHelper.ExecuteDataset(OleHelper.Conn, CommandType.Text, "select * from DataTable where DataId=" + DataId.ToString());
                    DataGridViewRow selectRow = this.dataGridView1.SelectedRows[0];
                    DataRow datarow=ds.Tables[0].Rows[0];
                    selectRow.Cells["DataValue"].Value = datarow["DataValue"].ToString();
                    selectRow.Cells["DataTime"].Value = datarow["DataTime"].ToString();
                    selectRow.Cells["DataTableId"].Value = datarow["DataTableId"].ToString();
                }
            }
            else
            {

                string CollectInfoId = this.dataGridView1.SelectedRows[0].Cells["ID"].Value.ToString();

                SetCollectProperty set = new SetCollectProperty(null,CollectInfoId );
                if (set.ShowDialog() == DialogResult.OK)
                {
                    DataSet ds = OleHelper.ExecuteDataset(OleHelper.Conn, CommandType.Text, "select * from CollectInfo where ID=" + CollectInfoId.ToString());
                    DataGridViewRow selectRow = this.dataGridView1.SelectedRows[0];
                    DataRow datarow = ds.Tables[0].Rows[0];
                    selectRow.Cells["ProtectStationName"].Value = datarow["ProtectStationName"].ToString();
                    selectRow.Cells["TestPileID"].Value = datarow["TestPileID"].ToString();
                    selectRow.Cells["Mileage"].Value = datarow["Mileage"].ToString();

                    try
                    {
                        string titude = datarow["Latitude"].ToString();
                        selectRow.Cells["Latitude"].Value = Lib.parseLatitude(titude.Substring(titude.IndexOf('&') + 1));
                        selectRow.Cells["Longtitude"].Value = Lib.parseLatitude(titude.Substring(0, titude.IndexOf('&')));

                    }
                    catch (Exception)
                    {
                        selectRow.Cells["Latitude"].Value = "格式错误";
                        selectRow.Cells["Longtitude"].Value = "格式错误";
                    }

                    Program.mainForm.UpdateCollectInfoTree();

                    //selectRow.Cells["DataTableId"].Value = datarow["DataTableId"].ToString();
                    //selectRow.DefaultCellStyle.BackColor = Color.White;
                    //Program.mainForm.ShowCharting(3, null);
                }
            }
        }
Esempio n. 2
0
        private void button_property_Click(object sender, EventArgs e)
        {
            string ColumnName="CollectId";
            if (this.dataGridView1.SelectedRows.Count > 0)
            {
                string CollectId= this.dataGridView1.SelectedRows[0].Cells[ColumnName].Value.ToString();
                SetCollectProperty set = new SetCollectProperty(null,CollectId);

                if (set.ShowDialog() == DialogResult.OK)
                {
                    //DataSet ds = OleHelper.ExecuteDataset(OleHelper.Conn, CommandType.Text, "select * from CollectInfo where CollectId='" + CollectId.ToString() + "'");
                    //DataGridViewRow selectRow = this.dataGridView1.SelectedRows[0];
                    //DataRow datarow = ds.Tables[0].Rows[0];
                    //selectRow.Cells["ProtectStationName"].Value = datarow["ProtectStationName"].ToString();
                    //selectRow.Cells["TestPileID"].Value = datarow["TestPileID"].ToString();
                    ////selectRow.Cells["DataTableId"].Value = datarow["DataTableId"].ToString();
                    //selectRow.DefaultCellStyle.BackColor = Color.White;
                    //this.dataGridView1.Refresh();

                    //Program.mainForm.ShowCharting(3, null);
                }

            }
        }
Esempio n. 3
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (this.comboBox_CollectId.SelectedIndex < 0)
         return;
     SetCollectProperty set = new SetCollectProperty(this.lineItem[this.comboBox_CollectId.SelectedIndex],this.CollectInfoIdList[this.comboBox_CollectId.SelectedIndex].ToString());
     if (set.ShowDialog() == DialogResult.OK)
     {
         this.zedGraphControl1.Invalidate();
     }
 }