public bool GenResCode(ReservationRoomModel obj, ref string RetMesg) { bool result = false; try { SqlParameter[] para = new SqlParameter[3]; para[0] = new SqlParameter("@Activity", SqlDbType.NVarChar, 50); para[0].Direction = ParameterDirection.Input; para[0].Value = obj.Activity; para[1] = new SqlParameter("@HotelCode", SqlDbType.NVarChar, 200); para[1].Direction = ParameterDirection.Input; para[1].Value = obj.HotelCode; para[2] = new SqlParameter("@ReturnCode", SqlDbType.NVarChar, 100); para[2].Direction = ParameterDirection.Output; para[2].Value = DBNull.Value; helper.ExecuteNonQuery("sp_GenCode", para, CommandType.StoredProcedure); RetMesg = para[2].Value.ToString();; result = true; } catch (Exception ex) { RetMesg = ex.Message; return(result); } return(result); }
public JsonResult ReservationCancel(ReservationRoomModel resroomcancel) { object[] message = new object[2]; int code = -1; string mess = ""; bool result = false; try { if (resroomcancel != null) { if (Session[CConfig.SESSION_USERID] != null && Session[CConfig.SESSION_HOTELCODE].ToString() != null) { //THONG TIN KHACH HANG resroomcancel.ModifyResby = Int32.Parse(Session[CConfig.SESSION_USERID].ToString()); result = db.ReserCancel(resroomcancel, ref code, ref mess); message[0] = mess; message[1] = code; } } } catch (Exception ex) { message[0] = ex.Message; message[1] = -1; } return(Json(new { mess = message }, JsonRequestBehavior.AllowGet)); }
public ActionResult Index() { string rescode = ""; //Lấy list phong TempData["room"] = new SelectList(db1.GetList_Room(1), "Value", "Name"); //Lấy list country TempData["country"] = new SelectList(db1.GetList_Country(1), "Value", "Name", 238); if (true) { try { if (Session[CConfig.SESSION_USERID] != null && Session[CConfig.SESSION_HOTELCODE].ToString() != null) { ReservationRoomModel reservation = new ReservationRoomModel(); reservation.HotelCode = Session[CConfig.SESSION_HOTELCODE].ToString(); reservation.Activity = "RESERVATIONCODE"; if (db.GenResCode(reservation, ref rescode)) { if (rescode.Length < 1) { TempData["ResCode"] = reservation.HotelCode + "000001"; } else { TempData["ResCode"] = rescode; } } else { TempData["ResCode"] = ""; } } TempData.Keep("ResCode"); } catch (Exception ex) { rescode = ex.Message; } } return(View()); }
public JsonResult SearchBooking(ReservationRoomModel mdReservationRoom, int CurrentPage, int NumInPage) { object[] message = new object[1]; UserID = Session[CConfig.SESSION_USERID] == null ? 1 : Convert.ToInt32(Session[CConfig.SESSION_USERID]); HotelCode = Session[CConfig.SESSION_HOTELCODE] == null ? "OzeHotelxxxx" : Session[CConfig.SESSION_HOTELCODE].ToString(); try { if (mdReservationRoom != null) { message[0] = data.getObjectCustomer_Booking(mdReservationRoom, HotelCode, UserID, CurrentPage, NumInPage); } } catch (Exception ex) { CLog.LogError(CBase.GetDeepCaller(), CBase.GetDetailError(ex)); } return(Json(new { mess = message }, JsonRequestBehavior.AllowGet)); }
public JsonResult ReservationEdit(CustomerModel customer, ReservationRoomModel reservation) { object[] message = new object[4]; int code = -1; string mess = ""; DataSet ds = new DataSet(); try { if (customer != null && reservation != null) { if (Session[CConfig.SESSION_USERID] != null && Session[CConfig.SESSION_HOTELCODE].ToString() != null) { //THONG TIN KHACH HANG customer.Activity = "UPDATE"; customer.Modifyby = Int32.Parse(Session[CConfig.SESSION_USERID].ToString()); customer.HotelCode = Session[CConfig.SESSION_HOTELCODE].ToString(); //THONG TIN DAT PHONG reservation.Activity = "UPDATE"; reservation.ModifyResby = Int32.Parse(Session[CConfig.SESSION_USERID].ToString()); reservation.HotelCode = Session[CConfig.SESSION_HOTELCODE].ToString(); reservation.Tax = 10; reservation.Deduction = 2000000; db.InsertReservationRoom(customer, reservation, ref code, ref mess); message[0] = mess; message[1] = code; } } } catch (Exception ex) { message[0] = ex.Message; message[1] = -1; } return(Json(new { mess = message }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// ReserCancel /// </summary> /// <param name="UserID"></param> /// <returns></returns> #region ReserCancel public bool ReserCancel(ReservationRoomModel resroom, ref int RetCode, ref string RetMesg) { bool result = false; try { SqlParameter[] para = new SqlParameter[3]; para[0] = new SqlParameter("@ReserCode", SqlDbType.NVarChar, 20); para[0].Direction = ParameterDirection.Input; para[0].Value = resroom.ReservationCode; //OUTPUT para[1] = new SqlParameter("@RetCode", SqlDbType.Int); para[1].Direction = ParameterDirection.Output; para[1].Value = DBNull.Value; para[2] = new SqlParameter("@RetMesg", SqlDbType.NVarChar, 100); para[2].Direction = ParameterDirection.Output; para[2].Value = DBNull.Value; helper.ExecuteNonQuery("sp_ReservationRoom_Cancel", para, CommandType.StoredProcedure); RetCode = Int32.Parse(para[1].Value.ToString()); RetMesg = para[2].Value.ToString(); result = true; } catch (Exception ex) { RetCode = -1; RetMesg = ex.Message; return(result); } return(result); }
public DataSet InsertReservationRoom(CustomerModel customer, ReservationRoomModel reservation, ref int RetCode, ref string RetMesg) { DataSet ds = new DataSet(); try { SqlParameter[] para = new SqlParameter[41]; //THONG TIN KH para[0] = new SqlParameter("@ActivityC", SqlDbType.NVarChar, 20); para[0].Direction = ParameterDirection.Input; para[0].Value = customer.Activity; para[1] = new SqlParameter("@FullName", SqlDbType.NVarChar, 50); para[1].Direction = ParameterDirection.Input; para[1].Value = customer.FullName; para[2] = new SqlParameter("@Sex", SqlDbType.Int); para[2].Direction = ParameterDirection.Input; para[2].Value = customer.Sex; para[3] = new SqlParameter("@DOB", SqlDbType.NVarChar, 20); para[3].Direction = ParameterDirection.Input; para[3].Value = customer.DOB; para[4] = new SqlParameter("@IdentityNumber", SqlDbType.NVarChar, 20); para[4].Direction = ParameterDirection.Input; para[4].Value = customer.IdentityNumber; para[5] = new SqlParameter("@CitizenshipCode", SqlDbType.Int); para[5].Direction = ParameterDirection.Input; para[5].Value = customer.CitizenshipCode; para[6] = new SqlParameter("@Company", SqlDbType.NVarChar, 150); para[6].Direction = ParameterDirection.Input; para[6].Value = customer.Company; para[7] = new SqlParameter("@Address", SqlDbType.NVarChar, 200); para[7].Direction = ParameterDirection.Input; para[7].Value = customer.Address; para[8] = new SqlParameter("@Email", SqlDbType.NVarChar, 100); para[8].Direction = ParameterDirection.Input; para[8].Value = customer.Email; para[9] = new SqlParameter("@Mobile", SqlDbType.NVarChar, 20); para[9].Direction = ParameterDirection.Input; para[9].Value = customer.Mobile; para[10] = new SqlParameter("@HotelCode", SqlDbType.NVarChar, 50); para[10].Direction = ParameterDirection.Input; para[10].Value = customer.HotelCode; para[11] = new SqlParameter("@RoomID", SqlDbType.Int); para[11].Direction = ParameterDirection.Input; para[11].Value = customer.RoomID; para[12] = new SqlParameter("@GroupID", SqlDbType.Int); para[12].Direction = ParameterDirection.Input; para[12].Value = customer.GroupID; para[13] = new SqlParameter("@GroupJoinID", SqlDbType.Int); para[13].Direction = ParameterDirection.Input; para[13].Value = customer.GroupJoinID; para[14] = new SqlParameter("@Leader", SqlDbType.Int); para[14].Direction = ParameterDirection.Input; para[14].Value = customer.Leader; para[15] = new SqlParameter("@Payer", SqlDbType.Int); para[15].Direction = ParameterDirection.Input; para[15].Value = customer.Payer; para[16] = new SqlParameter("@Createby", SqlDbType.Int); para[16].Direction = ParameterDirection.Input; para[16].Value = customer.Createby; //THONG TIN DAT PHONG para[17] = new SqlParameter("@ActivityR", SqlDbType.NVarChar, 20); para[17].Direction = ParameterDirection.Input; para[17].Value = reservation.Activity; para[18] = new SqlParameter("@ReservationCode", SqlDbType.NVarChar, 50); para[18].Direction = ParameterDirection.Input; para[18].Value = reservation.ReservationCode; para[19] = new SqlParameter("@ReservationType", SqlDbType.Int); para[19].Direction = ParameterDirection.Input; para[19].Value = reservation.ReservationType; para[20] = new SqlParameter("@Payment_Type_ID", SqlDbType.Int); para[20].Direction = ParameterDirection.Input; para[20].Value = reservation.Payment_Type_ID; para[21] = new SqlParameter("@ArrivalDate", SqlDbType.NVarChar, 20); para[21].Direction = ParameterDirection.Input; para[21].Value = reservation.ArrivalDate; para[22] = new SqlParameter("@Leave_Date ", SqlDbType.NVarChar, 20); para[22].Direction = ParameterDirection.Input; para[22].Value = reservation.LeaveDate; para[23] = new SqlParameter("@Number_People", SqlDbType.Int); para[23].Direction = ParameterDirection.Input; para[23].Value = reservation.Adult; para[24] = new SqlParameter("@Number_Children", SqlDbType.Int); para[24].Direction = ParameterDirection.Input; para[24].Value = reservation.Children; para[25] = new SqlParameter("@Holiday", SqlDbType.Int); para[25].Direction = ParameterDirection.Input; para[25].Value = reservation.Holiday; para[26] = new SqlParameter("@KhungGio", SqlDbType.Int); para[26].Direction = ParameterDirection.Input; para[26].Value = reservation.KhungGio; para[27] = new SqlParameter("@Price", SqlDbType.Float); para[27].Direction = ParameterDirection.Input; para[27].Value = reservation.Price; para[28] = new SqlParameter("@Tax", SqlDbType.Float); para[28].Direction = ParameterDirection.Input; para[28].Value = reservation.Tax; para[29] = new SqlParameter("@Deposit", SqlDbType.Float); para[29].Direction = ParameterDirection.Input; para[29].Value = reservation.Deposit; para[30] = new SqlParameter("@Discount", SqlDbType.Float); para[30].Direction = ParameterDirection.Input; para[30].Value = reservation.Discount; para[31] = new SqlParameter("@Deduction", SqlDbType.Float); para[31].Direction = ParameterDirection.Input; para[31].Value = reservation.Deduction; para[32] = new SqlParameter("@Note", SqlDbType.NVarChar, 200); para[32].Direction = ParameterDirection.Input; para[32].Value = reservation.Note; para[33] = new SqlParameter("@Reason", SqlDbType.NVarChar, 200); para[33].Direction = ParameterDirection.Input; para[33].Value = reservation.Reason; para[34] = new SqlParameter("@CreateResBy", SqlDbType.Int); para[34].Direction = ParameterDirection.Input; para[34].Value = reservation.CreateResBy; para[35] = new SqlParameter("@CusID", SqlDbType.Int); para[35].Direction = ParameterDirection.Input; para[35].Value = customer.ID; para[36] = new SqlParameter("@ResID", SqlDbType.Int); para[36].Direction = ParameterDirection.Input; para[36].Value = reservation.ID; para[37] = new SqlParameter("@ModifyBy", SqlDbType.Int); para[37].Direction = ParameterDirection.Input; para[37].Value = customer.Modifyby; para[38] = new SqlParameter("@ModifyResBy", SqlDbType.Int); para[38].Direction = ParameterDirection.Input; para[38].Value = reservation.ModifyResby; //OUTPUT para[39] = new SqlParameter("@RetCode", SqlDbType.Int); para[39].Direction = ParameterDirection.Output; para[39].Value = DBNull.Value; para[40] = new SqlParameter("@RetMesg", SqlDbType.NVarChar, 100); para[40].Direction = ParameterDirection.Output; para[40].Value = DBNull.Value; ds = helper.ExecuteQuery("sp_ReservationRoom_Create", para, CommandType.StoredProcedure); RetCode = Int32.Parse(para[39].Value.ToString()); RetMesg = para[40].Value.ToString(); } catch (Exception ex) { ds = null; RetCode = -1; RetMesg = ex.Message; throw ex; } return(ds); }
public ActionResult CheckIn(ReservationRoomModel reservation) { JsonRs result = new ReservationService().CheckIn(reservation); return(Json(new { result = int.Parse(result.Status), mess = result.Message }, JsonRequestBehavior.AllowGet)); }
public ActionResult DatTruoc(ReservationRoomModel reservation) { JsonRs result = new ReservationService().DatTruoc(reservation); return(Json(new { result = result.Status, mess = result.Message }, JsonRequestBehavior.AllowGet)); }
public JsonResult ReservationSave(CustomerModel customer, ReservationRoomModel reservation) { object[] message = new object[4]; int code = -1; string mess = ""; DataSet ds = new DataSet(); try { if (customer != null && reservation != null) { if (Session[CConfig.SESSION_USERID] != null && Session[CConfig.SESSION_HOTELCODE].ToString() != null) { //THONG TIN KHACH HANG customer.Activity = "INSERT"; customer.Createby = Int32.Parse(Session[CConfig.SESSION_USERID].ToString()); customer.HotelCode = Session[CConfig.SESSION_HOTELCODE].ToString(); //THONG TIN DAT PHONG reservation.Activity = "INSERT"; reservation.CreateResBy = Int32.Parse(Session[CConfig.SESSION_USERID].ToString()); reservation.HotelCode = Session[CConfig.SESSION_HOTELCODE].ToString(); reservation.Tax = 10; reservation.Deduction = 2000000; ds = db.InsertReservationRoom(customer, reservation, ref code, ref mess); message[0] = mess; message[1] = code; if (ds.Tables[0].Rows.Count > 0) { DataTable dt = ds.Tables[0]; //Chuyển data dạng bảng -> object nhận lại ở ajax List <object> resultCus = new List <object>(); List <object> resultRes = new List <object>(); foreach (DataRow rw in dt.AsEnumerable()) { #region Bảng chứ thông tin KH vừa thêm resultCus.Add(new { ID = rw["CusID"].ToString().Trim(), FullName = rw["Name"].ToString().Trim(), Sex = rw["Sex"].ToString().Trim(), //DOB = rw["DOB"].ToString().Trim(), DOB = DateTime.Parse(rw["DOB"].ToString().Trim()).ToString("dd/MM/yyyy"), IdentityNumber = rw["IdentifyNumber"].ToString().Trim(), CitizenshipCode = rw["CitizenshipCode"].ToString().Trim(), Address = rw["Address"].ToString().Trim(), Email = rw["Email"].ToString().Trim(), Mobile = rw["Mobile"].ToString().Trim(), Company = rw["Company"].ToString().Trim(), RoomID = rw["RoomID"].ToString().Trim(), GroupID = rw["Doan_ID"].ToString().Trim(), GroupJoinID = rw["Gop_Doan_ID"].ToString().Trim(), Leader = rw["Leader"].ToString().Trim(), Payer = rw["Payer"].ToString().Trim(), ReserCode = rw["BookingCode"].ToString().Trim() }); #endregion #region Bảng chứ thông tin Đặt phòng vừa thêm resultRes.Add(new { ID = rw["ResID"].ToString().Trim(), CustomerName = rw["Name"].ToString().Trim(), ReservationCode = rw["BookingCode"].ToString().Trim(), ReservationType = rw["Reservation_Type_ID"].ToString().Trim(), Payment_Type_ID = rw["Payment_Type_ID"].ToString().Trim(), //ArrivalDate = rw["Arrive_Date"].ToString().Trim(), //LeaveDate = rw["Leave_Date"].ToString().Trim(), ArrivalDate = DateTime.Parse(rw["Arrive_Date"].ToString().Trim()).ToString("dd/MM/yyyy HH:mm"), LeaveDate = DateTime.Parse(rw["Leave_Date"].ToString().Trim()).ToString("dd/MM/yyyy HH:mm"), Adult = rw["Number_People"].ToString().Trim(), Children = rw["Number_Children"].ToString().Trim(), Holiday = rw["Holiday"].ToString().Trim(), KhungGio = rw["KhungGio"].ToString().Trim(), Price = rw["Price"].ToString().Trim(), Deposit = rw["Deposit"].ToString().Trim(), Discount = rw["Discount"].ToString().Trim(), Note = rw["Note"].ToString().Trim() }); #endregion } message[2] = resultCus; message[3] = resultRes; } } } } catch (Exception ex) { message[0] = ex.Message; message[1] = -1; } return(Json(new { mess = message }, JsonRequestBehavior.AllowGet)); }
public ActionResult DatTruoc(ReservationRoomModel reservation) { // int result = new ReservationService().DatTruoc(reservation); return(Json(new { result = 1, message = "" }, JsonRequestBehavior.AllowGet)); }