コード例 #1
0
        public override ProceedTypes GetProceedTypeForVerificationResult(VerificationResult verRes)
        {
            UserSelectedActions userAction = verRes.UserAction;
            string selectedSug             = verRes.SelectedSuggestion;

            //Debug.WriteLine(userAction.ToString());

            if (userAction == UserSelectedActions.Change)
            {
                if (m_curVerifData.RangeToHighlight.Text != selectedSug)
                {
                    if (!m_curVerifData.RangeToHighlight.TryChangeText(selectedSug))
                    {
                        this.VerificationWindowInteractive.InvokeMethod(() =>
                                                                        PersianMessageBox.Show(VerificationWindowInteractive.GetWin32Window(), "تغییر مورد نظر قابل اعمال نیست!")
                                                                        );

                        return(ProceedTypes.InvalidUserAction);
                    }
                    else
                    {
                        base.RefreshForChangeCalled(m_curVerifData.ErrorText, selectedSug);
                        return(ProceedTypes.IdleProceed);
                    }
                }
            }

            return(ProceedTypes.IdleProceed);
        }
コード例 #2
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (!(btnOK.Focused || passwordTextBox.Focused))
     {
         Njit.Common.SendKeys.SendKeyDown(Keys.Tab);
         this.DialogResult = System.Windows.Forms.DialogResult.None;
         return;
     }
     try
     {
         ValidateContent();
     }
     catch (Njit.Common.ValidateException ex)
     {
         PersianMessageBox.Show(ex.ErrorMessage);
         if (ex.Control != null)
         {
             ex.Control.Focus();
             if (ex.Control is TextBox)
             {
                 (ex.Control as TextBox).SelectAll();
             }
             errorProvider.SetError(ex.Control, ex.ErrorMessage);
             ex.Control.TextChanged -= Control_TextChanged;
             ex.Control.TextChanged += Control_TextChanged;
         }
         this.DialogResult = System.Windows.Forms.DialogResult.None;
         return;
     }
     Options.SettingInitializer.GetUserSetting().SetCurrentUser(usersComboBox.SelectedItem ?? Options.SettingInitializer.GetUserSetting().GetUserByUserName(usersComboBox.Text));
     Properties.Settings.Default.LastUser = usersComboBox.Text;
     Properties.Settings.Default.Save();
 }
コード例 #3
0
ファイル: UserList.cs プロジェクト: Shiraz-NJIT/Mahba
        protected override void SaveUserData(int code, string fullname, string roleCode, string stateCode, bool _isguest, bool isLogin, DateTime?_Expire)
        {
            Model.Common.ArchiveCommonDataClassesDataContext dc = new Model.Common.ArchiveCommonDataClassesDataContext(Setting.Sql.ThisProgram.DatabaseConnection.ConnectionString);
            Model.Common.User originalMembership = dc.Users.Where(t => t.Code == code).Single();
            string            originalFullName   = originalMembership.FullName;

            Model.Common.User newInstance = Model.Common.User.GetNewInstance(code, fullname, originalMembership.Password, fullname, originalMembership.NikName, originalMembership.LastLogin, roleCode, stateCode, Setting.User.ThisProgram.GetUserVisible(code, true), _isguest, false, _Expire, Setting.Program.GetMacAddress().ToString());
            dc.Connection.Open();
            dc.Transaction = dc.Connection.BeginTransaction();
            try
            {
                Model.Common.User.Copy(originalMembership, newInstance);
                dc.SubmitChanges();
                try
                {
                    Setting.User.ThisProgram.AddLog(dc, Setting.User.UserOparatesPlaceNames.کاربران, Setting.User.UserOparatesNames.ویرایش, null, "ویرایش اطلاعات کاربر با نام '" + originalFullName + "'");
                }
                catch
                {
                    throw new Exception("خطا در ذخیره عملکرد کاربر جاری");
                }
            }
            catch (Exception ex)
            {
                dc.Transaction.Rollback();
                dc.Connection.Close();
                PersianMessageBox.Show(this, "خطا در ثبت اطلاعات" + Environment.NewLine + Environment.NewLine + ex.Message);
                return;
            }
            dc.Transaction.Commit();
            dc.Connection.Close();

            Setting.User.ThisProgram.SetCurrentUser(dc.Users.Where(t => t.Code == Setting.User.ThisProgram.GetCurrentUser <Model.Common.User>().Code).Single());
        }
コード例 #4
0
        public override bool ShowBatchModeStats()
        {
            string message = string.Format("تعداد اصلاحات انجام شده: {0}", ParsingUtils.ConvertNumber2Persian(m_bachModeStats.ToString()));

            PersianMessageBox.Show(ThisAddIn.GetWin32Window(), message, Constants.UIMessages.SuccessRefinementTitle);
            return(false);
        }
コード例 #5
0
        private void BtnAddLetterToIgnoreListClick(object sender, EventArgs e)
        {
            string input = tetLetterToIgnore.Text.Trim();

            if (input.Length > 1)
            {
                PersianMessageBox.Show("لطفاً تنها یک حرف درج کنید.");
            }
            else if (input.Length < 1)
            {
                PersianMessageBox.Show("لطفاً یک حرف درج کنید.");
            }
            else
            {
                if (GetAllCharsRefinerSettings().ContainsCharInIgnoreList(input[0]))
                {
                    PersianMessageBox.Show("این حرف قبلاً به لیست افزوده شده بود.");
                }
                else
                {
                    if (AddLetterToIgnoreList(input[0], false))
                    {
                        tetLetterToIgnore.Text = "";
                    }
                }
            }
        }
コード例 #6
0
 private bool CallValidateContent()
 {
     if (callTypeComboBoxExtended.Text == "")
     {
         PersianMessageBox.Show(this, "نوع تماس تکمیل نشده است");
         errorProvider.SetError(callTypeComboBoxExtended, "نوع تماس تکمیل نشده است");
         callTypeComboBoxExtended.Focus();
         return(false);
     }
     if (callTypeComboBoxExtended.SelectedIndex == -1)
     {
         PersianMessageBox.Show(this, "نوع تماس را از لیست انتخاب کنید\r\nبا کلیک بر روی آیتم ... امکان تعریف نوع های تماس بیشتر فراهم میگردد");
         errorProvider.SetError(callTypeComboBoxExtended, "نوع تماس را از لیست انتخاب کنید\r\nبا کلیک بر روی آیتم ... امکان تعریف نوع های تماس بیشتر فراهم میگردد");
         callTypeComboBoxExtended.Focus();
         return(false);
     }
     if (string.IsNullOrEmpty(NumbertextBoxExtended.Text))
     {
         PersianMessageBox.Show(this, "شماره تماس تکمیل نشده است");
         errorProvider.SetError(NumbertextBoxExtended, "شماره تماس تکمیل نشده است");
         NumbertextBoxExtended.Focus();
         return(false);
     }
     return(true);
 }
コード例 #7
0
 public bool CheckValidationsForSave(string originalPersonnelNumber)
 {
     if (dossierTypeComboBoxExtended.SelectedIndex == -1)
     {
         PersianMessageBox.Show(this, "نوع پرونده انتخاب نشده است");
         errorProvider.SetError(dossierTypeComboBoxExtended, "نوع پرونده انتخاب نشده است");
         dossierTypeComboBoxExtended.Focus();
         return(false);
     }
     foreach (TabPage tabPage in tabControlExtended.TabPages)
     {
         if (tabPage.Name != InfoTabPage.Name)
         {
             if (tabPage.Contains(PersonnelNumberTextBox))
             {
                 if (CheckPersonnelNumber(originalPersonnelNumber) == false)
                 {
                     tabControlExtended.SelectedTab = tabPage;
                     return(false);
                 }
             }
             if (CheckTabFields(tabPage) == false)
             {
                 tabControlExtended.SelectedTab = tabPage;
                 return(false);
             }
         }
     }
     return(true);
 }
コード例 #8
0
 public void ShowEditItemsForm()
 {
     if (this.AllowCheckAccessPermission && !this.DesignMode)
     {
         if (Njit.Program.Options.SettingInitializer != null)
         {
             if (!Njit.Program.Options.SettingInitializer.GetUserSetting().CheckUserAccessPermission(this))
             {
                 PersianMessageBox.Show(this.SecurityErrorMessage);
                 return;
             }
         }
     }
     if (this.EditItemsForm != null)
     {
         this.EditItemsForm.ShowDialog();
         this.RefreshData();
         OnEditItemsFormClosedAndDataRefreshed();
     }
     else
     {
         using (Forms.ComboBoxEditItems form = new Forms.ComboBoxEditItems(this.DataAccess, this.TableName, this.KeyField, this.CaptionField, this.IsDefaultField))
         {
             form.ShowDialog();
             this.RefreshData();
             OnEditItemsFormClosedAndDataRefreshed();
         }
     }
 }
コード例 #9
0
ファイル: ImportFiles.cs プロジェクト: Shiraz-NJIT/Mahba
        private void VsTwain_ImageAcquired(object sender, EventArgs e)
        {
            lblStatus.Text = "درحال ذخیره تصویر...";
            string fileName     = Njit.Common.PersianCalendar.GetDate(DateTime.Now, "-") + " " + Njit.Common.PersianCalendar.GetTime(DateTime.Now, "-", true, true);
            string documentPath = Path.Combine(tempDirectory, fileName + ".tiff").ToString();
            int    i            = 0;

            while (System.IO.File.Exists(documentPath))
            {
                documentPath = Path.Combine(tempDirectory, fileName + "(" + (++i).ToString() + ")" + ".tiff").ToString();
            }
            try
            {
                VsTwain.FileFormat = Vintasoft.Twain.FileFormat.TiffMulti;
                VsTwain.SaveImage(0, documentPath);
                VsTwain.DeleteImage(0);
            }
            catch (Exception ex)
            {
                PersianMessageBox.Show(this, "خطا در ذخیره فایل اسکن شده" + "\r\n\r\n" + ex.Message);
                return;
            }
            if (checkBoxInsertFilesIntoCurrentPosition.Checked)
            {
                imageViewer.InsertFile(documentPath);
            }
            else
            {
                imageViewer.AddFile(documentPath);
            }
            lblStatus.Text = "در حال اعمال روشنایی و کنتراست بر روی تصویر...";
            SetImageBrightnessAndContrast(documentPath);
        }
コード例 #10
0
        protected override void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                base.btnDelete_Click(sender, e);

                if (radGridView1.RowCount == 0)
                {
                    return;
                }
                if (radGridView1.CurrentRow == null)
                {
                    return;
                }
                int?   IDParent = radGridView1.CurrentRow.Cells["IDParent"].Value.IsNullOrEmpty() ? (int?)null : int.Parse(radGridView1.CurrentRow.Cells["IDParent"].Value.ToString());
                string Title    = radGridView1.CurrentRow.Cells["Label"].Value.ToString();
                if (IDParent != _ArchiveGroupID)
                {
                    PersianMessageBox.Show(this, "تغییر نام گروه اطلاعاتی " + Title + " از این سطح امکان پذیر نمی باشد", "اطلاع", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (DialogResult.Yes == PersianMessageBox.Show(this, "می خواهید گروه اطلاعاتی " + Title + " حذف شود و بایگانی ها به صورت مستقل از این گروه اطلاعاتی استفاده کنند؟ ", "تاییدیه حذف", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                {
                    int ID = int.Parse(radGridView1.CurrentRow.Cells["ID"].Value.ToString());
                    Controller.Common.ArchiveGroupTabController.Delete(ID);
                    SelectAllGroups();
                }
            }
            catch (Exception ex)
            {
                PersianMessageBox.Show(ex.Message);
            }
        }
コード例 #11
0
        private void btnRestore_Click(object sender, EventArgs e)
        {
            string restore_file = System.IO.Path.Combine(this.BackupPath, treeView.SelectedNode.Text + "." + this.BackupExtension);

            this.Cursor = Cursors.WaitCursor;
            Njit.Sql.Backup.BackupResult backupResult = Njit.Sql.Backup.BackupDatabase(Options.SystemUtility, Options.MasterDataAccess, this, this.Database, System.IO.Path.Combine(this.BackupPath, "پشتیبان خودکار قبل از بازیابی اطلاعات (" + Njit.Common.PersianCalendar.GetDateWithMonthName(DateTime.Now, " ") + " " + Njit.Common.PersianCalendar.GetTimeReverced(DateTime.Now, "-", true) + ")" + "." + this.BackupExtension), false, false);
            switch (backupResult)
            {
            case Njit.Sql.Backup.BackupResult.Success:
                break;

            case Njit.Sql.Backup.BackupResult.PathError:
            case Njit.Sql.Backup.BackupResult.SqlError:
            case Njit.Sql.Backup.BackupResult.Cancel:
                PersianMessageBox.Show(this, "خطا در پشتیبان گیری خودکار قبل از بازیابی اطلاعات");
                break;
            }
            Njit.Sql.Backup.RestoreResult result = Njit.Sql.Backup.RestoreDatabase(Options.MasterDataAccess, this, this.Database, restore_file, true, true);
            this.Cursor = Cursors.Default;
            if (result == Njit.Sql.Backup.RestoreResult.Success)
            {
                Close();
                ExitApplication();
            }
        }
コード例 #12
0
        protected override void btnRename_Click(object sender, EventArgs e)
        {
            try
            {
                base.btnRename_Click(sender, e);

                if (radGridView1.RowCount == 0)
                {
                    return;
                }
                if (radGridView1.SelectedRows == null)
                {
                    return;
                }
                string Title    = radGridView1.CurrentRow.Cells["Label"].Value.ToString();
                int    ID       = int.Parse(radGridView1.CurrentRow.Cells["ID"].Value.ToString());
                int?   IDParent = radGridView1.CurrentRow.Cells["IDParent"].Value.IsNullOrEmpty() ? (int?)null : int.Parse(radGridView1.CurrentRow.Cells["IDParent"].Value.ToString());
                if (IDParent != _ArchiveGroupID)
                {
                    PersianMessageBox.Show(this, "تغییر نام گروه اطلاعاتی " + Title + " از این سطح امکان پذیر نمی باشد", "اطلاع", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (DialogResult.OK == new View.ArchiveGroupTabAddEdit(ReturnTypeCode(), ID, Title).ShowDialog())
                {
                    SelectAllGroups();
                }
            }
            catch (Exception ex)
            {
                PersianMessageBox.Show(ex.Message);
            }
        }
コード例 #13
0
 private void btnSelect_Click(object sender, EventArgs e)
 {
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             if (_DataStream != null)
             {
                 this._DataStream.Dispose();
             }
             this._DataStream = new MemoryStream(File.ReadAllBytes(openFileDialog.FileName));
             Image tempImg = Image.FromStream(this._DataStream);
             if (tempImg.Width > this.MaxWidth || tempImg.Height > this.MaxHeight)
             {
                 DeletePicture();
                 tempImg.Dispose();
                 PersianMessageBox.Show(this, string.Format("اندازه تصویر نباید از {0} در {1} پیکسل بزرگتر باشد", this.MaxWidth, this.MaxHeight));
                 return;
             }
             tempImg.Dispose();
             RefreshPicture();
         }
         catch (Exception ex)
         {
             DeletePicture();
             PersianMessageBox.Show(this, "خطا در بارگذاری تصویر" + "\r\n\r\n" + ex.Message);
         }
     }
 }
コード例 #14
0
ファイル: FieldManage.cs プロジェクト: Shiraz-NJIT/Mahba
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (radGridView.SelectedRows.Count != 1)
            {
                return;
            }
            Field field = new Field(radGridView.SelectedRows[0]);

            if (field.ParentID.HasValue)
            {
                PersianMessageBox.Show(this, "این فیلد را از اینجا نمی توانید ویرایش کنید");
                return;
            }
            using (View.BaseForms.FieldEdit f = new View.BaseForms.FieldEdit(field))
            {
                f.EditField += OnEditField;
                f.SetCounterFieldProperties += OnSetCounterFieldProperties;
                f.GetCounterFieldProperties += OnGetCounterFieldProperties;
                if (f.ShowDialog() == DialogResult.OK)
                {
                    RefreshData();
                    SelectRow((int)f.Tag);
                }
            }
        }
コード例 #15
0
        private void btnAddOrSearch_Click(object sender, EventArgs e)
        {
            if (comboBoxExtendedField_Simple.SelectedItem == null)
            {
                PersianMessageBox.Show(this, "فیلد به درستی انتخاب نشده است");
                comboBoxExtendedField_Simple.Focus();
                comboBoxExtendedField_Simple.SelectAll();
                comboBoxExtendedField_Simple.SetError("فیلد به درستی انتخاب نشده است");
                return;
            }
            if (textBoxExtendedValue_Simple.Text == "" && ((comboBoxExtendedField_Simple.SelectedItem as Model.Archive.ArchiveField).IsNumber()))
            {
                PersianMessageBox.Show(this, string.Format("برای فیلد '{0}' یک مقدار عددی وارد کنید", comboBoxExtendedField_Simple.Text));
                textBoxExtendedValue_Simple.SelectAll();
                textBoxExtendedValue_Simple.SetError(string.Format("برای فیلد '{0}' یک مقدار عددی وارد کنید", comboBoxExtendedField_Simple.Text), true);
                return;
            }
            if (textBoxExtendedValue_Simple.Text != "" && ((comboBoxExtendedField_Simple.SelectedItem as Model.Archive.ArchiveField).IsNumber() && !textBoxExtendedValue_Simple.Text.IsNumber()))
            {
                PersianMessageBox.Show(this, string.Format("برای فیلد '{0}' یک مقدار عددی وارد کنید", comboBoxExtendedField_Simple.Text));
                textBoxExtendedValue_Simple.SelectAll();
                textBoxExtendedValue_Simple.SetError(string.Format("برای فیلد '{0}' یک مقدار عددی وارد کنید", comboBoxExtendedField_Simple.Text), true);
                return;
            }
            Controller.Common.SearchBoxSettingController.Insert(comboBoxExtendedField_Simple.SelectedIndex, comboBoxExtendedMethod_Simple.SelectedIndex);
            radGridViewSimple.DataSource          = Controller.Archive.DossierController.GetDossierList(Controller.Archive.ArchiveTabController.GetFirstDossierTab(), new SearchField(comboBoxExtendedField_Simple.SelectedItem as Model.Archive.ArchiveField, comboBoxExtendedMethod_Simple.SelectedItem as SearchMethod, textBoxExtendedValue_Simple.Text, SearchField.Relations.None));
            radGridViewSimple.ContextMenuOpening += radGridViewAdvanced_ContextMenuOpening;

            //اگرعرض ستونها عوض شود
            radGridViewSimple.ColumnWidthChanging += radGridViewSimple_ColumnWidthChanging;

            radGridViewSimple.BestFitColumnsSmart();
        }
コード例 #16
0
ファイル: ImportFiles.cs プロジェクト: Shiraz-NJIT/Mahba
 private void btnScan_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         VsTwain.StartDevice();
         if (this.SelectScannerBeforScan && this.ScanSource == null)
         {
             if (!VsTwain.SelectSource())
             {
                 PersianMessageBox.Show(this, "هیچ اسکنری انتخاب نشده است");
                 return;
             }
             else
             {
                 this.ScanSource = VsTwain.GetSourceProductName(VsTwain.SourceIndex);
             }
         }
         VsTwain.Acquire();
         lblStatus.Text = "درحال اسکن تصویر...";
     }
     catch (Exception ex)
     {
         PersianMessageBox.Show("خطا" + "\r\n\r\n" + ex.Message);
     }
     finally
     {
         Cursor.Current = Cursors.Default;
     }
 }
コード例 #17
0
 private void AddressMovebuttonExtended_Click(object sender, EventArgs e)
 {
     try
     {
         if (!AddressValidateContent())
         {
             return;
         }
         Model.Archive.AddressView addressView = Model.Archive.AddressView.GetNewInstance(0, null,
                                                                                          (int)((Njit.Program.Controls.ComboBoxExtended.CustomItem)(addressComboBoxExtended.SelectedItem)).Value,
                                                                                          addressComboBoxExtended.SelectedItem.ToString(), (int)((Njit.Program.Controls.ComboBoxExtended.CustomItem)(provinceComboBoxExtended.SelectedItem)).Value,
                                                                                          provinceComboBoxExtended.SelectedItem.ToString(), townshipTextBoxExtended.Text,
                                                                                          (int)((Njit.Program.Controls.ComboBoxExtended.CustomItem)(areaComboBoxExtended.SelectedItem)).Value, areaComboBoxExtended.SelectedItem.ToString(),
                                                                                          streetTextBoxExtended.Text, alleyTextBoxExtended.Text, postalCodeTextBoxExtended.Text);
         addressViewBindingSource.Add(addressView);
         townshipTextBoxExtended.Text   = "";
         streetTextBoxExtended.Text     = "";
         alleyTextBoxExtended.Text      = "";
         postalCodeTextBoxExtended.Text = "";
         addressComboBoxExtended.Focus();
     }
     catch (Exception ex)
     {
         PersianMessageBox.Show(ex.Message);
     }
 }
コード例 #18
0
ファイル: DocumentField.cs プロジェクト: Shiraz-NJIT/Mahba
 private void Delete()
 {
     if (txtB_id.Text.Count() != 0)
     {
         try
         {
             int          id           = int.Parse(txtB_id.Text);
             DialogResult dialogResult = PersianMessageBox.Show("آیا میخواهید حذف کنید", "سوال", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2);
             if (dialogResult == DialogResult.Yes)
             {
                 try
                 {
                     Njit.Sql.DataAccess da = new Njit.Sql.DataAccess(Setting.Sql.ThisProgram.ArchiveConnection.ConnectionString);
                     (da ?? (Njit.Program.Options.SettingInitializer.GetDataAccess())).Execute(CommandType.Text, string.Format("DELETE FROM [{0}] WHERE [{1}]=@p", TypeClickF1, "ID"), "@p", id);
                 }
                 catch
                 {
                 }
             }
             ChangeDataGrid(TypeClickF1);
             txtB_title.Clear();
             txtB_id.Clear();
         }
         catch
         {
             MessageBox.Show("لطفا یک سطر را انتخاب کنید");
         }
     }
 }
コード例 #19
0
 private bool AddressValidateContent()
 {
     if (addressComboBoxExtended.Text == "")
     {
         PersianMessageBox.Show(this, "نوع آدرس تکمیل نشده است");
         errorProvider.SetError(addressComboBoxExtended, "نوع آدرس تکمیل نشده است");
         addressComboBoxExtended.Focus();
         return(false);
     }
     if (addressComboBoxExtended.SelectedIndex == -1)
     {
         PersianMessageBox.Show(this, "نوع آدرس را از لیست انتخاب کنید\r\nبا کلیک بر روی آیتم ... امکان تعریف نوع های آدرس بیشتر فراهم میگردد");
         errorProvider.SetError(addressComboBoxExtended, "نوع آدرس را از لیست انتخاب کنید\r\nبا کلیک بر روی آیتم ... امکان تعریف نوع های آدرس بیشتر فراهم میگردد");
         addressComboBoxExtended.Focus();
         return(false);
     }
     if (provinceComboBoxExtended.Text == "")
     {
         PersianMessageBox.Show(this, "استان تکمیل نشده است");
         errorProvider.SetError(provinceComboBoxExtended, "استان تکمیل نشده است");
         provinceComboBoxExtended.Focus();
         return(false);
     }
     if (provinceComboBoxExtended.SelectedIndex == -1)
     {
         PersianMessageBox.Show(this, "استان را از لیست انتخاب کنید\r\nبا کلیک بر روی آیتم ... امکان افزودن استان های بیشتر فراهم میگردد");
         errorProvider.SetError(provinceComboBoxExtended, "استان را از لیست انتخاب کنید\r\nبا کلیک بر روی آیتم ... امکان افزودن استان های بیشتر فراهم میگردد");
         provinceComboBoxExtended.Focus();
         return(false);
     }
     if (string.IsNullOrEmpty(townshipTextBoxExtended.Text))
     {
         PersianMessageBox.Show(this, "شهرستان تکمیل نشده است");
         errorProvider.SetError(townshipTextBoxExtended, "شهرستان تکمیل نشده است");
         townshipTextBoxExtended.Focus();
         return(false);
     }
     if (areaComboBoxExtended.Text == "")
     {
         PersianMessageBox.Show(this, "منطقه شهری تکمیل نشده است");
         errorProvider.SetError(areaComboBoxExtended, "منطقه شهری تکمیل نشده است");
         areaComboBoxExtended.Focus();
         return(false);
     }
     if (areaComboBoxExtended.SelectedIndex == -1)
     {
         PersianMessageBox.Show(this, "منطقه شهری را از لیست انتخاب کنید\r\nبا کلیک بر روی آیتم ... امکان افزودن منطقه های شهری بیشتر فراهم میگردد");
         errorProvider.SetError(areaComboBoxExtended, "منطقه شهری را از لیست انتخاب کنید\r\nبا کلیک بر روی آیتم ... امکان افزودن منطقه های شهری بیشتر فراهم میگردد");
         areaComboBoxExtended.Focus();
         return(false);
     }
     if (string.IsNullOrEmpty(streetTextBoxExtended.Text))
     {
         PersianMessageBox.Show(this, "خیابان تکمیل نشده است");
         errorProvider.SetError(streetTextBoxExtended, "خیابان تکمیل نشده است");
         streetTextBoxExtended.Focus();
         return(false);
     }
     return(true);
 }
コード例 #20
0
ファイル: ArchiveAdd.cs プロジェクト: Shiraz-NJIT/Mahba
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (!(this.ActiveControl == btnOK || this.ActiveControl == btnOK))
     {
         Njit.Common.SendKeys.SendKeyDown(Keys.Tab);
         return;
     }
     try
     {
         ValidateContents();
     }
     catch (Njit.Common.ValidateException ex)
     {
         if (ex.Control != null)
         {
             ex.Control.TextChanged -= ControlTextChanged;
             ex.Control.Leave       -= ControlLeave;
         }
         PersianMessageBox.Show(ex.Message);
         if (ex.Control != null)
         {
             ex.Control.Focus();
             ex.Control.TextChanged += ControlTextChanged;
             ex.Control.Leave       += ControlLeave;
             errorProvider.SetError(ex.Control, ex.Message);
         }
         return;
     }
     this.SelectedDatabasePath = txtDatabasePath.Text;
     this.UseDatabase          = radioButtonSaveDocsToDatabase.Checked;
     this.SelectedDocumentsPathOrDatabasePath = txtDocumentsPath.Text;
     this.DialogResult = System.Windows.Forms.DialogResult.OK;
     this.Close();
 }
コード例 #21
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (!btnOK.Focused)
     {
         Njit.Common.SendKeys.SendKeyDown(Keys.Tab);
         return;
     }
     try
     {
         ValidateContents();
     }
     catch (Njit.Common.ValidateException ex)
     {
         ex.Control.TextChanged -= OnControlTextChanged;
         ex.Control.Leave       -= OnControlLeave;
         PersianMessageBox.Show(ex.Message);
         ex.Control.Focus();
         ex.Control.TextChanged += OnControlTextChanged;
         ex.Control.Leave       += OnControlLeave;
         errorProvider.SetError(ex.Control, ex.Message);
         if (ex.Tag is TabPage)
         {
             tabControlExtended.SelectedTab = ex.Tag as TabPage;
         }
         return;
     }
     if (SaveSettings())
     {
         this.ContentChanged = false;
         this.DialogResult   = System.Windows.Forms.DialogResult.OK;
         this.Close();
     }
 }
コード例 #22
0
 protected void btnOK_Click(object sender, EventArgs e)
 {
     if (textBox.Text.Trim() == "")
     {
         PersianMessageBox.Show(this, "مقدار وارد نشده است");
         errorProvider.SetError(textBox, "مقدار وارد نشده است");
         textBox.Focus();
         return;
     }
     try
     {
         if (this.IsDefaultField != null)
         {
             (this.DataAccess ?? (Options.SettingInitializer.GetDataAccess())).Execute(CommandType.Text, string.Format("INSERT INTO [{0}] ([{1}]) VALUES(@p1,@p2)", this.TableName, this.CaptionField), "@p", textBox.Text, "@p2", false);
         }
         else
         {
             (this.DataAccess ?? (Options.SettingInitializer.GetDataAccess())).Execute(CommandType.Text, string.Format("INSERT INTO [{0}] ([{1}]) VALUES(@p)", this.TableName, this.CaptionField), "@p", textBox.Text);
         }
     }
     catch (Exception ex)
     {
         PersianMessageBox.Show(this, "خطا در ثبت اطلاعات" + "\r\n\r\n" + ex.Message);
         return;
     }
     RefreshData();
     textBox.Text = "";
     textBox.Focus();
 }
コード例 #23
0
 private void EditSelectedDictionary()
 {
     foreach (int index in listViewUserDictionaries.SelectedIndices)
     {
         if (index == 0)
         {
             PersianMessageBox.Show("فایل اصلی واژه‌نامه را نمی‌توانید ویرایش کنید");
         }
         else
         {
             string dicPath = GetFileNameFromItem(listViewUserDictionaries.Items[index]);
             try
             {
                 var dicEditor = new DictionaryEditor(dicPath);
                 dicEditor.ShowDialog();
             }
             catch (Exception ex)
             {
                 PersianMessageBox.Show("خطا در ویرایش واژه‌نامه");
                 LogHelper.ErrorException("خطا در ویرایش واژه‌نامه", ex);
             }
             finally
             {
                 m_reloadSpellCheckerEngine = true;
             }
         }
     }
 }
コード例 #24
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     if (listBox.SelectedItem != null)
     {
         Njit.Program.Controls.ComboBoxExtended.CustomItem obj = ((Njit.Program.Controls.ComboBoxExtended.CustomItem)listBox.SelectedItem);
         try
         {
             (this.DataAccess ?? (Options.SettingInitializer.GetDataAccess())).Execute(CommandType.Text, string.Format("DELETE FROM [{0}] WHERE [{1}]=@p", this.TableName, this.KeyField), "@p", obj.Value);
         }
         catch (System.Data.SqlClient.SqlException ex)
         {
             if (ex.ErrorCode == -2146232060 && ex.Number == 547)
             {
                 PersianMessageBox.Show(this, "'" + obj.Caption + "' قابل حذف نیست. از این اطلاعات در جای دیگر استفاده شده است");
             }
             else
             {
                 PersianMessageBox.Show(this, "خطا در حذف '" + obj.Caption + "'" + Environment.NewLine + Environment.NewLine + ex.Message);
             }
         }
         catch (Exception ex)
         {
             PersianMessageBox.Show(this, "خطا در حذف '" + obj.Caption + "'" + Environment.NewLine + Environment.NewLine + ex.Message);
             return;
         }
         RefreshData();
     }
 }
コード例 #25
0
 protected override void OnFormClosed(FormClosedEventArgs e)
 {
     base.OnFormClosed(e);
     try
     {
         SaveSettings();
     }
     catch (Exception ex)
     {
         PersianMessageBox.Show(this, "خطا در ذخیره تنظیمات" + "\r\n" + ex.Message);
     }
     if (Options.SettingInitializer.GetProgramSetting().ShowExitDialog)
     {
         Options.SettingInitializer.GetProgramSetting().BackupDatabase();
     }
     if (this.ShutdownWhenExit)
     {
         System.Diagnostics.Process.Start("Shutdown.exe", "-s -t 0");
     }
     try
     {
         Application.CurrentInputLanguage = lastInputLanguage;
     }
     catch
     { }
     if (_SingleInstance != null && _SingleInstance.IsMainInstance)
     {
         _SingleInstance.Stop();
     }
 }
コード例 #26
0
        private void ShowUpdateApp()
        {
            //اگر ورژن جدید در دیتابیس بود بررسی میکند که اگر برنامه جدید در کلاینت کاربر نصب نبود برنامه را میبندن و برنامه جدید را باز میکند
            if (NjitSoftware.Controller.Common.VerionAppController.Version() != txtProgramVersion.Text)
            {
                var Result = PersianMessageBox.Show("ورژن جدید برنامه آماده دانلود است آیا مایل به آپدیت برنامه هستین؟", "پیام", MessageBoxButtons.YesNoCancel);
                if (Result == DialogResult.Yes)
                {
                    try
                    {
                        Model.Common.VersionClient vc = new Model.Common.VersionClient();
                        int userCode = Setting.User.ThisProgram.GetCurrentUser <Model.Common.User>().Code;
                        vc.userId     = userCode;
                        vc.MashinPath = AppDomain.CurrentDomain.BaseDirectory;

                        NjitSoftware.Controller.Common.VersionClientController.Insert(vc);
                        //اجرا شدن برنامه برای بروزرسانی نرم افزار
                        string AppUpdatePathExe = AppDomain.CurrentDomain.BaseDirectory;
                        System.Diagnostics.Process.Start(AppUpdatePathExe + "Update\\MahbaUpdateApp.exe");//@"D:\WorkUpDareApp\MahbaUpdateApp.exe"
                        Application.Exit();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
コード例 #27
0
        private void treeView_DragDrop(object sender, DragEventArgs e)
        {
            TreeNode dragedNode;

            if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
            {
                Point    pt = treeView.PointToClient(new Point(e.X, e.Y));
                TreeNode destinationNode = treeView.GetNodeAt(pt);
                dragedNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
                if (destinationNode != null && destinationNode != dragedNode)
                {
                    if (e.Effect == DragDropEffects.Move)
                    {
                        if (dragedNode.Tag is Control && !(dragedNode.Tag is Form))
                        {
                            PersianMessageBox.Show("کامپوننت ها را نمیتوانید جابجا کنید");
                            return;
                        }
                        else if (destinationNode.Tag is Control && !(destinationNode.Tag is Form))
                        {
                            PersianMessageBox.Show("نود ها را نمی توانید زیر یک کامپوننت قرار دهید");
                            return;
                        }
                        dragedNode.Remove();
                        destinationNode.Nodes.Add(dragedNode);
                        destinationNode.EnsureVisible();
                        dragedNode.EnsureVisible();
                    }
                }
            }
        }
コード例 #28
0
        public void SearchAll()
        {
            Model.Archive.ArchiveTab firstTab = Controller.Archive.ArchiveTabController.GetFirstDossierTab();
            if (firstTab == null)
            {
                PersianMessageBox.Show(this, "هنوز هیچ گروه اطلاعاتی تعریف نشده است");
            }
            else
            {
                radGridViewAll.DataSource          = Controller.Archive.DossierController.GetDossierList(firstTab, null);
                radGridViewAll.ContextMenuOpening += radGridViewAdvanced_ContextMenuOpening;
                radGridViewAll.CellMouseMove      += radGridViewExtended1_CellMouseMove;
                //مخفی کردن ستونهایی که نمی خواسته نمایش بده
                for (int i = 0; i < radGridViewAll.ColumnCount; i++)
                {
                    Model.Common.ArchiveCommonDataClassesDataContext dc = new Model.Common.ArchiveCommonDataClassesDataContext(Setting.Sql.ThisProgram.DatabaseConnection.ConnectionString);
                    var query = dc.FormStates.Where(t => t.MachineName == Environment.MachineName && t.WindowState == 9 && t.FormName == radGridViewAll.Columns[i].FieldName);
                    if (query.Count() == 1)
                    {
                        radGridViewAll.Columns[i].IsVisible = false;
                    }
                }
                radGridViewAll.ColumnWidthChanging += radGridViewAll_ColumnWidthChanging;

                radGridViewAll.BestFitColumnsSmart();
            }
        }
コード例 #29
0
        protected override void OnClick(EventArgs e)
        {
            Form form = this.FindForm();

            try
            {
                if (form != null)
                {
                    form.Cursor = Cursors.WaitCursor;
                }
                if (this.AllowCheckAccessPermission && !this.DesignMode)
                {
                    if (Njit.Program.Options.SettingInitializer != null)
                    {
                        if (!Njit.Program.Options.SettingInitializer.GetUserSetting().CheckUserAccessPermission(this))
                        {
                            PersianMessageBox.Show(this.SecurityErrorMessage);
                            return;
                        }
                    }
                }
                base.OnClick(e);
            }
            finally
            {
                if (form != null)
                {
                    form.Cursor = Cursors.Default;
                }
            }
        }
コード例 #30
0
ファイル: ArchiveTreeView.cs プロジェクト: Shiraz-NJIT/Mahba
 public void LoadData()
 {
     if (this.DesignMode)
     {
         return;
     }
     try
     {
         this.SuspendLayout();
         this.Nodes.Clear();
         Model.Common.ArchiveCommonDataClassesDataContext dc = new Model.Common.ArchiveCommonDataClassesDataContext(Setting.Sql.ThisProgram.DatabaseConnection.ConnectionString);
         var data = dc.ArchiveTrees;
         foreach (var item in data.Where(t => t.ParentID == null).OrderBy(t => t.Index))
         {
             TreeNode node = AddNode(null, item);
             AddNodes(node, data, item);
         }
         if (this.Nodes.Count > 0)
         {
             this.ExpandAll();
             this.SelectedNode = this.Nodes[0];
             this.SelectedNode.EnsureVisible();
         }
     }
     catch (Exception ex)
     {
         PersianMessageBox.Show(this, "خطا در بارگذاری اطلاعات" + "\r\n\r\n" + ex.Message);
         return;
     }
     finally
     {
         this.ResumeLayout(false);
     }
 }