예제 #1
0
        internal static void UpdateField(Model.Archive.ArchiveDataClassesDataContext dc, Model.Common.ArchiveGroupField archiveGroupField)
        {
            Model.Archive.ArchiveField originalArchiveField = dc.ArchiveFields.Where(t => t.IDParent == archiveGroupField.ID).Single();
            string originalLabel        = originalArchiveField.Label;
            string originalTabTitle     = originalArchiveField.ArchiveTab.Title;
            int    originalBoxTypeCode  = originalArchiveField.BoxTypeCode;
            string originalDefaultValue = originalArchiveField.DefaultValue;

            Model.Archive.ArchiveTab archiveTab = dc.ArchiveTabs.Where(t => t.ID == originalArchiveField.ArchiveTabID).Single();

            if (ArchiveFieldController.FieldNameAlreadyExist(dc, archiveTab.ID, archiveGroupField.Label, originalArchiveField.ID))
            {
                throw new Exception(string.Format("فیلد '{0}' در گروه اطلاعاتی '{1}' وجود دارد. لطفا نام دیگری انتخاب کنید", archiveGroupField.Label, archiveTab.Title));
            }

            Model.Archive.ArchiveField archiveField = Model.Archive.ArchiveField.GetNewInstance(originalArchiveField.ID, archiveTab.ID, archiveGroupField.Label, originalArchiveField.FieldName, archiveGroupField.FieldTypeCode, archiveGroupField.StatusCode, archiveGroupField.BoxTypeCode, archiveGroupField.AutoComplete, archiveGroupField.MinLength, archiveGroupField.MaxLength, archiveGroupField.MinValue, archiveGroupField.MaxValue, archiveGroupField.DefaultValue, archiveGroupField.ID, originalArchiveField.Index);
            Model.Archive.ArchiveField.Copy(originalArchiveField, archiveField);
            dc.SubmitChanges();

            try
            {
                Setting.User.ThisProgram.AddLog(Setting.User.UserOparatesPlaceNames.بایگانی, Setting.User.UserOparatesNames.ویرایش, null, "ویرایش فیلد '" + originalLabel + "' در گروه اطلاعاتی '" + originalTabTitle + "' در بایگانی '" + dc.GetArchive().Title + "'");
            }
            catch
            {
                throw new Exception("خطا در ذخیره عملکرد کاربر جاری");
            }

            SqlHelper.UpdateArchiveField(dc, originalArchiveField, (Enums.BoxTypes)originalBoxTypeCode, originalDefaultValue);
        }
예제 #2
0
        internal static void DeleteField(int archiveFieldID)
        {
            Model.Archive.ArchiveDataClassesDataContext dc = new Model.Archive.ArchiveDataClassesDataContext(Setting.Sql.ThisProgram.ArchiveConnection.ConnectionString);
            dc.Connection.Open();
            dc.Transaction = dc.Connection.BeginTransaction();
            try
            {
                Model.Archive.ArchiveField originalArchiveField = dc.ArchiveFields.Where(t => t.ID == archiveFieldID).Single();
                string originalLabel    = originalArchiveField.Label;
                string originalTabTitle = originalArchiveField.ArchiveTab.Title;
                if (originalArchiveField.IDParent.HasValue)
                {
                    originalArchiveField.IDParent = null;
                    dc.SubmitChanges();
                    foreach (var item in dc.ArchiveSubGroupFields.Where(t => t.ArchiveFieldID == originalArchiveField.ID))
                    {
                        item.IDParent = null;
                    }
                    dc.SubmitChanges();
                }
                else
                {
                    SqlHelper.DeleteArchiveField(dc, originalArchiveField);

                    dc.ArchiveSubGroupFields.DeleteAllOnSubmit(originalArchiveField.ArchiveSubGroupFields);
                    dc.SubmitChanges();

                    dc.CounterFieldSettings.DeleteAllOnSubmit(originalArchiveField.CounterFieldSettings);
                    dc.SubmitChanges();

                    dc.ArchiveFields.DeleteOnSubmit(originalArchiveField);
                    dc.SubmitChanges();

                    try
                    {
                        Setting.User.ThisProgram.AddLog(Setting.User.UserOparatesPlaceNames.بایگانی, Setting.User.UserOparatesNames.حذف, null, "حذف فیلد '" + originalLabel + "' در گروه اطلاعاتی '" + originalTabTitle + "' در بایگانی '" + dc.GetArchive().Title + "'");
                    }
                    catch
                    {
                        throw new Exception("خطا در ذخیره عملکرد کاربر جاری");
                    }
                }

                dc.Transaction.Commit();
                dc.Connection.Close();
            }
            catch
            {
                dc.Transaction.Rollback();
                dc.Connection.Close();
                throw;
            }
            finally
            {
                if (dc.Connection.State == System.Data.ConnectionState.Open)
                {
                    dc.Connection.Close();
                }
            }
        }
        internal static void AddSubGroupField(Model.Archive.ArchiveDataClassesDataContext dc, Model.Common.ArchiveGroupSubGroupField archiveGroupSubGroupField)
        {
            Model.Archive.ArchiveField archiveField = dc.ArchiveFields.Where(t => t.IDParent == archiveGroupSubGroupField.ArchiveGroupFieldID).Single();

            int index = 1;

            if (archiveField.ArchiveSubGroupFields.Count > 0)
            {
                index = (archiveField.ArchiveSubGroupFields.Max(t => t.Index) + 1);
            }

            if (FieldNameAlreadyExist(dc, archiveField.ID, archiveGroupSubGroupField.Label))
            {
                throw new Exception(string.Format("فیلد '{0}' در زیرگروه جدولی '{1}' وجود دارد. لطفا نام دیگری انتخاب کنید", archiveGroupSubGroupField.Label, archiveField.Label));
            }

            Model.Archive.ArchiveSubGroupField archiveSubGroupField = Model.Archive.ArchiveSubGroupField.GetNewInstance(archiveField.ID, archiveGroupSubGroupField.Label, null, archiveGroupSubGroupField.FieldTypeCode, archiveGroupSubGroupField.StatusCode, archiveGroupSubGroupField.BoxTypeCode, archiveGroupSubGroupField.AutoComplete, archiveGroupSubGroupField.MinLength, archiveGroupSubGroupField.MaxLength, archiveGroupSubGroupField.MinValue, archiveGroupSubGroupField.MaxValue, archiveGroupSubGroupField.DefaultValue, archiveGroupSubGroupField.ID, index);
            dc.ArchiveSubGroupFields.InsertOnSubmit(archiveSubGroupField);
            dc.SubmitChanges();

            SqlHelper.CreateFieldForSubGroupField(dc, archiveSubGroupField);

            try
            {
                Setting.User.ThisProgram.AddLog(Setting.User.UserOparatesPlaceNames.بایگانی, Setting.User.UserOparatesNames.ثبت, null, "افزودن فیلد '" + archiveSubGroupField.Label + "' به فیلد '" + archiveField.Label + "' در گروه اطلاعاتی '" + archiveField.ArchiveTab.Title + "' در بایگانی '" + dc.GetArchive().Title + "'");
            }
            catch
            {
                throw new Exception("خطا در ذخیره عملکرد کاربر جاری");
            }
        }
예제 #4
0
        internal static int AddField(Field field, int archiveTabID)
        {
            Model.Archive.ArchiveDataClassesDataContext dc = new Model.Archive.ArchiveDataClassesDataContext(Setting.Sql.ThisProgram.ArchiveConnection.ConnectionString);
            dc.Connection.Open();
            dc.Transaction = dc.Connection.BeginTransaction();
            try
            {
                Model.Archive.ArchiveTab archiveTab = dc.ArchiveTabs.Where(t => t.ID == archiveTabID).Single();

                if (ArchiveFieldController.FieldNameAlreadyExist(dc, archiveTabID, field.Label))
                {
                    throw new Exception(string.Format("فیلد '{0}' در گروه اطلاعاتی '{1}' وجود دارد. لطفا نام دیگری انتخاب کنید", field.Label, archiveTab.Title));
                }

                if (archiveTab.Exist == false)
                {
                    SqlHelper.CreateTableForArchiveTab(dc, archiveTab);
                    archiveTab.Exist = true;
                    dc.SubmitChanges();
                }

                int index = 1;
                if (archiveTab.ArchiveFields.Count > 0)
                {
                    index = archiveTab.ArchiveFields.Max(t => t.Index) + 1;
                }
                Model.Archive.ArchiveField archiveField = Model.Archive.ArchiveField.GetNewInstance(archiveTab.ID, field.Label, field.FieldName, field.FieldTypeCode, field.StatusCode, field.BoxTypeCode, field.AutoComplete, field.MinLength, field.MaxLength, field.MinValue, field.MaxValue, field.DefaultValue, null, index);
                dc.ArchiveFields.InsertOnSubmit(archiveField);
                dc.SubmitChanges();

                SqlHelper.CreateArchiveField(dc, archiveField);

                try
                {
                    Setting.User.ThisProgram.AddLog(Setting.User.UserOparatesPlaceNames.بایگانی, Setting.User.UserOparatesNames.ثبت, null, "افزودن فیلد '" + archiveField.Label + "' به گروه اطلاعاتی '" + archiveField.ArchiveTab.Title + "' در بایگانی '" + dc.GetArchive().Title + "'");
                }
                catch
                {
                    throw new Exception("خطا در ذخیره عملکرد کاربر جاری");
                }

                dc.Transaction.Commit();
                dc.Connection.Close();
                return(archiveField.ID);
            }
            catch
            {
                dc.Transaction.Rollback();
                dc.Connection.Close();
                throw;
            }
            finally
            {
                if (dc.Connection.State == System.Data.ConnectionState.Open)
                {
                    dc.Connection.Close();
                }
            }
        }
예제 #5
0
 private void AddToDisplayFields(List <Model.Archive.ArchiveField> displayFields, TreeNodeCollection treeNodeCollection)
 {
     foreach (TreeNode node in treeNodeCollection)
     {
         if ((node.Tag is Model.Archive.ArchiveField) && node.Checked)
         {
             Model.Archive.ArchiveField f = node.Tag as Model.Archive.ArchiveField;
             displayFields.Add(f);
         }
         AddToDisplayFields(displayFields, node.Nodes);
     }
 }
예제 #6
0
        internal static void UpdateField(int originalArchiveFieldID, Field field)
        {
            Model.Archive.ArchiveDataClassesDataContext dc = new Model.Archive.ArchiveDataClassesDataContext(Setting.Sql.ThisProgram.ArchiveConnection.ConnectionString);
            dc.Connection.Open();
            dc.Transaction = dc.Connection.BeginTransaction();
            try
            {
                Model.Archive.ArchiveField originalArchiveField = dc.ArchiveFields.Where(t => t.ID == originalArchiveFieldID).Single();
                string originalLabel        = originalArchiveField.Label;
                string originalTabTitle     = originalArchiveField.ArchiveTab.Title;
                int    originalBoxTypeCode  = originalArchiveField.BoxTypeCode;
                string originalDefaultValue = originalArchiveField.DefaultValue;

                if (ArchiveFieldController.FieldNameAlreadyExist(dc, originalArchiveField.ArchiveTabID, field.Label, originalArchiveFieldID))
                {
                    throw new Exception(string.Format("فیلد '{0}' در گروه اطلاعاتی '{1}' وجود دارد. لطفا نام دیگری انتخاب کنید", field.Label, originalArchiveField.ArchiveTab.Title));
                }

                Model.Archive.ArchiveField archiveField = Model.Archive.ArchiveField.GetNewInstance(originalArchiveField.ID, originalArchiveField.ArchiveTabID, field.Label, originalArchiveField.FieldName, field.FieldTypeCode, field.StatusCode, field.BoxTypeCode, field.AutoComplete, field.MinLength, field.MaxLength, field.MinValue, field.MaxValue, field.DefaultValue, originalArchiveField.IDParent, originalArchiveField.Index);
                Model.Archive.ArchiveField.Copy(originalArchiveField, archiveField);
                dc.SubmitChanges();

                SqlHelper.UpdateArchiveField(dc, originalArchiveField, (Enums.BoxTypes)originalBoxTypeCode, originalDefaultValue);

                try
                {
                    Setting.User.ThisProgram.AddLog(Setting.User.UserOparatesPlaceNames.بایگانی, Setting.User.UserOparatesNames.ویرایش, null, "ویرایش فیلد '" + originalLabel + "' در گروه اطلاعاتی '" + originalTabTitle + "' در بایگانی '" + dc.GetArchive().Title + "'");
                }
                catch
                {
                    throw new Exception("خطا در ذخیره عملکرد کاربر جاری");
                }

                dc.Transaction.Commit();
                dc.Connection.Close();
            }
            catch
            {
                dc.Transaction.Rollback();
                dc.Connection.Close();
                throw;
            }
            finally
            {
                if (dc.Connection.State == System.Data.ConnectionState.Open)
                {
                    dc.Connection.Close();
                }
            }
        }
