Ejemplo n.º 1
0
 private void AddTile_Click1(object sender, EventArgs e)
 {
     using (RegionAddEditForm regionAddEditForm = new RegionAddEditForm(null, null))
     {
         regionAddEditForm.ShowDialog();
     }
     dataShow();
 }
Ejemplo n.º 2
0
        private void EditTile_Click(object sender, EventArgs e)
        {
            if (regionDataGridView.Rows.Count != 0 && regionDataGridView.Rows != null)
            {
                regionInformation.Regionname = regionDataGridView.SelectedRows[0].Cells[0].Value.ToString();
                if (!string.IsNullOrEmpty(regionInformation.Regionname))
                {
                    try
                    {
                        Connection.Open();
                        SqlDataAdapter Adapter = new SqlDataAdapter(string.Format("Select RegionID From RegionInformation Where Regionname='{0}'", regionInformation.Regionname), Connection);
                        DataTable      RegionInfomationTable = new DataTable();
                        Adapter.Fill(RegionInfomationTable);

                        foreach (DataRow row in RegionInfomationTable.Rows)
                        {
                            regionID = Convert.ToString(row["RegionID"]);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Region Edit", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Connection.Close();
                    }
                    finally
                    {
                        Connection.Close();
                    }

                    using (RegionAddEditForm regionAddEditForm = new RegionAddEditForm(regionID, regionInformation.Regionname))
                    {
                        regionAddEditForm.ShowDialog();
                    }
                }
                else
                {
                    MetroFramework.MetroMessageBox.Show(this, "Data dosen't selected", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            dataShow();
        }