Ejemplo n.º 1
0
        private void btnSelectStyles_Click(object sender, RoutedEventArgs e)
        {
            StyleSelectWin win = new StyleSelectWin();

            win.Owner         = View.Extension.UIHelper.GetAncestor <Window>(this);
            win.SetCompleted += delegate(IEnumerable <ProStyle> styles)
            {
                _dataContext.Styles = styles;
                if (styles == null || styles.Count() == 0)
                {
                    tbStyles.Clear();
                }
                else
                {
                    string info = "";
                    foreach (var o in _dataContext.Styles)
                    {
                        info += o.Code + ",";
                    }
                    tbStyles.Text = info.TrimEnd(',');
                }
                win.Close();
            };
            win.ShowDialog();
        }
Ejemplo n.º 2
0
        private void btnApply_Click(object sender, RoutedEventArgs e)
        {
            RadButton      btn      = sender as RadButton;
            RetailTactic   tactic   = (RetailTactic)btn.DataContext;
            bool           showOnly = tactic.OrganizationID != VMGlobal.CurrentUser.OrganizationID;
            var            styleIDs = VMGlobal.DistributionQuery.LinqOP.Search <RetailTacticProStyleMapping, int>(selector: o => o.StyleID, condition: o => o.TacticID == tactic.ID).ToArray();
            StyleSelectWin win      = new StyleSelectWin(tactic.BrandID, showOnly: showOnly, styleIDsSeleted: styleIDs);

            win.Owner         = View.Extension.UIHelper.GetAncestor <Window>(this);
            win.SetCompleted += delegate(IEnumerable <ProStyle> styles)
            {
                var mapping = styles.Select(o => new RetailTacticProStyleMapping {
                    TacticID = tactic.ID, StyleID = o.ID
                });
                var result = _dataContext.SetStylesForTactic(tactic.ID, mapping);
                if (result.IsSucceed)
                {
                    MessageBox.Show("设置成功");
                    win.Close();
                }
                else
                {
                    MessageBox.Show(result.Message);
                }
            };
            win.ShowDialog();
        }