void ConditionSetResult_LoadingDataSource(object sender, LoadingDataEventArgs e)
        {
            List <AccessoriesQueryCondition> tempList = new List <AccessoriesQueryCondition>();

            facade.GetAccessoriesQueryConditionBySysNo(SysNo, (obj, arg) =>
            {
                if (arg.FaultsHandle())
                {
                    return;
                }

                this.ConditionSetResult.ItemsSource = arg.Result.Rows;
                tempList.Add(new AccessoriesQueryCondition()
                {
                    ConditionName = "--请选择--", SysNo = 0
                });
                foreach (var item in arg.Result.Rows)
                {
                    tempList.Add(new AccessoriesQueryCondition()
                    {
                        ConditionName = item.ConditionName, Priority = (PriorityType)item.Level, SysNo = item.SysNo
                    });
                }
                dynamic d = this.ConditionSetResult.ItemsSource as dynamic;
                list      = new List <ProductAccessoriesQueryConditionVM>();
                foreach (var item in d)
                {
                    list.Add(new ProductAccessoriesQueryConditionVM()
                    {
                        Condition = new AccessoriesQueryCondition()
                        {
                            ConditionName = item.ConditionName, Priority = (PriorityType)item.Level, SysNo = item.SysNo
                        },
                        ParentCondition = new AccessoriesQueryCondition()
                        {
                            ConditionName = item.ParentConditionName, SysNo = item.ParentSysNo
                        },
                        Priority = (PriorityType)item.Level
                    });
                }

                model.ParentConditionList            = tempList;
                cboParentConditionList.SelectedIndex = 0;
            });
        }
 public ProductAccessoriesQueryConditionPreView()
 {
     InitializeComponent();
     this.Loaded += (sender, e) =>
     {
         facade              = new ProductAccessoriesFacade();
         ConditionList       = new List <ProductAccessoriesQueryConditionVM>();
         ConditionValueList1 = new List <AccessoriesConditionValue>();
         ConditionValueList2 = new List <AccessoriesConditionValue>();
         ConditionValueList3 = new List <AccessoriesConditionValue>();
         ConditionValueList4 = new List <AccessoriesConditionValue>();
         IsTreeQuery         = false;
         facade.GetAccessoriesQueryConditionBySysNo(MaterSysNo, (obj, arg) =>
         {
             if (arg.FaultsHandle())
             {
                 return;
             }
             foreach (var item in arg.Result.Rows)
             {
                 IsTreeQuery = item.IsTreeQuery == "Y";
                 ConditionList.Add(new ProductAccessoriesQueryConditionVM()
                 {
                     Condition = new AccessoriesQueryCondition()
                     {
                         ConditionName = item.ConditionName, Priority = (PriorityType)item.Level, SysNo = item.SysNo
                     },
                     ParentCondition = new AccessoriesQueryCondition()
                     {
                         ConditionName = item.ParentConditionName, SysNo = item.ParentSysNo
                     },
                     Priority = (PriorityType)item.Level
                 });
             }
             BingControl();
         });
     };
 }
 public ProductAccessoriesQueryConditionValueMaintain()
 {
     InitializeComponent();
     ConditionValueSetResult.LoadingDataSource += new EventHandler <LoadingDataEventArgs>(ConditionValueSetResult_LoadingDataSource);
     this.Loaded += (sender, e) =>
     {
         model         = new ProductAccessoriesConditionValueQueryVM();
         ConditionList = new List <AccessoriesQueryCondition>()
         {
             new AccessoriesQueryCondition()
             {
                 ConditionName = "--全部--", SysNo = 0
             }
         };
         model.MasterSysNo = MaterSysNo;
         facade            = new ProductAccessoriesFacade();
         facade.GetAccessoriesQueryConditionBySysNo(MaterSysNo, (obj, arg) =>
         {
             if (arg.FaultsHandle())
             {
                 return;
             }
             dynamic d = arg.Result.Rows;
             foreach (var item in d)
             {
                 ConditionList.Add(new AccessoriesQueryCondition()
                 {
                     ConditionName = item.ConditionName, SysNo = item.SysNo, MasterSysNo = MaterSysNo, ParentSysNo = item.ParentSysNo
                 });
             }
             model.ConditionList        = ConditionList;
             this.DataContext           = model;
             cboCondition.SelectedIndex = 0;
             this.ConditionValueSetResult.Bind();
         });
     };
 }
Пример #4
0
        /// <summary>
        /// 导出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnExcelExporter_Click(object sender, RoutedEventArgs e)
        {
            dynamic   d           = this.ProductAccessoriesResult.SelectedItem as dynamic;
            bool      IsTreeQuery = d.IsTreeQuery == "Y";
            ColumnSet col         = new ColumnSet();
            List <ProductAccessoriesQueryConditionVM> ConditionList = new List <ProductAccessoriesQueryConditionVM>();

            //根据SysNo得到所有条件,动态生成列名
            facade.GetAccessoriesQueryConditionBySysNo((int)d.SysNo, (obj, arg) =>
            {
                if (arg.FaultsHandle())
                {
                    return;
                }
                foreach (var item in arg.Result.Rows)
                {
                    ConditionList.Add(new ProductAccessoriesQueryConditionVM()
                    {
                        Condition = new AccessoriesQueryCondition()
                        {
                            ConditionName = item.ConditionName, Priority = (PriorityType)item.Level, SysNo = item.SysNo
                        },
                        ParentCondition = new AccessoriesQueryCondition()
                        {
                            ConditionName = item.ParentConditionName, SysNo = item.ParentSysNo
                        },
                        Priority = (PriorityType)item.Level
                    });
                }
                int index = 0;
                if (IsTreeQuery)
                {
                    foreach (var item in ConditionList)
                    {
                        string title = item.Condition.ConditionName + "编号";
                        if (index == 0)
                        {
                            col.Insert(0, "FirstSysNo", title, 15);
                            col.Insert(1, "FirstValue", item.Condition.ConditionName, 25);
                        }
                        if (index == 1)
                        {
                            col.Insert(2, "SecondSysNo", title, 15);
                            col.Insert(3, "SecondValue", item.Condition.ConditionName, 25);
                        }
                        if (index == 2)
                        {
                            col.Insert(4, "ThirdSysNo", title, 15);
                            col.Insert(5, "ThirdValue", item.Condition.ConditionName, 25);
                        }
                        if (index == 3)
                        {
                            col.Insert(6, "FourthSysNo", title, 15);
                            col.Insert(7, "FourthValue", item.Condition.ConditionName, 25);
                        }
                        index = index + 1;
                    }
                }
                else
                {
                    col.Insert(0, "ConditionSysNo", "条件编号");
                    col.Insert(1, "ConditionName", "条件");
                    col.Insert(2, "ConditionValueSysNo", "选项值编号");
                    col.Insert(3, "ConditionValue", "选项值");
                    col.Insert(4, "Producut", "商品");
                }
                if (ConditionList.Count > 0 && IsTreeQuery)
                {
                    col.Insert(ConditionList.Count * 2, "Producut", "商品");
                }
                facade.GetAccessoriesQueryExcelOutput((int)d.SysNo, (string)d.IsTreeQuery, new ColumnSet[] { col });
            });
        }