Example #1
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            var gtype = comboBoxGroupType.Text;
            var gname = textBox_GroupName.Text;
            var gdesc = textBox_Description.Text;

            Group grp = new Group(gtype, gname, gdesc);

            grp.GType = gtype;
            grp.GName = gname;
            grp.GDesc = gdesc;

            if (bEdit)
            {
                var myItem = DBUtility.GetGroups().Find(item => item.GName == gname);
                if (myItem == null && gname != "")
                {
                    DBUtility.AddGroup(grp);
                    GetGroups();
                }
                else
                {
                    string message, caption;
                    string language = ChangeLanguage.ReadConfigValue("language");
                    if (language == "he-IL")
                    {
                        message = "שם הקבוצה קיים במערכת";
                        caption = "שגיאה";
                    }
                    else
                    {
                        message = "Department name allready exsits in the system";
                        caption = "Error";
                    }
                    MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);

                    return;
                }
            }
            else
            {
                DBUtility.EditGroup(grp);
            }
            textBox_GroupName.Text   = "";
            textBox_Description.Text = "";
            comboBoxGroupType.Text   = "";
            //instance event args and value has been passed
            var args = new GroupIdentityEventArgs(gtype, gname, gdesc);

            //Event has be raised with update arguments of delegate
            GroupIdentityUpdated?.Invoke(this, args);

            this.Hide();
        }
 private void GroupSaveRecord(object sender, GroupIdentityEventArgs e)
 {
     try
     {
         var count = dataGridView.Rows.Count;
         dataGridView.Rows.Add();
         dataGridView.Rows[count].Cells[0].Value = e.GType;
         dataGridView.Rows[count].Cells[1].Value = e.GName;
         dataGridView.Rows[count].Cells[2].Value = e.GDesc;
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #3
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            var gtype = comboBoxGroupType.Text;
            var gname = textBox_GroupName.Text;
            var gdesc = textBox_Description.Text;

            Group grp = new Group(gtype, gname, gdesc);

            if (!bEdit)
            {
                DBUtility.AddGroup(grp);
                //var myItem = DBUtility.GetGroups().Find(item => item.GName == gname);
                //if (myItem == null)
                //{
                //    DBUtility.AddGroup(grp);
                //}
                //else
                //{
                //    MessageBox.Show("מחלקה בשם זה קיימת במערכת");
                //    return;
                //}
            }
            else
            {
                DBUtility.EditGroup(grp);
            }

            //instance event args and value has been passed
            var grpargs = new GroupIdentityEventArgs(gtype, gname, gdesc);

            //Event has be raised with update arguments of delegate
            GroupIdentityUpdated?.Invoke(this, grpargs);

            this.Hide();
            this.Close();
        }
Example #4
0
 private void UpdateRecord(object sender, GroupIdentityEventArgs e)
 {
     dataGridView.Rows[_row].Cells[0].Value = e.GType;
     dataGridView.Rows[_row].Cells[1].Value = e.GName;
     dataGridView.Rows[_row].Cells[2].Value = e.GDesc;
 }