Exemplo n.º 1
0
        public void ProductBatchEntry(ProductEntryStatus entryStatus, ProductEntryStatusEx entryStatusEx, string note)
        {
            var productfacade = new ProductFacade();

            if (ucProductQueryResult.dgProductQueryResult.ItemsSource != null)
            {
                var viewList     = ucProductQueryResult.dgProductQueryResult.ItemsSource as List <dynamic>;
                var selectSource = viewList.Where(p => p.IsChecked).ToList();
                if (selectSource == null || selectSource.Count == 0)
                {
                    Window.Alert(ResProductQuery.SelectMessageInfo, MessageType.Error);
                    return;
                }
                var auditList = (from c in selectSource
                                 select
                                     (int) c.SysNo).ToList();

                productfacade.ProductBatchEntry(auditList
                                                , note
                                                , entryStatus
                                                , entryStatusEx
                                                , (result) =>
                {
                    if (string.IsNullOrWhiteSpace(result))
                    {
                        ucProductQueryResult.dgProductQueryResult.Bind();
                    }
                    else
                    {
                        if (result.Length > 100)
                        {
                            ProductTextboxAlert content = new ProductTextboxAlert(result);
                            content.Width  = 550D;
                            content.Height = 350D;
                            IDialog dialog = this.Window.ShowDialog("操作提示", content, (obj, args) =>
                            {
                                ucProductQueryResult.dgProductQueryResult.Bind();
                            });
                        }
                        else
                        {
                            Window.Alert("操作提示", result, MessageType.Warning, (obj, args) => { ucProductQueryResult.dgProductQueryResult.Bind(); });
                        }
                    }
                });
            }
        }
Exemplo n.º 2
0
        private void btnBatchAudit_Click(object sender, RoutedEventArgs e)
        {
            Window.Confirm("您确定要进行批量审核操作吗?", (s, args) =>
            {
                if (args.DialogResult == DialogResultType.OK)
                {
                    var viewList             = ucProductQueryResult.dgProductQueryResult.ItemsSource as List <dynamic>;
                    List <int> productSysNos = viewList.Where(p => p.IsChecked).Select(c => (int)c.SysNo).ToList();
                    if (productSysNos == null || productSysNos.Count == 0)
                    {
                        Window.Alert(ResProductQuery.SelectMessageInfo, MessageType.Error);
                        return;
                    }

                    var productfacade = new ProductFacade();
                    productfacade.BatchAuditProduct(productSysNos, ProductStatus.InActive_Audited, (result) =>
                    {
                        if (string.IsNullOrWhiteSpace(result))
                        {
                            ucProductQueryResult.dgProductQueryResult.Bind();
                        }
                        else
                        {
                            if (result.Length > 100)
                            {
                                ProductTextboxAlert content = new ProductTextboxAlert(result);
                                content.Width  = 550D;
                                content.Height = 350D;
                                IDialog dialog = this.Window.ShowDialog("操作提示", content, (obj, args1) =>
                                {
                                    ucProductQueryResult.dgProductQueryResult.Bind();
                                });
                            }
                            else
                            {
                                Window.Alert("操作提示", result, MessageType.Warning, (obj, args2) => { ucProductQueryResult.dgProductQueryResult.Bind(); });
                            }
                        }
                    });
                }
            });
            #region 原有进出关审核逻辑
            //Window.Confirm("您确定要进行批量审核操作吗?", (s, args) =>
            //{
            //    if (args.DialogResult == Newegg.Oversea.Silverlight.Controls.Components.DialogResultType.OK)
            //    {
            //        ProductBatchEntryVM productBatchEntryVM = new ProductBatchEntryVM();
            //        productBatchEntryVM.Title = "批量审核商品";
            //        productBatchEntryVM.BtnPassTitle = "审核通过";
            //        productBatchEntryVM.BtnRejectTitle = "审核不通过";
            //        ProductBatchEntryNote content = new ProductBatchEntryNote(this, productBatchEntryVM);
            //        content.Width = 550D;
            //        content.Height = 350D;
            //        IDialog dialog = this.Window.ShowDialog(productBatchEntryVM.Title, content, (obj, args1) =>
            //        {
            //            if (productBatchEntryVM.AuditPass.HasValue)
            //            {
            //                if (productBatchEntryVM.AuditPass == true)
            //                {
            //                    ProductBatchEntry(ProductEntryStatus.AuditSucess, ProductEntryStatusEx.Inspection, productBatchEntryVM.Note);
            //                }
            //                else
            //                {
            //                    ProductBatchEntry(ProductEntryStatus.AuditFail, ProductEntryStatusEx.Inspection, productBatchEntryVM.Note);
            //                }
            //            }
            //        });
            //        content.Dialog = dialog;
            //    }
            //});
            #endregion
        }