Exemplo n.º 1
0
        public int addTraindetails(TrainBO tbo)
        {
            int retTrainId = 0;

            try
            {
                con = new SqlConnection(constr);
                SqlCommand cmd = new SqlCommand("sp_insertTrainMaster_MadhusudhanB", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@TrainId", tbo.TrainId);
                cmd.Parameters.AddWithValue("@TrainName", tbo.TrainName);
                cmd.Parameters.AddWithValue("@Source", tbo.Source);
                cmd.Parameters.AddWithValue("@Destination", tbo.Destination);
                cmd.Parameters.AddWithValue("@TicketFare", tbo.TicketFare);
                SqlParameter para = new SqlParameter("@TrainIdout", SqlDbType.Int);
                para.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(para);

                con.Open();
                int res = cmd.ExecuteNonQuery();
                if (res > 0)
                {
                    retTrainId = Convert.ToInt32(cmd.Parameters["@TrainIdout"].Value);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }
            return(retTrainId);
        }
Exemplo n.º 2
0
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandArgument != null)
     {
         if (e.CommandName.ToLower() == "cmdedit")
         {
             Response.Redirect("addtraindetails.aspx?id=" + e.CommandArgument);
         }
         else
         {
             TrainBO  tbo  = new TrainBO();
             int      d    = Convert.ToInt32(e.CommandArgument);
             TrainBLL tbll = new TrainBLL();
             tbll.delete(d);
         }
     }
 }
Exemplo n.º 3
0
 public DataSet viewbyid(TrainBO tbo)
 {
     try
     {
         DataSet ds = new DataSet();
         con = new SqlConnection(constr);
         SqlCommand cmd = new SqlCommand("sp_viewTrainMaster_MadhusudhanBbyid", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@TrainId", tbo.TrainId);
         SqlDataAdapter sda = new SqlDataAdapter(cmd);
         sda.Fill(ds);
         return(ds);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 4
0
        //BOOKING
        public int bookticket(TrainBO tbo)
        {
            int retbookId = 0;

            try
            {
                con = new SqlConnection(constr);
                SqlCommand cmd = new SqlCommand("sp_insertTrainBooking_MadhusudhanB", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@BookingId", tbo.BookId);
                cmd.Parameters.AddWithValue("@TrainId", tbo.TrainId);
                cmd.Parameters.AddWithValue("@UserName", tbo.UserName);
                cmd.Parameters.AddWithValue("@Email", tbo.Email);
                cmd.Parameters.AddWithValue("@contactNo", tbo.ContactNo);
                cmd.Parameters.AddWithValue("@NoOfTicket", tbo.NoOftickets);
                cmd.Parameters.AddWithValue("@TicketAmount", tbo.TicketAmount);
                SqlParameter param = new SqlParameter("@BookingIdout", SqlDbType.Int);
                param.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(param);
                con.Open();
                int res = cmd.ExecuteNonQuery();
                if (res > 0)
                {
                    retbookId = Convert.ToInt32(cmd.Parameters["@BookingIdout"].Value);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                con.Close();
            }
            return(retbookId);
        }
Exemplo n.º 5
0
        //book

        public int bookticket(TrainBO tbo)
        {
            return(tdal.bookticket(tbo));
        }
Exemplo n.º 6
0
 public DataSet viewbyid(TrainBO tbo)
 {
     return(tdal.viewbyid(tbo));
 }
Exemplo n.º 7
0
 public int addTraindetails(TrainBO tbo)
 {
     return(tdal.addTraindetails(tbo));
 }