Exemple #1
0
 //Search Method
 public void Search_Data()
 {
     GetDBConnection.Open();
     using (var cmd = new SqlCommand())
     {
         dt.Clear();
         cmd.CommandText = "Select * from Member where Member_name ='" + search_text + "'";
         SqlDataAdapter sda = new SqlDataAdapter(cmd);
         cmd.CommandType = CommandType.Text;
         cmd.Connection  = GetDBConnection;
         sda.Fill(dt);
         GetDBConnection.Close();
     }
 }
Exemple #2
0
 //Read Method
 public void Read_Data()
 {
     GetDBConnection.Open();
     using (var cmd = new SqlCommand())
     {
         dt.Clear();
         cmd.CommandText = "Select * from Member";
         SqlDataAdapter sda = new SqlDataAdapter(cmd);
         cmd.CommandType = CommandType.Text;
         cmd.Connection  = GetDBConnection;
         sda.Fill(dt);
         GetDBConnection.Close();
     }
 }
Exemple #3
0
        //Delete Method
        public void Delete_Data()
        {
            GetDBConnection.Open();
            using (var cmd = new SqlCommand())
            {
                dt.Clear();
                cmd.CommandText = "Delete from Member where Member_id = @id";
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                cmd.CommandType = CommandType.Text;

                //PARAMETERS @name
                cmd.Parameters.Add("@id", SqlDbType.Int).Value = id;

                cmd.Connection = GetDBConnection;
                sda.Fill(dt);
                GetDBConnection.Close();
            }
        }
Exemple #4
0
 public void show_name()
 {
     GetDBConnection.Open();
     using (var cmd = new SqlCommand())
     {
         datafill.Clear();
         SqlDataReader rd;
         cmd.CommandText = "Select * from member";
         cmd.CommandType = CommandType.Text;
         cmd.Connection  = GetDBConnection;
         rd = cmd.ExecuteReader();
         while (rd.Read())
         {
             datafill.Add(rd[1].ToString());
         }
         GetDBConnection.Close();
     }
 }
Exemple #5
0
        public bool Validation()
        {
            GetDBConnection.Open();
            bool check = false;

            using (var cmd = new SqlCommand())
            {
                cmd.CommandText = "Select * from Admin_Login username=@user AND pass=@pass";
                cmd.CommandType = CommandType.Text;
                cmd.Connection  = GetDBConnection;

                //PARAMETERS
                cmd.Parameters.Add("@user", SqlDbType.NVarChar).Value = username;
                cmd.Parameters.Add("@pass", SqlDbType.NVarChar).Value = password;

                check = true;
                GetDBConnection.Close();
                return(check);
            }
        }
Exemple #6
0
        //Insert method
        public void insert()
        {
            GetDBConnection.Open();
            using (var cmd = new SqlCommand())
            {
                cmd.CommandText = "insert into Trainer (Trainer_name,Trainer_gender,Trainer_dob,Trainer_mobile,Trainer_Email,Trainer_address) values(@name,@gender,@dob,@mobile,@email,@address)";
                cmd.CommandType = CommandType.Text;
                cmd.Connection  = GetDBConnection;

                //PARAMETERS @name,@cnic,@gender,@dob,@mobile,@email,@joindate,@gymtime,@address,@membershiptype
                cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value    = name;
                cmd.Parameters.Add("@gender", SqlDbType.NVarChar).Value  = gender;
                cmd.Parameters.Add("@dob", SqlDbType.NVarChar).Value     = dob;
                cmd.Parameters.Add("@mobile", SqlDbType.NVarChar).Value  = mobile;
                cmd.Parameters.Add("@email", SqlDbType.NVarChar).Value   = email;
                cmd.Parameters.Add("@address", SqlDbType.NVarChar).Value = address;
                cmd.ExecuteNonQuery();
                GetDBConnection.Close();
            }
        }
Exemple #7
0
        public void insert()
        {
            GetDBConnection.Open();
            using (var cmd = new SqlCommand())
            {
                cmd.CommandText = "insert into Payment (Payment_Customer_name,Payment_amount,Payment_description,Payment_date,Package_name,Package_type) values(@name,@amount,@desc,@paid_date,@pkg_name,@pkg_type)";
                cmd.CommandType = CommandType.Text;
                cmd.Connection  = GetDBConnection;

                //PARAMETERS @name,@cnic,@gender,@dob,@mobile,@email,@joindate,@gymtime,@address,@membershiptype
                cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value      = name;
                cmd.Parameters.Add("@amount", SqlDbType.NVarChar).Value    = amount;
                cmd.Parameters.Add("@desc", SqlDbType.NVarChar).Value      = desc;
                cmd.Parameters.Add("@paid_date", SqlDbType.NVarChar).Value = paid_date;
                cmd.Parameters.Add("@pkg_name", SqlDbType.NVarChar).Value  = pkg_name;
                cmd.Parameters.Add("@pkg_type", SqlDbType.NVarChar).Value  = pkg_type;
                cmd.ExecuteNonQuery();
                GetDBConnection.Close();
            }
        }
Exemple #8
0
        //Update Method
        public void Update_Data()
        {
            GetDBConnection.Open();
            using (var cmd = new SqlCommand())
            {
                dt.Clear();
                cmd.CommandText = "Update Member SET Member_mobile=@mobile, Member_Email=@email, Gym_time=@gymtime, Member_address=@address, Membership_type=@membershiptype where Member_id = @id";
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                cmd.CommandType = CommandType.Text;

                //PARAMETERS
                cmd.Parameters.Add("@id", SqlDbType.Int).Value                  = id;
                cmd.Parameters.Add("@mobile", SqlDbType.NVarChar).Value         = mobile;
                cmd.Parameters.Add("@email", SqlDbType.NVarChar).Value          = email;
                cmd.Parameters.Add("@gymtime", SqlDbType.NVarChar).Value        = gymtime;
                cmd.Parameters.Add("@address", SqlDbType.NVarChar).Value        = address;
                cmd.Parameters.Add("@membershiptype", SqlDbType.NVarChar).Value = membershiptype;

                cmd.Connection = GetDBConnection;
                sda.Fill(dt);
                GetDBConnection.Close();
            }
        }