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();
        }
        private void myRadDataForm_BeginningEdit(object sender, System.ComponentModel.CancelEventArgs e)
        {
            RetailTactic tactic = (RetailTactic)myRadDataForm.CurrentItem;

            if (tactic.OrganizationID != VMGlobal.CurrentUser.OrganizationID)
            {
                MessageBox.Show("只能修改本机构创建的零售策略.");
                e.Cancel = true;
            }
        }
示例#3
0
 public RetailTacticBO(RetailTactic tactic)
 {
     this.ID        = tactic.ID;
     this.Name      = tactic.Name;
     OrganizationID = tactic.OrganizationID;
     this.BeginDate = tactic.BeginDate;
     BrandID        = tactic.BrandID;
     CanVIPApply    = tactic.CanVIPApply;
     CostMoney      = tactic.CostMoney;
     CutMoney       = tactic.CutMoney;
     Discount       = tactic.Discount;
     EndDate        = tactic.EndDate;
     CreateTime     = tactic.CreateTime;
     CreatorID      = tactic.CreatorID;
     Kind           = tactic.Kind;
 }
        private void myRadDataForm_AddedNewItem(object sender, AddedNewItemEventArgs e)
        {
            RetailTactic tactic = (RetailTactic)myRadDataForm.CurrentItem;

            tactic.OrganizationID = VMGlobal.CurrentUser.OrganizationID;
        }