Beispiel #1
0
 public ModuleAPIs(IModuleAPIRepository moduleAPIRepository)
 {
     this.moduleAPIRepository = moduleAPIRepository;
 }
Beispiel #2
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);
            }
        }