コード例 #1
0
ファイル: BranchService.cs プロジェクト: priceLiu/MulitNop
        /// <summary>
        /// Deletes a Branch
        /// </summary>
        /// <param name="branch">Branch</param>
        public virtual void DeleteBranch(Branch branch)
        {
            if (branch == null)
                throw new ArgumentNullException("branch");

            _branchRepository.Delete(branch);

            //event notification
            _eventPublisher.EntityDeleted(branch);
        }
コード例 #2
0
ファイル: Vendor.cs プロジェクト: priceLiu/MulitNop
 public virtual void RemoveBranch(Branch branch)
 {
     if (this.Branches.Contains(branch))
         this.Branches.Remove(branch);
 }
コード例 #3
0
ファイル: Vendor.cs プロジェクト: priceLiu/MulitNop
 public virtual void AddBranch(Branch branch)
 {
     if (!this.Branches.Contains(branch))
         this.Branches.Add(branch);
 }
コード例 #4
0
ファイル: Branch.cs プロジェクト: priceLiu/MulitNop
 public object Clone()
 {
     var addr = new Branch()
     {
         Name = this.Name,
         Website = this.Website,
         Email = this.Email,
         Country = this.Country,
         CountryId = this.CountryId,
         StateProvince = this.StateProvince,
         StateProvinceId = this.StateProvinceId,
         City = this.City,
         Address1 = this.Address1,
         Address2 = this.Address2,
         ZipPostalCode = this.ZipPostalCode,
         PhoneNumber = this.PhoneNumber,
         FaxNumber = this.FaxNumber,
         CreatedOnUtc = this.CreatedOnUtc,
         DisplayOrder = this.DisplayOrder,
     };
     return addr;
 }
コード例 #5
0
ファイル: VendorController.cs プロジェクト: priceLiu/MulitNop
        public void UpdateLocalesBranch(Branch branch, BranchModel model)
        {
            foreach (var localized in model.Locales)
            {
                _localizedEntityService.SaveLocalizedValue(branch,
                                                               x => x.Name,
                                                               localized.Name,
                                                               localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(branch,
                                                           x => x.City,
                                                           localized.City,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(branch,
                                                           x => x.Address1,
                                                           localized.Address1,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(branch,
                                                           x => x.Address2,
                                                           localized.Address2,
                                                           localized.LanguageId);
            }
        }
コード例 #6
0
 public static Branch ToEntity(this BranchModel model, Branch destination)
 {
     return Mapper.Map(model, destination);
 }
コード例 #7
0
ファイル: BranchService.cs プロジェクト: priceLiu/MulitNop
        /// <summary>
        /// Updates the Branch
        /// </summary>
        /// <param name="branch">Branch</param>
        public virtual void UpdateBranch(Branch branch)
        {
            if (branch == null)
                throw new ArgumentNullException("branch");

            //some validation
            if (branch.CountryId == 0)
                branch.CountryId = null;
            if (branch.StateProvinceId == 0)
                branch.StateProvinceId = null;

            _branchRepository.Update(branch);

            //event notification
            _eventPublisher.EntityUpdated(branch);
        }
コード例 #8
0
ファイル: BranchService.cs プロジェクト: priceLiu/MulitNop
        /// <summary>
        /// Inserts a branch
        /// </summary>
        /// <param name="branch">Branch</param>
        public virtual void InsertBranch(Branch branch)
        {
            if (branch == null)
                throw new ArgumentNullException("branch");

            branch.CreatedOnUtc = DateTime.UtcNow;

            //some validation
            if (branch.CountryId == 0)
                branch.CountryId = null;
            if (branch.StateProvinceId == 0)
                branch.StateProvinceId = null;

            _branchRepository.Insert(branch);

            //event notification
            _eventPublisher.EntityInserted(branch);
        }