Ejemplo n.º 1
0
 public void NavigateToPage(Type destPage)
 {
     if (this.AppFrame.CurrentSourcePageType != destPage)
     {
         AppFrame.Navigate(destPage, string.Empty, new Windows.UI.Xaml.Media.Animation.SuppressNavigationTransitionInfo());
     }
 }
Ejemplo n.º 2
0
 public void GoBack()
 {
     if (AppFrame?.CanGoBack == true)
     {
         AppFrame.GoBack();
     }
 }
Ejemplo n.º 3
0
 public Shell()
 {
     InitializeComponent();
     NavMenuList.ItemsSource   = navlist;
     NavMenuList.SelectedIndex = 0;
     AppFrame.Navigate(typeof(ColorPalettePage));
 }
Ejemplo n.º 4
0
 private void NavigationView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
 {
     if (args.IsSettingsInvoked)
     {
         AppFrame.Navigate(typeof(SettingPage));
     }
 }
Ejemplo n.º 5
0
        public void Get()
        {
            var context = this.HttpContext;

            if (context.WebSockets.IsWebSocketRequest)
            {
                ISimpleWebSoket webSoket = new MyWebSoket(context.WebSockets.AcceptWebSocketAsync().Result);

                webSoket.OnMessage += (o, e) =>
                {
                    Console.WriteLine(e.Data);
                };

                AppFrame app = AppFrame.GetAppFrame();
                EventHandler <PLC.ModBus.Rtu.Driver.EventEntity.ParkingLotStatusEventArgs> OnSelected = (o, e) => {
                    webSoket.SendAsync(e.ToString()).Wait();
                };

                app.OnSelected += OnSelected;

                webSoket.OnMessage += (o, e) => { webSoket.SendAsync(e.Data); };

                webSoket.KeepAlive();

                app.OnSelected -= OnSelected;
            }
        }
Ejemplo n.º 6
0
        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (PhotoView.IsSelected)
            {
                AppFrame.Navigate(typeof(Domain.Photo.View));
            }
            if (PairView.IsSelected)
            {
                AppFrame.Navigate(typeof(Domain.Pair.View));
            }
            if (StudentView.IsSelected)
            {
                AppFrame.Navigate(typeof(Domain.Student.View));
            }
            // if (_REPLACEME_View.IsSelected)
            // {
            //     AppFrame.Navigate(typeof(Domain._REPLACEME_.View));
            // }

            string nameOfSelection = ((ListBoxItem)e.AddedItems[0]).Name;

            if (nameOfSelection == "Load")
            {
                AppFrame.Navigate(typeof(OpeningView));
                UserActionPresenter.PresentMessageOkCancel("Are you sure you want to LOAD model data?", "Load", new RelayCommand(AppConfig.Load));
            }
            if (nameOfSelection == "Save")
            {
                AppFrame.Navigate(typeof(OpeningView));
                UserActionPresenter.PresentMessageOkCancel("Are you sure you want to SAVE model data?", "Save", new RelayCommand(AppConfig.Save));
            }
        }
Ejemplo n.º 7
0
 private void NavigatePage(Type pageType)
 {
     if (pageType != null && pageType != AppFrame.CurrentSourcePageType)
     {
         AppFrame.Navigate(pageType);
     }
 }
Ejemplo n.º 8
0
        public AppShell()
        {
            InitializeComponent();

            if (!DesignMode.DesignModeEnabled)
            {
                Current = this;

                AppFrame.Navigating += AppFrameOnNavigating;
                LayoutUpdated       += (sender, args) => OnPaneSizeChanged();

                Loaded += (sender, args) =>
                {
                    togglePaneButton.Focus(FocusState.Programmatic);
                    OnPaneSizeChanged();
                    SetSelectedMenuItem(selectedMenuItem);
                };

                SystemNavigationManager.GetForCurrentView().BackRequested += (sender, e) =>
                {
                    if (!e.Handled && AppFrame.CanGoBack)
                    {
                        e.Handled = true;
                        AppFrame.GoBack();
                    }
                };
            }
        }
Ejemplo n.º 9
0
 private void BackCommandExecute()
 {
     if (AppFrame.CanGoBack)
     {
         AppFrame.GoBack();
     }
 }
Ejemplo n.º 10
0
 private void MainPage_BackRequested(object sender, BackRequestedEventArgs e)
 {
     if (AppFrame.CanGoBack)
     {
         AppFrame.GoBack();
     }
 }
Ejemplo n.º 11
0
 private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (MovieView.IsSelected)
     {
         TryNavigate(typeof(View), "MovieView");
     }
     if (StudioView.IsSelected)
     {
         TryNavigate(typeof(Domain.Studio.View), "StudioView");
     }
     if (Load.IsSelected)
     {
         AppFrame.Navigate(typeof(OpeningView));
         UIService.PresentMessageSingleActionCancel("Are you sure you want to LOAD model data?", "LOAD", new RelayCommand(PersistencyManager.Load));
     }
     if (Save.IsSelected)
     {
         AppFrame.Navigate(typeof(OpeningView));
         UIService.PresentMessageSingleActionCancel("Are you sure you want to SAVE model data?", "SAVE", new RelayCommand(PersistencyManager.Save));
     }
     if (Quit.IsSelected)
     {
         AppFrame.Navigate(typeof(OpeningView));
         UIService.PresentMessageSingleActionCancel("Are you sure you want to QUIT?", "QUIT", new RelayCommand(Application.Current.Exit));
     }
 }
Ejemplo n.º 12
0
        public override void AddCommands()
        {
            NavigationCommands.Add("File", new RelayCommand(() =>
            {
                AppFrame.Navigate(typeof(Views.App.FileView));
            }));

            NavigationCommands.Add("OpenCarView", new RelayCommand(() =>
            {
                AppFrame.Navigate(typeof(CarView));
            }));

            NavigationCommands.Add("OpenCustomerView", new RelayCommand(() =>
            {
                AppFrame.Navigate(typeof(CustomerView));
            }));

            NavigationCommands.Add("OpenEmployeeView", new RelayCommand(() =>
            {
                AppFrame.Navigate(typeof(EmployeeView));
            }));

            NavigationCommands.Add("OpenSaleView", new RelayCommand(() =>
            {
                AppFrame.Navigate(typeof(SaleView));
            }));
        }
Ejemplo n.º 13
0
        public override void AddCommands()
        {
            NavigationCommands.Add("LeadsPage", new RelayCommand(() =>
            {
                AppFrame.Navigate(typeof(View.Domain.LeadsPage));
            }));

            NavigationCommands.Add("ActiveLeads", new RelayCommand(() =>
            {
                AppFrame.Navigate(typeof(View.Domain.LeadsPage));
            }));

            NavigationCommands.Add("PendingLeads", new RelayCommand(() =>
            {
                AppFrame.Navigate(typeof(View.Domain.LeadsPage));
            }));

            NavigationCommands.Add("ClosedLeads", new RelayCommand(() =>
            {
                AppFrame.Navigate(typeof(View.Domain.LeadsPage));
            }));

            NavigationCommands.Add("Customers", new RelayCommand(() =>
            {
                AppFrame.Navigate(typeof(View.Domain.CustomersPage));
            }));

            NavigationCommands.Add("Customer", new RelayCommand(() =>
            {
                AppFrame.Navigate(typeof(View.Domain.CustomerPage));
            }));
        }
Ejemplo n.º 14
0
 public void NavigateToPage(Type destPage, object parameter = null)
 {
     if (this.AppFrame.CurrentSourcePageType != destPage)
     {
         AppFrame.Navigate(destPage, parameter, new Windows.UI.Xaml.Media.Animation.SuppressNavigationTransitionInfo());
     }
 }
Ejemplo n.º 15
0
        public bool Post(string operate, string ip, int port, int index)
        {
            try
            {
                if (index > 10 || index < 0)
                {
                    return(false);
                }

                AppFrame app = AppFrame.GetAppFrame();
                switch (operate.ToLower())
                {
                case "up":
                    return(!string.IsNullOrEmpty(app.SetUp("Web用户", ip: ip, port: port, index: index)));

                case "down":
                    return(!string.IsNullOrEmpty(app.SetDown("Web用户", ip: ip, port: port, index: index)));

                default:
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Ejemplo n.º 16
0
 private void Navmgr_BackRequested(object sender, BackRequestedEventArgs e)
 {
     if (AppFrame.CanGoBack)
     {
         AppFrame.GoBack();
         e.Handled = true;
     }
 }
Ejemplo n.º 17
0
        public AppShell()
        {
            this.InitializeComponent();
            var navmgr = SystemNavigationManager.GetForCurrentView();

            navmgr.BackRequested += Navmgr_BackRequested;
            AppFrame.Navigate(typeof(MainPage));
        }
Ejemplo n.º 18
0
        public AppPage()
        {
            this.InitializeComponent();
            this.Loaded += (s, e) => { masterViewModel.OnLoaded(); };
            masterViewModel.PropertyChanged += this.OnPageNavigation;

            AppFrame.Navigate(typeof(FirstPage));
        }
Ejemplo n.º 19
0
        private void NavigationView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
        {
            var invokedMenuItem = sender.MenuItems.OfType <NavigationViewItem>().Where(item => item.Content.ToString() == args.InvokedItem.ToString()).First();
            var pageTypeName    = invokedMenuItem.Tag.ToString();
            var pageType        = Assembly.GetExecutingAssembly().GetType($"{PageNamespace}.{pageTypeName}");

            AppFrame.Navigate(pageType);
        }
Ejemplo n.º 20
0
 public void OnBackRequested(object sender, BackRequestedEventArgs e)
 {
     if (AppFrame.CanGoBack)
     {
         e.Handled = true;
         AppFrame.GoBack();
     }
 }
Ejemplo n.º 21
0
        public bool saveCustomer(AppFrame.Model.CustomerModel customer)
        {
            HibernateTemplate.TemplateFlushMode = Spring.Data.NHibernate.TemplateFlushMode.Auto;

            HibernateTemplate.Save((customer));
            HibernateTemplate.Flush();
            return true;
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Navigates to the previous page in the navigation history.
 /// </summary>
 public void GoBack()
 {
     System.Diagnostics.Debug.Assert(AppFrame != null);
     if (AppFrame.CanGoBack)
     {
         AppFrame.GoBack();
     }
 }
Ejemplo n.º 23
0
 private void SystemNavigationManager_BackRequested(object sender, BackRequestedEventArgs e)
 {
     if (!e.Handled && AppFrame.CanGoBack)
     {
         e.Handled = true;
         AppFrame.GoBack();
     }
 }
Ejemplo n.º 24
0
 private void OnBackRequested(object sender, BackRequestedEventArgs e)
 {
     if (AppFrame.CanGoBack)
     {
         e.Handled = true;
         AppFrame.GoBack();
         shell.ClearSelection();
     }
 }
Ejemplo n.º 25
0
        public void NavigateTo(string page, object parameter)
        {
            if (!_pages.ContainsKey(page))
            {
                throw new ArgumentException($"Unable to find a page registered with the name {page}.");
            }

            AppFrame.Navigate(_pages[page], parameter);
        }
Ejemplo n.º 26
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (e.Parameter is Episode)
            {
                AppFrame.Navigate(typeof(Player), e.Parameter);
            }
        }
Ejemplo n.º 27
0
 private void DeviceStates_CurrentStateChanged(object sender, VisualStateChangedEventArgs e)
 {
     if (e.NewState == Medium)
     {
         if (AppFrame.CurrentSourcePageType != typeof(MainPage))
         {
             AppFrame.GoBack();
         }
     }
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Navigate to the Page for the selected <paramref name="listViewItem" />.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="listViewItem">The ListViewItem.</param>
        private void NavMenuList_ItemInvoked(object sender, ListViewItem listViewItem)
        {
            var item = (INavigationBarMenuItem)((NavMenuListView)sender).ItemFromContainer(listViewItem);

            if (item?.DestPage != null &&
                item.DestPage != AppFrame.CurrentSourcePageType)
            {
                AppFrame.Navigate(item.DestPage, item.Arguments);
            }
        }
Ejemplo n.º 29
0
        private void OnMenuItemClick(object sender, ItemClickEventArgs e)
        {
            var item = e.ClickedItem as NavMenuItem;

            if (item.DestPage != null &&
                item.DestPage != AppFrame.CurrentSourcePageType)
            {
                AppFrame.Navigate(item.DestPage, item.Arguments);
            }
        }
Ejemplo n.º 30
0
 private void TryNavigate(System.Type viewType, string viewName)
 {
     if (true) // Replace if you want to use login-based access restrictions
     {
         AppFrame.Navigate(viewType);
     }
     else
     {
         // Inform user about insufficient access rights
     }
 }
Ejemplo n.º 31
0
 // Avoid Exception when the first click happens
 private void firstClickCtrl()
 {
     if (flag == 0)
     {
         return;
     }
     else
     {
         AppFrame.RemoveBackEntry();
     }
 }
 private static object[] AddProductToDataGrid(AppFrame.Model.DepartmentStockIn stockInDetail)
 {
     var obj = new object[MAX_COLUMNS];
     obj[STOCK_IN_ID_POS] = stockInDetail.DepartmentStockInPK.StockInId;
     obj[STOCK_IN_DATE_POS] = stockInDetail.StockInDate.ToString("dd/MM/yyyy HH:mm:ss");
     long quantity = 0;
     foreach (DepartmentStockInDetail detail in stockInDetail.DepartmentStockInDetails)
     {
         if (detail.DelFlg == 0)
         {
             quantity += detail.Quantity;
         }
     }
     obj[PRODUCT_QUANTITY_POS] = quantity;
     obj[UPDATER_POS] = stockInDetail.UpdateId;
     return obj;
 }
Ejemplo n.º 33
0
        public System.Collections.IList FindAll(AppFrame.ObjectCriteria criteria)
        {
            return (IList)HibernateTemplate.Execute(
                delegate(ISession session)
                {
                    //try
                    //{
                        ICriteria hibernateCriteria = session.CreateCriteria(typeof(LoginModel));
                        if (criteria != null)
                        {
                            IDictionary<string, SubObjectCriteria> map = criteria.GetSubCriteria();
                            if (map.Count > 0)
                            {
                                foreach (string key in map.Keys)
                                {
                                    hibernateCriteria.CreateAlias(key, key);
                                }
                                AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());

                                foreach (string key in map.Keys)
                                {
                                    SubObjectCriteria subCriteria = null;
                                    map.TryGetValue(key, out subCriteria);
                                    AddCriteriaAndOrder(hibernateCriteria, subCriteria.GetWhere(), subCriteria.GetOrder());
                                }
                            }
                            else
                            {
                                AddCriteriaAndOrder(hibernateCriteria, criteria.GetWhere(), criteria.GetOrder());
                            }
                        }
                        return hibernateCriteria.List();
                    //}
                    //catch (Exception)
                    //{
                    //    return null;
                    //}

                }
                );
        }
Ejemplo n.º 34
0
 public bool UpdateCustomer(AppFrame.Model.CustomerModel customer)
 {
     return CustomerDao.updateCustomer(customer);
 }
Ejemplo n.º 35
0
 public bool SaveCustomer(AppFrame.Model.CustomerModel customer)
 {
     return CustomerDao.saveCustomer(customer);
 }
Ejemplo n.º 36
0
        void form_SelectProductEvent(object sender, AppFrame.Presenter.GoodsIO.ProductMasterSearchDepartmentEventArgs e)
        {
            /*pODList[dgvBill.CurrentCell.OwningRow.Index].Product = e.ReturnProduct;
            GoodsSaleEventArgs goodsSaleEventArgs = new GoodsSaleEventArgs();
            int selectedIndex = dgvBill.CurrentCell.OwningRow.Index;
            goodsSaleEventArgs.SelectedIndex = selectedIndex;
            goodsSaleEventArgs.SelectedPurchaseOrderDetail = bdsBill[selectedIndex] as PurchaseOrderDetail;

            EventUtility.fireEvent(LoadGoodsEvent, this, goodsSaleEventArgs);

            // event has been modified
            pODList[selectedIndex] = goodsSaleEventArgs.SelectedPurchaseOrderDetail;
            GoodsSaleController.PurchaseOrder.PurchasePrice = CalculateTotalPrice(pODList);
            txtTotalAmount.Text = GoodsSaleController.PurchaseOrder.PurchasePrice.ToString();
            CalculateCharge();
            bdsBill.EndEdit();*/
            txtBarcode.Text = e.ReturnProduct.ProductId;
            //txtGoodsName.Text = e.ReturnProduct.ProductMaster.ProductFullName;
            txtQuantity.Text = "1";
            if(form!=null)
            {
                form.SelectProductEvent -= new EventHandler<AppFrame.Presenter.GoodsIO.ProductMasterSearchDepartmentEventArgs>(form_SelectProductEvent);
                form.Close();
            }
        }
Ejemplo n.º 37
0
 public bool updateCustomer(AppFrame.Model.CustomerModel customer)
 {
     HibernateTemplate.Update(customer);
     HibernateTemplate.Flush();
     return true;
 }
Ejemplo n.º 38
0
 public bool DeleteCustomer(AppFrame.Model.CustomerModel customer)
 {
     return CustomerDao.deleteCustomer(customer);
 }
Ejemplo n.º 39
0
 public bool deleteCustomer(AppFrame.Model.CustomerModel customer)
 {
     HibernateTemplate.Delete(customer);
     return true;
 }
        void departmentStockCheckingView_SaveInventoryCheckingEvent(object sender, AppFrame.Presenter.GoodsIO.DepartmentGoodsIO.DepartmentStockCheckingEventArgs e)
        {
            foreach (DepartmentStockView stockView in e.SaveStockViewList)
            {
                long checkedGoodQty = stockView.GoodQuantity;
                long checkedErrorQty = stockView.ErrorQuantity;
                long checkedLostQty = stockView.LostQuantity;
                long checkedDamageQty = stockView.DamageQuantity;
                long checkedUnconfirmQty = stockView.UnconfirmQuantity;
                long goodQuantity, errorQuantity, lostQuantity, damageQuantity, unconfirmQuantity;
                GetCheckingQuantities(stockView.DepartmentStocks, out goodQuantity, out errorQuantity, out lostQuantity, out damageQuantity, out unconfirmQuantity);
                bool NeedFixing = false;
                if (checkedGoodQty != goodQuantity
                       || checkedErrorQty != errorQuantity
                       || checkedLostQty != lostQuantity
                       || checkedDamageQty != damageQuantity
                       || checkedUnconfirmQty != unconfirmQuantity)
                {
                    NeedFixing = true;
                }

                // if after checking quantity is equal with checked values
                if(stockView.Quantity ==
                    (stockView.GoodQuantity+stockView.ErrorQuantity+
                     stockView.DamageQuantity+stockView.LostQuantity+stockView.UnconfirmQuantity))
                {

                    foreach (DepartmentStock stock in stockView.DepartmentStocks)
                    {
                        if(NeedFixing)
                        {
                            stock.GoodQuantity = stock.Quantity;
                            AutoFixing(stock, ref checkedErrorQty, ref checkedDamageQty, ref checkedLostQty, ref checkedUnconfirmQty);
                        }
                        stock.UpdateDate = DateTime.Now;
                        stock.UpdateId = ClientInfo.getInstance().LoggedUser.Name;
                        DepartmentStockLogic.Update(stock);
                    }

                }
                else // in case quantity does not equal checked values.
                {
                    // we do auto fixing

                    IList departmentStocks = stockView.DepartmentStocks;
                    SortListByQuantity(departmentStocks);
                    for( int i =0;i < departmentStocks.Count;i++)
                    {
                        DepartmentStock stock = (DepartmentStock) departmentStocks[i];
                        // if not last item
                        if (i < departmentStocks.Count - 1)
                        {
                            if (checkedGoodQty >= stock.Quantity)
                            {
                                stock.GoodQuantity = stock.Quantity;
                                checkedGoodQty -= stock.Quantity;
                            }
                            else
                            {
                                stock.GoodQuantity = checkedGoodQty;
                                checkedGoodQty = 0;
                            }
                        }
                        else
                        {
                            stock.GoodQuantity = checkedGoodQty;
                            checkedGoodQty = 0;
                        }
                    }
                    // do auto fixing here
                    for( int i =departmentStocks.Count -1;i >= 0;i--)
                    {
                        DepartmentStock stock = (DepartmentStock)departmentStocks[i];
                        if(NeedFixing)
                        {
                            // if not last item
                            if( i > 0)
                            {
                                // fixing
                                AutoFixing(stock, ref checkedErrorQty, ref checkedDamageQty, ref checkedLostQty, ref checkedUnconfirmQty);
                            }
                            else // last fixing
                            {
                                // don't need to fix, just map the remain quantities to stock
                                stock.ErrorQuantity = checkedErrorQty;
                                stock.DamageQuantity = checkedDamageQty;
                                stock.LostQuantity = checkedLostQty;
                                stock.UnconfirmQuantity = checkedUnconfirmQty;
                            }
                        }
                        DepartmentStockTempMapper mapper = new DepartmentStockTempMapper();
                        DepartmentStockTempLogic.Add(mapper.Convert(stock));
                    }
                }
            }
        }
Ejemplo n.º 41
0
 void form_SelectProductEvent(object sender, AppFrame.Presenter.GoodsIO.ProductMasterSearchDepartmentEventArgs e)
 {
     LoadGoodsByProductId(e.ReturnProduct.ProductId);
 }
Ejemplo n.º 42
0
        void form_SelectProductEvent(object sender, AppFrame.Presenter.GoodsIO.ProductMasterSearchDepartmentEventArgs e)
        {
            pODReturnList[dgvBill.CurrentCell.OwningRow.Index].Product = e.ReturnProduct;
            GoodsSaleEventArgs goodsSaleEventArgs = new GoodsSaleEventArgs();
            int selectedIndex = dgvBill.CurrentCell.OwningRow.Index;
            goodsSaleEventArgs.SelectedIndex = selectedIndex;
            goodsSaleEventArgs.SelectedPurchaseOrderDetail = bdsBill[selectedIndex] as PurchaseOrderDetail;
            /*goodsSaleEventArgs.SelectedPurchaseOrderDetail.Product.ProductId =
                dgvBill.CurrentCell.Value as string;*/
            EventUtility.fireEvent(LoadGoodsEvent, this, goodsSaleEventArgs);

            // event has been modified
            pODReturnList[selectedIndex] = goodsSaleEventArgs.SelectedPurchaseOrderDetail;
            bdsReturnBill.EndEdit();

            if (form != null)
            {
                form.SelectProductEvent -= new EventHandler<AppFrame.Presenter.GoodsIO.ProductMasterSearchDepartmentEventArgs>(form_SelectProductEvent);
                form.Close();
            }
        }
        void departmentStockCheckingView_LoadGoodsByProductIdEvent(object sender, AppFrame.Presenter.GoodsIO.DepartmentGoodsIO.DepartmentStockCheckingEventArgs e)
        {
            string barCode = e.InputBarcode;
            Product product = ProductLogic.FindById(barCode);
            if(product==null)
            {
                return;
            }

            // search in temp stock
            ObjectCriteria criteria = new ObjectCriteria();
            criteria.AddEqCriteria("DepartmentStockTempPK.ProductId", product.ProductId);
            criteria.AddEqCriteria("DepartmentStockTempPK.DepartmentId", CurrentDepartment.Get().DepartmentId);
            criteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            IList tempList =DepartmentStockTempLogic.FindAll(criteria);
            if(tempList!=null && tempList.Count > 0)
            {
                e.UnconfirmTempBarcode = true;
                throw new BusinessException("Mã vạch này đã kiểm trước đó và chưa được xác nhận. Xin liên hệ người quản lý kho.");
            }
            // search in stock
            ProductMaster searchProductMaster = product.ProductMaster;
            ObjectCriteria searchByProductMasterCriteria = new ObjectCriteria();
            /*searchByProductMasterCriteria.AddEqCriteria("Department", CurrentDepartment.Get());
            searchByProductMasterCriteria.AddEqCriteria("ProductMaster", searchProductMaster);
            searchByProductMasterCriteria.AddOrder("CreateDate", false);
            searchByProductMasterCriteria.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            IList productsStockIn = DepartmentStockInDetailLogic.FindAllProductMaster(searchProductMaster);*/
            searchByProductMasterCriteria.AddEqCriteria("ProductMaster", searchProductMaster);
            IList productsStockIn = ProductLogic.FindAll(searchByProductMasterCriteria);
            IList productsInStock = new ArrayList();
            IList productIds = new ArrayList();
            //foreach (DepartmentStockInDetail detail in productsStockIn)
            foreach (Product detail in productsStockIn)
            {
                productIds.Add(detail.ProductId);
            }
            ObjectCriteria stockCrit = new ObjectCriteria();
            stockCrit.AddSearchInCriteria("DepartmentStockPK.ProductId", productIds);
            stockCrit.AddEqCriteria("DepartmentStockPK.DepartmentId", CurrentDepartment.Get().DepartmentId);
            stockCrit.AddEqCriteria("DelFlg", CommonConstants.DEL_FLG_NO);
            stockCrit.AddOrder("DepartmentStockPK.ProductId",true);
            IList departmentStocks = DepartmentStockLogic.FindAll(stockCrit);

            // create stock view
            if (departmentStocks != null && departmentStocks.Count > 0)
            {
                DepartmentStockView stockView = new DepartmentStockView();
                stockView.ProductMaster = product.ProductMaster;
                stockView.DepartmentStocks = departmentStocks;
                foreach (DepartmentStock departmentStock in departmentStocks)
                {

                    // empty old stock
                    departmentStock.GoodQuantity = 0;
                    departmentStock.ErrorQuantity = 0;
                    departmentStock.UnconfirmQuantity = 0;
                    departmentStock.LostQuantity = 0;
                    departmentStock.DamageQuantity = 0;

                    // sum new stock
                    stockView.Quantity += departmentStock.Quantity;
                    stockView.GoodQuantity += departmentStock.Quantity;
                    stockView.ErrorQuantity += departmentStock.ErrorQuantity;
                    stockView.UnconfirmQuantity += departmentStock.UnconfirmQuantity;
                    stockView.LostQuantity += departmentStock.LostQuantity;
                    stockView.DamageQuantity += departmentStock.DamageQuantity;
                    stockView.ProductId = product.ProductId;

                    stockView.ProductId = product.ProductId;

                }
                e.ScannedStockView = stockView;
            }
        }
Ejemplo n.º 44
0
 public IList FindAll(AppFrame.ObjectCriteria criteria)
 {
     return LoginDao.FindAll(criteria);
 }