Esempio n. 1
0
        public ActionResult orderSubmit(Order_info order_info)
        {

            try
            {
                EstayMobileService.MobileContractClient _client = new MobileContractClient();
                _client.ClientCredentials.UserName.UserName = help.StringHelper.appSettings("WCFUserName");
                _client.ClientCredentials.UserName.Password = help.StringHelper.appSettings("WCFPassWord");
                object f = _client.confirmOrderStatus(order_info.order_id).ResultCode;
                if (order_info.o_state_id == 1)
                  order_info.room_id = _client.confirmOrderStatus(order_info.order_id).ResultCode == SAS.EstayMobileService.EnumResultCode.Success ? 1 : 0;
                else
                    order_info.room_id = _client.ChangeOrderState(new OrderAndStateChangeParamsDTO() { OrderID = order_info.order_id, NewOrderStateInfoID = order_info.o_state_id }).ResultCode == SAS.EstayMobileService.EnumResultCode.Success ? 1 : 0;

            }
            catch (Exception ex)
            {
                 //ViewBag.sign =
                help.DBhelp.log("确认订单失败"+ex.ToString()); order_info.room_id = 0;
            }
            ViewBag.sign = order_info.room_id;
          
       

           return View("MyOrder", getOrder());
        }
Esempio n. 2
0
        private ActionResult GetData(string hotelId, string startTime, string endTime, string page)
        {
            DateTime tempS, tempE; DateTime.TryParse(startTime, out tempS); DateTime.TryParse(endTime, out tempE); int.TryParse(hotelId, out InthotelId);
            DateTime now = DateTime.Now.AddMonths(-1); DateTime s = string.IsNullOrEmpty(startTime) ? now.AddDays(1 - now.Day).Date : tempS; DateTime e = string.IsNullOrEmpty(endTime) ? now.AddDays(1 - now.Day).AddMonths(1).AddDays(-1).Date : tempE;
            //int.TryParse(hotelId,out InthotelId);int.TryParse();
            List<hotel_info> ListHotelsTemp = new List<hotel_info>();
            object totalPrice, totalGureetePrice, totalOtherPrice, totalPage; int cureentPage; int.TryParse(page, out cureentPage);
            Order_info order = new Order_info() { OrderList = new Order_info().getOrderInfos(new Order_info() { hotel_id = InthotelId, o_check_in_date = s, o_check_out_date = e }, cureentPage, out totalPrice, out totalGureetePrice, out totalOtherPrice, out totalPage, out ListHotelsTemp) };
            ViewBag.allPage = totalPage;
            ViewBag.curentPage = page == null ? "1" : cureentPage.ToString();

            //int t=order.OrderList.Count>0?order.OrderList[0].hotel_id:0;
            ViewBag.curentHotelId = hotelId == null ? order.OrderList.Count > 0 ? order.OrderList[0].hotel_id : 0 : InthotelId;
            ViewBag.totalGureetePrice = totalGureetePrice;
            ViewBag.totalOtherPrice = totalOtherPrice;
            ViewBag.totalPrice = totalPrice;
            ViewBag.startTime = s.ToString("yyyy-MM-dd");
            ViewBag.endTime = e.ToString("yyyy-MM-dd");
            ViewData["hotels"] = ListHotelsTemp;
            return View("MyBill", order);
        }
