Esempio n. 1
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);
        }
Esempio n. 2
0
 public static AdminBiz GetInstant()
 {
     if (Instant == null)
     {
         lock (lockHelper) {
             if (Instant == null)
             {
                 Instant = new AdminBiz();
             }
         }
     }
     return(Instant);
 }
Esempio n. 3
0
        public static AdminBiz GetInstant()
        {
            if (Instant == null)
            {
                lock (lockHelper) {
                    if (Instant == null)
                    {
                        Instant = new AdminBiz();
                    }
                }

            }
            return Instant;
        }