public DocumentsConfirmationForm(ref Form tTopForm, ref InfiniumDocuments tInfiniumDocuments, int iDocumentConfirmationID) { InitializeComponent(); InfiniumDocuments = tInfiniumDocuments; DocumentConfirmationID = iDocumentConfirmationID; DataTable DT = InfiniumDocuments.GetConfirmationRecipients(iDocumentConfirmationID); RecipientsList.ItemsDataTable = InfiniumDocuments.UsersDataTable; RecipientsList.InitializeItems(); bEdit = true; foreach (DataRow Row in DT.Rows) { RecipientsList.SelectItem(Convert.ToInt32(Row["UserID"])); } TopForm = tTopForm; }
public CreateIncomeDocumentForm(ref Form tTopForm, ref InfiniumDocuments tInfiniumDocuments, int iIncomeDocumentID) { InitializeComponent(); InfiniumDocuments = tInfiniumDocuments; TopForm = tTopForm; DocumentsTypeComboBox.DataSource = InfiniumDocuments.DocumentTypesDataTable; DocumentsTypeComboBox.DisplayMember = "DocumentType"; DocumentsTypeComboBox.ValueMember = "DocumentTypeID"; RecipientComboBox.DataSource = InfiniumDocuments.CorrespondentsDataTable; RecipientComboBox.DisplayMember = "CorrespondentName"; RecipientComboBox.ValueMember = "CorrespondentID"; FactoryTypesComboBox.DataSource = InfiniumDocuments.FactoryTypesDataTable; FactoryTypesComboBox.DisplayMember = "Factory"; FactoryTypesComboBox.ValueMember = "FactoryID"; DocumentsStatesComboBox.DataSource = InfiniumDocuments.DocumentsStatesDataTable; DocumentsStatesComboBox.DisplayMember = "DocumentState"; DocumentsStatesComboBox.ValueMember = "DocumentsStateID"; RecipientsList.ItemsDataTable = InfiniumDocuments.UsersDataTable; RecipientsList.InitializeItems(); AttachmentsDataTable = new DataTable(); AttachmentsDataTable.Columns.Add(new DataColumn("FileName", Type.GetType("System.String"))); AttachmentsDataTable.Columns.Add(new DataColumn("Path", Type.GetType("System.String"))); AttachmentsDataTable.Columns.Add(new DataColumn("IsNew", Type.GetType("System.String"))); RecipientsDataTable = new DataTable(); RecipientsDataTable.Columns.Add(new DataColumn("UserID", Type.GetType("System.Int32"))); AttachmentsGrid.DataSource = AttachmentsDataTable; AttachmentsGrid.Columns["IsNew"].Visible = false; AttachmentsGrid.Columns["Path"].Visible = false; int DocumentTypeID = -1; DateTime DateTime = DateTime.Now; int UserID = -1; int CorrespondentID = -1; string Description = ""; int DocumentStateID = -1; int FactoryID = -1; string IncomeNumber = ""; string RegNumber = ""; IncomeDocumentID = iIncomeDocumentID; InfiniumDocuments.GetEditIncomeDocument(IncomeDocumentID, ref DocumentTypeID, ref DateTime, ref UserID, ref CorrespondentID, RecipientsDataTable, ref Description, ref RegNumber, ref IncomeNumber, ref DocumentStateID, AttachmentsDataTable, ref FactoryID); DocumentsTypeComboBox.SelectedValue = DocumentTypeID; if (CorrespondentID > 0) { RecipientComboBox.SelectedValue = CorrespondentID; } DocumentsStatesComboBox.SelectedValue = DocumentStateID; FactoryTypesComboBox.SelectedValue = FactoryID; DescriptionTextBox.Text = Description; AttachmentsGrid.DataSource = AttachmentsDataTable; RegNumberTextBox.Text = RegNumber; IncomeNumberTextBox.Text = IncomeNumber; foreach (DataRow Row in RecipientsDataTable.Rows) { RecipientsList.SelectItem(Convert.ToInt32(Row["UserID"])); } bEdit = true; CreateButton.Text = "Сохранить"; }