Ejemplo n.º 1
0
        public JsResultObject submitOrder(OrderModel order, bool isElong)
        {
            JsResultObject re = new JsResultObject();

            order.lastModifyDate = DateTime.Now;


            if (isElong)
            {
                ELongApiBiz elongBiz = ELongApiBiz.GetInstant();
                re = elongBiz.submitHotelOrder(ref order);
                if (re.code == JsResultObject.CODE_SUCCESS)
                {
                    order.orderStatus = OrderModel.ORDER_STATUS_ELONG_SUCCESS;
                }
                else
                {
                    order.orderStatus = OrderModel.ORDER_STATUS_FAIL;
                }
            }

            BaseZdBiz.SaveOrUpdate(order, "订单");

            return(re);
        }
Ejemplo n.º 2
0
        public JsResultObject submitComment(MemberCommentModel comment)
        {
            JsResultObject        re    = new JsResultObject();
            OrderModel            order = BaseZdBiz.Load <OrderModel>(comment.orderFk);
            MemberRewardRuleModel rule  = GetCurRewardRule();

            if (order.checkOutDate.AddDays(rule.comValidityDays).CompareTo(DateTime.Now) < 0)
            {
                re.code = JsResultObject.CODE_ERROR;
                re.msg  = string.Format("离店日期超出{0}日", rule.comValidityDays);
                return(re);
            }

            comment.createDate = DateTime.Now;
            comment.setPk(comment.createPk());
            re = BaseZdBiz.Save(comment);
            order.orderStatus = OrderModel.ORDER_STATUS_COMMENTED;
            re = BaseZdBiz.Update(order, "");
            MemberModel        member     = BaseZdBiz.Load <MemberModel>(comment.memberFk);
            MemberAccountModel oldAccount = getCurrMemberAccount(member);
            MemberAccountModel newAccount = new MemberAccountModel(comment.memberFk);

            newAccount.method       = MemberAccountModel.METHOD_COMMENT_REWARD;
            newAccount.createDate   = DateTime.Now;
            newAccount.method       = MemberAccountModel.METHOD_COMMENT_REWARD;
            newAccount.oldAmount    = oldAccount.newAmount;
            newAccount.changeAmount = Convert.ToInt32(GetReward(order).amount);
            newAccount.newAmount    = newAccount.oldAmount + newAccount.changeAmount;
            newAccount.setPk(newAccount.createPk());
            re = BaseZdBiz.Save(newAccount);

            return(re);
        }
Ejemplo n.º 3
0
        public static IList <OuterLinkModel> getOuterLinks()
        {
            ICriteria icr = BaseZdBiz.CreateCriteria <OuterLinkModel>();

            icr.Add(Restrictions.Eq("recInd", BaseModel.IND_Y));
            icr.AddOrder(Order.Desc("recLevel"));
            return(icr.List <OuterLinkModel>());
        }
Ejemplo n.º 4
0
 private CacheBiz(string pathBase)
 {
     this.pathBase       = pathBase;
     this.pathDictCache  = this.pathBase + "/" + BaseZdBiz.GetPathJsCache() + "DictModel.js";
     this.pathGeoCache   = this.pathBase + "/" + BaseZdBiz.GetPathJsCache() + "GeoModel.js";
     this.pathHotelCache = this.pathBase + "/" + BaseZdBiz.GetPathJsCache() + "HotelModel.js";
     this.pathBrandCache = this.pathBase + "/" + BaseZdBiz.GetPathJsCache() + "BrandModel.js";
     this.pathRoleCache  = this.pathBase + "/" + BaseZdBiz.GetPathJsCache() + "RoleModel.js";
 }
Ejemplo n.º 5
0
        public IList <BrandModel> getHotBrands()
        {
            ICriteria icr = BaseZdBiz.CreateCriteria <BrandModel>();

            icr.Add(Restrictions.Eq("recInd", BaseModel.IND_Y));
            icr.AddOrder(Order.Desc("recLevel"));
            IList <BrandModel> listHotBrand = icr.List <BrandModel>();

            return(listHotBrand);
        }
Ejemplo n.º 6
0
        public JsResultObject createNewOrder(OrderModel order)
        {
            JsResultObject re = new JsResultObject();

            this.OpenSession();
            ICriteria icr       = this.session.CreateCriteria <OrderModel>();
            DateTime  startDate = new DateTime(order.createDate.Year, order.createDate.Month, order.createDate.Day, 0, 0, 0);
            DateTime  endDate   = startDate.AddDays(1);

            icr.Add(Restrictions.And(
                        Restrictions.And(
                            Restrictions.Eq("hotelId", order.hotelId)
                            , Restrictions.Between("createDate", startDate, endDate)
                            ),
                        Restrictions.Eq("guestsNameArray", order.guestsNameArray)

                        ));
            IList <OrderModel> orders = icr.List <OrderModel>();

            if (orders.Count > 0)
            {
                re.code = JsResultObject.CODE_ERROR;
                re.msg  = "同名住客不能在同一天预订同一间酒店的房间";
                return(re);
            }
            string[] guestsName = order.guestsNameArray.Split(',');
            if (string.IsNullOrEmpty(order.guestsNameArray))
            {
                re.code = JsResultObject.CODE_ERROR;
                re.msg  = "必须至少填写一个住客的名字";
                return(re);
            }
            Array.Sort(guestsName);
            order.guestsNameArray = ObjectUtil.ToUnionString(guestsName, ',');

            re = ServiceUtil.ValidateMoblie(order.mobile);
            if (re.code != JsResultObject.CODE_SUCCESS)
            {
                return(re);
            }

            // re = ServiceUtil.ValidateEmail(order.email);
            // if (re.code != JsResultObject.CODE_SUCCESS) { return re; }



            re = BaseZdBiz.Save(order);
            ConfigModel config = AdminBiz.GetCurrConfig();

            if (config.autoOrderInd == BaseModel.IND_Y)
            {
                re = submitOrder(order, true);
            }
            return(re);
        }
Ejemplo n.º 7
0
        public MemberRewardRuleModel GetCurRewardRule()
        {
            MemberRewardRuleModel rule = BaseZdBiz.Load <MemberRewardRuleModel>("default");

            if (rule == null)
            {
                ICriteria icr = BaseZdBiz.CreateCriteria <MemberRewardRuleModel>();
                rule = icr.List <MemberRewardRuleModel>()[0];
            }
            return(rule);
        }
Ejemplo n.º 8
0
        public static ConfigModel GetCurrConfig()
        {
            ConfigModel config = BaseZdBiz.Load <ConfigModel>("default");

            if (config == null)
            {
                config    = new ConfigModel();
                config.id = "default";
            }
            return(config);
        }
Ejemplo n.º 9
0
        public JsResultObject requireMemberRewards(MemberModel member)
        {
            JsResultObject            re      = new JsResultObject();
            IList <MemberRewardModel> rewards = getMemberRewards(member, new string[] { MemberRewardModel.REBATE_STATUS_UNREBATED });

            foreach (MemberRewardModel reward in rewards)
            {
                reward.rebateStatus = MemberRewardModel.REBATE_STATUS_REQUIRE;
                re.code            += BaseZdBiz.Update(reward, "").code;
            }
            return(re);
        }
Ejemplo n.º 10
0
        public static IList <T> List <T>(params ICriterion[] conditions)
        {
            ICriteria icr = BaseZdBiz.CreateCriteria <T>();

            foreach (ICriterion condition in conditions)
            {
                icr.Add(condition);
            }
            IList <T> list = icr.List <T>();

            return(list);
        }
Ejemplo n.º 11
0
        public JsResultObject cancelOrder(OrderModel order, string cancelCode, string cancelReason)
        {
            JsResultObject re       = new JsResultObject();
            ELongApiBiz    elongBiz = ELongApiBiz.GetInstant();

            order.orderStatus = OrderModel.ORDER_STATUS_CANCEL;
            BaseZdBiz.Update(order, "");
            if (order.elongOrderId != default(int))
            {
                re = elongBiz.cancelHotelOrderById(order.elongOrderId, cancelCode, cancelReason);
            }
            return(re);
        }
Ejemplo n.º 12
0
        public JsResultObject checkMemberRegInfo(MemberModel member)
        {
            JsResultObject re     = new JsResultObject();
            JsResultObject tempRe = new JsResultObject();

            MemberModel tempMember = BaseZdBiz.Load <MemberModel>(member.id);

            if (tempMember != null)
            {
                re.code = JsResultObject.CODE_ERROR;
                re.traceStack.Add("exists", string.Format("用户名{0}已被注册,请使用另外用户名的重新注册", member.id));
                return(re);
            }

            ICriteria icr = BaseZdBiz.CreateCriteria <MemberModel>();

            icr.Add(Restrictions.Eq("email", member.email));
            if (icr.List().Count > 0)
            {
                re.code = JsResultObject.CODE_ERROR;
                re.traceStack.Add("exists", string.Format("邮箱{0}已被注册,请使用另外邮箱的重新注册", member.email));
                return(re);
            }

            icr = BaseZdBiz.CreateCriteria <MemberModel>();
            icr.Add(Restrictions.Eq("moblie", member.email));
            if (icr.List().Count > 0)
            {
                re.code = JsResultObject.CODE_ERROR;
                re.traceStack.Add("moblie", string.Format("手机{0}已被注册,请使用另外手机的重新注册", member.moblie));
                return(re);
            }


            //  tempRe = ServiceUtil.ValidateEmail(member.id);
            // re.code += tempRe.code;
            //   if (tempRe.code != JsResultObject.CODE_SUCCESS)
            //   {
            //       re.traceStack.Add("email", tempRe.msg);
            //   }

            tempRe   = ServiceUtil.ValidateMoblie(member.moblie);
            re.code += tempRe.code;
            if (tempRe.code != JsResultObject.CODE_SUCCESS)
            {
                re.traceStack.Add("moblie", tempRe.msg);
            }


            return(re);
        }
Ejemplo n.º 13
0
        public void ImportDictList()
        {
            IList <ELongBaseCodeAdapter> basecodes = ELongStaticClient.GetBaseCodeList();

            //this.OpenSession();
            // ITransaction tx = this.session.BeginTransaction();
            foreach (ELongBaseCodeAdapter basecode in basecodes)
            {
                DictModel dict = new DictModel();
                dict.from(basecode);
                System.Console.WriteLine(string.Format("{0}:{1}:{2}", dict.type, dict.text, dict.value));
                BaseZdBiz.SaveOrUpdate(dict, "");
            }
            //tx.Commit();
        }
Ejemplo n.º 14
0
        public Dictionary <string, IList <GeoModel> > GeoProvinceCitys()
        {
            Dictionary <string, IList <GeoModel> > dict = new Dictionary <string, IList <GeoModel> >();
            ICriteria        icr      = BaseZdBiz.CreateCriteria <GeoModel>();
            IList <GeoModel> allCitys = icr.List <GeoModel>();

            foreach (GeoModel geo in allCitys)
            {
                string provinceId = geo.provinceId;
                if (!dict.ContainsKey(provinceId))
                {
                    dict.Add(provinceId, new List <GeoModel>());
                }
                dict[provinceId].Add(geo);
            }
            return(dict);
        }
Ejemplo n.º 15
0
        public MemberAccountModel getCurrMemberAccount(MemberModel member)
        {
            ICriteria icr = BaseZdBiz.CreateCriteria <MemberAccountModel>();

            icr.Add(Restrictions.Eq("memberFk", member.id));
            icr.AddOrder(Order.Desc("createDate"));
            IList <MemberAccountModel> accounts = icr.List <MemberAccountModel>();

            if (accounts.Count > 0)
            {
                return(accounts[0]);
            }
            else
            {
                return(new MemberAccountModel(member.id));
            }
        }
Ejemplo n.º 16
0
        public IList <HotelDetailModel> getHotHotelDetail()
        {
            IList <string> ids = new List <string>();
            ICriteria      icr = BaseZdBiz.CreateCriteria <HotelModel>();

            icr.Add(Restrictions.Eq("recInd", BaseModel.IND_Y));
            icr.AddOrder(Order.Desc("recLevel"));
            IList <HotelModel> hotels = icr.List <HotelModel>();

            foreach (HotelModel hotel in hotels)
            {
                ids.Add(hotel.hotelId);
            }
            icr = BaseZdBiz.CreateCriteria <HotelDetailModel>();
            icr.Add(Restrictions.In("id", ids.ToArray()));
            return(icr.List <HotelDetailModel>());
        }
Ejemplo n.º 17
0
        public JsResultObject rebateReward(MemberModel member, int rebateAmount, string remark)
        {
            JsResultObject     re      = new JsResultObject();
            MemberAccountModel account = getCurrMemberAccount(member);

            if (member.rebateInd != BaseModel.IND_Y)
            {
                re.code = JsResultObject.CODE_ERROR;
                re.msg  = string.Format("当前用户尚未申请返还", account.newAmount, rebateAmount);
                return(re);
            }
            else if (account.newAmount < rebateAmount)
            {
                re.code = JsResultObject.CODE_ERROR;
                re.msg  = string.Format("当前用户帐户奖励{0},小于{1},返还无效", account.newAmount, rebateAmount);
                return(re);
            }
            MemberAccountModel newAccount = new MemberAccountModel();

            newAccount.createDate = DateTime.Now;
            newAccount.oldAmount  = account.newAmount;
            newAccount.newAmount  = account.newAmount - rebateAmount;
            newAccount.remark     = remark;
            newAccount.memberFk   = member.id;
            newAccount.method     = MemberAccountModel.METHOD_REWARD_REBATE;
            newAccount.setPk(newAccount.createPk());
            newAccount.remark = string.Format("成功为手机号码{0}充值{1}元", member.rebateMoblie, rebateAmount);
            re = BaseZdBiz.Save(newAccount);
            if (re.code == JsResultObject.CODE_SUCCESS)
            {
                MemberRewardLogModel rewardLog = new MemberRewardLogModel();
                rewardLog.createDate = DateTime.Now;
                rewardLog.amount     = rebateAmount;
                rewardLog.moblie     = member.rebateMoblie;
                rewardLog.method     = MemberAccountModel.METHOD_REWARD_REBATE;
                rewardLog.remark     = string.Format("成功为手机号码{0}充值{1}元", member.rebateMoblie, rebateAmount);
                rewardLog.status     = BaseModel.STATUS_ACTIVATE;
                rewardLog.memberFk   = member.id;
                rewardLog.setPk(rewardLog.createPk());
                re = BaseZdBiz.Save(rewardLog);
            }
            return(re);
        }
Ejemplo n.º 18
0
        public JsResultObject submitMemberRegInfo(MemberModel member)
        {
            JsResultObject re = BaseZdBiz.Save(member);

            if (re.code == JsResultObject.CODE_SUCCESS)
            {
                MemberRewardRuleModel rule    = GetCurRewardRule();
                MemberAccountModel    account = new MemberAccountModel(member.id);
                account.oldAmount    = 0;
                account.newAmount    = 10;
                account.changeAmount = 10;
                account.createDate   = DateTime.Now;
                account.method       = MemberAccountModel.METHOD_ACCOUNT_CREATE;
                account.remark       = string.Format("帐号创建成功,获得奖励{0}元", 10);
                account.setPk(account.createPk());
                re = BaseZdBiz.Save(account);
            }
            return(re);
        }
Ejemplo n.º 19
0
        public IList <GeoCommercialLocationModel> GetGeoCls(string geoFk)
        {
            if (CACHE_GEO_CLS_BY_GEO_FK == null)
            {
                CACHE_GEO_CLS_BY_GEO_FK = new Dictionary <string, IList <GeoCommercialLocationModel> >();
            }
            IList <GeoCommercialLocationModel> localtions = null;

            if (CACHE_GEO_CLS_BY_GEO_FK.ContainsKey(geoFk))
            {
                return(CACHE_GEO_CLS_BY_GEO_FK[geoFk]);
            }
            ICriteria icr = BaseZdBiz.CreateCriteria <GeoCommercialLocationModel>();

            icr.Add(Restrictions.Eq("geoFk", geoFk));
            localtions = icr.List <GeoCommercialLocationModel>();

            CACHE_GEO_CLS_BY_GEO_FK.Add(geoFk, localtions);
            return(localtions);
        }
Ejemplo n.º 20
0
        public JsResultObject renewOrder(OrderModel order)
        {
            JsResultObject re       = new JsResultObject();
            ELongApiBiz    elongBiz = ELongApiBiz.GetInstant();

            if (DateTimeUtil.CompareDay(order.checkInDate, DateTime.Now) < 0)
            {
                re.code = JsResultObject.CODE_ERROR;
                re.msg  = string.Format("原订单:{0} 已超出入住日期{1},不能再还原,请重新创建订单", order.id, order.checkInDate.ToShortDateString());
            }
            else
            {
                order.orderStatus = OrderModel.ORDER_STATUS_NEW;
                re     = BaseZdBiz.Update(order, "");
                re.msg = string.Format("原订单:{0} 还原成功,请记得在{1}入住", order.id, order.checkInDate.ToShortDateString());
            }


            return(re);
        }
Ejemplo n.º 21
0
        public GeoModel GetGeoByCityId(string cityId)
        {
            if (CACHE_GEOS_BY_CITY_ID == null)
            {
                CACHE_GEOS_BY_CITY_ID = new Dictionary <string, GeoModel>();
            }
            GeoModel geo = null;

            if (CACHE_GEOS_BY_CITY_ID.ContainsKey(cityId))
            {
                return(CACHE_GEOS_BY_CITY_ID[cityId]);
            }
            ICriteria icr = BaseZdBiz.CreateCriteria <GeoModel>();

            icr.Add(Restrictions.Eq("cityCode", cityId));
            IList <GeoModel> geos = icr.List <GeoModel>();

            if (geos.Count > 0)
            {
                geo = geos[0];
            }
            CACHE_GEOS_BY_CITY_ID.Add(cityId, geo);
            return(geo);
        }
Ejemplo n.º 22
0
        public GeoModel GetGeoByCityName(string cityName)
        {
            if (CACHE_GEOS_BY_CITY_NAME == null)
            {
                CACHE_GEOS_BY_CITY_NAME = new Dictionary <string, GeoModel>();
            }
            GeoModel geo = null;

            if (CACHE_GEOS_BY_CITY_NAME.ContainsKey(cityName))
            {
                return(CACHE_GEOS_BY_CITY_NAME[cityName]);
            }
            ICriteria icr = BaseZdBiz.CreateCriteria <GeoModel>();

            icr.Add(Restrictions.Like("cityName", "%" + cityName + "%"));
            IList <GeoModel> geos = icr.List <GeoModel>();

            if (geos.Count > 0)
            {
                geo = geos[0];
            }
            CACHE_GEOS_BY_CITY_NAME.Add(cityName, geo);
            return(geo);
        }
Ejemplo n.º 23
0
 public FrontPageModel getCurFrontPage()
 {
     return(BaseZdBiz.Load <FrontPageModel>("default"));
 }
Ejemplo n.º 24
0
 public static PageSeoModel getCurPageSeo()
 {
     return(BaseZdBiz.Load <PageSeoModel>("default"));
 }
Ejemplo n.º 25
0
        public JsResultObject ImportHotelDetail(string hotelId, bool hasSubInfo)
        {
            JsResultObject re = new JsResultObject();

            ELongHotelDetailAdapter adapter = ELongStaticClient.GetHotelDetail(hotelId);
            HotelDetailModel        hotel   = new HotelDetailModel();

            hotel.from(adapter);
            System.Console.WriteLine(string.Format("{0}:{1}:{2}", hotel.country, hotel.city, hotel.name));
            re = BaseZdBiz.SaveOrUpdate(hotel, "");


            if (!hasSubInfo)
            {
                return(re);
            }

            IList <ELongHotelImageAdapter> images = ELongStaticClient.GetHotelImageList(hotelId);

            foreach (ELongHotelImageAdapter image in images)
            {
                HotelImageModel temp = new HotelImageModel();
                temp.setPk(temp.createPk());
                temp.from(image);
                //System.Console.WriteLine(string.Format("{0}:{1}:{2}", temp.hotelFk, temp.title, temp.imgUrl));
                re.rowNum += BaseZdBiz.SaveOrUpdate(temp, "").rowNum;
            }



            IList <ELongHotelRoomAdapter> rooms = ELongStaticClient.GetHotelRoomList(hotelId);

            foreach (ELongHotelRoomAdapter room in rooms)
            {
                HotelRoomModel temp = new HotelRoomModel();
                temp.setPk(temp.createPk());
                temp.from(room);
                //System.Console.WriteLine(string.Format("{0}:{1}:{2}", temp.hotelFk, temp.roomName, temp.area));
                re.rowNum += BaseZdBiz.SaveOrUpdate(temp, "").rowNum;
            }

            ELongHotelFeatureInfoAdapter featureInfo           = ELongStaticClient.GetHotelFeatureInfo(hotelId);
            HotelFeatrueInfoModel        hotelFeatrueInfoModel = new HotelFeatrueInfoModel();

            hotelFeatrueInfoModel.from(featureInfo);
            re.rowNum += BaseZdBiz.SaveOrUpdate(hotelFeatrueInfoModel, "").rowNum;


            IList <ELongHotelLandMarkAdapter> landmarks = ELongStaticClient.GetHotelLandMarkList(hotelId);

            foreach (ELongHotelLandMarkAdapter landmark in landmarks)
            {
                HotelLandMarkModel temp = new HotelLandMarkModel();
                temp.setPk(temp.createPk());
                temp.from(landmark);
                temp.id = temp.createPk().ToString();
                //System.Console.WriteLine(string.Format("{0}:{1}:{2}", temp.hotelFk, temp.roomName, temp.area));
                re.rowNum += BaseZdBiz.SaveOrUpdate(temp, "").rowNum;
            }

            IList <ElongHotelSurroundingAttractionAdapter> attractions = ELongStaticClient.GetHotelSurroundingAttractionList(hotelId);

            foreach (ElongHotelSurroundingAttractionAdapter attraction in attractions)
            {
                HotelSurroundingAttractionModel temp = new HotelSurroundingAttractionModel();
                temp.setPk(temp.createPk());
                temp.from(attraction);
                //System.Console.WriteLine(string.Format("{0}:{1}:{2}", temp.hotelFk, temp.roomName, temp.area));
                re.rowNum += BaseZdBiz.SaveOrUpdate(temp, "").rowNum;
            }

            IList <ELongHotelSurroundingCommerceAdapter> commerces = ELongStaticClient.GetHotelSurroundingCommerceList(hotelId);

            foreach (ELongHotelSurroundingCommerceAdapter commerce in commerces)
            {
                HotelSurroundingCommerceModel temp = new HotelSurroundingCommerceModel();
                temp.setPk(temp.createPk());
                temp.from(commerce);
                //System.Console.WriteLine(string.Format("{0}:{1}:{2}", temp.hotelFk, temp.roomName, temp.area));
                re.rowNum += BaseZdBiz.SaveOrUpdate(temp, "").rowNum;
            }

            IList <ElongHotelSurroundingRestaurantAdapter> restaurants = ELongStaticClient.GetHotelSurroundingRestaurantList(hotelId);

            foreach (ElongHotelSurroundingRestaurantAdapter restaurant in restaurants)
            {
                HotelSurroundingRestaurantModel temp = new HotelSurroundingRestaurantModel();
                temp.setPk(temp.createPk());
                temp.from(restaurant);
                //System.Console.WriteLine(string.Format("{0}:{1}:{2}", temp.hotelFk, temp.roomName, temp.area));
                re.rowNum += BaseZdBiz.SaveOrUpdate(temp, "").rowNum;
            }

            IList <ElongHotelSurroundingShopAdapter> shops = ELongStaticClient.GetHotelSurroundingShopList(hotelId);

            foreach (ElongHotelSurroundingShopAdapter shop in shops)
            {
                HotelSurroundingShopModel temp = new HotelSurroundingShopModel();
                temp.setPk(temp.createPk());
                temp.from(shop);
                //System.Console.WriteLine(string.Format("{0}:{1}:{2}", temp.hotelFk, temp.roomName, temp.area));
                re.rowNum += BaseZdBiz.SaveOrUpdate(temp, "").rowNum;
            }


            IList <ElongHotelTrafficInfoAdapter> traffics = ELongStaticClient.GetHotelTrafficInfoList(hotelId);

            foreach (ElongHotelTrafficInfoAdapter traffic in traffics)
            {
                HotelTrafficInfoModel temp = new HotelTrafficInfoModel();

                temp.from(traffic);
                temp.id = temp.createPk().ToString();
                //System.Console.WriteLine(string.Format("{0}:{1}:{2}", temp.hotelFk, temp.roomName, temp.area));
                re.rowNum += BaseZdBiz.SaveOrUpdate(temp, "").rowNum;
            }


            return(re);
        }