Example #1
0
        private void RibbonToggleButtonDaryaftShod_Click(object sender, RoutedEventArgs e)
        {
            Darkhastha2 selectedItem = (Darkhastha2)GridViewDarkhastha.SelectedItem;

            if (selectedItem == null)
            {
                DialogBoxOk dialogBoxOk = new DialogBoxOk();
                dialogBoxOk.Message = "ابتدا یک درخواست را انتخاب کنید";
                dialogBoxOk.ShowDialog();
                return;
            }

            var darkhastQuery = from d in Entities.Darkhasthas
                                where d.DarkhastGUID == selectedItem.DarkhastGuid
                                select d;
            Darkhastha darkhast = darkhastQuery.FirstOrDefault();

            if (RibbonToggleButtonDaryaftShod.IsChecked == true)
            {
                darkhast.TarikhDaryaftKala = DateTime.Now;
            }
            else
            {
                darkhast.TarikhDaryaftKala = null;
            }

            Darkhastha_Log2.InsertLog(darkhast, RevisionOperation.Update);
            Entities.SaveChanges();
            LoadGridViewDarkhastha();
        }
Example #2
0
 void currentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     if (e.ExceptionObject.GetType() == typeof(SqlCeException))
     {
         DialogBoxOk dialogBoxOk = new DialogBoxOk();
         dialogBoxOk.Message = "دیتابیس مشغول است.لطفا بعد از چند لحظه دوباره سعی کنید.";
         dialogBoxOk.ShowDialog();
     }
 }
Example #3
0
        private void ButtonDeleteBakhshName_Click(object sender, RoutedEventArgs e)
        {
            Bakhshha selectedBakhsh = (Bakhshha)ComboBoxBakhshName.SelectedItem;

            if (selectedBakhsh == null)
            {
                return;
            }

            DialogBoxConfrimDelete dialogBoxConfrimDelete = new DialogBoxConfrimDelete();

            dialogBoxConfrimDelete.Message =
                "آیا از حذف این بخش اطمینان دارید؟در صورت حذف بخش دستگاه های آن بخش نیز حذف خواهند شد";
            dialogBoxConfrimDelete.ShowDialog();

            if (dialogBoxConfrimDelete.DialogResult == true)
            {
                var dastgahtQuery = from dastgah in Entities.Dastgahhas
                                    where dastgah.BakhshGUID == selectedBakhsh.BakhshGUID
                                    select dastgah;

                if (dastgahtQuery.Any())
                {
                    DialogBoxOk dialogBoxOk = new DialogBoxOk();
                    dialogBoxOk.Message = "این بخش شامل دستگاه هایی می باشد و قابل حذف نیست";
                    dialogBoxOk.ShowDialog();
                    return;
                }


                var dastgahQuery = from d in Entities.Dastgahhas
                                   where d.BakhshGUID == selectedBakhsh.BakhshGUID
                                   select d;

                foreach (var dd in dastgahQuery)
                {
                    Entities.Dastgahhas.DeleteObject(dd);
                }

                var bakhshQuery = from b in Entities.Bakhshhas
                                  where b.BakhshGUID == selectedBakhsh.BakhshGUID
                                  select b;
                Entities.Bakhshhas.DeleteObject(bakhshQuery.FirstOrDefault());

                Entities.SaveChanges();

                LoadComboBoxBakhshName();

                Darkhast.DialogBoxOk dialogBoxOk2 = new DialogBoxOk();
                dialogBoxOk2.Message = "بخش انتخاب شده حذف شد";
                dialogBoxOk2.ShowDialog();
            }
        }
Example #4
0
        private void MenuItemCopyTedadDarkhast_Click(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            Darkhastha2 currentRow = (Darkhastha2)GridViewDarkhastha.SelectedItem;

            if (currentRow != null)
            {
                Clipboard.SetText(currentRow.TedadDarkhast.ToString(), TextDataFormat.UnicodeText);
            }
            else
            {
                DialogBoxOk dialogBoxOk = new DialogBoxOk();
                dialogBoxOk.Message = "ابتدا یک درخواست را انتخاب کنید";
                dialogBoxOk.ShowDialog();
            }
        }
Example #5
0
        private void MenuItemCopyKalaNameArabi_Click(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            Darkhastha2 currentRow = (Darkhastha2)GridViewDarkhastha.SelectedItem;

            if (currentRow != null)
            {
                Clipboard.SetText(currentRow.DarkhastName.Replace("ی", "ي").Replace("ک", "ك"), TextDataFormat.UnicodeText);
            }
            else
            {
                DialogBoxOk dialogBoxOk = new DialogBoxOk();
                dialogBoxOk.Message = "ابتدا یک درخواست را انتخاب کنید";
                dialogBoxOk.ShowDialog();
            }
        }
Example #6
0
        private void ButtonDeleteDastgahName_Click(object sender, RoutedEventArgs e)
        {
            DialogBoxConfrimDelete dialogBoxConfrimDelete = new DialogBoxConfrimDelete();

            dialogBoxConfrimDelete.Message = "آیا از حذف این دستگاه اطمینان دارید؟";
            dialogBoxConfrimDelete.ShowDialog();

            if (dialogBoxConfrimDelete.DialogResult == true)
            {
                Bakhshha  bakhsh  = (Bakhshha)ComboBoxBakhshName2.SelectedItem;
                Dastgahha dastgah = (Dastgahha)ComboBoxDastgahName.SelectedItem;

                var darkhastQuery = from darkhast in Entities.Darkhasthas
                                    where darkhast.DastgahGUID == dastgah.DastgahGUID
                                    select darkhast;

                if (darkhastQuery.Any())
                {
                    DialogBoxOk dialogBoxOk2 = new DialogBoxOk();
                    dialogBoxOk2.Message = "این دستگاه قبلا در درخواست ها استفاده شده است و نمی توانید آن را حذف کنید.فقط می توانید آن را ویرایش کنید";
                    dialogBoxOk2.ShowDialog();
                    return;
                }

                var deleteQuery = from d in Entities.Dastgahhas
                                  where d.BakhshGUID == bakhsh.BakhshGUID && d.DastgahGUID == dastgah.DastgahGUID
                                  select d;

                Entities.Dastgahhas.DeleteObject(((Dastgahha)deleteQuery.FirstOrDefault()));
                Entities.SaveChanges();

                LoadComboBoxDastgahName();
                DialogBoxOk dialogBoxOk = new DialogBoxOk();
                dialogBoxOk.Message = "دستگاه حذف شد";
                dialogBoxOk.ShowDialog();
            }
        }