private void PersonBlock_Load(object sender, EventArgs e) { if (DesignerDetector.IsComponentInDesignMode(this)) { return; } LoadUsedPersons(); }
public PersonBlock() { InitializeComponent(); if (DesignerDetector.IsComponentInDesignMode(this)) { return; } _persons = Environment.UsedPersonsNames.ToList(); }
private void OnLoad(object sender, EventArgs e) { if (DesignerDetector.IsComponentInDesignMode(this)) { return; } // loading doc types if (Environment.DocTypeData != null) { if (Environment.DocTypes != null) { docTypeParser = new DocTypeParser(Environment.DocTypeData, Environment.DocTypes); if (ID > 0) { bool parsed = false; text.Text = Environment.DocTypeData.GetDocType(ID, Environment.CurCultureInfo.TwoLetterISOLanguageName); DataRow[] drs = docTypeParser.ParseQuery(text.Text); if (drs != null) { foreach (DataRow t in drs.Where(t => t[Environment.DocTypeData.IDField].Equals(ID))) { SearchType = (byte)t[Environment.DocTypeData.SearchTypeField]; Text = t[Environment.CurCultureInfo.TwoLetterISOLanguageName.Equals("ru") ? Environment.DocTypeData.NameField : Environment.DocTypeData.TypeDocField].ToString(); parsed = true; break; } } if (!parsed) { ID = 0; text.Text = ""; } } } else { throw new Exception("DocTypeBlock: " + Environment.StringResources.GetString("DocTypeBlock_OnLoad_Error1")); } } else { if (!DesignerDetector.IsComponentInDesignMode(this)) { throw new Exception("DocTypeBlock: " + Environment.StringResources.GetString("DocTypeBlock_OnLoad_Error2") + " (Data)."); } } }
private void EmployeeBlock_Load(object sender, EventArgs e) { if (DesignerDetector.IsComponentInDesignMode(this)) { return; } SetLabel(); System.Timers.Timer timer = new System.Timers.Timer(1000) { AutoReset = false }; timer.Elapsed += timer_Elapsed; timer.Start(); }
public SelectTypeDialog(int typeID, bool formNeeded, string pattern, int runTypeID, Direction inOut, bool showCheckBoxes) { InitializeComponent(); this.TypeID = typeID; this.formNeeded = formNeeded; this.pattern = pattern; this.runTypeID = runTypeID; panelPreviosSelect.Visible = (runTypeID > 0); this.inOut = inOut; this.showCheckBoxes = showCheckBoxes; if (formNeeded) { if (runTypeID > 0) { bool dirNeeded = (Environment.PersonID > 0) || Environment.DocTypeData.GetDocBoolField(Environment.DocTypeData.OutGoingField, runTypeID); labelReturn.Text = Environment.StringResources.GetString("CreateNew") + " " + (dirNeeded ? ((inOut.Equals(Direction.Out)) ? Environment.StringResources.GetString("Outgoing") + " " : Environment.StringResources.GetString("Incoming") + " ") : "") + Environment.StringResources.GetString("Select_SelectTypeDialog_Message1") + " " + Environment.DocTypeData.GetDocType(runTypeID, Environment.CurCultureInfo.TwoLetterISOLanguageName) + " (Ctrl+F8)"; labelReturn.LinkArea = new LinkArea(0, labelReturn.Text.Length - 10); labelReturn.LinkVisited = true; } groupSynonyms.Visible = false; } panelSimilar.Visible = showCheckBoxes; panelSubtypes.Visible = showCheckBoxes; if (!DesignerDetector.IsComponentInDesignMode(this)) { dt = Environment.DocTypeData.GetDocTypes(formNeeded); } }
private void DocProperties_Load(object sender, EventArgs e) { if (DesignerDetector.IsComponentInDesignMode(this)) { return; } groupBoxPersons.Text = Environment.PersonWord.GetForm(Cases.I, true, true); if (DocID != 0) { Text += " #" + DocID; DataRow row = Environment.DocData.GetDocProperties(DocID, Environment.CurCultureInfo.TwoLetterISOLanguageName); if (row != null) { // description description.Text = row[Environment.DocData.DescriptionField] as string ?? string.Empty; originalDescription = description.Text; // type id object obj = row[Environment.DocData.DocTypeIDField]; if (obj is int) { typeID = (int)obj; docTypeBlock.Text = row[Environment.DocData.DocTypeField].ToString(); docTypeBlock.ID = typeID; } originalTypeID = typeID; // название originalName = row[Environment.DocData.NameField] as string ?? ""; checkBoxName.Checked = !string.IsNullOrEmpty(originalName); textBoxName.ReadOnly = true; textBoxName.Text = originalName.Trim(); // number originalNumber = row[Environment.DocData.NumberField] as string; if (string.IsNullOrEmpty(originalNumber)) { if (originalNumber == null) { originalNumber = ""; } checkBoxNoNumber.Checked = true; number.ReadOnly = true; } else { number.Text = originalNumber; checkBoxNoNumber.Checked = false; } // date obj = row[Environment.DocData.DateField]; if (obj is DateTime) { dateBlock.Value = (DateTime)obj; originalDate = dateBlock.Value; } // protected obj = row[Environment.DocData.ProtectedField]; if (obj is byte) { checkBoxProtected.Checked = obj.Equals((byte)1); } originalProtectedDoc = checkBoxProtected.Checked; // persons DocProertiesPersons_Load(dateBlock.Value); #region Создал, редактировал // Создал obj = row[Environment.DocData.CreatorField]; if (obj is int) { _docCreator = (int)obj; } if (_docCreator > 0) { var cr = new Employee(_docCreator, Environment.EmpData); _linkDocAuthor.Url = Lib.Win.Document.Environment.UsersURL + cr.ID; _linkDocAuthor.Text = Environment.CurCultureInfo.TwoLetterISOLanguageName.Equals("ru") ? cr.ShortName : cr.ShortEngName; _linkDocAuthor.Caption = string.Format("№{0} {1}", cr.ID, _linkDocAuthor.Text); } // Дата создания obj = row[Environment.DocData.CreateDateField]; if (obj is DateTime) { _docCreateDate = (DateTime)obj; } if (_docCreateDate > DateTime.MinValue) { lblDocCreateDate.Text += _docCreateDate.ToLocalTime().ToString("dd.MM.yyyy HH:mm:ss"); } // Изменил obj = row[Environment.DocData.EditorField]; if (obj is int) { _editorId = (int)obj; } // Дата последнего изменения obj = row[Environment.DocData.EditedField]; if (obj is DateTime) { _editedDate = (DateTime)obj; } // Если отличается автор и редактор либо отличается дата создания от даты редактирования // То показываем поля изменил, изменено на форме if (_editorId != _docCreator || _editedDate != _docCreateDate) { lblEdited.Visible = true; lblEditor.Visible = true; if (_editorId > 0) { var ed = new Employee(_editorId, Environment.EmpData); _linkEditor.Url = Lib.Win.Document.Environment.UsersURL + ed.ID; _linkEditor.Text = Environment.CurCultureInfo.TwoLetterISOLanguageName.Equals("ru") ? ed.ShortName : ed.ShortEngName; _linkEditor.Caption = string.Format("№{0} {1}", ed.ID, _linkEditor.Text); } if (_editedDate > DateTime.MinValue) { lblEdited.Text += _editedDate.ToLocalTime().ToString("dd.MM.yyyy HH:mm:ss"); } } else { lblEdited.Visible = false; lblEditor.Visible = false; } #endregion // Проверяем, какие поля доступны для изменения ////////////////////////////////////////////////// bool eformSigned; bool docSigned; Environment.DocSignatureData.IsSigns(DocID, out eformSigned, out docSigned); if (docSigned || eformSigned) { typeEnabled = false; typeNameEnable = false; numberEnabled = false; dateEnabled = false; //descrEnabled = false; } else if (Environment.DocDataData.IsDataPresent(DocID)) { typeEnabled = false; } if (typeNameEnable) { typeNameEnable = row[Environment.DocTypeData.NameExistField].Equals((byte)1); } newWindowDocumentButton.Set(DocID, row); } } else { Text = Environment.StringResources.GetString("DocProperties.DocProperties_Load.Message1"); buttonEdit_Click(sender, e); buttonOK.Text = Environment.StringResources.GetString("Save"); } UpdateControls(); }