Ejemplo n.º 1
0
        public static IdentifyingCodeInfo GetIdentifyingCodeInfoByIdentifyingCodeId(Guid identifyingCodeId, string moduleName, int wid)
        {
            if (identifyingCodeId == null || Guid.Empty.Equals(identifyingCodeId))
            {
                return null;
            }

            try
            {
                using (var context = new HotelDbContext())
                {
                    IIdentifyingCodeRepository repository = new IdentifyingCodeRepository(context); //改造方向:依赖注入,彻底去除对Infrastructure层的依赖

                    return
                        repository.Get(
                                item => item.IdentifyingCodeId.Equals(identifyingCodeId)
                                        && item.ModuleName.Equals(moduleName)
                                        && item.Wid.Equals(wid)).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {

                throw;
            }

        }
Ejemplo n.º 2
0
        public static IdentifyingCodeInfo GetConfirmIdentifyingCodeInfo(int shopId, string identifyingCode, string moduleName, int wid)
        {

            if (shopId == 0 || string.IsNullOrEmpty(identifyingCode) || string.IsNullOrEmpty(moduleName))
            {
                return null;
            }

            try
            {
                using (var context = new HotelDbContext())
                {
                    IIdentifyingCodeRepository repository = new IdentifyingCodeRepository(context); //改造方向:依赖注入,彻底去除对Infrastructure层的依赖

                    var strShop = shopId.ToString(CultureInfo.InvariantCulture);
                    return
                        repository.Get(
                            item =>
                            item.ShopId == strShop
                            && item.IdentifyingCode.Equals(identifyingCode)
                            && item.ModuleName.Equals(moduleName)
                            && item.Wid.Equals(wid)).FirstOrDefault();
                }
            }
            catch (Exception ex)
            {

                throw;
            }

        }
        public static IdentifyingCodeInfo GetIdentifyingCodeInfoByIdentifyingCodeId(Guid identifyingCodeId, string moduleName, int wid)
        {
            if (identifyingCodeId == null || Guid.Empty.Equals(identifyingCodeId))
            {
                return(null);
            }

            try
            {
                using (var context = new HotelDbContext())
                {
                    IIdentifyingCodeRepository repository = new IdentifyingCodeRepository(context); //改造方向:依赖注入,彻底去除对Infrastructure层的依赖

                    return
                        (repository.Get(
                             item => item.IdentifyingCodeId.Equals(identifyingCodeId) &&
                             item.ModuleName.Equals(moduleName) &&
                             item.Wid.Equals(wid)).FirstOrDefault());
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 4
0
        public static bool ModifyIdentifyingCodeInfoStatus(string orderCode, int status)
        {
            if (string.IsNullOrEmpty(orderCode))
            {
                return(false);
            }

            using (var context = new WXDBContext())
            {
                var repository = new IdentifyingCodeRepository(context);

                var identifyingCode = repository.Get(item => item.OrderCode.Equals(orderCode));
                if (identifyingCode.Any())
                {
                    foreach (var item in identifyingCode)
                    {
                        item.Status     = status;
                        item.ModifyTime = DateTime.Now;
                    }

                    return(repository.Update(identifyingCode));
                }
            }

            return(false);
        }
        public static IdentifyingCodeInfo GetConfirmIdentifyingCodeInfo(int shopId, string identifyingCode, string moduleName, int wid)
        {
            if (shopId == 0 || string.IsNullOrEmpty(identifyingCode) || string.IsNullOrEmpty(moduleName))
            {
                return(null);
            }

            try
            {
                using (var context = new HotelDbContext())
                {
                    IIdentifyingCodeRepository repository = new IdentifyingCodeRepository(context); //改造方向:依赖注入,彻底去除对Infrastructure层的依赖

                    var strShop = shopId.ToString(CultureInfo.InvariantCulture);
                    return
                        (repository.Get(
                             item =>
                             item.ShopId == strShop &&
                             item.IdentifyingCode.Equals(identifyingCode) &&
                             item.ModuleName.Equals(moduleName) &&
                             item.Wid.Equals(wid)).FirstOrDefault());
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }