Example #1
0
        public override void OnDelete(object obj)
        {
            WarningModel message = new WarningModel()
            {
                Message = "Are you sure want to delete data?"
            };

            IDialogService dialog = ObjectPool.Instance.Resolve <IDialogService>();
            bool?          result = dialog.ShowDialog <YesNo>(message);

            if (result.HasValue && result.Value)
            {
                IDbManager        dbManager         = ObjectPool.Instance.Resolve <IDbManager>();
                IDataCommand      db                = dbManager.GetDatabase(ApplicationSettings.Instance.Database.DefaultConnection.Name);
                OrderCollaborator orderCollaborator = ObjectPool.Instance.Resolve <OrderCollaborator>();
                foreach (CreateOrderModel order in Source.ToList())
                {
                    if (order.IsSelected)
                    {
                        db.Execute("DeletePrintOrder", new
                        {
                            OrderId = order.PoNumber,
                            Status  = "F"
                        });
                        orderCollaborator.PaymentOrder.source.Remove(order);
                    }
                }
                db.Close();
                base.OnDelete(obj);
            }
        }
 public FinishedOrder()
 {
     InitializeComponent();
     model = ObjectPool.Instance.Resolve<OrderCollaborator>();
     if (this.DataContext == null && model != null)
     {
         this.DataContext = model.PaymentOrder;
     } 
 }
Example #3
0
 public Queue()
 {
     InitializeComponent();
     model = ObjectPool.Instance.Resolve<OrderCollaborator>();
     if (this.DataContext == null && model != null)
     {
         this.DataContext = model.Queue;
     } 
 }
        private void InitializeModels()
        {
            OrderCollaborator order = new OrderCollaborator();
            MasterCollaborator master = new MasterCollaborator();
            DashboardCollaborator report = new DashboardCollaborator();
            StockCollaborator stock = new StockCollaborator();

            ObjectPool.Instance.Register<OrderCollaborator>().ImplementedBy(order);
            ObjectPool.Instance.Register<MasterCollaborator>().ImplementedBy(master);
            ObjectPool.Instance.Register<DashboardCollaborator>().ImplementedBy(report);
            ObjectPool.Instance.Register<StockCollaborator>().ImplementedBy(stock);
        }
Example #5
0
        private void OnUpdateQueueOrder(string status)
        {
            IDbManager        dbManager         = ObjectPool.Instance.Resolve <IDbManager>();
            IDataCommand      db                = dbManager.GetDatabase(ApplicationSettings.Instance.Database.DefaultConnection.Name);
            OrderCollaborator orderCollaborator = ObjectPool.Instance.Resolve <OrderCollaborator>();
            UserModel         user              = ObjectPool.Instance.Resolve <UserModel>();

            foreach (CreateOrderModel order in Source.ToList())
            {
                if (order.IsSelected)
                {
                    db.Execute("UpdatePrintOrder", new
                    {
                        OrderId = order.PoNumber,
                        Status  = status,
                        Queue   = 1
                    });
                    order.IsSelected = false;

                    /// update list
                    order.Status = "Q";

                    foreach (CreateOrderDetailModel detail in order.Details.Source)
                    {
                        db.Execute("InsertTransactionStock", new
                        {
                            MaterialId = detail.MaterialId,
                            QualityId  = detail.QualityId,
                            Qty        = detail.Qty,
                            CreatedBy  = user.Username,
                        });
                    }

                    orderCollaborator.PrintOrder.source.Remove(order);
                    orderCollaborator.Queue.Source.Add(order);
                }
            }
            db.Close();
            orderCollaborator.Queue.Source = orderCollaborator.Queue.Source.OrderBy(x => x.UpdateDate).Convert();
            CheckedHeader = false;
        }
Example #6
0
        private void OnUpdateQueueOrder(string status)
        {
            IDbManager   dbManager = ObjectPool.Instance.Resolve <IDbManager>();
            IDataCommand db        = dbManager.GetDatabase(ApplicationSettings.Instance.Database.DefaultConnection.Name);
            //bool updated = false;

            OrderCollaborator orderCollaborator = ObjectPool.Instance.Resolve <OrderCollaborator>();

            foreach (CreateOrderModel order in Source.ToList())
            {
                if (order.IsSelected)
                {
                    if (order.Remaining < 0)
                    {
                        IDialogService dialog       = ObjectPool.Instance.Resolve <IDialogService>();
                        bool?          dialogResult = dialog.ShowDialog <Warning>(new WarningModel()
                        {
                            Message = string.Format("Po Number {0} - ({1}) must be in complete payment.", order.PoNumber, order.CustomerName)
                        });
                    }
                    else
                    {
                        //updated = true;
                        db.Execute("UpdatePrintOrder", new
                        {
                            OrderId = order.PoNumber,
                            Status  = status,
                            Queue   = 2
                        });

                        orderCollaborator.Queue.Source.Remove(order);
                        orderCollaborator.PaymentOrder.Source.Add(order);
                    }
                    order.IsSelected = false;
                }
            }
            db.Close();
            orderCollaborator.PaymentOrder.Source = orderCollaborator.PaymentOrder.Source.OrderByDescending(x => x.UpdateDate).Convert();
            CheckedHeader = false;
        }