コード例 #1
0
        private void EditRule_Click(object sender, RoutedEventArgs e)
        {
            BillingDataDataContext db = new BillingDataDataContext();

            if (CostingRuleGrid.Visibility == Visibility.Visible && CostingRuleGrid.SelectedItem != null)
            {
                if (MessageBox.Show("Do you Want edit this Rule", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    CostingRule dcr = (CostingRule)CostingRuleGrid.SelectedItem;
                    AddRule     win = new AddRule(dcr.Id);
                    win.Closed += win_Closed;
                    win.Show();
                    CostingRuleGrid.SelectedItem = null;
                }
            }
            if (ServiceRuleGrid.Visibility == Visibility.Visible && ServiceRuleGrid.SelectedItem != null)
            {
                if (MessageBox.Show("Do you Want edit this Rule", "", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    ServiceRule    dcr = (ServiceRule)ServiceRuleGrid.SelectedItem;
                    AddServiceRule win = new AddServiceRule(dcr.Id);
                    win.Closed += win_Closed;
                    win.Show();
                    ServiceRuleGrid.SelectedItem = null;
                }
            }
            db.SubmitChanges();
        }
コード例 #2
0
        public AddServiceRule(int ruleId)
            : this()
        {
            this.isUpdate = true;
            BillingDataDataContext db = new BillingDataDataContext();

            db   = new BillingDataDataContext();
            rule = db.Rules.SingleOrDefault(x => x.ID == ruleId);
            if (rule == null)
            {
                MessageBox.Show("Invalid Rule.");
                return;
            }
            isInitialized           = true;
            SRule                   = RuleSR = (new JavaScriptSerializer()).Deserialize <ServiceRule>(rule.Properties);
            this.FromWeightBox.Text = SRule.startW.ToString();
            this.ToWeightBox.Text   = SRule.endW.ToString();
            if (SRule.type == 'W')
            {
                this.WholeRadio.IsChecked = true;
                this.StepRadio.IsChecked  = false;
            }
            else
            {
                this.WholeRadio.IsChecked = false;
                this.StepRadio.IsChecked  = true;
                this.StepBox.Text         = SRule.stepweight.ToString();
            }
            if (SRule.change == 'I')
            {
                this.IncRadio.IsChecked = true;
            }
            else
            {
                this.DecRadio.IsChecked = true;
            }
            if (SRule.mode == 'P')
            {
                this.PerRadio.IsChecked = true;
                this.ValueBox.Text      = SRule.per.ToString();
            }
            else
            {
                this.AmountRadio.IsChecked = true;
                this.AmountBox.Text        = SRule.per.ToString();
            }
            AddRule.setFormList(SRule, this.ServiceTwinBox, this.ZoneTwinBox, this.StateTwinBox, this.CitiesTwinBox, ServiceGroupTwinBox);
            this.RemarkBox.Text        = rule.Remark;
            this.AddFilter.Data        = Geometry.Parse(@"F1M2,12.942C2,12.942 10.226,15.241 10.226,15.241 10.226,15.241 8.275,17.071 8.275,17.071 9.288,17.922 10.917,18.786 12.32,18.786 15.074,18.786 17.386,16.824 18.039,14.171 18.039,14.171 21.987,15.222 21.987,15.222 20.891,19.693 16.996,23 12.357,23 9.771,23 7.076,21.618 5.308,19.934 5.308,19.934 3.454,21.671 3.454,21.671 3.454,21.671 2,12.942 2,12.942z M11.643,2C14.229,2 16.924,3.382 18.692,5.066 18.692,5.066 20.546,3.329 20.546,3.329 20.546,3.329 22,12.058 22,12.058 22,12.058 13.774,9.759 13.774,9.759 13.774,9.759 15.725,7.929 15.725,7.929 14.712,7.078 13.083,6.214 11.68,6.214 8.926,6.214 6.614,8.176 5.961,10.829 5.961,10.829 2.013,9.778 2.013,9.778 3.109,5.307 7.004,2 11.643,2z");
            this.AddFilter.Height      = 18;
            this.AddFilter.Width       = 18;
            this.Title                 = "Update Rule " + ruleId.ToString();
            this.AddRuleButtonBox.Text = " Update Rule";
        }
コード例 #3
0
 private void AddRuleButton_Click(object sender, RoutedEventArgs e)
 {
     if (CostingRuleRadio.IsChecked == true)
     {
         AddRule window = new AddRule(new BillingDataDataContext().Quotations.Where(x => x.CLCODE == ((Client)this.ClientCombo.SelectedItem).CLCODE).FirstOrDefault());
         window.Closed += addRulwWindow_Closed;
         window.Show();
     }
     if (ServiceRuleRadio.IsChecked == true)
     {
         AddServiceRule window = new AddServiceRule(new BillingDataDataContext().Quotations.Where(x => x.CLCODE == ((Client)this.ClientCombo.SelectedItem).CLCODE).FirstOrDefault());
         window.Closed += ServiceRuleWindowClosed;
         window.Show();
     }
 }
コード例 #4
0
 public AddRule(int ruleId)
     : this()
 {
     this.isUpdate = true;
     db            = new BillingDataDataContext();
     rule          = db.Rules.SingleOrDefault(x => x.ID == ruleId);
     if (rule == null)
     {
         MessageBox.Show("Invalid Rule.");
         return;
     }
     InitializeComponent();
     this.Title                 = "Update Rule " + ruleId.ToString();
     this.AddFilter.Data        = Geometry.Parse(@"F1M2,12.942C2,12.942 10.226,15.241 10.226,15.241 10.226,15.241 8.275,17.071 8.275,17.071 9.288,17.922 10.917,18.786 12.32,18.786 15.074,18.786 17.386,16.824 18.039,14.171 18.039,14.171 21.987,15.222 21.987,15.222 20.891,19.693 16.996,23 12.357,23 9.771,23 7.076,21.618 5.308,19.934 5.308,19.934 3.454,21.671 3.454,21.671 3.454,21.671 2,12.942 2,12.942z M11.643,2C14.229,2 16.924,3.382 18.692,5.066 18.692,5.066 20.546,3.329 20.546,3.329 20.546,3.329 22,12.058 22,12.058 22,12.058 13.774,9.759 13.774,9.759 13.774,9.759 15.725,7.929 15.725,7.929 14.712,7.078 13.083,6.214 11.68,6.214 8.926,6.214 6.614,8.176 5.961,10.829 5.961,10.829 2.013,9.778 2.013,9.778 3.109,5.307 7.004,2 11.643,2z");
     this.AddFilter.Height      = 18;
     this.AddFilter.Width       = 18;
     this.AddRuleButtonBox.Text = " Update Rule";
     RuleCR             = (new JavaScriptSerializer()).Deserialize <CostingRule>(rule.Properties);
     FromWeightBox.Text = RuleCR.startW.ToString();
     ToWeightBox.Text   = RuleCR.endW.ToString();
     DOXAmountBox.Text  = RuleCR.doxAmount.ToString();
     NDoxAmountBox.Text = RuleCR.ndoxAmount.ToString();
     AddRule.setFormList(RuleCR, ServiceTwinBox, ZoneTwinBox, StateTwinBox, CitiesTwinBox, ServiceGroupTwinBox);
     if (RuleCR.type == 'R')
     {
         RangeTypeRadio.IsChecked      = true;
         StepTypeRadio.IsChecked       = false;
         MultiplierTypeRadio.IsChecked = false;
     }
     if (RuleCR.type == 'S')
     {
         RangeTypeRadio.IsChecked      = false;
         StepTypeRadio.IsChecked       = true;
         MultiplierTypeRadio.IsChecked = false;
     }
     if (RuleCR.type == 'M')
     {
         RangeTypeRadio.IsChecked      = false;
         StepTypeRadio.IsChecked       = false;
         MultiplierTypeRadio.IsChecked = true;
     }
     StepBlockBox.Text = RuleCR.stepWeight.ToString();
 }