예제 #7
0
 public DossierSearchBoxPopup(Model.Archive.ArchiveField archiveField, bool allowSelectRelation)
 {
     InitializeComponent();
     this.ArchiveField              = archiveField;
     comboBoxExtendedAndOr.Visible  = allowSelectRelation;
     comboBoxExtendedAndOr.Location = new Point(lblField.Location.X + lblField.Width + 5, comboBoxExtendedAndOr.Location.Y);
     this.Width = comboBoxExtendedAndOr.Location.X + comboBoxExtendedAndOr.Width + 50;
     if (comboBoxExtendedAndOr.Visible == false)
     {
         this.Width -= comboBoxExtendedAndOr.Width;
     }
     contextMenuStripSelect.Enabled       = allowSelectRelation;
     searchMethodBindingSource.DataSource = SearchMethod.GetAllSearchMethods();
 }
예제 #8
0
 private void CheckNodes(TreeNodeCollection treeNodeCollection, List <Model.Archive.ArchiveField> displayFields)
 {
     foreach (TreeNode n in treeNodeCollection)
     {
         Model.Archive.ArchiveField f = n.Tag as Model.Archive.ArchiveField;
         if (f != null && displayFields.Contains(f))
         {
             n.Checked = true;
         }
         else
         {
             n.Checked = false;
         }
         CheckNodes(n.Nodes, displayFields);
     }
 }
예제 #9
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);
            }
        }
예제 #10
0
 private void DossierChangeDataField_Load(object sender, EventArgs e)
 {
     radGridViewExtended1.DataSource = new List <ChangeData>();
     txtPN.Focus();
     listarchiveField        = Controller.Archive.ArchiveTabController.GetArchiveFields(1);
     comboBox1.DataSource    = listarchiveField;
     comboBox1.DisplayMember = "Label";
     comboBox1.ValueMember   = "ID";
     if (comboBox1.SelectedValue != null)
     {
         Model.Archive.ArchiveField af = listarchiveField.Where(q => q.ID.ToString() == comboBox1.SelectedValue.ToString()).FirstOrDefault();
         if (af != null)
         {
             CreateObject("Dossier1", af, 0, 0, 200, 200);
         }
     }
 }
예제 #11
0
 private void comboBoxExtendedTab_SelectedValueChanged(object sender, EventArgs e)
 {
     if (comboBoxExtendedTab_Simple.SelectedItem == null)
     {
         this.archiveFieldBindingSource.DataSource = null;
     }
     else
     {
         var list = Controller.Archive.ArchiveFieldController.GetArchiveFieldsThahIsNotSubGroup(comboBoxExtendedTab_Simple.SelectedItem as Model.Archive.ArchiveTab);
         if ((comboBoxExtendedTab_Simple.SelectedItem as Model.Archive.ArchiveTab).TypeCode == 1)
         {
             Model.Archive.ArchiveField personnelNumberField = Model.Archive.ArchiveField.GetNewInstance((comboBoxExtendedTab_Simple.SelectedItem as Model.Archive.ArchiveTab).ID, Setting.Archive.ThisProgram.LoadedArchiveSettings.PersonnelNumber_Label, "PersonnelNumber", (int)Enums.FieldTypes.متن, (int)Enums.StatusOfFields.مقدار_نتواند_تهی_باشد, (int)Enums.BoxTypes.کادر_متن, true, null, null, null, null, null, null, 0);
             personnelNumberField.ArchiveTab = (comboBoxExtendedTab_Simple.SelectedItem as Model.Archive.ArchiveTab);
             list.Insert(0, personnelNumberField);
         }
         this.archiveFieldBindingSource.DataSource = list;
     }
 }
