Пример #1
0
 private void buttonUserUnregister_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.SelectedUserControlIndex != null && this.SelectedUserControlIndex.UserID > 0 && this.SelectedUserControlIndex.SecurityIdentifier != ContextAttributes.User.SecurityIdentifier)
         {
             if (CustomMsgBox.Show(this, "Are you sure you want to deregister this user?" + "\r\n" + "\r\nUser:  "******"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
             {
                 if (this.userControlRepository.GetEditable((int)this.selectedUserControlIndex.UserID))
                 {
                     this.userControlAPIs.UserControlUnregister(this.SelectedUserControlIndex.UserID, this.SelectedUserControlIndex.UserName, this.SelectedUserControlIndex.SecurityIdentifier);
                     this.LoadUserControls();
                 }
                 else
                 {
                     throw new Exception("Can not deregister this user. Please check again!");
                 }
             }
         }
     }
     catch (Exception exception)
     {
         ExceptionHandlers.ShowExceptionMessageBox(this, exception);
     }
 }
Пример #2
0
        protected virtual void ImportExcel(GlobalEnums.MappingTaskID mappingTaskID)
        {
            try
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.Filter = "Excel File (.xlsx)|*.xlsx";

                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    string fileName = openFileDialog.FileName;

                    ColumnMappings columnMappings = new ColumnMappings(mappingTaskID, fileName);

                    if (columnMappings.ShowDialog() == DialogResult.OK)
                    {
                        this.DoImportExcel(fileName);
                    }

                    columnMappings.Dispose();
                }
                openFileDialog.Dispose();
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #3
0
 private void reloadTabPages()
 {
     try
     {
         this.customTabBatch.SuspendLayout();
         this.clearTabPages();
         foreach (TabPage tabpage in this.tabPages)
         {
             if (this.reportViewModel.ReportTabPageIDs != null && this.reportViewModel.ReportTabPageIDs.IndexOf(tabpage.Tag.ToString()) != -1 && !this.customTabBatch.TabPages.Contains(tabpage))
             {
                 this.customTabBatch.TabPages.Add(tabpage);
             }
         }
         if (this.customTabBatch.TabPages.Contains(this.tabPageCommodities))
         {
             this.customTabBatch.SelectedTab = this.tabPageCommodities;
         }
     }
     catch (Exception exception)
     {
         ExceptionHandlers.ShowExceptionMessageBox(this, exception);
     }
     finally
     {
         this.customTabBatch.ResumeLayout();
     }
 }
