Example #1
0
        public ProductPresenter(IUnityContainer container, IProductView view)
        {
            View = view;
            this.container = container;
            this.service = new WMSServiceClient();
            View.Model = this.container.Resolve<ProductModel>();

            //Event Delegate
            View.LoadSearch += new EventHandler<DataEventArgs<string>>(this.OnLoadSearch);
            View.New += new EventHandler<EventArgs>(this.OnNew);
            View.LoadData += new EventHandler<DataEventArgs<Product>>(this.OnLoadData);
            View.Save += new EventHandler<EventArgs>(this.OnSave);
            View.Delete += new EventHandler<EventArgs>(this.OnDelete);
            View.AssignBinToProduct += new EventHandler<DataEventArgs<Bin>>(OnAssignBinToProduct);
            View.RemoveFromList += new EventHandler<EventArgs>(this.OnRemoveFromList);
            View.AddProductTrackOption += new EventHandler<EventArgs>(OnAddProductTrackOption);
            View.AddProductUnit += new EventHandler<EventArgs>(OnAddProductUnit);
            View.LoadUnitsFromGroup += new EventHandler<EventArgs>(OnLoadUnitsFromGroup);
            //View.LoadBins += new EventHandler<DataEventArgs<string>>(OnLoadBins);
            View.SetRequired += new EventHandler<DataEventArgs<object>>(View_SetRequired);
            View.UnSetRequired += new EventHandler<DataEventArgs<object>>(View_UnSetRequired);
            View.UpdateBinToProduct += new EventHandler<DataEventArgs<ZoneBinRelation>>(View_UpdateBinToProduct);
            View.AddAlternateProduct += new EventHandler<EventArgs>(View_AddAlternateProduct);
            View.AddProductAccount += new EventHandler<DataEventArgs<ProductAccountRelation>>(View_AddProductAccount);
            View.UpdateProductAccount += new EventHandler<DataEventArgs<object>>(View_UpdateProductAccount);
            //View.SetIsMain += new EventHandler<DataEventArgs<object>>(View_SetIsMain);
            //View.UnSetIsMain += new EventHandler<DataEventArgs<object>>(View_UnSetIsMain);


            ProcessWindow pw = new ProcessWindow("Loading ...");

            View.Model.EntityList = service.GetProductApp(new Product { Company = App.curCompany, Reference = App.curLocation.LocationID.ToString() }, 25);
            View.Model.Record = null;
            View.Model.StatusList = App.EntityStatusList;
            //Load Pick Methods
            View.Model.PickMethods = App.PickMethodList;
            view.Model.TemplateList = service.GetLabelTemplate(new LabelTemplate { LabelType = new DocumentType { DocTypeID = LabelType.ProductLabel } });
            view.Model.TemplateList.Add(new LabelTemplate());

            //List Height
            View.ListRecords.MaxHeight = SystemParameters.FullPrimaryScreenHeight - 250;
            View.Model.CurAltern = new ProductAlternate();

            //USE CASN
            if (Util.GetConfigOption("USECASN").Equals("T")) 
                View.TbItmCasN.Visibility = Visibility.Visible;
            

            pw.Close();

        }