Exemple #1
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);
            }
        }
Exemple #2
0
        public MasterMDI(GlobalEnums.NmvnTaskID nmvnTaskID, Form loadedView)
        {
            InitializeComponent();

            try
            {
                this.nmvnTaskID = nmvnTaskID;
                this.moduleAPIs = new ModuleAPIs(CommonNinject.Kernel.Get <IModuleAPIRepository>());

                switch (this.nmvnTaskID)
                {
                case GlobalEnums.NmvnTaskID.SmartCoding:

                    this.buttonLoading.Visible             = false;
                    this.buttonNew.Visible                 = false;
                    this.buttonEdit.Visible                = false;
                    this.buttonSave.Visible                = false;
                    this.buttonDelete.Visible              = false;
                    this.buttonImport.Visible              = false;
                    this.buttonExport.Visible              = false;
                    this.toolStripSeparatorImport.Visible  = false;
                    this.buttonApprove.Visible             = false;
                    this.buttonVoid.Visible                = false;
                    this.toolStripSeparatorApprove.Visible = false;
                    this.toolStripSeparatorVoid.Visible    = false;
                    this.buttonPrint.Visible               = false;
                    this.buttonPrintPreview.Visible        = false;
                    this.toolStripSeparatorPrint.Visible   = false;
                    this.toolStripTopHead.Visible          = false;
                    break;

                case GlobalEnums.NmvnTaskID.Batch:
                    this.Size            = new Size(1388, 740);
                    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
                    this.MinimizeBox     = false; this.MaximizeBox = false; this.WindowState = FormWindowState.Normal;

                    this.panelTopRight.Visible = false;
                    this.panelTopLeft.Dock     = DockStyle.Fill;
                    break;

                case GlobalEnums.NmvnTaskID.BatchMaster:
                    if (GlobalVariables.ConfigID != (int)GlobalVariables.FillingLine.BatchMaster)
                    {
                        this.Size            = new Size(1388, 740);
                        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
                        this.MinimizeBox     = false; this.MaximizeBox = false; this.WindowState = FormWindowState.Normal;
                    }

                    //this.panelTopRight.Visible = false;
                    //this.panelTopLeft.Dock = DockStyle.Fill;
                    break;

                case GlobalEnums.NmvnTaskID.Commodity:
                    this.Size            = new Size(1388, 740);
                    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
                    this.MinimizeBox     = false; this.MaximizeBox = false; this.WindowState = FormWindowState.Normal;

                    this.panelTopRight.Visible = false;
                    this.panelTopLeft.Dock     = DockStyle.Fill;
                    break;

                default:
                    break;
                }

                this.beginingDateBinding = this.textFillterLowerDate.TextBox.DataBindings.Add("Text", GlobalEnums.GlobalOptionSetting, "LowerFillterDate", true);
                this.endingDateBinding   = this.textFillterUpperDate.TextBox.DataBindings.Add("Text", GlobalEnums.GlobalOptionSetting, "UpperFillterDate", true);

                this.beginingDateBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.endingDateBinding.BindingComplete   += new BindingCompleteEventHandler(CommonControl_BindingComplete);

                this.buttonNaviBarHeaderVisibleBinding         = this.buttonNaviBarHeader.DataBindings.Add("Visible", this.naviBarModuleMaster, "Collapsed", true, DataSourceUpdateMode.OnPropertyChanged);
                this.buttonNaviBarHeaderVisibleBinding.Parse  += new ConvertEventHandler(buttonNaviBarHeaderVisibleBinding_Parse);
                this.buttonNaviBarHeaderVisibleBinding.Format += new ConvertEventHandler(buttonNaviBarHeaderVisibleBinding_Format);

                this.listViewTaskMaster.Dock = DockStyle.Fill;
                this.listViewTaskMaster.Columns.Add(new ColumnHeader()
                {
                    Width = this.listViewTaskMaster.Width
                });

                if (loadedView != null)
                {
                    this.naviBarModuleMaster.Visible = false;
                    this.OpenView(loadedView);
                }
                else
                {
                    this.InitializeModuleMaster();
                    this.buttonNaviBarHeader_Click(this.buttonNaviBarHeader, new EventArgs());
                }

                DateTime buildDate = new FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime;
                this.statusVersion.Text = "Version 1.0." + GlobalVariables.ConfigVersionID(GlobalVariables.ConfigID).ToString() + ", Date: " + buildDate.ToString("dd/MM/yyyy HH:mm:ss");

                this.comboSearchBarcode.Text    = this.searchPlaceHolder;
                this.toolUserReferences.Enabled = true; //ContextAttributes.User.IsDatabaseAdmin;
                this.statusUserDescription.Text = ContextAttributes.User.FullyQualifiedUserName;

                this.panelTop.Height = this.nmvnTaskID == GlobalEnums.NmvnTaskID.SmartCoding ? 61 : 39;
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }
Exemple #3
0
        public MasterMDI(GlobalEnums.NmvnTaskID nmvnTaskID, Form loadedView, bool isMainView)
        {
            InitializeComponent();

            try
            {
                this.nmvnTaskID = nmvnTaskID;
                IModuleAPIRepository moduleAPIRepository = CommonNinject.Kernel.Get <IModuleAPIRepository>();
                this.moduleAPIs = new ModuleAPIs(moduleAPIRepository);

                if (GlobalEnums.NMVNOnly)
                {
                    this.panelTopRight.Visible = false;
                }

                switch (this.nmvnTaskID)
                {
                case GlobalEnums.NmvnTaskID.SmartCoding:
                    this.buttonEscape.Visible              = false;
                    this.buttonLoading.Visible             = false;
                    this.buttonNew.Visible                 = false;
                    this.buttonEdit.Visible                = false;
                    this.buttonSave.Visible                = false;
                    this.buttonDelete.Visible              = false;
                    this.buttonImport.Visible              = false;
                    this.buttonExport.Visible              = false;
                    this.toolStripSeparatorImport.Visible  = false;
                    this.buttonApprove.Visible             = false;
                    this.buttonVoid.Visible                = false;
                    this.toolStripSeparatorApprove.Visible = false;
                    this.toolStripSeparatorVoid.Visible    = false;
                    this.buttonPrint.Visible               = false;
                    this.buttonPrintPreview.Visible        = false;
                    this.toolStripSeparatorPrint.Visible   = false;
                    this.separatorInputData.Visible        = false;
                    this.labelSearchBarcode.Visible        = false;
                    this.toolStripTopHead.Visible          = false;
                    break;

                case GlobalEnums.NmvnTaskID.Batch:
                    this.Size            = new Size(1180, 732);
                    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
                    this.MinimizeBox     = false; this.MaximizeBox = false; this.WindowState = FormWindowState.Normal;

                    this.panelTopRight.Visible = false;
                    this.panelTopLeft.Dock     = DockStyle.Fill;
                    break;

                case GlobalEnums.NmvnTaskID.FillingLine:
                    this.Size            = new Size(620, 360);
                    this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
                    this.MinimizeBox     = false; this.MaximizeBox = false; this.WindowState = FormWindowState.Normal;

                    this.toolStripTopHead.Visible = false;
                    this.panelTopRight.Visible    = false;
                    this.panelTopLeft.Dock        = DockStyle.Fill;
                    this.statusStrip.Visible      = false;
                    break;

                default:
                    break;
                }

                this.beginingDateBinding = this.dateTimexLowerFillterDate.DataBindings.Add("Value", GlobalEnums.GlobalOptionSetting, CommonExpressions.PropertyName <OptionSetting>(p => p.LowerFillterDate), true, DataSourceUpdateMode.OnPropertyChanged);
                this.endingDateBinding   = this.dateTimexUpperFillterDate.DataBindings.Add("Value", GlobalEnums.GlobalOptionSetting, CommonExpressions.PropertyName <OptionSetting>(p => p.UpperFillterDate), true, DataSourceUpdateMode.OnPropertyChanged);

                this.beginingDateBinding.BindingComplete += new BindingCompleteEventHandler(CommonControl_BindingComplete);
                this.endingDateBinding.BindingComplete   += new BindingCompleteEventHandler(CommonControl_BindingComplete);

                this.buttonNaviBarHeaderVisibleBinding         = this.buttonNaviBarHeader.DataBindings.Add("Visible", this.naviBarModuleMaster, "Collapsed", true, DataSourceUpdateMode.OnPropertyChanged);
                this.buttonNaviBarHeaderVisibleBinding.Parse  += new ConvertEventHandler(buttonNaviBarHeaderVisibleBinding_Parse);
                this.buttonNaviBarHeaderVisibleBinding.Format += new ConvertEventHandler(buttonNaviBarHeaderVisibleBinding_Format);

                #region fastNMVNTask
                this.fastNMVNTask.AboutToCreateGroups += fastNMVNTask_AboutToCreateGroups;
                this.fastNMVNTask.ShowGroups           = true;

                //this.fastNMVNTask.UseTranslucentHotItem = true; //DEFAULT HotItem
                fastNMVNTask.UseTranslucentHotItem = false;
                fastNMVNTask.UseHotItem            = true;
                fastNMVNTask.UseExplorerTheme      = false;

                RowBorderDecoration rbd = new RowBorderDecoration();
                rbd.BorderPen      = new Pen(Color.SeaGreen, 2);
                rbd.FillBrush      = null;
                rbd.CornerRounding = 4.0f;
                HotItemStyle hotItemStyle2 = new HotItemStyle();
                hotItemStyle2.Decoration  = rbd;
                fastNMVNTask.HotItemStyle = hotItemStyle2;
                #endregion fastNMVNTask


                if (loadedView != null)
                {
                    this.naviBarModuleMaster.Visible = false;
                    this.OpenView(loadedView);
                }
                else
                {
                    this.InitializeModuleMaster();
                    //this.buttonNaviBarHeader_Click(this.buttonNaviBarHeader, new EventArgs());
                }

                DateTime buildDate = new FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime;
                this.statusVersion.Text        = "Version 1.0." + GlobalVariables.ConfigVersionID(GlobalVariables.ConfigID).ToString() + ", Date: " + buildDate.ToString("dd/MM/yyyy HH:mm:ss");
                this.labelDataSource.Text      = this.moduleAPIs.DataSource;
                this.labelApplicationRole.Text = ApplicationRoles.Required && ApplicationRoles.Name != "" && ApplicationRoles.ExceptionMessage == "" ? "[Application Role]" : "[Windows Authentication]";

                this.comboSearchBarcode.Text       = this.searchPlaceHolder;
                this.toolUserReferences.Visible    = ContextAttributes.User.IsDatabaseAdmin && false; //HIDE AT CHEVRON
                this.toolUserGroupControls.Visible = ContextAttributes.User.IsDatabaseAdmin;
                this.statusUserDescription.Text    = ContextAttributes.User.FullyQualifiedUserName;

                this.panelTopRight.Width = (this.nmvnTaskID == GlobalEnums.NmvnTaskID.SmartCoding ? 10 : this.labelSearchBarcode.Width) + this.comboSearchBarcode.Width + this.buttonSearchBarcode.Width + 10;
                this.panelTop.Height     = this.nmvnTaskID == GlobalEnums.NmvnTaskID.SmartCoding ? 61 : 39;

                #region JUST DISABLE FOR CHEVRON
                int?accessLevel = moduleAPIRepository.TotalSmartCodingEntities.GetAccessLevel(ContextAttributes.User.UserID, (int)TotalBase.Enums.GlobalEnums.NmvnTaskID.MonthEnd, 0).Single();
                if (accessLevel < (int)TotalBase.Enums.GlobalEnums.AccessLevel.Readable)
                {
                    this.buttonLockedDate.Enabled = false;
                }

                this.txtLockedDate.Visible = false;
                //this.buttonLockedDate.Visible = false;
                #endregion

                this.isMainView = isMainView;
                if (this.isMainView)
                {
                    this.AddEventLogs("Log on application");
                }
            }
            catch (Exception exception)
            {
                ExceptionHandlers.ShowExceptionMessageBox(this, exception);
            }
        }