private void btn_AddGroup_Click_1(object sender, EventArgs e)
        {
            ButtonMarker.Top = btn_AddGroup.Top + 60;
            var addgrp = new AddGroup();

            addgrp.GroupIdentityUpdated += this.GroupSaveRecord;
            addgrp.ShowDialog();
        }
Exemple #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dataGridView.SelectedRows.Count > 0)
            {
                try
                {
                    var row   = dataGridView.CurrentCell.RowIndex;
                    var gtype = Convert.ToString(dataGridView.Rows[row].Cells[0].Value);
                    var gname = Convert.ToString(dataGridView.Rows[row].Cells[1].Value);
                    var gdesc = Convert.ToString(dataGridView.Rows[row].Cells[2].Value);

                    _row = row;

                    var addGrp = new AddGroup();

                    addGrp.LoadData(gtype, gname, gdesc);
                    addGrp.GroupIdentityUpdated += this.UpdateRecord;
                    addGrp.btnEdit.Visible       = false;
                    addGrp.btnAdd.Visible        = false;
                    addGrp.dataGridView.Hide();
                    addGrp.Size             = new Size(addGrp.Size.Width, 270);
                    addGrp.btn_Save.Visible = true;



                    addGrp.ShowDialog();
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Log.Write2Log(exception.Message.ToString());
                }
            }
            else
            {
                string message, caption;
                string language = ChangeLanguage.ReadConfigValue("language");
                if (language == "he-IL")
                {
                    message = "אנא בחר/י רשומה מהטבלה לעריכה";
                    caption = "קבוצה";
                }
                else
                {
                    message = "Please select a record for editing";
                    caption = "Department";
                }
                MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }