コード例 #1
0
 public IEnumerable <login> lsLogin(string sUserName, string sPassword)
 {
     try
     {
         using (HBDataModel hbd = new HBDataModel())
         {
             List <login> ls_login =
                 hbd.Database.SqlQuery <login>
                     ("EXEC [dbo].[sp_login]  {0}, {1}", sUserName, sPassword).ToList();
             return(ls_login);
         }
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
コード例 #2
0
        public IEnumerable <Admin_View_booking> bookings(DateTime?dtStart, DateTime?dtEnd)
        {
            try
            {
                using (HBDataModel hbd = new HBDataModel())
                {
                    List <Admin_View_booking> bookings_ls = hbd.Database.SqlQuery <Admin_View_booking>
                                                                ("EXEC [dbo].[sp_booking_list]  {0}, {1}", dtStart, dtEnd).ToList();

                    return(bookings_ls);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #3
0
        public IEnumerable <reservationInfo> ls_Reservation_Info(int iReservationId)
        {
            try
            {
                //using (SqlConnection con = new SqlConnection(sConn))
                //{
                //    SqlCommand cmd = new SqlCommand("sp_view_reservation_info", con);
                //    cmd.CommandType = CommandType.StoredProcedure;


                //    SqlParameter paramReservationId = new SqlParameter();
                //    paramReservationId.ParameterName = "@reservationId";
                //    paramReservationId.Value = iReservationId;
                //    cmd.Parameters.Add(paramReservationId);

                //    con.Open();
                //    SqlDataAdapter da = new SqlDataAdapter(cmd);

                //    DataTable dtRes_info = new DataTable();
                //    da.Fill(dtRes_info);
                //    da.Dispose();
                //    return dtRes_info;

                //}

                using (HBDataModel hbd = new HBDataModel())
                {
                    List <reservationInfo> res_info_ls = hbd.Database.SqlQuery <reservationInfo>
                                                             ("EXEC [dbo].[sp_view_reservation_info]  {0}", iReservationId).ToList();

                    return(res_info_ls);
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }