예제 #1
0
        public static StorePage QuerySearchResultPage(int sellerSysNo)
        {
            var filter = new StorePageFilter();

            filter.PageType = "SearchResult";
            return(StoreDA.QueryStorePage(filter));
        }
예제 #2
0
        /// <summary>
        /// 一周排行
        /// </summary>
        /// <param name="MerchantSysNo"></param>
        /// <param name="CategoryCode"></param>
        /// <param name="languageCode"></param>
        /// <param name="companyCode"></param>
        /// <returns></returns>
        public static List <RecommendProduct> QueryWeekRankingForCategoryCode(
            int MerchantSysNo,
            string CategoryCode,
            int count,
            string languageCode = "zh-CN",
            string companyCode  = "8601")
        {
            string cacheKey = CommonFacade.GenerateKey("QueryWeekRankingForCategoryCode", CategoryCode, languageCode, companyCode, MerchantSysNo.ToString());

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <RecommendProduct>)HttpRuntime.Cache[cacheKey]);
            }
            var p1 = StoreDA.QueryWeekRankingForCategoryCode(MerchantSysNo, CategoryCode);

            if (p1.Count < count)
            {
                var p2 = StoreDA.QuerySuperSpecialProductForCategoryCode(MerchantSysNo, CategoryCode, languageCode, companyCode);
                p2.ForEach(p =>
                {
                    if (p1.All(f => f.SysNo != p.SysNo))
                    {
                        p1.Add(p);
                    }
                });
            }
            List <RecommendProduct> result = p1.Take(count).ToList();

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);
            return(result);
        }
예제 #3
0
 public static int SaveStoreAttachment(List <StoreAttachment> attas)
 {
     if (attas.Count <= 0)
     {
         return(0);
     }
     using (var trans = TransactionManager.Create())
     {
         //StoreDA.DeleteAttachmentBySellerSysNo(attas[0].SellerSysNo.Value);
         foreach (var item in attas)
         {
             if (item.SysNo.HasValue)
             {
                 //TODO update
                 StoreDA.UpdateStoreAttachment(item);
             }
             else
             {
                 StoreDA.InsertStoreAttachment(item);
             }
         }
         trans.Complete();
     }
     return(1);
 }
예제 #4
0
        /// <summary>
        /// 根据PageTypeKey获取页面元素
        /// </summary>
        /// <param name="pageTypeKey"></param>
        public static Dictionary <string, List <StorePageElement> > GetPageElementByPageTypeKey(string pageTypeKey)
        {
            List <StorePageElement> list = StoreDA.GetPageElementByPageTypeKey(pageTypeKey);
            Dictionary <string, List <StorePageElement> > dic = new Dictionary <string, List <StorePageElement> >();

            if (list != null && list.Count > 0)
            {
                foreach (var item in list)
                {
                    if (!string.IsNullOrEmpty(item.ElementGroupName))
                    {
                        if (dic.ContainsKey(item.ElementGroupName))
                        {
                            dic[item.ElementGroupName].Add(item);
                        }
                        else
                        {
                            List <StorePageElement> elements = new List <StorePageElement>();
                            elements.Add(item);
                            dic.Add(item.ElementGroupName, elements);
                        }
                    }
                }
            }

            return(dic);
        }
예제 #5
0
        public static StorePage QueryProductListPage(int sellerSysNo)
        {
            var filter = new StorePageFilter();

            filter.PageType = "ProductList";
            return(StoreDA.QueryStorePage(filter));
        }
예제 #6
0
        public static StorePage QueryHomePage(int sellerSysNo)
        {
            var filter = new StorePageFilter();

            filter.PageType    = "Home";
            filter.SellerSysNo = sellerSysNo;
            return(StoreDA.QueryStorePage(filter));
        }
예제 #7
0
 public static void SavePageHeader(StorePageHeader header)
 {
     if (header.SysNo.HasValue)
     {
         StoreDA.UpdateStorePageHeader(header);
     }
     else
     {
         StoreDA.InsertStorePageHeader(header);
     }
 }
예제 #8
0
        /// <summary>
        /// save drafts
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public static int SaveStorePage(StorePage page)
        {
            var result = StoreDA.QueryStorePageByPageName(page.PageName, page.SellerSysNo.Value);

            if (result != null)
            {
                page.SysNo = result.SysNo;
                return(StoreDA.UpdateStorePage(page));
            }
            else
            {
                return(StoreDA.SaveStorePage(page));
            }
        }
예제 #9
0
 public static int SaveCertification(CertificationInfo certificaiton)
 {
     if (certificaiton == null)
     {
         return(0);
     }
     using (var trans = TransactionManager.Create())
     {
         StoreDA.InsertApplication(certificaiton);
         StoreDA.InsertCertificationAttachment(certificaiton);
         trans.Complete();
     }
     return(1);
 }
예제 #10
0
        /// <summary>
        /// publish store page
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public static int PublishStorePage(StorePage page)
        {
            using (var trans = TransactionManager.Create())
            {
                //step 1 save drafts
                var sysNo = SaveStorePage(page);
                page.SysNo = sysNo;
                //StoreDA.SaveStorePageDraft(page);
                //step 2 publish
                StoreDA.PublishStorePage(page);

                trans.Complete();
            }
            return(1);
        }
        public Store Get(int nID, int nStoreID)
        {
            Connection.Open();
            Command.CommandText = StoreDA.Get(nID, nStoreID);

            SqlDataReader reader  = Command.ExecuteReader();
            Store         _oStore = new Store();

            if (reader.HasRows)
            {
                _oStore = MakeObject(reader);
            }
            reader.Close();
            Connection.Close();
            return(_oStore);
        }
예제 #12
0
        /// <summary>
        /// 所有的有效的二级域名商家
        /// </summary>
        /// <returns></returns>
        public static List <StoreDomainPage> GetAllStoreDomainHomePageList()
        {
            string cacheKey = CommonFacade.GenerateKey("GetAllStoreDomainHomePageList");

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <StoreDomainPage>)HttpRuntime.Cache[cacheKey]);
            }
            List <StoreDomainPage> result = StoreDA.GetAllStoreDomainHomePageList();

            if (result != null)
            {
                HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Middle), Cache.NoSlidingExpiration);
            }
            return(result);
        }
예제 #13
0
        public static StorePage QueryStorePageByPageName(string pageName, int sellerSysNo)
        {
            var page = StoreDA.QueryStorePageByPageName(pageName, sellerSysNo);

            if (page != null)
            {
                var value = page.DataValue;
                if (!string.IsNullOrEmpty(value))
                {
                    var result = SerializationUtility.JsonDeserialize2 <StorePage>(value);
                    result.SysNo = page.SysNo;
                    return(result);
                }
            }
            return(null);
        }
        public string Delete(Store oStore, int nStoreID)
        {
            string sReturnMessage = "";

            Connection.Open();
            Command.CommandText = StoreDA.IUD(oStore, EnumDBOperation.Delete, nStoreID);
            try
            {
                Command.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                sReturnMessage = e.Message.Split('~')[0];
            }
            Connection.Close();
            return(sReturnMessage);
        }
        public List <Store> Gets(int nBUID, int nUserID)
        {
            Connection.Open();
            Command.CommandText = StoreDA.Gets(nBUID, nUserID);

            SqlDataReader reader   = Command.ExecuteReader();
            Store         _oStore  = new Store();
            List <Store>  _oStores = new List <Store>();

            if (reader.HasRows)
            {
                _oStores = MakeObjects(reader);
            }
            reader.Close();
            Connection.Close();
            return(_oStores);
        }
예제 #16
0
        public static QueryResult <StoreNavigation> QueryStoreNavigationList(StorePageListQueryFilter filter, int SellSysno)
        {
            var result = StoreDA.QueryStoreNavigationList(filter, SellSysno);

            //insert home to first
            var home = QueryHomePage(SellSysno);

            if (home != null)
            {
                var navHome = new StoreNavigation();
                navHome.LinkUrl = string.Format("/Store/{0}/{1}", SellSysno, home.SysNo.Value);
                navHome.Content = "首页";
                result.ResultList.Insert(0, navHome);
            }

            return(result);
        }
예제 #17
0
        /// <summary>
        /// 新品上市
        /// </summary>
        /// <param name="MerchantSysNo"></param>
        /// <param name="C1SysNo"></param>
        /// <param name="count"></param>
        /// <param name="languageCode"></param>
        /// <param name="companyCode"></param>
        /// <returns></returns>
        public static List <RecommendProduct> QueryStoreNewRecommendProduct(
            int MerchantSysNo,
            string CategoryCode,
            int count,
            string languageCode = "zh-CN",
            string companyCode  = "8601")
        {
            string cacheKey = CommonFacade.GenerateKey("QueryStoreNewRecommendProduct", languageCode, companyCode, MerchantSysNo.ToString());

            if (HttpRuntime.Cache[cacheKey] != null)
            {
                return((List <RecommendProduct>)HttpRuntime.Cache[cacheKey]);
            }

            List <RecommendProduct> result = StoreDA.QueryStoreNewRecommendProduct(MerchantSysNo, CategoryCode, count, languageCode, companyCode);

            HttpRuntime.Cache.Insert(cacheKey, result, null, DateTime.Now.AddSeconds(CacheTime.Long), Cache.NoSlidingExpiration);

            return(result);
        }
예제 #18
0
        /// <summary>
        /// 保存商家的基本信息
        /// 1.信息保存到ECStore.dbo.StoreBasicInfo
        /// 2.信息同步到IPP3.dbo.Vendor
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static int SaveStoreBasicInfo(StoreBasicInfo info)
        {
            using (var trans = TransactionManager.Create())
            {
                if (info.SysNo.HasValue)
                {
                    StoreDA.UpdateStoreBasicInfo(info);
                }
                else
                {
                    StoreDA.InsertStoreBasicInfo(info);
                }

                var basicInfo = StoreDA.QueryStoreBasicInfoBySellerSysNo(info.SellerSysNo.Value);

                StoreDA.SaveStoreBasicInfoToIPP3Vendor(ConvertStoreBasicToIPP3Vendor(basicInfo), info.InUserSysNo.Value);

                trans.Complete();
            }
            return(1);
        }
        public Store IUD(Store oStore, int nStoreID)
        {
            Connection.Open();
            if (oStore.StoreID == 0)
            {
                Command.CommandText = StoreDA.IUD(oStore, EnumDBOperation.Insert, nStoreID);
            }
            else
            {
                Command.CommandText = StoreDA.IUD(oStore, EnumDBOperation.Update, nStoreID);
            }
            SqlDataReader reader  = Command.ExecuteReader();
            Store         _oStore = new Store();

            if (reader.HasRows)
            {
                _oStore = MakeObject(reader);
            }
            reader.Close();
            Connection.Close();
            return(_oStore);
        }
예제 #20
0
 public static StorePageTemplate QueryStorePageTemplateByTemplateKey(string TemplateKey)
 {
     return(StoreDA.QueryStorePageTemplateByTemplateKey(TemplateKey));
 }
예제 #21
0
 /// <summary>
 /// 分页查询商家代理
 /// </summary>
 /// <param name="filter"></param>
 /// <param name="SellSysno"></param>
 /// <returns></returns>
 public static QueryResult <VendorAgentInfo> QueryStoreAgentInfosByPage(StorePageListQueryFilter filter, int SellSysno)
 {
     return(StoreDA.QueryStoreAgentInfosByPage(filter, SellSysno));
 }
예제 #22
0
 public static VendorBasicInfo LoadVendorInfo(int SellerSysNo)
 {
     return(StoreDA.LoadVendorInfo(SellerSysNo));
 }
예제 #23
0
 public static int RestoreDefaultStorePage(int sysno, int SellerSysNo)
 {
     return(StoreDA.RestoreDefaultStorePage(sysno, SellerSysNo));
 }
예제 #24
0
 public static List <StorePageTemplate> QueryStorePageTemplate(string pageTypeKey)
 {
     return(StoreDA.QueryStorePageTemplate(pageTypeKey));
 }
예제 #25
0
 public static void DelStoreAgentProduct(int agentSysNo)
 {
     StoreDA.DelStoreAgentProduct(agentSysNo);
 }
예제 #26
0
 public static List <StoreAttachment> QueryStoreAttachment(int sellerSysNo)
 {
     return(StoreDA.QueryStoreAttachment(sellerSysNo));
 }
예제 #27
0
 public static StorePageHeader QueryPageHeaderBySellerSysNo(int sellerSysNo)
 {
     return(StoreDA.QueryPageHeaderBySellerSysNo(sellerSysNo));
 }
예제 #28
0
 public static List <StorePageLayout> QueryAllPageLayout()
 {
     return(StoreDA.QueryAllPageLayout());
 }
예제 #29
0
 public static void DelStoreAttachment(int sysNo)
 {
     StoreDA.DelStoreAttachment(sysNo);
 }
예제 #30
0
 public static List <StorePageTheme> QueryAllStorePageTheme()
 {
     return(StoreDA.QueryAllStorePageTheme());
 }