Esempio n. 3
0
        /// <summary>
        /// 账单查询(out decimal totalPrice,out decimal totalGureetePrice,out totalOtherPrice,out int totalPage)
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public List<Order_info> getOrderInfos(Order_info order, int page, out object totalPrice, out object totalGureetePrice, out object totalOtherPrice, out object totalPage,out List<hotel_info> ListHotels)
        {

            int pageSize = 30, allCount = 0, count = 0;decimal FreePercent=0;
            object ototalPrice=0, ototalGureetePrice=0, ototalOtherPrice=0, ototalPage;
            List<hotel_info> ListHotelsTemp = new List<hotel_info>();
            string sqlGetAllHotel = string.Format("select hotel_id,h_name_cn from {0}  where u_id='{1}'","hotel_info",new HotelInfoHelp().getUId());
            string hho = order.o_check_in_date.ToString();
            string condition = string.Empty;
            List<Order_info> list = new List<Order_info>();
            ////酒店ID
            if (order.hotel_id > 0)
            {
                if (condition == string.Empty)
                    condition = string.Format("hotel_id={0}", order.hotel_id);
                else
                    condition += string.Format("and hotel_id={0}", order.hotel_id);

            }
            //入住日期
            if (order._o_check_in_date != null && order._o_check_in_date.ToString() != "0001/1/1 0:00:00")
            {
                if (condition == string.Empty)
                    condition = string.Format("o_check_in_date>='{0}'", order._o_check_in_date);
                else
                    condition += string.Format(" and o_check_in_date>='{0}'", order._o_check_in_date);
            }
            //离店日期
            if (order._o_check_out_date != null && order._o_check_out_date.ToString() != "0001/1/1 0:00:00")
            {
                if (condition == string.Empty)
                    condition = string.Format("o_check_out_date<='{0}'", order._o_check_out_date);
                else
                    condition += string.Format(" and o_check_out_date<='{0}'", order._o_check_out_date);
            }
            if(string.IsNullOrEmpty(condition))
             condition += string.Format("hotel_id in(select hotel_id from hotel_info where u_id='{0}') and o_state_id=3", new HotelInfoHelp().getUId());
            else
             condition += string.Format("and hotel_id in(select hotel_id from hotel_info where u_id='{0}') and o_state_id=3", new HotelInfoHelp().getUId());
            if (condition != string.Empty)
            {

                string needFild = "o_SerialId,hotel_name,o_user_name,o_user_phone,o_check_in_date,o_check_out_date,o_total_price,room_name,o_title,o_guaranteePrice";
                string sql = page == 0 || page == 1 ? string.Format("select top {0} {2} from order_info where {1} ", pageSize, condition, needFild) : string.Format("select top {0} {3} from order_info where order_id>(select max(order_id) from (select top {1} order_id from order_info where {2} order by hotel_id) as a) and {2} order by order_id", pageSize, pageSize*(page-1), condition, needFild);
                string sqlSum = string.Format("select count(*),sum(o_total_price),sum(o_total_price)*(select sum(value) from temp where uid='{1}'),sum(o_guaranteeprice),(select sum(value) from temp where uid='{1}') from order_info where {0} group by hotel_id", condition, new HotelInfoHelp().getUId());
                using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
                {
                    conn.Open();
                    using (SqlCommand cmdSum = new SqlCommand(sqlSum, conn))
                    {
                        using (SqlDataReader drSum = cmdSum.ExecuteReader())
                        {
                            while (drSum.Read())
                            {
                                allCount = Convert.ToInt32(drSum[0]); ototalPrice = drSum[1]; ototalOtherPrice = drSum[2]; ototalGureetePrice = drSum[3]; FreePercent = Convert.ToDecimal(drSum[4]);
                            }
                        }
                    }

                    using (SqlCommand cmd = new SqlCommand(sql + ";" + sqlGetAllHotel, conn))
                    {
                        using (SqlDataReader dr = cmd.ExecuteReader())
                        {
                            while (dr.Read())
                            {
                                decimal price = Convert.ToDecimal(dr[6]);
                                Order_info o = new Order_info() { o_SerialId = dr[0].ToString(), hotel_name = dr[1].ToString(), o_user_name = dr[2].ToString(), o_user_phone = dr[3].ToString(), o_check_in_date = Convert.ToDateTime(dr[4]), o_check_out_date = Convert.ToDateTime(dr[5]), o_total_price = price, room_name = dr[7].ToString(), _o_title = dr[8].ToString(), otherMoney = price * FreePercent, GetMoney = price - price * FreePercent, o_guaranteePrice=Convert.ToDecimal(dr[9])};
                                list.Add(o);
                            }
                            //读取所有酒店信息
                            dr.NextResult();
                            while (dr.Read())
                            {
                                ListHotelsTemp.Add(new hotel_info() { hotel_id=Convert.ToInt32(dr[0]),h_name_cn=dr[1].ToString()});
                            }
                        }
                    }
                }
            }
           // allCount = 60;
            totalPrice = Convert.ToDecimal(ototalPrice) - Convert.ToDecimal(ototalGureetePrice) + Convert.ToDecimal(ototalGureetePrice); totalGureetePrice = ototalGureetePrice; totalOtherPrice = ototalOtherPrice;
            totalPage = Convert.ToDecimal(allCount) / pageSize > Convert.ToInt32(allCount / pageSize) ? Convert.ToInt32(allCount / pageSize) + 1 : Convert.ToInt32(allCount / pageSize);
            ListHotels = ListHotelsTemp;
            return list;
        }
Esempio n. 4
0
        /// <summary>
        /// 订单查询(out decimal totalPrice,out decimal totalGureetePrice,out totalOtherPrice,out int totalPage)
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        public List<Order_info> getOrderInfos( Order_info order)
        {
            string hho = order.o_check_in_date.ToString();
            string condition=string.Empty;
            ////酒店ID
            //if (order.hotel_id>0)
            //{
            //    if (condition == string.Empty)
            //        condition = string.Format("hotel_id={0}", order.hotel_id);
            //    else
            //        condition += string.Format("and hotel_id={0}", order.hotel_id);

            //}

            //订单编号
            if (!string.IsNullOrEmpty(order.o_SerialId ))
            {
                if(condition==string.Empty)
                condition=string.Format("o_SerialId='{0}'",order.o_SerialId);
                else
                  condition+=string.Format("and o_SerialId='{0}'",order.o_SerialId);

            }
            //入住人姓名
            if (!string.IsNullOrEmpty(order.o_user_name))
            {
                if (condition == string.Empty)
                    condition = string.Format("o_user_name='{0}'", order.o_user_name);
                else
                    condition += string.Format(" and o_user_name='{0}'", order.o_user_name);
            } if (!string.IsNullOrEmpty(order.o_user_phone))
            {
                if (condition == string.Empty)
                    condition = string.Format("o_user_phone='{0}'", order.o_user_phone);
                else
                    condition += string.Format(" and o_user_phone='{0}'", order.o_user_phone);
            }
            //预定开始日期
            if (order.earliestArriveTime != null && order.earliestArriveTime.ToString() != "0001/1/1 0:00:00")
            {
                if (condition == string.Empty)
                    condition = string.Format("o_ctime>='{0}'", order.earliestArriveTime);
                else
                    condition += string.Format(" and o_ctime>='{0}'", order.earliestArriveTime);
            }
            //预定结束日期
            if (order.lastestArriveTime != null && order.lastestArriveTime.ToString() != "0001/1/1 0:00:00")
            {
                if (condition == string.Empty)
                    condition = string.Format("o_ctime<='{0}'", order.lastestArriveTime);
                else
                    condition += string.Format(" and o_ctime<='{0}'", order.lastestArriveTime);
            }
            //入住日期
            if (order._o_check_in_date != null && order._o_check_in_date.ToString() != "0001/1/1 0:00:00")
            {
                if (condition == string.Empty)
                    condition = string.Format("o_check_in_date>='{0}'", order._o_check_in_date);
                else
                    condition += string.Format(" and o_check_in_date>='{0}'", order._o_check_in_date);
            }
            //离店日期
            if (order._o_check_out_date != null && order._o_check_out_date.ToString() != "0001/1/1 0:00:00")
            {
                if (condition == string.Empty)
                    condition = string.Format("o_check_out_date<='{0}'", order._o_check_out_date);
                else
                    condition += string.Format(" and o_check_out_date<='{0}'", order._o_check_out_date);
            }
            List<Order_info> list = new List<Order_info>();
            if (condition != string.Empty)
            {
                string sql = string.Format("select o_SerialId, hotel_name,o_user_name,o_user_phone,o_check_in_date,o_check_out_date,o_total_price ,room_name,(select  o_state_title from  order_state_type_info as s where a.o_state_id=s.o_state_id) from order_info as a where {0} and hotel_id in(select hotel_id from hotel_info where u_id='{1}') ", condition, new HotelInfoHelp().getUId());
                using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
                {
                    conn.Open();
                    SqlCommand cmd = new SqlCommand(sql, conn);
                    SqlDataReader dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        DateTime s,e;
                        DateTime.TryParse(dr[4].ToString(),out s);
                        DateTime.TryParse(dr[5].ToString(),out e);
                        Order_info o = new Order_info() { o_SerialId = dr[0].ToString(), hotel_name = dr[1].ToString(), o_other_guest_info = dr[2].ToString(), o_user_phone = dr[3].ToString(), o_check_in_date = s, o_check_out_date = e, o_total_price = Convert.ToDecimal(dr[6]), room_name=dr[7].ToString(),_o_title=dr[8].ToString() };
                        list.Add(o);
                    }
                }
            }
            return list;
              

        }
Esempio n. 5
0
        public List<Order_info> getOrderInfos(string start,string end, Order_info order)
        {
            int orderState = 0; DateTime s, e; DateTime.TryParse(start, out s); DateTime.TryParse(end, out e);
            List<Order_info> list = new List<Order_info>();
           // int.TryParse(state.ToString(), out orderState);
            try
            {
                using (DBC.HotelDBContent db = new DBC.HotelDBContent())
                {
                    string uId = new HotelInfoHelp().getUId();
                    int[] rf = (from h in db.hotel where h.u_id == uId select h.hotel_id).ToArray();

                    list = (from o in db.orders where rf.Contains(o.hotel_id) && o.o_ctime >= s && o.o_ctime<=e select o).ToList();

                }
                // uId = "test1";

                // var f = from h in db.drrs where rf.Contains(h.hotel_id) select h;

            }
            catch (Exception ex)
            {

                throw ex;
            }
            return list;

        }
Esempio n. 6
0
 //查询新单
 public ActionResult CheckOrder()
 {
     order = new Order_info();
     order.OrderList = order.getOrderInfos(Order_info.orderStatus.confirmed);
     return View("CheckOrderinfo", order);
 }
Esempio n. 7
0
 public Order_info getOrder()
 {
     order = new Order_info();
     order.OrderList = order.getOrderInfos(Order_info.orderStatus.newOrder);
     return order;
 }
Esempio n. 8
0
 private static Order_info QueryOrder(Order_info order_info)
 {
     Order_info order = new Order_info();
     order_info.OrderList = order.getOrderInfos(order_info);
     //if( order.OrderList.Count>0)
     //    return order_info;
     //else
         return order_info;
 }
Esempio n. 9
0
        public ActionResult orderQuerySubmit(Order_info order_info)
        {

            
            ViewBag.sign = order_info.room_id;
            Order_info order = QueryOrder(order_info);


            return View("QueryOrderInfo", order);
        }
Esempio n. 10
0
        public ActionResult Create(Order_info order_info)
        {
            if (ModelState.IsValid)
            {
                db.orders.Add(order_info);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(order_info);
        }
Esempio n. 11
0
 public ActionResult Edit(Order_info order_info)
 {
     if (ModelState.IsValid)
     {
         db.Entry(order_info).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(order_info);
 }