public override void CommitChanges()
        {
            BusinessDomain.DataAccessProvider.AddUpdateLocationsGroup(this);
            cache.Set(this);

            CommitChildrenChanges();
        }
Beispiel #2
0
        public VATGroup CommitChanges()
        {
            BusinessDomain.DataAccessProvider.AddUpdateVATGroup(this);
            cache.Set(this);

            return(this);
        }
        public PaymentType CommitChanges()
        {
            BusinessDomain.DataAccessProvider.AddUpdatePaymentMethod(this);
            cache.Set(this);

            return(this);
        }
Beispiel #4
0
        public Item CommitChanges()
        {
            if (barCode3 != null && barCode3.Length > 254)
            {
                while (barCode3.Length > 254 && barCode3.Contains(","))
                {
                    barCode3 = barCode3.Substring(0, barCode3.LastIndexOf(','));
                }

                if (barCode3.Length > 254)
                {
                    barCode3 = barCode3.Substring(0, 254);
                }
            }

            if (BusinessDomain.AppConfiguration.AutoGenerateItemCodes && string.IsNullOrWhiteSpace(code))
            {
                AutoGenerateCode();
            }

            if (!string.IsNullOrEmpty(groupName) && groupId <= 1)
            {
                ItemsGroup g = ItemsGroup.EnsureByPath(groupName, ItemsGroup.Cache);
                groupId = g.Id;
            }

            BusinessDomain.DataAccessProvider.AddUpdateItem(this);
            cache.Set(this);

            return(this);
        }
Beispiel #5
0
        public Location CommitChanges()
        {
            if (BusinessDomain.AppConfiguration.AutoGenerateLocationCodes && string.IsNullOrWhiteSpace(code))
            {
                AutoGenerateCode();
            }

            if (!string.IsNullOrEmpty(groupName) && groupId <= 1)
            {
                LocationsGroup g = GroupBase <LocationsGroup> .EnsureByPath(groupName, LocationsGroup.Cache);

                groupId = g.Id;
            }

            BusinessDomain.DataAccessProvider.AddUpdateLocation(this,
                                                                BusinessDomain.AppConfiguration.DocumentNumbersPerLocation,
                                                                OperationNumberingInfo.RECOMMENDED_NUMBERS_PER_LOCATION);
            cache.Set(this);

            return(this);
        }
Beispiel #6
0
        public Partner CommitChanges()
        {
            if (BusinessDomain.AppConfiguration.AutoGeneratePartnerCodes && string.IsNullOrWhiteSpace(code))
            {
                AutoGenerateCode();
            }

            if (!string.IsNullOrEmpty(groupName) && groupId <= 1)
            {
                PartnersGroup g = PartnersGroup.EnsureByPath(groupName, PartnersGroup.Cache);
                groupId = g.Id;
            }

            BusinessDomain.DataAccessProvider.AddUpdatePartner(this);
            cache.Set(this);

            return(this);
        }
Beispiel #7
0
        public User CommitChanges()
        {
            if (BusinessDomain.AppConfiguration.AutoGenerateUserCodes && string.IsNullOrWhiteSpace(code))
            {
                AutoGenerateCode();
            }

            if (!string.IsNullOrEmpty(groupName) && groupId <= 1)
            {
                UsersGroup g = GroupBase <UsersGroup> .EnsureByPath(groupName, UsersGroup.Cache);

                groupId = g.Id;
            }

            bool isNew = id < 0;

            BusinessDomain.DataAccessProvider.AddUpdateUser(this);
            cache.Set(this);

            if (isNew)
            {
                BusinessDomain.RestrictionTree.ResetLevelRestrictions(id, userLevel);
                BusinessDomain.RestrictionTree.SaveRestrictions();
            }

            if (lockedLocationIdDirty)
            {
                ConfigEntry.SaveValue(LOCKED_LOCATION_KEY, LockedLocationId, id);
                lockedLocationIdDirty = false;
            }

            if (lockedPartnerIdDirty)
            {
                ConfigEntry.SaveValue(LOCKED_PARTNER_KEY, LockedPartnerId, id);
                lockedPartnerIdDirty = false;
            }

            if (defaultPartnerIdDirty)
            {
                ConfigEntry.SaveValue(DEFAULT_PARTNER_KEY, DefaultPartnerId, id);
                defaultPartnerIdDirty = false;
            }

            if (defaultCompanyIdDirty)
            {
                ConfigEntry.SaveValue(DEFAULT_COMPANY_KEY, DefaultCompanyId, id);
                BusinessDomain.CurrentCompany = CompanyRecord.GetDefault();
                defaultCompanyIdDirty         = false;
            }

            if (hideItemsPurchasePriceDirty)
            {
                ConfigEntry.SaveValue(HIDE_ITEMS_PURCHASE_PRICE_KEY, HideItemsPurchasePrice, id);
                hideItemsPurchasePriceDirty = false;
            }

            if (hideItemsAvailabilityDirty)
            {
                ConfigEntry.SaveValue(HIDE_ITEMS_AVAILABILITY_KEY, HideItemsAvailability, id);
                hideItemsAvailabilityDirty = false;
            }

            if (allowZeroPricesDirty)
            {
                ConfigEntry.SaveValue(ALLOW_ZERO_PRICES_KEY, AllowZeroPrices, id);
                allowZeroPricesDirty = false;
            }

            if (BusinessDomain.LoggedUser.Id == id)
            {
                BusinessDomain.LoggedUser = this;
            }

            return(this);
        }