예제 #1
0
        public int SaveDetails()
        {
            SqlConnection con   = new SqlConnection(GetConStr.ConString());
            string        query = "INSERT INTO Customer(customer_id, email, subscription_status, basic, premium) values ('" + customer_id + "','" + email + "','" + subscription_status + "','" + basic + "','" + premium + "')";
            SqlCommand    cmd   = new SqlCommand(query, con);

            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            return(i);
        }
예제 #2
0
        public int RecordChargeStatus(string cs, string customer_id)
        {
            SqlConnection con   = new SqlConnection(GetConStr.ConString());
            string        query = "UPDATE Customer set charge_status = '" + cs + "' WHERE customer_id = '" + customer_id + "'";
            SqlCommand    cmd   = new SqlCommand(query, con);

            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            return(i);
        }
예제 #3
0
        public int PlanRemove(string customer_id)
        {
            SqlConnection con   = new SqlConnection(GetConStr.ConString());
            string        query = "UPDATE Customer set subscription_status = 'inactive' WHERE customer_id = '" + customer_id + "'";
            SqlCommand    cmd   = new SqlCommand(query, con);

            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            return(i);
        }
예제 #4
0
        public string getDetailsWithId(string customer_id)
        {
            SqlConnection con    = new SqlConnection(GetConStr.ConString());
            string        query  = "SELECT * FROM Customer WHERE customer_id = '" + customer_id + "'";
            string        result = "";
            SqlCommand    cmd    = new SqlCommand(query, con);

            con.Open();
            cmd.ExecuteNonQuery();
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                result = dr["basic"].ToString();
            }
            con.Close();
            return(result);
        }
예제 #5
0
        public int PlanChange(string cond, string customer_id)
        {
            SqlConnection con   = new SqlConnection(GetConStr.ConString());
            string        query = "";

            if (cond == "basic")
            {
                query = "UPDATE Customer set subscription_status = 'active', basic = 'True', premium = 'False' WHERE customer_id = '" + customer_id + "'";
            }
            else
            {
                query = "UPDATE Customer set subscription_status = 'active', basic = 'False', premium = 'True' WHERE customer_id = '" + customer_id + "'";
            }

            SqlCommand cmd = new SqlCommand(query, con);

            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            return(i);
        }