Esempio n. 1
0
        /// <summary>
        /// 保存处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOk_Click(object sender, EventArgs e)
        {
            List <Hashtable> data = new List <Hashtable>();
            int  index            = 0;
            bool change           = _datatable.Rows.Count != dataGridView1.RowCount - 1;

            if (!change)
            {
                for (int i = 0; i < dataGridView1.RowCount - 1; i++)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        if (GetValue(dataGridView1, i, j) != _datatable.Rows[i][j].ToString())
                        {
                            change = true;
                            break;
                        }
                    }
                }
            }
            if (!change)
            {
                return;
            }
            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                if (dataGridView1.Rows[i].Cells["SaleDate"].Value != null)
                {
                    string    sdate      = dataGridView1.Rows[i].Cells["SaleDate"].Value.ToString();
                    string    saleprice  = dataGridView1.Rows[i].Cells["SalePrice"].Value.ToString();
                    string    price      = dataGridView1.Rows[i].Cells["Price"].Value.ToString();
                    string    updatedate = dataGridView1.Rows[i].Cells["updatedate"].Value.ToString();
                    Hashtable table      = new Hashtable();
                    table.Add("SaleDate", sdate);
                    table.Add("SalePrice", saleprice);
                    table.Add("Price", price);
                    table.Add("No", index);
                    table.Add("Updatedate", updatedate);
                    data.Add(table);
                    index++;
                }
            }
            //保存价格数据
            MapDBClass.UpdateSalePrice(_MapId, _LayerId, _ObjectId, data);
            Initial(_MapId, _LayerId, _ObjectId);
        }