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();
        }
Example #2
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();
        }