コード例 #1
0
        public ProductInfoDto Convert(ProductInfoData entity)
        {
            ProductInfoDto dto = new ProductInfoDto();

            dto.ProductId              = entity.ProductId;
            dto.Name                   = entity.Name;
            dto.Description            = entity.Description;
            dto.CategoryId             = entity.CategoryId;
            dto.CatalogId              = entity.CatalogId;
            dto.SupplierId             = entity.SupplierId;
            dto.SellingPeriodId        = entity.SellingPeriodId;
            dto.SupplierName           = entity.SupplierName;
            dto.CategoryText           = entity.CategoryText;
            dto.SellingPeriodName      = entity.SellingPeriodName;
            dto.UnitPrice              = entity.UnitPrice;
            dto.Sketch                 = entity.Sketch;
            dto.IsDiscontinued         = entity.IsDiscontinued;
            dto.DiscountAmount         = entity.DiscountAmount;
            dto.Packaging              = entity.Packaging;
            dto.UnitOfMeasure          = entity.UnitOfMeasure;
            dto.Rating                 = entity.Rating;
            dto.NumberOfRatings        = entity.NumberOfRatings;
            dto.SellingPeriodStartTime = entity.SellingPeriodStartTime;
            dto.SellingPeriodEndTime   = entity.SellingPeriodEndTime;

            if (WebContext.Current.ApplicationOption.IsMultiLanguageSupported && LanguageId != null)
            {
                dto.Name         = WebContext.GetLocalizedData(CommonConst.ProductNameKeyFormatString, entity.ProductId, LanguageId, entity.Name);
                dto.Description  = WebContext.GetLocalizedData(CommonConst.ProductDescKeyFormatString, entity.ProductId, LanguageId, entity.Description);
                dto.SupplierName = WebContext.GetLocalizedData(CommonConst.SupplierNameKeyFormatString, entity.SupplierId, LanguageId, entity.SupplierName);
                dto.CategoryText = WebContext.GetLocalizedData(CommonConst.CategoryKeyFormatString, entity.CategoryId, LanguageId, entity.CategoryText);
            }

            return(dto);
        }
コード例 #2
0
        private void LoadSetupMenu()
        {
            IEnumerable <SetupMenuDto> accessableMenus = WebContext.Current.DomainSettingList[CurrentUserContext.User.DomainId].SetupMenus;

            if (accessableMenus != null)
            {
                foreach (SetupMenuDto item in accessableMenus)
                {
                    MenuItem menu = new MenuItem();
                    SetupMenu.Items.Add(menu);
                    menu.Value       = item.StringId;
                    menu.NavigateUrl = ServerPath + item.NavigateUrl;
                    menu.Text        = WebContext.GetLocalizedData(SetupConst.SetupMenuTextKeyFormatString, item.Id, CurrentUserContext.CurrentLanguage.Id, item.MenuText);
                }
            }
        }
コード例 #3
0
        public CartItemDto Convert(ProductInfoData product)
        {
            CartItemDto dto = new CartItemDto();

            dto.ProductId    = product.ProductId;
            dto.ProductName  = product.Name;
            dto.SupplierId   = product.SupplierId;
            dto.SupplierName = product.SupplierName;
            dto.UnitPrice    = product.UnitPrice;
            dto.Amount       = dto.UnitPrice * dto.QtyOrdered;

            if (WebContext.Current.ApplicationOption.IsMultiLanguageSupported && LanguageId != null)
            {
                dto.ProductName  = WebContext.GetLocalizedData(CommonConst.ProductNameKeyFormatString, product.ProductId, LanguageId, product.Name);
                dto.SupplierName = WebContext.GetLocalizedData(CommonConst.SupplierNameKeyFormatString, product.SupplierId, LanguageId, product.SupplierName);
            }

            return(dto);
        }
コード例 #4
0
        public CategoryDto Convert(CategoryData entity)
        {
            CategoryDto dto = new CategoryDto();

            dto.Id = entity.Id;
            if (entity.Id != null)
            {
                dto.StringId = entity.Id.ToString();
            }
            dto.Display   = entity.Name;
            dto.Name      = entity.Name;
            dto.ParentId  = entity.ParentId;
            dto.CatalogId = entity.CatalogId;

            if (WebContext.Current.ApplicationOption.IsMultiLanguageSupported && LanguageId != null)
            {
                dto.Name = WebContext.GetLocalizedData(CommonConst.CategoryKeyFormatString, entity.Id, LanguageId, entity.Name);
            }

            return(dto);
        }
コード例 #5
0
        public SupplierInfoDto Convert(SupplierInfoData entity)
        {
            SupplierInfoDto dto = new SupplierInfoDto();

            dto.SupplierId       = entity.SupplierId;
            dto.Name             = entity.Name;
            dto.Address          = entity.Address;
            dto.Country          = entity.Country;
            dto.CountryState     = entity.CountryState;
            dto.City             = entity.City;
            dto.ZipCode          = entity.ZipCode;
            dto.ContactPerson    = entity.ContactPerson;
            dto.ContactPhone     = entity.ContactPhone;
            dto.ContactEmail     = entity.ContactEmail;
            dto.ContactFax       = entity.ContactFax;
            dto.CategoryId       = entity.CategoryId;
            dto.CategoryText     = entity.CategoryText;
            dto.NationId         = entity.NationId;
            dto.NationText       = entity.NationText;
            dto.AllowTakeOut     = entity.AllowTakeOut;
            dto.AllowReserve     = entity.AllowReserve;
            dto.AllowBringWine   = entity.AllowBringWine;
            dto.DayStartTime     = entity.DayStartTime;
            dto.DayEndTime       = entity.DayEndTime;
            dto.Grade            = entity.Grade;
            dto.Logo             = entity.Logo;
            dto.Website          = entity.Website;
            dto.Rating           = entity.Rating;
            dto.NumberOfRatings  = entity.NumberOfRatings;
            dto.ProductCatalogId = entity.ProductCatalogId;

            if (WebContext.Current.ApplicationOption.IsMultiLanguageSupported && LanguageId != null)
            {
                dto.Name         = WebContext.GetLocalizedData(CommonConst.SupplierNameKeyFormatString, entity.SupplierId, LanguageId, entity.Name);
                dto.CategoryText = WebContext.GetLocalizedData(CommonConst.CategoryKeyFormatString, entity.CategoryId, LanguageId, entity.CategoryText);
            }

            return(dto);
        }
コード例 #6
0
        public string GetItemName(object obj)
        {
            CartItemDto item = (CartItemDto)obj;

            return(WebContext.GetLocalizedData(CommonConst.ProductNameKeyFormatString, item.ProductId, CurrentUserContext.CurrentLanguage.Id, item.ProductName));
        }
コード例 #7
0
        public static string LocalizeData(this HtmlHelper htmlHelper, string keyFormatString, object id, string defaultValue)
        {
            BaseController controller = htmlHelper.ViewContext.Controller as BaseController;

            return(WebContext.GetLocalizedData(keyFormatString, id, controller.CurrentLanguageId, defaultValue));
        }