Beispiel #1
0
 public static void Insert(Model.Archive.Info info)
 {
     if (info == null)
     {
         return;
     }
     Model.Archive.ArchiveDataClassesDataContext dc = Model.Archive.ArchiveDataClassesDataContext.GetNewInstance();
     dc.Connection.Open();
     dc.Transaction = dc.Connection.BeginTransaction();
     try
     {
         dc.Infos.InsertOnSubmit(info);
         dc.SubmitChanges();
         dc.Transaction.Commit();
     }
     catch (Exception ex)
     {
         dc.Transaction.Rollback();
         throw new Exception("خطا در ثبت اطلاعات" + "\r\n\r\n" + ex.Message);
     }
     finally
     {
         dc.Connection.Close();
     }
 }
Beispiel #2
0
 internal static void InsertOrUpdate(Model.Archive.Info info, Model.Archive.ArchiveDataClassesDataContext dc)
 {
     try
     {
         if (info == null)
         {
             return;
         }
         var query = dc.Infos.Where(t => t.PersonnelNumber == info.PersonnelNumber);
         if (query.Count() == 1)
         {
             var originalInfo = query.Single();
             Model.Archive.Info.Copy(originalInfo, info);
             dc.SubmitChanges();
         }
         else
         {
             dc.Infos.InsertOnSubmit(info);
             dc.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         throw new Exception("خطا در ثبت اطلاعات" + "\r\n\r\n" + ex.Message);
     }
 }
Beispiel #3
0
        private void LoadContactInfo(Model.Archive.Dossier dossier)
        {
            if (!Setting.Archive.ThisProgram.LoadedArchiveSettings.InfoGroupTab)
            {
                return;
            }

            List <Model.Archive.ContactView> contactView = Controller.Archive.ContactController.Select(dossier.PersonnelNumber);

            contactViewBindingSource.DataSource = contactView;

            List <Model.Archive.AddressView> addressView = Controller.Archive.AddressController.Select(dossier.PersonnelNumber);

            addressViewBindingSource.DataSource = addressView;

            Model.Archive.Info info = Controller.Archive.InfoController.Select(dossier.PersonnelNumber);
            if (info.IsNullOrEmpty())
            {
                txtComment.Text = null;
                txtEmail.Text   = null;
                txtWebsite.Text = null;
                return;
            }
            txtComment.Text = info.Comment;
            txtEmail.Text   = info.Email;
            txtWebsite.Text = info.Website;
        }
Beispiel #4
0
 private bool SaveInformation()
 {
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         List <Model.Archive.ArchiveTab>         archiveTabs    = Controller.Archive.ArchiveTabController.GetActiveDossierTabs();
         Model.Archive.Dossier                   dossier        = Model.Archive.Dossier.GetNewInstance(PersonnelNumberTextBox.Text, imageData.IsNullOrEmpty() ? null : new System.Data.Linq.Binary(imageData), this.SelectedDossier.FilesPathOrDatabaseName, int.Parse((dossierTypeComboBoxExtended.SelectedItem as Njit.Program.Controls.ComboBoxExtended.CustomItem).Value.ToString()));
         List <System.Data.SqlClient.SqlCommand> sqlCommandList = new List <System.Data.SqlClient.SqlCommand>();
         foreach (Model.Archive.ArchiveTab tab in archiveTabs)
         {
             sqlCommandList.Add(SqlHelper.GetDeleteCommandForArchiveTab(tab, PersonnelNumberTextBox.Text));
             foreach (var archiveField in tab.ArchiveFields)
             {
                 if (archiveField.FieldTypeCode == (int)Enums.FieldTypes.زیرگروه_جدولی)
                 {
                     sqlCommandList.Add(SqlHelper.GetDeleteCommandForArchiveField(archiveField, PersonnelNumberTextBox.Text));
                 }
             }
             List <System.Data.SqlClient.SqlCommand> sqlCommands = SqlHelper.GetDossierInsertCommands(tabControlExtended.TabPages[tab.Name], tab, PersonnelNumberTextBox.Text);
             sqlCommandList.AddRange(sqlCommands);
         }
         //--------------- ذخیره اطلاعات تماس و آدرس
         List <Model.Archive.ContactView> contactView = new List <Model.Archive.ContactView>();
         List <Model.Archive.AddressView> addressView = new List <Model.Archive.AddressView>();
         Model.Archive.Info info = null;
         if (Setting.Archive.ThisProgram.LoadedArchiveSettings.InfoGroupTab)
         {
             foreach (Model.Archive.ContactView item in contactViewBindingSource)
             {
                 item.PersonnelNumber = PersonnelNumberTextBox.Text;
                 contactView.Add(item);
             }
             foreach (Model.Archive.AddressView item in addressViewBindingSource)
             {
                 item.PersonnelNumber = PersonnelNumberTextBox.Text;
                 addressView.Add(item);
             }
             if (!(string.IsNullOrEmpty(txtComment.Text) && string.IsNullOrEmpty(txtEmail.Text) && string.IsNullOrEmpty(txtWebsite.Text)))
             {
                 info = Model.Archive.Info.GetNewInstance(PersonnelNumberTextBox.Text, txtComment.Text, txtEmail.Text, txtWebsite.Text);
             }
         }
         Controller.Archive.DossierController.Update(dossier, sqlCommandList, contactView, addressView, info);
         EnableOrDisableForm(false, false);
         PersianMessageBox.Show("اطلاعات پرونده با موفقیت ثبت گردید");
         return(true);
     }
     catch (Exception ex)
     {
         PersianMessageBox.Show(ex.Message);
         return(false);
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }
Beispiel #5
0
 public static void Insert(Model.Archive.Info info, Model.Archive.ArchiveDataClassesDataContext dc)
 {
     try
     {
         if (info == null)
         {
             return;
         }
         dc.Infos.InsertOnSubmit(info);
         dc.SubmitChanges();
     }
     catch (Exception ex)
     {
         throw new Exception("خطا در ثبت اطلاعات" + "\r\n\r\n" + ex.Message);
     }
 }
        private StringBuilder CreateDossier(string PersonnelNumber)
        {
            StringBuilder _Error = new StringBuilder();

            if (CheckPersonnelNumber(PersonnelNumber))
            {
                Model.Archive.ArchiveDataClassesDataContext dc = Model.Archive.ArchiveDataClassesDataContext.GetNewInstance();
                Njit.Common.SystemUtility sysUtil = null;
                try
                {
                    sysUtil = Njit.Program.Options.GetSystemUtility(dc.Connection as System.Data.SqlClient.SqlConnection, Setting.Program.ThisProgram.NetworkName, Setting.Program.ThisProgram.NetworkPort);
                }
                catch (Exception ex)
                {
                    _Error.Append("خطا در اتصال به سرور" + "\r\n" + ex.Message);
                }
                try
                {
                    if (Setting.Archive.ThisProgram.LoadedArchiveSettings.UseDatabase == false && !sysUtil.DirectoryExists(Setting.Archive.ThisProgram.LoadedArchiveSettings.DocumentsPathOrDatabaseName))
                    {
                        throw new Exception("مسیر ذخیره اسناد نامعتبر است\r\nلطفا در قسمت تنظیمات برنامه مسیر ذخیره اسناد را انتخاب کنید" + "\r\n" + Setting.Archive.ThisProgram.LoadedArchiveSettings.DocumentsPathOrDatabaseName);
                    }
                    Model.Archive.Dossier dossier = Model.Archive.Dossier.GetNewInstance(PersonnelNumber, null, Setting.Archive.ThisProgram.LoadedArchiveSettings.UseDatabase ? Setting.Archive.ThisProgram.LoadedArchiveSettings.DocumentsPathOrDatabaseName : Path.Combine(Setting.Archive.ThisProgram.LoadedArchiveSettings.DocumentsPathOrDatabaseName, Njit.Common.PublicMethods.ReplaceInvalidPathAndFileNameChars(PersonnelNumber, "-")), Convert.ToInt32(dossierTypeComboBoxExtended.SelectedValue));
                    List <System.Data.SqlClient.SqlCommand> sqlCommandList = new List <System.Data.SqlClient.SqlCommand>();
                    List <Model.Archive.ContactView>        contactView    = new List <Model.Archive.ContactView>();
                    List <Model.Archive.AddressView>        addressView    = new List <Model.Archive.AddressView>();
                    Model.Archive.Info info = null;

                    Controller.Archive.DossierController.Insert(dossier, sqlCommandList, contactView, addressView, info);
                }
                catch (Exception ex)
                {
                    _Error.Append(ex.Message.ToString());
                }
            }
            else
            {
                _Error.Append("کد پرسنلی");
                _Error.Append("'" + PersonnelNumber + "'");
                _Error.Append("در سیستم وجود دارد");
            }
            return(_Error);
        }
Beispiel #7
0
 public static void Update(Model.Archive.Dossier dossier, List <System.Data.SqlClient.SqlCommand> sSqlCommands,
                           List <Model.Archive.ContactView> contactView, List <Model.Archive.AddressView> addressView, Model.Archive.Info info)
 {
     Model.Archive.ArchiveDataClassesDataContext dc = Model.Archive.ArchiveDataClassesDataContext.GetNewInstance();
     dc.Connection.Open();
     dc.Transaction = dc.Connection.BeginTransaction();
     try
     {
         Controller.Archive.DossierController.Update(dossier, dc);
         //------------
         foreach (System.Data.SqlClient.SqlCommand sqlCommand in sSqlCommands)
         {
             sqlCommand.Connection  = dc.Connection as System.Data.SqlClient.SqlConnection;
             sqlCommand.Transaction = dc.Transaction as System.Data.SqlClient.SqlTransaction;
             sqlCommand.ExecuteNonQuery();
         }
         //------------ اطلاعات تماس و آدرس
         Controller.Archive.InfoController.InsertOrUpdate(info, dc);
         Controller.Archive.AddressController.Update(addressView, dossier.PersonnelNumber, dc);
         Controller.Archive.ContactController.Update(contactView, dossier.PersonnelNumber, dc);
         try
         {
             Setting.User.ThisProgram.AddLog(Setting.User.UserOparatesPlaceNames.پرونده, Setting.User.UserOparatesNames.ویرایش, null, "ویرایش پرونده با " + Setting.Archive.ThisProgram.LoadedArchiveSettings.PersonnelNumber_Label + " " + dossier.PersonnelNumber);
         }
         catch
         {
             throw new Exception("خطا در ذخیره عملکرد کاربر جاری");
         }
         dc.Transaction.Commit();
     }
     catch (Exception ex)
     {
         dc.Transaction.Rollback();
         throw new Exception(ex.Message);
     }
     finally
     {
         dc.Connection.Close();
     }
 }
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (dossierTypeComboBoxExtended.SelectedValue == null)
            {
                MessageBox.Show("سطح دسترسی پرونده ها را مشخص نکرده اید");
            }
            else if (dataGridView1.Rows.Count <= 1)
            {
                MessageBox.Show("اطلاعات دانشجویان وارد نشده است");
            }
            #region CreateDossier
            List <ErrorExcel> _listerro = new List <ErrorExcel>();
            for (int rows = 0; rows < dataGridView1.Rows.Count; rows++)
            {
                string        PersonnelNumber = "";
                StringBuilder er = new StringBuilder();
                try
                {
                    if (dataGridView1.Rows[rows].Cells[0].Value != null)
                    {
                        //کدپرسنلی
                        PersonnelNumber = dataGridView1.Rows[rows].Cells[0].Value.ToString();
                        //چک کردن شماره پرسنلی ها
                        if (CheckPersonnelNumber(PersonnelNumber) == false)
                        {
                            continue;
                        }
                        else
                        {
                            //اضافه کردن ااطلاعات کدپرسنلی
                            List <Model.Archive.ArchiveTab>         archiveTabs    = Controller.Archive.ArchiveTabController.GetActiveDossierTabs();
                            Model.Archive.Dossier                   dossier        = Model.Archive.Dossier.GetNewInstance(PersonnelNumber, null, Setting.Archive.ThisProgram.LoadedArchiveSettings.UseDatabase ? Setting.Archive.ThisProgram.LoadedArchiveSettings.DocumentsPathOrDatabaseName : Path.Combine(Setting.Archive.ThisProgram.LoadedArchiveSettings.DocumentsPathOrDatabaseName, Njit.Common.PublicMethods.ReplaceInvalidPathAndFileNameChars(PersonnelNumber, "-")), Convert.ToInt32(dossierTypeComboBoxExtended.SelectedValue));
                            List <System.Data.SqlClient.SqlCommand> sqlCommandList = new List <System.Data.SqlClient.SqlCommand>();
                            foreach (Model.Archive.ArchiveTab tab in archiveTabs)
                            {
                                sqlCommandList.Add(SqlHelper.GetDeleteCommandForArchiveTab(tab, PersonnelNumber));
                                List <Dossier1> listDossier1 = new List <Dossier1>();
                                //نام
                                listDossier1.Add(CreateDossier1(rows, 1, "Field1", "string"));
                                //نام خانوادگی
                                listDossier1.Add(CreateDossier1(rows, 2, "Field2", "string"));
                                //کدملی
                                listDossier1.Add(CreateDossier1(rows, 3, "Field15", "string"));
                                //نام پدر
                                listDossier1.Add(CreateDossier1(rows, 4, "Field1018", "string"));
                                //جنسیت
                                listDossier1.Add(CreateDossier1(rows, 5, "Field1019", "string"));
                                //ش ش
                                listDossier1.Add(CreateDossier1(rows, 6, "Field1020", "int"));
                                // ت ت
                                listDossier1.Add(CreateDossier1(rows, 7, "Field1021", "string"));
                                //تلفن دائم
                                listDossier1.Add(CreateDossier1(rows, 8, "Field1049", "int"));
                                //تلفن ضروری
                                listDossier1.Add(CreateDossier1(rows, 9, "Field1045", "string"));
                                //تلفن همراه
                                listDossier1.Add(CreateDossier1(rows, 10, "Field1041", "string"));
                                //کد پستی
                                listDossier1.Add(CreateDossier1(rows, 11, "Field1043", "string"));
                                //صندوق پستی
                                listDossier1.Add(CreateDossier1(rows, 12, "Field1044", "string"));
                                //استان
                                listDossier1.Add(CreateDossier1(rows, 13, "Field1034", "string"));
                                //شهر
                                listDossier1.Add(CreateDossier1(rows, 14, "Field1035", "string"));
                                //بخش
                                listDossier1.Add(CreateDossier1(rows, 15, "Field1036", "string"));
                                //ادرس
                                listDossier1.Add(CreateDossier1(rows, 16, "Field1029", "string"));
                                //رشته
                                listDossier1.Add(CreateDossier1(rows, 17, "Field1032", "string"));
                                //مقطع
                                listDossier1.Add(CreateDossier1(rows, 18, "Field1033", "string"));
                                //معدل
                                listDossier1.Add(CreateDossier1(rows, 19, "Field1046", "double"));
                                //تاریخ اخذ
                                listDossier1.Add(CreateDossier1(rows, 20, "Field1048", "string"));
                                //نظام وظیفه
                                listDossier1.Add(CreateDossier1(rows, 21, "Field1047", "string"));
                                //دین
                                listDossier1.Add(CreateDossier1(rows, 22, "Field1037", "string"));
                                //مذهب
                                listDossier1.Add(CreateDossier1(rows, 23, "Field1038", "string"));
                                //ملیت
                                listDossier1.Add(CreateDossier1(rows, 24, "Field1042", "string"));
                                //سال قبولی
                                listDossier1.Add(CreateDossier1(rows, 25, "Field1040", "int"));
                                //رتبه
                                listDossier1.Add(CreateDossier1(rows, 26, "Field1039", "int"));
                                //سهمیه نهایی
                                listDossier1.Add(CreateDossier1(rows, 27, "Field1025", "string"));
                                //سهمیه ثبت نام
                                listDossier1.Add(CreateDossier1(rows, 28, "Field1024", "string"));
                                //ترم ورود
                                listDossier1.Add(CreateDossier1(rows, 29, "Field1023", "int"));
                                //تاریخ شروع تحصیل
                                listDossier1.Add(CreateDossier1(rows, 30, "Field1022", "int"));
                                //نیسمال ثبت نام
                                listDossier1.Add(CreateDossier1(rows, 31, "Field1026", "int"));
                                //نوع پذیرش
                                listDossier1.Add(CreateDossier1(rows, 32, "Field1027", "string"));
                                // نوع بورسیه
                                listDossier1.Add(CreateDossier1(rows, 33, "Field1028", "string"));
                                //نوع دوره
                                listDossier1.Add(CreateDossier1(rows, 34, "Field1030", "string"));
                                //دانشکده
                                listDossier1.Add(CreateDossier1(rows, 35, "Field1031", "string"));
                                //شماره قدیم
                                listDossier1.Add(CreateDossier1(rows, 36, "Field1050", "string"));
                                //دانشجو میهمان
                                listDossier1.Add(CreateDossier1(rows, 37, "Field1051", "bool"));
                                listDossier1.Add(CreateDossier1(rows, 38, "Field1052", "bool"));
                                listDossier1.Add(CreateDossier1(rows, 39, "Field1053", "string"));
                                List <System.Data.SqlClient.SqlCommand> sqlCommands = SqlHelper.GetDossier1InsertCommands(listDossier1, tab, PersonnelNumber);
                                sqlCommandList.AddRange(sqlCommands);
                                List <Model.Archive.ContactView> contactView = new List <Model.Archive.ContactView>();
                                List <Model.Archive.AddressView> addressView = new List <Model.Archive.AddressView>();
                                Model.Archive.Info info = null;

                                Controller.Archive.DossierController.Insert(dossier, sqlCommandList, contactView, addressView, info);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    er.Append(ex);
                }

                if (er.Length != 0)
                {
                    ErrorExcel ex = new ErrorExcel();
                    ex.Row             = rows;
                    ex.PerssonelNumber = PersonnelNumber;
                    ex.Error           = er;
                    _listerro.Add(ex);
                    continue;
                }
            }
            #endregion
            if (_listerro.Any())
            {
                radGridViewExtended1.DataSource = null;
                radGridViewExtended1.DataSource = _listerro;
                radGridViewExtended1.EnableAlternatingRowColor = true;
            }
            else
            {
                MessageBox.Show("تمام اطلاعات با موفقیت ثبت شد");
            }
        }
Beispiel #9
0
 private void SaveInformation()
 {
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         Model.Archive.ArchiveDataClassesDataContext dc = Model.Archive.ArchiveDataClassesDataContext.GetNewInstance();
         Njit.Common.SystemUtility sysUtil;
         try
         {
             sysUtil = Njit.Program.Options.GetSystemUtility(dc.Connection as System.Data.SqlClient.SqlConnection, Setting.Program.ThisProgram.NetworkName, Setting.Program.ThisProgram.NetworkPort);
         }
         catch (Exception ex)
         {
             throw new Exception("خطا در اتصال به سرور" + "\r\n" + ex.Message);
         }
         if (Setting.Archive.ThisProgram.LoadedArchiveSettings.UseDatabase == false && !sysUtil.DirectoryExists(Setting.Archive.ThisProgram.LoadedArchiveSettings.DocumentsPathOrDatabaseName))
         {
             throw new Exception("مسیر ذخیره اسناد نامعتبر است\r\nلطفا در قسمت تنظیمات برنامه مسیر ذخیره اسناد را انتخاب کنید" + "\r\n" + Setting.Archive.ThisProgram.LoadedArchiveSettings.DocumentsPathOrDatabaseName);
         }
         List <Model.Archive.ArchiveTab>         archiveTabs    = Controller.Archive.ArchiveTabController.GetActiveDossierTabs();
         Model.Archive.Dossier                   dossier        = Model.Archive.Dossier.GetNewInstance(PersonnelNumberTextBox.Text, imageData.IsNullOrEmpty() ? null : new System.Data.Linq.Binary(imageData), Setting.Archive.ThisProgram.LoadedArchiveSettings.UseDatabase ? Setting.Archive.ThisProgram.LoadedArchiveSettings.DocumentsPathOrDatabaseName : Path.Combine(Setting.Archive.ThisProgram.LoadedArchiveSettings.DocumentsPathOrDatabaseName, Njit.Common.PublicMethods.ReplaceInvalidPathAndFileNameChars(PersonnelNumberTextBox.Text, "-")), int.Parse((dossierTypeComboBoxExtended.SelectedItem as Njit.Program.Controls.ComboBoxExtended.CustomItem).Value.ToString()));
         List <System.Data.SqlClient.SqlCommand> sqlCommandList = new List <System.Data.SqlClient.SqlCommand>();
         foreach (Model.Archive.ArchiveTab item in archiveTabs)
         {
             List <System.Data.SqlClient.SqlCommand> sqlCommand = SqlHelper.GetDossierInsertCommands(tabControlExtended.TabPages[item.Name], item, PersonnelNumberTextBox.Text);
             sqlCommandList.AddRange(sqlCommand);
         }
         //--------------- ذخیره اطلاعات تماس و آدرس
         List <Model.Archive.ContactView> contactView = new List <Model.Archive.ContactView>();
         List <Model.Archive.AddressView> addressView = new List <Model.Archive.AddressView>();
         Model.Archive.Info info = null;
         if (Setting.Archive.ThisProgram.LoadedArchiveSettings.InfoGroupTab)
         {
             foreach (Model.Archive.ContactView item in contactViewBindingSource)
             {
                 item.PersonnelNumber = PersonnelNumberTextBox.Text;
                 contactView.Add(item);
             }
             foreach (Model.Archive.AddressView item in addressViewBindingSource)
             {
                 item.PersonnelNumber = PersonnelNumberTextBox.Text;
                 addressView.Add(item);
             }
             if (!(string.IsNullOrEmpty(txtComment.Text) && string.IsNullOrEmpty(txtEmail.Text) && string.IsNullOrEmpty(txtWebsite.Text)))
             {
                 info = Model.Archive.Info.GetNewInstance(PersonnelNumberTextBox.Text, txtComment.Text, txtEmail.Text, txtWebsite.Text);
             }
         }
         Controller.Archive.DossierController.Insert(dossier, sqlCommandList, contactView, addressView, info);
         EnableOrDisableForm(false, false);
         var result = PersianMessageBox.Show(this, "اطلاعات پرونده با موفقیت ثبت گردید", "اطلاعات ثبت شد", new Njit.MessageBox.VDialogButton[] { new Njit.MessageBox.VDialogButton(Njit.MessageBox.VDialogResult.OK, "ثبت اسناد پرونده"), new Njit.MessageBox.VDialogButton(Njit.MessageBox.VDialogResult.Continue, "ثبت پرونده جدید"), new Njit.MessageBox.VDialogButton(Njit.MessageBox.VDialogResult.Cancel, "خروج") }, Njit.MessageBox.VDialogIcon.Question, Njit.MessageBox.VDialogDefaultButton.Button1, System.Windows.Forms.RightToLeft.Yes, false, null, null, null, null, null);
         if (result == Njit.MessageBox.VDialogResult.Cancel)
         {
             this.Close();
         }
         else if (result == Njit.MessageBox.VDialogResult.Continue)
         {
             InvokeOnClick(btnNewDossier, EventArgs.Empty);
         }
         else if (result == Njit.MessageBox.VDialogResult.OK)
         {
             Model.Common.User currentUser = Setting.User.ThisProgram.GetCurrentUser <Model.Common.User>();
             if (currentUser != null)
             {
                 if (IsMembershipInAdministartorRole(currentUser))
                 {
                     using (View.ArchiverDocumentManagement f = new ArchiverDocumentManagement(dossier.PersonnelNumber, 0))
                     {
                         this.Close();
                         f.ShowDialog();
                     }
                 }
                 else if (Setting.User.ThisProgram.CheckUserAccessPermission(currentUser, "ArchiverDocumentManagement", null))
                 {
                     using (View.ArchiverDocumentManagement f = new ArchiverDocumentManagement(dossier.PersonnelNumber, 0))
                     {
                         this.Close();
                         f.ShowDialog();
                     }
                 }
                 else if (Setting.User.ThisProgram.CheckUserAccessPermission(currentUser, "ArchiveDocumentShow", null))
                 {
                     using (View.ArchiveDocumentShow f = new ArchiveDocumentShow(dossier.PersonnelNumber, 0))
                     {
                         this.Close();
                         f.ShowDialog(this);
                     }
                 }
                 else
                 {
                     PersianMessageBox.Show("شما به صفحه اضافه کردن اسناد دسترسی ندارید");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         PersianMessageBox.Show(ex.Message);
         return;
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }