예제 #1
0
        public void EnableOrDisableThisForm(bool status, bool resetText)
        {
            if (resetText)
            {
                imageData = null;
                pictureBoxPersonnel.Image = Properties.Resources.Person;
                txtDocumentsCount.Text    = "0";
            }
            if (status)
            {
                btnNewDossier.Text = "انصراف";
            }
            else
            {
                btnNewDossier.Text = "ویرایش";
            }

            btnSetImage.Enabled                 = status;
            btnEditPersonnelNumber.Enabled      = btnSaveDossier.Enabled = status;
            dossierTypeComboBoxExtended.Enabled = status;
            DossierFormHelper.EnableOrDisableTabcontrol(tabControlExtended, status, resetText);
            PersonnelNumberTextBox.Enabled = !status;
            Control lblPersonnelNumber = GetPersonnelNumberLabel();

            if (lblPersonnelNumber != null)
            {
                lblPersonnelNumber.Enabled = !status;
            }
            if (!status)
            {
                PersonnelNumberTextBox.Focus();
            }
        }
예제 #2
0
 public void EnableOrDisableForm(bool status, bool resetText)
 {
     if (resetText)
     {
         imageData = null;
         pictureBoxPersonnel.Image = Properties.Resources.Person;
         txtDocumentsCount.Text    = "0";
     }
     btnSetImage.Enabled                 = status;
     btnSaveDossier.Enabled              = status;
     btnImportFiles.Enabled              = !status;
     btnShowDocuments.Enabled            = !status;
     dossierTypeComboBoxExtended.Enabled = status;
     DossierFormHelper.EnableOrDisableTabcontrol(tabControlExtended, status, resetText);
 }
예제 #3
0
        private void CreateObject(string TabPageName, Model.Archive.ArchiveField CurrentField, int XLabel, int YLabel, int XText, int YText)
        {
            try
            {
                switch (CurrentField.BoxTypeCode)
                {
                case (int)Enums.BoxTypes.کادر_متن:
                    Njit.Program.Controls.TextBoxExtended textBoxExtended = DossierFormHelper.CreateTextBox(CurrentField.Label, CurrentField.FieldName, CurrentField.FieldTypeCode, CurrentField.MinLength, CurrentField.MaxLength, CurrentField.MinValue, CurrentField.MaxValue, CurrentField.DefaultValue, XText, YText);
                    textBoxExtended.Size        = new Size(200, 20);
                    textBoxExtended.RightToLeft = RightToLeft.Yes;
                    pnlInfo.Controls.Add(textBoxExtended);
                    break;

                case (int)Enums.BoxTypes.کادر_ورود_تاریخ:

                    Njit.Program.Controls.DateControl dateControl = DossierFormHelper.CreateDateBox(CurrentField, XText, YText);
                    dateControl.Size = new Size(200, 20);
                    pnlInfo.Controls.Add(dateControl);
                    break;

                case (int)Enums.BoxTypes.کادر_بازشو:
                    Njit.Program.Controls.ComboBoxExtended comboBoxExtended = DossierFormHelper.CreateComboBox(CurrentField, XText, YText);
                    comboBoxExtended.Size        = new Size(200, 20);
                    comboBoxExtended.RightToLeft = RightToLeft.Yes;
                    pnlInfo.Controls.Add(comboBoxExtended);
                    break;

                case (int)Enums.BoxTypes.کادر_انتخاب:
                    CheckBox checkBox = DossierFormHelper.CreateChekBox(CurrentField, XLabel, YLabel);
                    checkBox.Size        = new Size(200, 20);
                    checkBox.RightToLeft = RightToLeft.Yes;
                    pnlInfo.Controls.Add(checkBox);
                    break;

                case (int)Enums.FieldTypes.ساعت:
                    Njit.Program.Controls.TimeControl timeControl = DossierFormHelper.CreateTimeBox(CurrentField, XText, YText);
                    timeControl.Size        = new Size(200, 20);
                    timeControl.RightToLeft = RightToLeft.Yes;
                    pnlInfo.Controls.Add(timeControl);
                    break;
                }
            }
            catch (Exception ex)
            {
                PersianMessageBox.Show("خطا در بارگذاری اطلاعات" + "\r\n\r\n" + ex.Message);
            }
        }
예제 #4
0
        public bool CheckTabFields(TabPage tabPage)
        {
            int archiveTabID = (int)tabPage.Tag;
            List <Model.Archive.ArchiveField> fields = Controller.Archive.DossierCacheController.GetArchiveFields(archiveTabID);

            foreach (Control control in tabPage.Controls)
            {
                string errorMessage = DossierFormHelper.CheckControlData(PersonnelNumberTextBox.Text, tabPage.Name, fields, control);
                if (errorMessage != null)
                {
                    PersianMessageBox.Show(this, errorMessage);
                    errorProvider.SetError(control, errorMessage);
                    control.Focus();
                    tabControlExtended.SelectedTab = tabPage;
                    return(false);
                }
            }
            return(true);
        }
예제 #5
0
        private void CreateObject(string tabPageName, Model.Archive.ArchiveField field, int xLabel, int yLabel, int xControl, int yControl)
        {
            try
            {
                if (field.BoxTypeCode != (int)Enums.BoxTypes.کادر_ورود_اطلاعات_گروهی && field.BoxTypeCode != (int)Enums.BoxTypes.کادر_انتخاب)
                {
                    Label label = DossierFormHelper.CreateLabel(field.Label, xLabel, yLabel);
                    tabControlExtended.TabPages[tabPageName].Controls.Add(label);
                }

                if (field.StatusCode == (int)Enums.StatusOfFields.مقدار_نتواند_تهی_باشد)
                {
                    Label labelStar = DossierFormHelper.CreateLabelStar(xLabel, yLabel);
                    tabControlExtended.TabPages[tabPageName].Controls.Add(labelStar);
                }
                else if (field.StatusCode == (int)Enums.StatusOfFields.مقدار_یکتا_باشد_و_نتواند_تهی_باشد)
                {
                    Label labelStar = DossierFormHelper.CreateLabelStar(xLabel, yLabel);
                    labelStar.ForeColor = Color.Green;
                    tabControlExtended.TabPages[tabPageName].Controls.Add(labelStar);
                }
                switch (field.BoxTypeCode)
                {
                case (int)Enums.BoxTypes.کادر_متن:
                    Njit.Program.Controls.TextBoxExtended textBox = DossierFormHelper.CreateTextBox(field, xControl, yControl);
                    if (field.FieldTypeCode != (int)Enums.FieldTypes.متن_طولانی)
                    {
                        textBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Controls_KeyDown);
                    }
                    textBox.TextChanged += new EventHandler(Controls_TextChanged);
                    tabControlExtended.TabPages[tabPageName].Controls.Add(textBox);
                    if (field.AutoComplete)
                    {
                        textBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
                        textBox.AutoCompleteMode   = AutoCompleteMode.Append;
                        textBox.AutoCompleteCustomSource.AddRange(SqlHelper.GetAllFieldValues(tabPageName, field.FieldName));
                    }
                    if (field.FieldTypeCode == (int)Enums.FieldTypes.شمارنده)
                    {
                        textBox.ReadOnly = true;
                        Model.Archive.CounterFieldSetting counterFieldSetting = Controller.Archive.ArchiveFieldController.GetCounterFieldProperties(field.ID);
                        string newValue = SqlHelper.GetNewValueOfCounterFiled(field, counterFieldSetting);
                        textBox.Text = newValue;
                    }
                    break;

                case (int)Enums.BoxTypes.کادر_ورود_تاریخ:
                    Njit.Program.Controls.DateControl dateControl = DossierFormHelper.CreateDateBox(field, xControl, yControl);
                    dateControl.KeyDown     += new System.Windows.Forms.KeyEventHandler(this.Controls_KeyDown);
                    dateControl.TextChanged += new EventHandler(Controls_TextChanged);
                    tabControlExtended.TabPages[tabPageName].Controls.Add(dateControl);
                    break;

                case (int)Enums.BoxTypes.کادر_بازشو:
                    Njit.Program.Controls.ComboBoxExtended comboBoxExtended = DossierFormHelper.CreateComboBox(field, xControl, yControl);
                    comboBoxExtended.TextChanged += new EventHandler(Controls_TextChanged);
                    comboBoxExtended.KeyDown     += new System.Windows.Forms.KeyEventHandler(this.Controls_KeyDown);
                    tabControlExtended.TabPages[tabPageName].Controls.Add(comboBoxExtended);
                    break;

                case (int)Enums.BoxTypes.کادر_انتخاب:
                    CheckBox checkBox = DossierFormHelper.CreateChekBox(field, xLabel, yLabel);
                    checkBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Controls_KeyDown);
                    tabControlExtended.TabPages[tabPageName].Controls.Add(checkBox);
                    break;

                case (int)Enums.BoxTypes.کادر_ورود_ساعت:
                    Njit.Program.Controls.TimeControl timeControl = DossierFormHelper.CreateTimeBox(field, xControl, yControl);
                    timeControl.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Controls_KeyDown);
                    tabControlExtended.TabPages[tabPageName].Controls.Add(timeControl);
                    break;

                case (int)Enums.BoxTypes.کادر_ورود_اطلاعات_گروهی:
                    Njit.Program.Controls.DataGridViewExtended dataGridViewExtended = DossierFormHelper.CreateDataGridView(field);
                    dataGridViewExtended.Rows.CollectionChanged += Rows_CollectionChanged;
                    dataGridViewExtended.CurrentCellChanged     += DataGridView_CurrentCellChanged;
                    GroupBox groupBox = DossierFormHelper.CreateGroupBox(field, yControl);
                    groupBox.Controls.Add(dataGridViewExtended);
                    tabControlExtended.TabPages[tabPageName].Controls.Add(groupBox);
                    break;

                case (int)Enums.BoxTypes.کادر_انتخاب_اشخاص:
                    Njit.Program.Controls.ComboBoxExtended personComboBoxExtended = DossierFormHelper.CreatePersonComboBox(field, xControl, yControl);
                    personComboBoxExtended.TextChanged          += new EventHandler(Controls_TextChanged);
                    personComboBoxExtended.KeyDown              += new System.Windows.Forms.KeyEventHandler(this.Controls_KeyDown);
                    personComboBoxExtended.SelectedIndexChanged += personComboBoxExtended_SelectedIndexChanged;
                    tabControlExtended.TabPages[tabPageName].Controls.Add(personComboBoxExtended);
                    break;
                }
            }
            catch (Exception ex)
            {
                PersianMessageBox.Show(ex.Message);
            }
        }
