예제 #1
0
        public DataTable getLocationById(BALLocation obj)
        {
            try
            {
                SqlConnection  cn = new SqlConnection(strCon);
                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = new SqlCommand("[dbo].[sp_cruiseLocations]", cn);
                da.SelectCommand.Parameters.AddWithValue("@action", obj.action);
                da.SelectCommand.Parameters.AddWithValue("@LocationId", obj.LocationId);

                da.SelectCommand.CommandType = CommandType.StoredProcedure;
                cn.Open();
                da.SelectCommand.ExecuteReader();

                cn.Close();
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (dt != null)
                {
                    return(dt);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception)
            {
                return(null);
            }
        }
예제 #2
0
        public int DeleteCountry(BALLocation obj)
        {
            try
            {
                SqlConnection  cn = new SqlConnection(strCon);
                SqlDataAdapter da = new SqlDataAdapter();
                da.DeleteCommand = new SqlCommand("[dbo].[sp_cruiseLocations]", cn);
                da.DeleteCommand.Parameters.AddWithValue("@action", obj.action);

                da.DeleteCommand.Parameters.AddWithValue("@CountryId", obj.countryid);
                da.DeleteCommand.CommandType = CommandType.StoredProcedure;
                cn.Open();
                int Status = da.DeleteCommand.ExecuteNonQuery();
                cn.Close();
                if (Status > 0)
                {
                    return(Status);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }