Пример #1
0
        private void btnDeletGroup_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (IDGroup != 0)
                {
                    if (MessageBox.Show("هل تريد حذف العنصر المحدد؟", "حذف", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                    {
                        PharmaLinq = new Linq.PharmaLinqDataContext(flag.Con);
                        Linq.Group group = PharmaLinq.Groups.Single(item => item.ID_Groups == IDGroup);

                        group.Exist = false;
                        PharmaLinq.SubmitChanges();

                        MessageBox.Show("تم الحذف");


                        USC.USC_GROUPS_MANGE frm = new USC_GROUPS_MANGE();
                        MainWindow.GetMainForm.GridUsc.Children.Clear();
                        MainWindow.GetMainForm.GridUsc.Children.Add(frm);
                    }
                }
                else
                {
                    MessageBox.Show("الرجاء اختيار عنصر");
                }
            }
            catch (Exception ex)
            {
                flag.Con.Close();
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void btnSaveGroup_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                PharmaLinq = new Linq.PharmaLinqDataContext(flag.Con);
                Linq.Group group = new Linq.Group();

                group.Exist     = true;
                group.GroupName = txtNameGroup.Text;
                group.ID_User   = IDUser;

                PharmaLinq.Groups.InsertOnSubmit(group);
                PharmaLinq.SubmitChanges();

                MessageBox.Show("تم الحفظ");

                btnNewGroup.IsEnabled   = true;
                btnEditGroup.IsEnabled  = true;
                btnDeletGroup.IsEnabled = true;
                btnSaveGroup.IsEnabled  = false;

                USC.USC_GROUPS_MANGE frm = new USC_GROUPS_MANGE();
                MainWindow.GetMainForm.GridUsc.Children.Clear();
                MainWindow.GetMainForm.GridUsc.Children.Add(frm);
            }
            catch (Exception ex)
            {
                flag.Con.Close();
                MessageBox.Show(ex.Message);
            }
        }
Пример #3
0
 private void btnGroupsMange_Selected(object sender, RoutedEventArgs e)
 {
     USC.USC_GROUPS_MANGE Groups = new USC.USC_GROUPS_MANGE();
     GridUsc.Children.Clear();
     Groups.IDUser = IDUSER_main;
     GridUsc.Children.Add(Groups);
 }