예제 #12
0
        internal static void DeleteField(Model.Archive.ArchiveDataClassesDataContext dc, Model.Common.ArchiveGroupField archiveGroupField)
        {
            Model.Archive.ArchiveField originalArchiveField = dc.ArchiveFields.Where(t => t.IDParent == archiveGroupField.ID).Single();
            string originalLabel    = originalArchiveField.Label;
            string originalTabTitle = originalArchiveField.ArchiveTab.Title;

            if (originalArchiveField.IDParent.HasValue)
            {
                originalArchiveField.IDParent = null;
                dc.SubmitChanges();
                foreach (var item in dc.ArchiveSubGroupFields.Where(t => t.ArchiveFieldID == originalArchiveField.ID))
                {
                    item.IDParent = null;
                }
                dc.SubmitChanges();
                Model.Common.CounterFieldSetting archiveGroupFieldCounterSetting = Controller.Common.ArchiveGroupFieldController.GetCounterFieldProperties(archiveGroupField.ID);
                if (archiveGroupFieldCounterSetting != null)
                {
                    Controller.Archive.ArchiveFieldController.SetCounterFieldProperties(dc, originalArchiveField.ID, archiveGroupFieldCounterSetting.FixedValueType, archiveGroupFieldCounterSetting.FixedValue, archiveGroupFieldCounterSetting.Separator);
                }
            }
            else
            {
                SqlHelper.DeleteArchiveField(dc, originalArchiveField);

                dc.ArchiveSubGroupFields.DeleteAllOnSubmit(originalArchiveField.ArchiveSubGroupFields);
                dc.SubmitChanges();

                dc.CounterFieldSettings.DeleteAllOnSubmit(originalArchiveField.CounterFieldSettings);
                dc.SubmitChanges();

                dc.ArchiveFields.DeleteOnSubmit(originalArchiveField);
                dc.SubmitChanges();

                try
                {
                    Setting.User.ThisProgram.AddLog(Setting.User.UserOparatesPlaceNames.بایگانی, Setting.User.UserOparatesNames.حذف, null, "حذف فیلد '" + originalLabel + "' در گروه اطلاعاتی '" + originalTabTitle + "' در بایگانی '" + dc.GetArchive().Title + "'");
                }
                catch
                {
                    throw new Exception("خطا در ذخیره عملکرد کاربر جاری");
                }
            }
        }
예제 #13
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBox1.SelectedValue != null)
     {
         foreach (Control control in pnlInfo.Controls)
         {
             pnlInfo.Controls.Remove(control);
         }
         Model.Archive.ArchiveField af = listarchiveField.Where(q => q.ID.ToString() == comboBox1.SelectedValue.ToString()).FirstOrDefault();
         if (af != null)
         {
             int Distance            = 0;
             int StartPointLabel_X   = 0;
             int StartPointLabel_Y   = 6;
             int StartPointControl_X = 0;
             int StartPointControl_Y = 5;
             CreateObject("Dossier1", af, StartPointLabel_X, StartPointLabel_Y + Distance * 28, StartPointControl_X, StartPointControl_Y + Distance * 28);
         }
     }
 }
예제 #14
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);
            }
        }
예제 #15
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                Model.Archive.ArchiveField CurrentField = new Model.Archive.ArchiveField();
                if (comboBox1.SelectedValue != null)
                {
                    CurrentField = listarchiveField.Where(q => q.ID.ToString() == comboBox1.SelectedValue.ToString()).FirstOrDefault();
                }
                if (CurrentField != null)
                {
                    DialogResult dr = MessageBox.Show("اطلاعات پرونده ها تغییر کند؟", "تغییر گروهی اطلاعات", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    switch (dr)
                    {
                    case DialogResult.Yes:
                    {
                        foreach (var item in radGridViewExtended1.Rows)
                        {
                            string _PN = item.Cells[0].Value.ToString();
                            if (_PN != null)
                            {
                                try
                                {
                                    switch (CurrentField.BoxTypeCode)
                                    {
                                    case (int)Enums.BoxTypes.کادر_متن:
                                        string value = pnlInfo.Controls[0].Text;
                                        if (value == null)
                                        {
                                            value = "_";
                                        }
                                        SqlHelper.UpdateDossier1(_PN, CurrentField.FieldName, value);
                                        Setting.User.ThisProgram.AddLog(Setting.User.UserOparatesPlaceNames.لاگیری_سند_و_پرونده, Setting.User.UserOparatesNames.ویرایش, _PN, "ویرایش اطلاعات پرونده به صورت گروهی به مقدار:" + value);
                                        break;

                                    case (int)Enums.BoxTypes.کادر_ورود_تاریخ:
                                        string value2 = pnlInfo.Controls[0].Text;
                                        if (value2 == null)
                                        {
                                            value2 = "_";
                                        }
                                        SqlHelper.UpdateDossier1(_PN, CurrentField.FieldName, value2);
                                        Setting.User.ThisProgram.AddLog(Setting.User.UserOparatesPlaceNames.لاگیری_سند_و_پرونده, Setting.User.UserOparatesNames.ویرایش, _PN, "ویرایش اطلاعات پرونده به صورت گروهی به مقدار:" + value2);
                                        break;

                                    case (int)Enums.BoxTypes.کادر_بازشو:
                                        Njit.Program.Controls.ComboBoxExtended comboBoxExtended = (Njit.Program.Controls.ComboBoxExtended)pnlInfo.Controls[0];
                                        SqlHelper.UpdateDossier1(_PN, CurrentField.FieldName, comboBoxExtended.Text);
                                        Setting.User.ThisProgram.AddLog(Setting.User.UserOparatesPlaceNames.لاگیری_سند_و_پرونده, Setting.User.UserOparatesNames.ویرایش, _PN, "ویرایش اطلاعات پرونده به صورت گروهی به مقدار:" + comboBox1.Text);
                                        break;

                                    case (int)Enums.BoxTypes.کادر_انتخاب:
                                        CheckBox checkBox = (CheckBox)pnlInfo.Controls[0];
                                        SqlHelper.UpdateDossier1(_PN, CurrentField.FieldName, checkBox.Checked);
                                        Setting.User.ThisProgram.AddLog(Setting.User.UserOparatesPlaceNames.لاگیری_سند_و_پرونده, Setting.User.UserOparatesNames.ویرایش, _PN, "ویرایش اطلاعات پرونده به صورت گروهی به مقدار:" + checkBox.Checked);
                                        break;

                                    case (int)Enums.FieldTypes.ساعت:
                                        string value3 = pnlInfo.Controls[0].Text;
                                        if (value3 == null)
                                        {
                                            value3 = "_";
                                        }
                                        SqlHelper.UpdateDossier1(_PN, CurrentField.FieldName, value3);
                                        Setting.User.ThisProgram.AddLog(Setting.User.UserOparatesPlaceNames.لاگیری_سند_و_پرونده, Setting.User.UserOparatesNames.ویرایش, _PN, "ویرایش اطلاعات پرونده به صورت گروهی به مقدار:" + value3);
                                        break;
                                    }
                                }
                                catch { continue; }
                            }
                        }
                        MessageBox.Show("اطلاعات با موفقیت ویرایش شد.");
                        break;
                    }

                    case DialogResult.Cancel:
                    {
                        break;
                    }
                    }
                }
            }
            catch (Exception ex)
            {
                PersianMessageBox.Show(ex.Message);
            }
        }
예제 #16
0
 internal static string GetArchiveFieldLabel(int archiveFieldID)
 {
     Model.Archive.ArchiveField field = Model.Archive.ArchiveDataClassesDataContext.GetNewInstance().ArchiveFields.Where(t => t.ID == archiveFieldID).SingleOrDefault();
     return(field == null ? "" : field.Label);
 }
예제 #17
0
 internal static Model.Archive.ArchiveField GetArchive(int archiveFieldID)
 {
     Model.Archive.ArchiveField field = Model.Archive.ArchiveDataClassesDataContext.GetNewInstance().ArchiveFields.Where(t => t.ID == archiveFieldID).SingleOrDefault();
     return(field);
 }
예제 #18
0
 internal static object GetFieldValue(Model.Archive.ArchiveField archiveField, string personnelNumber)
 {
     return(SqlHelper.GetArchiveFieldValue(archiveField.ArchiveTab.Name, archiveField.FieldName, personnelNumber));
 }