Ejemplo n.º 1
0
 protected override void btnNew_Clicked(object o, EventArgs args)
 {
     // Added transaction to ensure that we are connected to the same server in case of
     // master-slave replication
     using (new DbMasterScope(BusinessDomain.DataAccessProvider)) {
         using (EditNewPriceRule editNewPriceRule = new EditNewPriceRule(grid.Model.Count))
             if (editNewPriceRule.Run() == ResponseType.Ok)
             {
                 selectedId = editNewPriceRule.GetPriceRule().CommitChanges().Id;
                 OnEntitiesChanged();
             }
     }
 }
Ejemplo n.º 2
0
        protected override void btnEdit_Clicked(object o, EventArgs args)
        {
            if (grid.FocusedRow < 0)
            {
                return;
            }

            PriceRule selectedPriceRule = (PriceRule)entities [grid.FocusedRow].Clone();

            selectedId = (int?)selectedPriceRule.Id;

            // Added transaction to ensure that we are connected to the same server in case of
            // master-slave replication
            using (new DbMasterScope(BusinessDomain.DataAccessProvider)) {
                using (EditNewPriceRule editNewPriceRule = new EditNewPriceRule(selectedPriceRule))
                    if (editNewPriceRule.Run() == ResponseType.Ok)
                    {
                        editNewPriceRule.GetPriceRule().CommitChanges();
                        OnEntitiesChanged();
                    }
            }
        }