예제 #6
0
        private void CreateObjectsForTab(Model.Archive.ArchiveTab archiveTab)
        {
            try
            {
                if (archiveTab.Name != InfoTabPage.Name)
                {
                    List <Model.Archive.ArchiveField> fields = Controller.Archive.DossierCacheController.GetArchiveFields(archiveTab.ID);
                    if (fields.Count == 0)
                    {
                        return;
                    }

                    tabControlExtended.TabPages.Add(archiveTab.Name, archiveTab.Title);
                    tabControlExtended.TabPages[archiveTab.Name].Tag       = archiveTab.ID;
                    tabControlExtended.TabPages[archiveTab.Name].BackColor = Color.White;

                    int labelPoint_x   = 650;
                    int labelPoint_y   = 26;
                    int controlPoint_x = 460;
                    int controlPoint_y = 25;
                    int distance       = -1;

                    if (archiveTab.Index == 1)
                    {
                        Label lblPersonnelNumber = DossierFormHelper.CreateLabel(Setting.Archive.ThisProgram.LoadedArchiveSettings.PersonnelNumber_Label, 0, 0);
                        lblPersonnelNumber.Name     = "PersonnelNumberLabel";
                        lblPersonnelNumber.Size     = new Size(160, 20);
                        lblPersonnelNumber.Location = new Point(labelPoint_x, labelPoint_y);
                        lblPersonnelNumber.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));

                        PersonnelNumberTextBox.Size     = new Size(160, 20);
                        PersonnelNumberTextBox.Location = new Point(controlPoint_x, controlPoint_y);
                        PersonnelNumberTextBox.Anchor   = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
                        //PersonnelNumberTextBox.GetType = Njit.Program.InputBoxValidationHelper.InputTypes.AllCharacters;
                        PersonnelNumberTextBox.Tag = Setting.Archive.ThisProgram.LoadedArchiveSettings.PersonnelNumber_Label;

                        Label lblStar = DossierFormHelper.CreateLabelStar(labelPoint_x, labelPoint_y);
                        lblStar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));

                        tabControlExtended.TabPages[archiveTab.Name].Controls.Add(lblStar);
                        tabControlExtended.TabPages[archiveTab.Name].Controls.Add(lblPersonnelNumber);
                        tabControlExtended.TabPages[archiveTab.Name].Controls.Add(PersonnelNumberTextBox);

                        distance++;
                    }

                    int place = 0;
                    foreach (Model.Archive.ArchiveField archiveField in fields)
                    {
                        if ((((float)place) % 2) == 0 || archiveField.BoxTypeCode == (int)Enums.BoxTypes.کادر_ورود_اطلاعات_گروهی || archiveField.FieldTypeCode == (int)Enums.FieldTypes.متن_طولانی || archiveField.FieldTypeCode == (int)Enums.FieldTypes.متن_طولانی_تک_خطی)
                        {
                            distance++;
                            CreateObject(archiveTab.Name, archiveField, labelPoint_x, labelPoint_y + distance * 28, controlPoint_x, controlPoint_y + distance * 28);
                        }
                        else
                        {
                            CreateObject(archiveTab.Name, archiveField, labelPoint_x - 400, labelPoint_y + distance * 28, controlPoint_x - 400, controlPoint_y + distance * 28);
                        }

                        place++;
                        if (archiveField.BoxTypeCode == (int)Enums.BoxTypes.کادر_ورود_اطلاعات_گروهی)
                        {
                            distance += 7;
                            place     = 0;
                        }
                        if (archiveField.FieldTypeCode == (int)Enums.FieldTypes.متن_طولانی)
                        {
                            distance += 1;
                            place     = 0;
                        }
                        if (archiveField.FieldTypeCode == (int)Enums.FieldTypes.متن_طولانی_تک_خطی)
                        {
                            place = 0;
                        }
                    }
                }
                else
                {
                    InfoTabPage.Text = archiveTab.Title;
                }
                tabControlExtended.TabPages[archiveTab.Name].AutoScroll = true;
            }
            catch (Exception ex)
            {
                PersianMessageBox.Show("خطا در بازگذاری اطلاعات" + "\r\n" + ex.Message);
            }
        }