Пример #1
0
        public CreateInnerDocumentForm(ref Form tTopForm, ref InfiniumDocuments tInfiniumDocuments)
        {
            InitializeComponent();

            InfiniumDocuments = tInfiniumDocuments;

            TopForm = tTopForm;

            DocumentsTypeComboBox.DataSource    = InfiniumDocuments.DocumentTypesDataTable;
            DocumentsTypeComboBox.DisplayMember = "DocumentType";
            DocumentsTypeComboBox.ValueMember   = "DocumentTypeID";

            DocumentsStatesComboBox.DataSource    = InfiniumDocuments.DocumentsStatesDataTable;
            DocumentsStatesComboBox.DisplayMember = "DocumentState";
            DocumentsStatesComboBox.ValueMember   = "DocumentsStateID";

            FactoryTypesComboBox.DataSource    = InfiniumDocuments.FactoryTypesDataTable;
            FactoryTypesComboBox.DisplayMember = "Factory";
            FactoryTypesComboBox.ValueMember   = "FactoryID";

            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.Boolean")));

            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;
        }
        public DocumentsConfirmationForm(ref Form tTopForm, ref InfiniumDocuments tInfiniumDocuments, int iDocumentID, int iDocumentCategoryID)
        {
            InitializeComponent();

            InfiniumDocuments = tInfiniumDocuments;

            DocumentCategoryID = iDocumentCategoryID;
            DocumentID         = iDocumentID;

            RecipientsList.ItemsDataTable = InfiniumDocuments.UsersDataTable;
            RecipientsList.InitializeItems();

            TopForm = tTopForm;
        }
        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 AddDocumentRecipientsForm(ref Form tTopForm, ref InfiniumDocuments tInfiniumDocuments, int iDocumentID, int iDocumentCategoryID)
        {
            InitializeComponent();

            InfiniumDocuments = tInfiniumDocuments;

            DocumentCategoryID = iDocumentCategoryID;
            DocumentID         = iDocumentID;

            UsersDT = InfiniumDocuments.UsersDataTable.Clone();

            DataTable RecDT = InfiniumDocuments.GetDocumentsRecipients(DocumentCategoryID, DocumentID);

            foreach (DataRow Row in InfiniumDocuments.UsersDataTable.Rows)
            {
                if (RecDT.Select("UserID = " + Row["UserID"]).Count() > 0)
                {
                    continue;
                }

                if (Convert.ToInt32(Row["UserID"]) == Security.CurrentUserID)
                {
                    continue;
                }

                DataRow NewRow = UsersDT.NewRow();
                NewRow["UserID"] = Row["UserID"];
                NewRow["Name"]   = Row["Name"];
                UsersDT.Rows.Add(NewRow);
            }

            RecipientsList.ItemsDataTable = UsersDT;
            RecipientsList.InitializeItems();

            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 = "Сохранить";
        }