Пример #1
0
        private void radGridViewExtended1_DoubleClick(object sender, EventArgs e)
        {
            string PessonelNumber = "";
            int    ID             = 0;

            foreach (Telerik.WinControls.UI.GridViewRowInfo item in radGridViewExtended1.SelectedRows)
            {
                PessonelNumber = item.Cells[1].Value.ToString();
                try
                {
                    ID = Convert.ToInt32(item.Cells[0].Value.ToString());
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            if (PessonelNumber != "")
            {
                var dialogResult = PersianMessageBox.Show(this, "مایل به مشاهده پرونده : " + PessonelNumber + " هستید؟", "تایید ", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                if (dialogResult == System.Windows.Forms.DialogResult.Yes)
                {
                    Model.Common.ArchiveCommonDataClassesDataContext dc = new Model.Common.ArchiveCommonDataClassesDataContext(Setting.Sql.ThisProgram.DatabaseConnection.ConnectionString);
                    var df = dc.DocumentsFailures.Where(q => q.ID == ID).FirstOrDefault();
                    if (df != null)
                    {
                        df.isRead      = true;
                        df.DateChecker = System.DateTime.Now;
                        df.Userchecker = Setting.User.ThisProgram.GetCurrentUser <Model.Common.User>().Code;
                        dc.SubmitChanges();
                    }
                    else
                    {
                        return;
                    }
                    Model.Common.User currentUser = Setting.User.ThisProgram.GetCurrentUser <Model.Common.User>();
                    if (currentUser != null)
                    {
                        if (IsMembershipInAdministartorRole(currentUser))
                        {
                            using (View.ArchiverDocumentManagement f = new ArchiverDocumentManagement(PessonelNumber, 0))
                            {
                                f.ShowDialog();
                            }
                        }
                        else if (Setting.User.ThisProgram.CheckUserAccessPermission(currentUser, "ArchiverDocumentManagement", null))
                        {
                            using (View.ArchiverDocumentManagement f = new ArchiverDocumentManagement(PessonelNumber, 0))
                            {
                                f.ShowDialog();
                            }
                        }
                        else if (Setting.User.ThisProgram.CheckUserAccessPermission(currentUser, "ArchiveDocumentShow", null))
                        {
                            using (View.ArchiveDocumentShow f = new ArchiveDocumentShow(PessonelNumber, 0))
                            {
                                f.ShowDialog();
                            }
                        }
                    }
                }
            }
        }
Пример #2
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;
     }
 }