Beispiel #1
0
        public LocationImageClass ShowLocation(string locationId)
        {
            LocationImageClass locobj = new LocationImageClass();

            con = new SqlConnection(cs);
            cmd = new SqlCommand("Select LocationName,Location_Address,LocationImage from tblLocation where Location_Id=@locationId", con);
            try
            {
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("locationId", locationId);
                con.Open();
                SqlDataReader sdr = cmd.ExecuteReader();
                if (sdr.HasRows)
                {
                    while (sdr.Read())
                    {
                        locobj.LocationName    = sdr["LocationName"].ToString();
                        locobj.LocationAddress = sdr["Location_Address"].ToString();
                        locobj.LocationImage   = sdr["LocationImage"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
            finally
            {
                con.Close();
            }
            return(locobj);
        }
Beispiel #2
0
        public void UpdateLocation(LocationImageClass locobj)
        {
            SqlConnection con = new SqlConnection(cs);
            SqlCommand    cmd = new SqlCommand("usp_UpdateLocation", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@locationId", locobj.LocationId);
            cmd.Parameters.AddWithValue("@locationName", locobj.LocationName);
            cmd.Parameters.AddWithValue("@locationAddress", locobj.LocationAddress);
            cmd.Parameters.AddWithValue("@limage", locobj.LocationImage);
            cmd.Parameters.AddWithValue("@update_by", locobj.UpdatedBy);
            //cmd.Parameters.AddWithValue("@date", locobj.Date);
            //cmd.Parameters.AddWithValue("@time", locobj.Time);
            con.Open();
            cmd.ExecuteNonQuery();
        }