Ejemplo n.º 1
0
        private void labelOpenCommonMDI_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                GlobalEnum.TaskID taskID = sender.Equals(this.pictureBoxLogo) ? GlobalEnum.TaskID.ListLogo : sender.Equals(this.pictureBoxFactory) ? GlobalEnum.TaskID.ListFactory : sender.Equals(this.pictureBoxOwner) ? GlobalEnum.TaskID.ListOwner : sender.Equals(this.pictureBoxCategory) ? GlobalEnum.TaskID.ListCategory : sender.Equals(this.pictureBoxProduct) ? GlobalEnum.TaskID.ListProduct : sender.Equals(this.pictureBoxCoil) ? GlobalEnum.TaskID.ListCoil : GlobalEnum.TaskID.ListCoil;

                CommonMDI commonMDI = new CommonMDI(taskID);
                if (commonMDI.ShowDialog() == System.Windows.Forms.DialogResult.OK || true)
                {
                    CommonMetaList commonMetaList = new CommonMetaList();
                    switch (taskID)
                    {
                    case GlobalEnum.TaskID.ListLogo:
                        this.comboBoxLogoID.DataSource = commonMetaList.GetListLogo();
                        break;

                    case GlobalEnum.TaskID.ListFactory:
                        this.comboBoxFactoryID.DataSource = commonMetaList.GetListFactory();
                        break;

                    case GlobalEnum.TaskID.ListOwner:
                        this.comboBoxOwnerID.DataSource = commonMetaList.GetListOwner();
                        break;

                    case GlobalEnum.TaskID.ListCategory:
                        this.comboBoxCategoryID.DataSource = commonMetaList.GetListCategory();
                        break;

                    case GlobalEnum.TaskID.ListProduct:
                        this.comboBoxProductID.DataSource = commonMetaList.GetListProduct();
                        break;

                    case GlobalEnum.TaskID.ListCoil:
                        this.comboBoxCoilID.DataSource = commonMetaList.GetListCoil();
                        break;

                    default:
                        break;
                    }
                }
                commonMDI.Dispose();
            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }
Ejemplo n.º 2
0
        private void InitializeCommonControlBinding()
        {
            CommonMetaList commonMetaList = new CommonMetaList();


            ListMaintenance.ListFactoryDataTable listFactoryDataTable = commonMetaList.GetListFactory();
            this.comboBoxFactoryID.DataSource    = listFactoryDataTable;
            this.comboBoxFactoryID.DisplayMember = listFactoryDataTable.DescriptionColumn.ColumnName;
            this.comboBoxFactoryID.ValueMember   = listFactoryDataTable.FactoryIDColumn.ColumnName;
            this.factoryIDBinding = this.comboBoxFactoryID.DataBindings.Add("SelectedValue", this.dataMessageBLL.DataMessageMaster, "FactoryID", true);

            ListMaintenance.ListOwnerDataTable listOwnerDataTable = commonMetaList.GetListOwner();
            this.comboBoxOwnerID.DataSource    = listOwnerDataTable;
            this.comboBoxOwnerID.DisplayMember = listOwnerDataTable.DescriptionColumn.ColumnName;
            this.comboBoxOwnerID.ValueMember   = listOwnerDataTable.OwnerIDColumn.ColumnName;
            this.ownerIDBinding = this.comboBoxOwnerID.DataBindings.Add("SelectedValue", this.dataMessageBLL.DataMessageMaster, "OwnerID", true);

            ListMaintenance.ListCategoryDataTable listCategoryDataTable = commonMetaList.GetListCategory();
            this.comboBoxCategoryID.DataSource    = listCategoryDataTable;
            this.comboBoxCategoryID.DisplayMember = listCategoryDataTable.DescriptionColumn.ColumnName;
            this.comboBoxCategoryID.ValueMember   = listCategoryDataTable.CategoryIDColumn.ColumnName;
            this.categoryIDBinding = this.comboBoxCategoryID.DataBindings.Add("SelectedValue", this.dataMessageBLL.DataMessageMaster, "CategoryID", true);

            ListMaintenance.ListProductDataTable listProductDataTable = commonMetaList.GetListProduct();
            this.comboBoxProductID.DataSource    = listProductDataTable;
            this.comboBoxProductID.DisplayMember = listProductDataTable.DescriptionColumn.ColumnName;
            this.comboBoxProductID.ValueMember   = listProductDataTable.ProductIDColumn.ColumnName;
            this.productIDBinding = this.comboBoxProductID.DataBindings.Add("SelectedValue", this.dataMessageBLL.DataMessageMaster, "ProductID", true);

            ListMaintenance.ListCoilDataTable listCoilDataTable = commonMetaList.GetListCoil();
            this.comboBoxCoilID.DataSource    = listCoilDataTable;
            this.comboBoxCoilID.DisplayMember = listCoilDataTable.DescriptionColumn.ColumnName;
            this.comboBoxCoilID.ValueMember   = listCoilDataTable.CoilIDColumn.ColumnName;
            this.coilIDBinding = this.comboBoxCoilID.DataBindings.Add("SelectedValue", this.dataMessageBLL.DataMessageMaster, "CoilID", true);

            ListMaintenance.ListStaffNameDataTable listStaffNameDataTable = commonMetaList.GetStaffName();
            this.comboBoxRequestedEmployeeID.DataSource    = listStaffNameDataTable;
            this.comboBoxRequestedEmployeeID.DisplayMember = listStaffNameDataTable.DescriptionOfficialColumn.ColumnName;
            this.comboBoxRequestedEmployeeID.ValueMember   = listStaffNameDataTable.StaffIDColumn.ColumnName;
            this.requestedEmployeeIDBinding = this.comboBoxRequestedEmployeeID.DataBindings.Add("SelectedValue", this.dataMessageBLL.DataMessageMaster, "RequestedEmployeeID", true);


            this.coilExtensionBinding = this.textBoxCoilExtension.DataBindings.Add("Text", this.dataMessageBLL.DataMessageMaster, "CoilExtension", true);
            this.remarksBinding       = this.textBoxRemarks.DataBindings.Add("Text", this.dataMessageBLL.DataMessageMaster, "Remarks", true);

            this.productionDateBinding = this.dateTimePickerRequestedDate.DataBindings.Add("Value", this.dataMessageBLL.DataMessageMaster, "ProductionDate", true);

            this.isDirtyBinding    = this.checkBoxIsDirty.DataBindings.Add("Checked", this.dataMessageBLL.DataMessageMaster, "IsDirty", true);
            this.isDirtyBLLBinding = this.checkBoxIsDirtyBLL.DataBindings.Add("Checked", this.dataMessageBLL, "IsDirty", true);


            this.factoryIDBinding.BindingComplete           += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.ownerIDBinding.BindingComplete             += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.categoryIDBinding.BindingComplete          += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.productIDBinding.BindingComplete           += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.coilIDBinding.BindingComplete              += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.requestedEmployeeIDBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);


            this.coilExtensionBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.remarksBinding.BindingComplete       += new BindingCompleteEventHandler(CommonControl_BindingComplete);

            this.productionDateBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);

            this.isDirtyBinding.BindingComplete    += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            this.isDirtyBLLBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);

            this.naviGroupDetails.DataBindings.Add("ExpandedHeight", this.numericUpDownSizingDetail, "Value", true, DataSourceUpdateMode.OnPropertyChanged);
            this.numericUpDownSizingDetail.Minimum = this.naviGroupDetails.HeaderHeight * 2;
            this.numericUpDownSizingDetail.Maximum = this.naviGroupDetails.Height + this.dataGridViewDataMessageMaster.Height;
        }