Пример #4
0
        private void buttonDownload_Click(object sender, EventArgs e)
        {
            try
            {
                ChangePassword changePassword = new ChangePassword(); //new ChangePassword(true): checkPasswordOnly
                DialogResult   dialogResult   = changePassword.ShowDialog(); changePassword.Dispose();
                if (dialogResult == System.Windows.Forms.DialogResult.Yes)
                {
                    CustomMsgBox.Show(this, "Mật khẩu vừa thay đổi thành công." + "\r\n" + "\r\n" + "Vui lòng mở lại phần mềm để đăng nhập bằng mật khẩu mới.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    this.DialogResult = DialogResult.Yes;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }

            //try
            //{
            //    throw new Exception("Please open your program again in order to update new version." + "\r\n" + "\r\n" + "Contact your admin for more information. Thank you!" + "\r\n" + "\r\n" + "\r\n" + "\r\n" + "Vui lòng mở lại phần mềm để cập nhật phiên bản mới nhất. Cám ơn.");
            //}
            //catch (Exception exception)
            //{
            //    CommonConfigs.AddUpdateAppSetting("VersionID", "-9");
            //    ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            //    this.DialogResult = DialogResult.Cancel;
            //}
        }
Пример #5
0
 protected virtual void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e)
 {
     if (e.BindingCompleteState == BindingCompleteState.Exception)
     {
         ExceptionHandlers.ShowExceptionMessageBox(this, e.ErrorText); e.Cancel = true;
     }
 }
Пример #6
0
        protected override void InitializeTabControl()
        {
            try
            {
                if (GlobalVariables.ConfigID == (int)GlobalVariables.FillingLine.Drum)
                {
                    this.labelNextPackNo.Visible = false; this.textexNextPackNo.Visible = false;
                }
                if (GlobalVariables.ConfigID == (int)GlobalVariables.FillingLine.Drum)
                {
                    this.labelNextCartonNo.Visible = false; this.labelNextCartonNo.Visible = false;
                }

                CustomTabControl customTabBatch = new CustomTabControl();
                //customTabControlCustomerChannel.ImageList = this.imageListTabControl;

                customTabBatch.Font         = this.textexCode.Font;
                customTabBatch.DisplayStyle = TabStyle.VisualStudio;
                customTabBatch.DisplayStyleProvider.ImageAlign = ContentAlignment.MiddleLeft;

                customTabBatch.TabPages.Add("Batch", "Lot Details    ");
                customTabBatch.TabPages[0].Controls.Add(this.layoutMaster);

                this.naviBarMaster.Bands[0].ClientArea.Controls.Add(customTabBatch);

                customTabBatch.Dock    = DockStyle.Fill;
                this.layoutMaster.Dock = DockStyle.Fill;
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #7
0
 private void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e)
 {
     if (e.BindingCompleteState == BindingCompleteState.Exception)
     {
         ExceptionHandlers.ShowExceptionMessageBox(this, e.ErrorText); e.Cancel = true;
     }
     if (sender.Equals(this.bindingCustomerID))
     {
         if (this.combexCustomerID.SelectedItem != null)
         {
             CustomerBase customerBase = (CustomerBase)this.combexCustomerID.SelectedItem;
             this.salesOrderViewModel.CustomerName  = customerBase.Name;
             this.salesOrderViewModel.ContactInfo   = customerBase.ContactInfo;
             this.salesOrderViewModel.SalespersonID = customerBase.SalespersonID;
             //this.salesOrderViewModel.ReceiverID = customerBase.CustomerID;
         }
     }
     if (sender.Equals(this.bindingReceiverID))
     {
         if (this.combexReceiverID.SelectedItem != null)
         {
             CustomerBase customerBase = (CustomerBase)this.combexReceiverID.SelectedItem;
             this.salesOrderViewModel.ReceiverName    = customerBase.Name;
             this.salesOrderViewModel.ShippingAddress = customerBase.ShippingAddress;
         }
     }
 }
Пример #8
0
        private void naviBarModuleMaster_ActiveBandChanged(object sender, EventArgs e)
        {
            try
            {
                int moduleID;
                if (int.TryParse(this.naviBarModuleMaster.ActiveBand.Tag.ToString(), out moduleID))
                {
                    if (moduleID == 9)
                    {
                        this.OpenModuleDetail((int)GlobalEnums.NmvnTaskID.Reports);
                        if (lastActiveBand != null)
                        {
                            this.naviBarModuleMaster.ActiveBand = lastActiveBand;
                        }
                    }
                    else
                    {
                        this.buttonNaviBarHeader.Text = this.naviBarModuleMaster.ActiveBand.Text;

                        this.fastNMVNTask.Parent = null;
                        this.naviBarModuleMaster.ActiveBand.ClientArea.Controls.Add(this.fastNMVNTask);
                        this.fastNMVNTask.Dock    = DockStyle.Fill;
                        this.fastNMVNTask.Visible = true;

                        lastActiveBand = this.naviBarModuleMaster.ActiveBand;

                        InitializeTaskMaster(moduleID);
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #9
0
        private void InitializeModuleMaster()
        {
            try
            {
                ICollection <ModuleIndex> moduleIndexs = this.moduleAPIs.GetModuleIndexes();

                foreach (ModuleIndex moduleIndex in moduleIndexs)
                {
                    if (moduleIndex.ModuleID == 1 || moduleIndex.ModuleID == 6 || moduleIndex.ModuleID == 9)
                    {
                        NaviBand naviBand = new NaviBand();

                        naviBand.Text = moduleIndex.Code;
                        naviBand.Tag  = moduleIndex.ModuleID.ToString();

                        naviBand.SmallImage = this.imageListModuleMasterSmall.Images[moduleIndex.ModuleID == 1 ? 0 : (moduleIndex.ModuleID == 6 ? 1 : 2)];
                        naviBand.LargeImage = this.imageListModuleMasterLarge.Images[moduleIndex.ModuleID == 1 ? 0 : (moduleIndex.ModuleID == 6 ? 1 : 2)];

                        this.naviBarModuleMaster.Bands.Add(naviBand);
                    }
                }

                this.naviBarModuleMaster.VisibleLargeButtons = this.naviBarModuleMaster.Bands.Count;
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #10
0
        public UserReferences()
        {
            InitializeComponent();
            try
            {
                this.UserID = ContextAttributes.User.UserID;

                ModuleAPIs moduleAPIs = new ModuleAPIs(CommonNinject.Kernel.Get <IModuleAPIRepository>());

                this.fastNMVNTasks.ShowGroups           = true;
                this.fastNMVNTasks.AboutToCreateGroups += fastNMVNTasks_AboutToCreateGroups;
                this.fastNMVNTasks.SetObjects(moduleAPIs.GetModuleDetailIndexes());
                this.fastNMVNTasks.Sort(this.olvModuleName, SortOrder.Ascending);

                this.userAPIs = new UserAPIs(CommonNinject.Kernel.Get <IUserAPIRepository>());
                this.comboUserID.ComboBox.DataSource    = this.userAPIs.GetUserIndexes();
                this.comboUserID.ComboBox.DisplayMember = CommonExpressions.PropertyName <UserIndex>(p => p.FullyQualifiedUserName);
                this.comboUserID.ComboBox.ValueMember   = CommonExpressions.PropertyName <UserIndex>(p => p.UserID);
                this.bindingUserID = this.comboUserID.ComboBox.DataBindings.Add("SelectedValue", this, CommonExpressions.PropertyName <UserIndex>(p => p.UserID), true, DataSourceUpdateMode.OnPropertyChanged);


                this.gridexUserAccessControl.AutoGenerateColumns = false;
                this.gridexUserAccessControl.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

                this.bindingListUserAccessControls              = new BindingList <UserAccessControlDTO>();
                this.gridexUserAccessControl.DataSource         = this.bindingListUserAccessControls;
                this.bindingListUserAccessControls.ListChanged += bindingListUserAccessControls_ListChanged;

                StackedHeaderDecorator stackedHeaderDecorator = new StackedHeaderDecorator(this.gridexUserAccessControl);
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #11
0
        public UserGroups(UserGroupAPIs userGroupAPIs, UserGroupIndex userGroupIndex, bool removeVersusRename)
        {
            InitializeComponent();

            try
            {
                this.userGroupAPIs      = userGroupAPIs;
                this.userGroupIndex     = userGroupIndex;
                this.removeVersusRename = removeVersusRename;

                this.textexCode.TextChanged        += textexNewUserGroupID_TextChanged;
                this.textexName.TextChanged        += textexNewUserGroupID_TextChanged;
                this.textexDescription.TextChanged += textexNewUserGroupID_TextChanged;

                this.textexCode.ReadOnly        = this.userGroupIndex != null && this.removeVersusRename;
                this.textexName.ReadOnly        = this.userGroupIndex != null && this.removeVersusRename;
                this.textexDescription.ReadOnly = this.userGroupIndex != null && this.removeVersusRename;
                this.Text          = this.userGroupIndex != null ? (this.removeVersusRename ? "Delete group" : "Rename group") : "Add new group";
                this.buttonOK.Text = this.userGroupIndex != null ? (this.removeVersusRename ? "Delete" : "Rename") : "Add";

                if (this.userGroupIndex != null)
                {
                    this.textexCode.Text = this.userGroupIndex.Code; this.textexName.Text = this.userGroupIndex.Name; this.textexDescription.Text = this.userGroupIndex.Description;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #12
0
        private void fastBarcodes_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                FastObjectListView fastBarcodes = sender as FastObjectListView;
                if (fastBarcodes.SelectedObject != null)
                {
                    BarcodeDTO barcodeDTO = fastBarcodes.SelectedObject as BarcodeDTO;
                    if (barcodeDTO != null)
                    {
                        if (true)
                        {
                            WebapiGettsa webapiGettsa = new WebapiGettsa(barcodeDTO.Label);
                            webapiGettsa.ShowDialog(); webapiGettsa.Dispose();
                        }
                        else
                        {
                            PrintViewModel printViewModel = new PrintViewModel();
                            printViewModel.ReportPath = "SearchBarcode";
                            printViewModel.ReportParameters.Add(new Microsoft.Reporting.WinForms.ReportParameter("Barcode", barcodeDTO.Code));

                            SsrsViewer ssrsViewer = new SsrsViewer(printViewModel);
                            ssrsViewer.Show();
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #13
0
        private void fastBarcodes_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                try
                {
                    FastObjectListView fastBarcodes = sender as FastObjectListView;
                    if (fastBarcodes.SelectedObject != null)
                    {
                        CartonDTO cartonDTO = null; PalletDTO palletDTO = null;
                        if (sender.Equals(this.fastCartons))
                        {
                            cartonDTO = fastBarcodes.SelectedObject as CartonDTO;
                        }
                        if (sender.Equals(this.fastPallets))
                        {
                            palletDTO = fastBarcodes.SelectedObject as PalletDTO;
                        }

                        if (cartonDTO != null || palletDTO != null)
                        {
                            QuickView quickView = new QuickView(this.scannerAPIs.GetBarcodeList((GlobalVariables.FillingLine)(cartonDTO != null ? cartonDTO.FillingLineID : palletDTO.FillingLineID), cartonDTO != null ? cartonDTO.CartonID : 0, palletDTO != null ? palletDTO.PalletID : 0), cartonDTO != null ? "Carton: " + cartonDTO.Code : "Pallet: " + palletDTO.Code);
                            quickView.ShowDialog(); quickView.Dispose();
                        }
                    }
                }
                catch (Exception exception)
                {
                    ExceptionHandlers.ShowExceptionMessageBox(this, exception);
                }
            }
        }
Пример #14
0
        public UserControls()
        {
            InitializeComponent();
            try
            {
                this.userControlRepository = CommonNinject.Kernel.Get <IUserControlRepository>();
                this.userControlAPIs       = new UserControlAPIs(CommonNinject.Kernel.Get <IUserControlAPIRepository>());
                this.userGroupAPIs         = new UserGroupAPIs(CommonNinject.Kernel.Get <IUserGroupAPIRepository>());

                this.comboActiveOption.SelectedIndex = 0;

                this.fastUserControlIndexes.ShowGroups           = true;
                this.fastUserControlIndexes.AboutToCreateGroups += fastGroups_AboutToCreateGroups;

                this.fastUserGroupDetails.ShowGroups           = true;
                this.fastUserGroupDetails.AboutToCreateGroups += fastGroups_AboutToCreateGroups;

                this.fastUserSalespersons.ShowGroups           = true;
                this.fastUserSalespersons.AboutToCreateGroups += fastGroups_AboutToCreateGroups;

                this.onDataLogs         = this.userControlRepository.GetOnDataLogs();
                this.onEventLogs        = this.userControlRepository.GetOnEventLogs();
                this.bindingOnDataLogs  = this.checkOnDataLogs.DataBindings.Add("Checked", this, "OnDataLogs", true, DataSourceUpdateMode.OnPropertyChanged);
                this.bindingOnEventLogs = this.checkOnEventLogs.DataBindings.Add("Checked", this, "OnEventLogs", true, DataSourceUpdateMode.OnPropertyChanged);

                this.textexLegalNotice.Text        = this.userControlRepository.GetLegalNotice();
                this.labelUpdateSuccessfullly.Text = ""; this.separatorLegalNotice.Visible = false;
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #15
0
        private void listViewTaskMaster_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (this.listViewTaskMaster.SelectedItems.Count > 0)
                {
                    //Get taskID by ListViewItem key (The key defined when add ListViewItem to ListView)
                    int taskID; if (!int.TryParse(this.listViewTaskMaster.SelectedItems[0].Name, out taskID))
                    {
                        return;
                    }

                    //Find and active the current form
                    for (int i = 0; i < this.MdiChildren.Length; i++)
                    {
                        IToolstripChild mdiChildCallToolStrip = this.MdiChildren[i] as IToolstripChild;
                        if (mdiChildCallToolStrip != null)
                        {
                            if (taskID == (int)mdiChildCallToolStrip.NMVNTaskID)
                            {
                                Form mdiChildrenForm = (Form)this.MdiChildren[i];
                                mdiChildrenForm.Activate();
                                return;
                            }
                        }

                        this.OpenModuleDetail(taskID);
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #16
0
        private void MasterMdi_MdiChildActivate(object sender, EventArgs e)
        {
            try
            {
                ToolStripManager.RevertMerge(this.toolstripMain);
                IToolstripMerge mergeToolstrip = ActiveMdiChild as IToolstripMerge;
                if (mergeToolstrip != null)
                {
                    ToolStripManager.Merge(mergeToolstrip.toolstripChild, toolstripMain);
                }

                IToolstripChild toolstripChild = ActiveMdiChild as IToolstripChild;
                if (toolstripChild != null)
                {
                    toolstripChild.PropertyChanged -= new PropertyChangedEventHandler(toolstripChild_PropertyChanged);
                    toolstripChild.PropertyChanged += new PropertyChangedEventHandler(toolstripChild_PropertyChanged);

                    toolstripChild_PropertyChanged(toolstripChild, new PropertyChangedEventArgs("IsDirty"));
                }

                if (ActiveMdiChild != null)
                {
                    ActiveMdiChild.WindowState = FormWindowState.Maximized;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #17
0
        private void buttonSearchBarcode_Click(object sender, EventArgs e)
        {
            try
            {
                this.comboSearchBarcode.Text = this.comboSearchBarcode.Text.Trim();
                if (this.comboSearchBarcode.Text.Length > 0 && (this.comboSearchBarcode.Text != this.searchPlaceHolder))
                {
                    if (this.comboSearchBarcode.Items.IndexOf(this.comboSearchBarcode.Text) == -1)
                    {
                        this.comboSearchBarcode.Items.Add(this.comboSearchBarcode.Text);
                    }

                    SearchBarcode searchBarcode = new SearchBarcode(this.comboSearchBarcode.Text);
                    DialogResult  dialogResult  = searchBarcode.ShowDialog(); searchBarcode.Dispose();

                    if (dialogResult == System.Windows.Forms.DialogResult.Yes)
                    {
                        SmartCoding activeSmartCoding = ActiveMdiChild as SmartCoding;
                        if (activeSmartCoding != null)
                        {
                            activeSmartCoding.ReprintCarton(GlobalEnums.ReprintCartonID);
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #18
0
        public UserAdd(UserAPIs userAPIs)
        {
            InitializeComponent();

            try
            {
                List <DomainUser> allUsers = new List <DomainUser>();
                PrincipalContext  ctx      = new PrincipalContext(ContextType.Domain, "chevronvn.com"); //, "OU=SomeOU,dc=YourCompany,dc=com"// create your domain context and define the OU container to search in
                UserPrincipal     qbeUser  = new UserPrincipal(ctx);                                    // define a "query-by-example" principal - here, we search for a UserPrincipal (user)
                PrincipalSearcher srch     = new PrincipalSearcher(qbeUser);                            // create your principal searcher passing in the QBE principal

                foreach (var found in srch.FindAll())                                                   // find all matches
                {                                                                                       // do whatever here - "found" is of type "Principal" - it could be user, group, computer.....
                    allUsers.Add(new DomainUser()
                    {
                        FirstName = found.DisplayName, LastName = found.Name, UserName = this.GetWindowsIdentityName(found.DistinguishedName), SecurityIdentifier = found.Sid.Value
                    });
                }

                this.combexUserID.DataSource    = allUsers;
                this.combexUserID.DisplayMember = CommonExpressions.PropertyName <DomainUser>(p => p.UserName);
                this.combexUserID.ValueMember   = CommonExpressions.PropertyName <DomainUser>(p => p.UserName);
                this.bindingUserName            = this.combexUserID.DataBindings.Add("SelectedValue", this, CommonExpressions.PropertyName <DomainUser>(p => p.UserName), true, DataSourceUpdateMode.OnPropertyChanged);

                this.userAPIs = userAPIs;
                this.combexOrganizationalUnitID.DataSource    = this.userAPIs.GetOrganizationalUnitIndexes();
                this.combexOrganizationalUnitID.DisplayMember = CommonExpressions.PropertyName <OrganizationalUnitIndex>(p => p.LocationOrganizationalUnitName);
                this.combexOrganizationalUnitID.ValueMember   = CommonExpressions.PropertyName <OrganizationalUnitIndex>(p => p.OrganizationalUnitID);
                this.bindingOrganizationalUnitID = this.combexOrganizationalUnitID.DataBindings.Add("SelectedValue", this, CommonExpressions.PropertyName <OrganizationalUnitIndex>(p => p.OrganizationalUnitID), true, DataSourceUpdateMode.OnPropertyChanged);
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #19
0
        protected override void InitializeTabControl()
        {
            try
            {
                base.InitializeTabControl();

                #region TabCenter
                this.customTabCenter = new CustomTabControl();
                this.customTabCenter.DisplayStyle = TabStyle.VisualStudio;
                this.customTabCenter.Font         = this.panelCenter.Font;

                this.customTabCenter.TabPages.Add("tabCenterAA", "Commodity Details          ");
                this.customTabCenter.TabPages.Add("tabCenterBB", "API Code, Remarks        ");

                this.customTabCenter.TabPages[0].Controls.Add(this.layoutTop);
                this.customTabCenter.TabPages[1].Controls.Add(this.layoutRight);
                this.customTabCenter.TabPages[0].BackColor = this.panelCenter.BackColor;
                this.customTabCenter.TabPages[1].BackColor = this.panelCenter.BackColor;
                this.layoutTop.Dock   = DockStyle.Fill;
                this.layoutRight.Dock = DockStyle.Fill;

                this.panelCenter.Controls.Add(this.customTabCenter);
                this.customTabCenter.Dock = DockStyle.Fill;
                #endregion TabCenter

                this.layoutTop.ColumnStyles[this.layoutTop.ColumnCount - 1].SizeType = SizeType.Absolute; this.layoutTop.ColumnStyles[this.layoutTop.ColumnCount - 1].Width = 15;
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #20
0
        private void WizardMaster_Load(object sender, EventArgs e)
        {
            try
            {
                this.forecastViewModel.PropertyChanged += forecastDetailDTO_PropertyChanged;

                LocationAPIs locationAPIs = new LocationAPIs(CommonNinject.Kernel.Get <ILocationAPIRepository>());
                this.combexForecastLocationID.DataSource    = locationAPIs.GetLocationBases();
                this.combexForecastLocationID.DisplayMember = CommonExpressions.PropertyName <LocationBase>(p => p.Name);
                this.combexForecastLocationID.ValueMember   = CommonExpressions.PropertyName <LocationBase>(p => p.LocationID);
                this.bindingForecastLocationID = this.combexForecastLocationID.DataBindings.Add("SelectedValue", this.forecastViewModel, CommonExpressions.PropertyName <ForecastViewModel>(p => p.ForecastLocationID), true, DataSourceUpdateMode.OnPropertyChanged);


                this.bindingEntryDate   = this.dateTimexEntryDate.DataBindings.Add("Value", this.forecastViewModel, CommonExpressions.PropertyName <ForecastViewModel>(p => p.EntryDate), true, DataSourceUpdateMode.OnPropertyChanged);
                this.bindingVoucherCode = this.textexVoucherCode.DataBindings.Add("Text", this.forecastViewModel, CommonExpressions.PropertyName <ForecastViewModel>(p => p.VoucherCode), true, DataSourceUpdateMode.OnPropertyChanged);
                this.bindingDescription = this.textexDescription.DataBindings.Add("Text", this.forecastViewModel, CommonExpressions.PropertyName <ForecastViewModel>(p => p.Description), true, DataSourceUpdateMode.OnPropertyChanged);
                this.bindingRemarks     = this.textexRemarks.DataBindings.Add("Text", this.forecastViewModel, CommonExpressions.PropertyName <ForecastViewModel>(p => p.Remarks), true, DataSourceUpdateMode.OnPropertyChanged);

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

                this.bindingEntryDate.BindingComplete   += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.bindingVoucherCode.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.bindingDescription.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.bindingRemarks.BindingComplete     += new BindingCompleteEventHandler(CommonControl_BindingComplete);

                this.buttonOK.Enabled = this.forecastViewModel.IsValid;
                this.errorProviderMaster.DataSource = this.forecastViewModel;
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #21
0
        private void buttonOKESC_Click(object sender, EventArgs e)
        {
            try
            {
                if (sender.Equals(this.buttonOK))
                {
                    if (this.salesOrderViewModel.CustomerID != null && this.salesOrderViewModel.ReceiverID != null && this.salesOrderViewModel.SalespersonID != null)
                    {
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        CustomMsgBox.Show(this, "Vui lòng chọn khách hàng, nhân viên kinh doanh.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
                    }
                }

                if (sender.Equals(this.buttonESC))
                {
                    this.DialogResult = DialogResult.Cancel;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #22
0
        private void buttonOKESC_Click(object sender, EventArgs e)
        {
            try
            {
                if (sender.Equals(this.buttonOK))
                {
                    if (this.forecastViewModel.ForecastLocationID != null)
                    {
                        this.forecastViewModel.EntryDate = new DateTime(((DateTime)this.forecastViewModel.EntryDate).Year, ((DateTime)this.forecastViewModel.EntryDate).Month, 1);
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        CustomMsgBox.Show(this, "Vui lòng chọn forecast location.", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
                    }
                }

                if (sender.Equals(this.buttonESC))
                {
                    this.DialogResult = DialogResult.Cancel;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #23
0
        private void buttonOKESC_Click(object sender, EventArgs e)
        {
            try
            {
                if (sender.Equals(this.buttonOK))
                {
                    if (this.combexUserID.SelectedIndex >= 0 && this.UserName != null)
                    {
                        DomainUser domainUser = this.combexUserID.SelectedItem as DomainUser;
                        if (domainUser != null)
                        {
                            this.userControlAPIs.UserControlRegister(domainUser.FirstName, domainUser.LastName, domainUser.UserName, domainUser.SecurityIdentifier);
                            this.DialogResult = DialogResult.OK;
                        }
                    }
                }

                if (sender.Equals(this.buttonESC))
                {
                    this.DialogResult = DialogResult.Cancel;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #24
0
        private void OptionBatches_Load(object sender, EventArgs e)
        {
            try
            {
                BatchAPIs batchAPIs = new BatchAPIs(CommonNinject.Kernel.Get <IBatchAPIRepository>());

                this.combexBatchID.DataSource    = batchAPIs.GetBatchAvailables(this.batchQuantityDetailDTO.LocationID, this.batchQuantityDetailDTO.DeliveryAdviceID, this.batchQuantityDetailDTO.TransferOrderID, this.batchQuantityDetailDTO.CommodityID, true);
                this.combexBatchID.DisplayMember = CommonExpressions.PropertyName <BatchAvailable>(p => p.Code);
                this.combexBatchID.ValueMember   = CommonExpressions.PropertyName <BatchAvailable>(p => p.BatchID);
                this.bindingBatchID = this.combexBatchID.DataBindings.Add("SelectedValue", this.batchQuantityDetailDTO, CommonExpressions.PropertyName <IBatchQuantityDetailDTO>(p => p.BatchID), true, DataSourceUpdateMode.OnPropertyChanged);

                this.bindingBatchEntryDate           = this.textexBatchEntryDate.DataBindings.Add("Text", this.batchQuantityDetailDTO, CommonExpressions.PropertyName <IBatchQuantityDetailDTO>(p => p.BatchEntryDate), true, DataSourceUpdateMode.OnPropertyChanged);
                this.bindingQuantityBatchAvailable   = this.textexQuantityBatchAvailable.DataBindings.Add("Text", this.batchQuantityDetailDTO, CommonExpressions.PropertyName <IBatchQuantityDetailDTO>(p => p.QuantityBatchAvailable), true, DataSourceUpdateMode.OnPropertyChanged);
                this.bindingLineVolumeBatchAvailable = this.textexLineVolumeBatchAvailable.DataBindings.Add("Text", this.batchQuantityDetailDTO, CommonExpressions.PropertyName <IBatchQuantityDetailDTO>(p => p.LineVolumeBatchAvailable), true, DataSourceUpdateMode.OnPropertyChanged);

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

                this.bindingBatchEntryDate.BindingComplete           += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.bindingQuantityBatchAvailable.BindingComplete   += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.bindingLineVolumeBatchAvailable.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #25
0
        private void BaseView_Load(object sender, EventArgs e)
        {
            try
            {
                InitializeTabControl();

                this.fastListIndex.CheckBoxes            = false;
                this.fastListIndex.SelectedIndexChanged += new EventHandler(this.fastListIndex_SelectedIndexChanged);
                this.fastListIndex.MouseClick           += new MouseEventHandler(fastListIndex_MouseClick);
                this.fastListIndex.KeyDown += new KeyEventHandler(fastListIndex_KeyDown);

                this.baseDTO.PropertyChanged += new PropertyChangedEventHandler(ModelDTO_PropertyChanged);

                this.InitializeCommonControlBinding();
                this.InitializeDataGridBinding();
                this.InitializeReadOnlyModeBinding();

                this.Loading();
                this.DoAfterLoad();
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #26
0
        private void MasterMDI_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                for (int i = 0; i < this.MdiChildren.Length; i++)
                {
                    IToolstripChild mdiChildCallToolStrip = this.MdiChildren[i] as IToolstripChild;
                    if (mdiChildCallToolStrip != null)
                    {
                        if (mdiChildCallToolStrip.ReadonlyMode)
                        {
                            ((Form)mdiChildCallToolStrip).Close();
                        }
                    }
                    else
                    {
                        this.MdiChildren[i].Close();
                    }
                }

                if (this.MdiChildren.Length > 0)
                {
                    e.Cancel = true;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #27
0
        protected override void invokeEdit(int?id)
        {
            try
            {
                base.invokeEdit(id);

                this.reloadTabPages();

                if (this.reportViewModel.OptionBoxIDs != null)
                {
                    this.dateTimexFromDate.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.FromDate)) != -1; this.labelFromDate.Visible = this.dateTimexFromDate.Visible; this.pictureFromDate.Visible = this.dateTimexFromDate.Visible;
                    this.dateTimexToDate.Visible   = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.ToDate)) != -1; this.labelToDate.Visible = this.dateTimexToDate.Visible; this.pictureToDate.Visible = this.dateTimexToDate.Visible; labelToDate.Text = this.dateTimexFromDate.Visible ? "To" : "As at";

                    this.comboSummaryVersusDetail.Visible  = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.SummaryVersusDetail)) != -1;
                    this.comboQuantityVersusVolume.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.QuantityVersusVolume)) != -1; this.buttonQuantityVersusVolume.Visible = this.comboSummaryVersusDetail.Visible || this.comboQuantityVersusVolume.Visible;
                    this.comboDateVersusMonth.Visible      = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.DateVersusMonth)) != -1; this.buttonDateVersusMonth.Visible = this.comboDateVersusMonth.Visible;
                    this.comboSalesVersusPromotion.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.SalesVersusPromotion)) != -1;

                    this.comboForecastFilters.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.ForecastFilters)) != -1; this.buttonSalesVersusPromotion.Visible = this.comboSalesVersusPromotion.Visible || this.comboForecastFilters.Visible;

                    this.comboSlowMoving.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.SlowMoving)) != -1; this.labelSlowMoving.Visible = this.comboSlowMoving.Visible; this.numericSlowMoving.Visible = this.comboSlowMoving.Visible;

                    this.comboUserName.Visible = this.reportViewModel.OptionBoxIDs.IndexOf(GlobalEnums.OBx(GlobalEnums.OptionBoxID.UserName)) != -1; this.buttonUserName.Visible = this.comboUserName.Visible;
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #28
0
        private void InitializeModuleMaster()
        {
            try
            {
                ICollection <ModuleIndex> moduleIndexs = this.moduleAPIs.GetModuleIndexes();

                foreach (ModuleIndex moduleIndex in moduleIndexs)
                {
                    if (moduleIndex.ModuleID != 8)
                    {
                        NaviBand naviBand = new NaviBand();

                        naviBand.Text = moduleIndex.Code;
                        naviBand.Tag  = moduleIndex.ModuleID.ToString();

                        naviBand.SmallImage = this.imageListModuleMasterSmall.Images[moduleIndex.ModuleID <= 9 ? moduleIndex.ModuleID : 8];
                        naviBand.LargeImage = this.imageListModuleMasterLarge.Images[moduleIndex.ModuleID <= 9 ? moduleIndex.ModuleID : 8];

                        this.naviBarModuleMaster.Bands.Add(naviBand);
                    }
                }

                this.naviBarModuleMaster.VisibleLargeButtons = this.naviBarModuleMaster.Bands.Count;
                this.naviBarModuleMaster.PopupHeight         = this.naviBarModuleMaster.Height + this.naviBarModuleMaster.HeaderHeight - (this.naviBarModuleMaster.ButtonHeight) * this.naviBarModuleMaster.Bands.Count - 15;
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Пример #29
0
 private void CommonControl_BindingComplete(object sender, BindingCompleteEventArgs e)
 {
     if (e.BindingCompleteState == BindingCompleteState.Exception)
     {
         ExceptionHandlers.ShowExceptionMessageBox(this, e.ErrorText); e.Cancel = true;
     }
     if (sender.Equals(this.bindingWarehouseID))
     {
         if (this.combexWarehouseID.SelectedItem != null)
         {
             WarehouseBase warehouseBase = (WarehouseBase)this.combexWarehouseID.SelectedItem;
             this.warehouseAdjustmentViewModel.WarehouseName = warehouseBase.Name;
         }
     }
     if (sender.Equals(this.bindingWarehouseReceiptID))
     {
         if (this.combexWarehouseReceiptID.SelectedItem != null)
         {
             WarehouseBase warehouseBase = (WarehouseBase)this.combexWarehouseReceiptID.SelectedItem;
             this.warehouseAdjustmentViewModel.WarehouseReceiptName = warehouseBase.Name;
         }
     }
     if (sender.Equals(this.bindingWarehouseAdjustmentTypeID))
     {
         if (this.combexWarehouseAdjustmentTypeID.SelectedItem != null)
         {
             WarehouseAdjustmentTypeBase warehouseAdjustmentTypeBase = (WarehouseAdjustmentTypeBase)this.combexWarehouseAdjustmentTypeID.SelectedItem;
             this.warehouseAdjustmentViewModel.WarehouseAdjustmentTypeName = warehouseAdjustmentTypeBase.Name;
         }
     }
 }
        protected override void InitializeTabControl()
        {
            try
            {
                base.InitializeTabControl();

                this.customTabBatch = new CustomTabControl();

                this.customTabBatch.Font         = this.fastAvailablePallets.Font;
                this.customTabBatch.DisplayStyle = TabStyle.VisualStudio;
                this.customTabBatch.DisplayStyleProvider.ImageAlign = ContentAlignment.MiddleLeft;

                this.customTabBatch.TabPages.Add("tabPendingPallets", "Pending pallets");
                this.customTabBatch.TabPages.Add("tabPendingCartons", "Pending cartons");
                this.customTabBatch.TabPages[0].Controls.Add(this.fastAvailablePallets);
                this.customTabBatch.TabPages[1].Controls.Add(this.fastAvailableCartons);


                this.customTabBatch.Dock       = DockStyle.Fill;
                this.fastAvailablePallets.Dock = DockStyle.Fill;
                this.fastAvailableCartons.Dock = DockStyle.Fill;
                this.Controls.Add(this.customTabBatch);
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }