Example #1
0
        private void buttonUpdate_Click(object sender, System.EventArgs e)
        {
            try
            {
                //upates the selected region

                //get the selected index
                int index = this.dataGrid.CurrentRowIndex;

                if (index == -1)
                {
                    return;
                }

                DataConvertors.ConvertDataRowToTableMetadata(index, this.ds.Tables[0], this.region);
                this.region.RegionDescription = "A new description";
                this.regionPersistent.Update(this.region);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to update item " + ex.Message);
            }
            finally
            {
            }
        }
Example #2
0
        private void dataGrid_CurrentCellChanged(object sender, System.EventArgs e)
        {
//
            try
            {
                int index = this.dataGrid.CurrentRowIndex;

                if (index > -1)
                {
                    //get the current region object.
                    DataConvertors.ConvertDataRowToTableMetadata(index, this.ds.Tables[0], this.region);
                }

                //show the description on the text box
                this.textRegionDescription.Text = this.region.RegionDescription;
            }
            catch (Exception ex)
            {
            }
        }
Example #3
0
        private void buttonDelete_Click(object sender, System.EventArgs e)
        {
            try
            {
                int index = this.dataGrid.CurrentRowIndex;

                if (index == -1)
                {
                    return;
                }

                DataConvertors.ConvertDataRowToTableMetadata(index, this.ds.Tables[0], this.region);

                this.regionPersistent.Delete(this.region, false);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to delete item " + ex.Message);
            }
            finally
            {
            }
        }