Example #1
0
        public List <NailService> GetAvailableServices()
        {
            string query    = "select * from Services where isObsolete = 'False' order by pos";
            var    services = new List <NailService>();

            using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["dbConnectionSctring"].ConnectionString))
                using (SqlCommand cmd = new SqlCommand(query, cn))
                {
                    cn.Open();
                    SqlDataReader dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        services.Add(NailService.Parse(dr));
                    }
                    cn.Close();
                }
            return(services);
        }
Example #2
0
        public List <NailService> GetSelectedServicesForDate(int nailDateID)
        {
            string query    = "select id,name,price,duration,abbreviation,isObsolete from Services,(SELECT serviceId FROM dbo.NailDateService where nailDateId = @ID) as t where t.serviceId = id";
            var    services = new List <NailService>();

            using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["dbConnectionSctring"].ConnectionString))
                using (SqlCommand cmd = new SqlCommand(query, cn))
                {
                    cmd.Parameters.Add("@ID", SqlDbType.Int).Value = nailDateID;
                    cn.Open();
                    SqlDataReader dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        services.Add(NailService.Parse(dr));
                    }
                    cn.Close();
                }
            return(services);
        }