Exemplo n.º 1
0
        //delete casConfirmer
        public void deleteCas(CasConfirmer Cas1)
        {
            string connString;

            connString = ConfigurationManager.ConnectionStrings["Dbcon"].ConnectionString;
            // create Sqlconnection object
            SqlConnection sqlConnection = new SqlConnection(connString);

            try
            {
                sqlConnection.Open();

                SqlCommand cmd = new SqlCommand("Delete CasConfirmer  Where ID=@ID)", sqlConnection);

                cmd.Connection  = sqlConnection;
                cmd.CommandText = "delete from  CasConfirmer where ID='" + Cas1.Id + "' ";
                cmd.ExecuteNonQuery();


                sqlConnection.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Exemplo n.º 2
0
        //add casConfirmer
        public void addcas(CasConfirmer cas1)
        {
            test t1 = new test();

            //true means positive
            if (t1.Result == true)
            {
                SqlCommand cmd = new SqlCommand();
                string     connString;
                connString = ConfigurationManager.ConnectionStrings["Dbcon"].ConnectionString;
                SqlConnection sqlConnection = new SqlConnection(connString);

                try
                {
                    sqlConnection.Open();

                    cmd.Connection  = sqlConnection;
                    cmd.CommandText = "insert into CasConfirmer (ID,NAME,CIN,PhoneNumber,Adresse,Etatsante,NeveauRisqueColor) values('" + cas1.Id + "','" + cas1.Nom + "','" + cas1.CIN1 + "','" + cas1.PhoneNumber1 + "','" + cas1.Adresse + "','" + cas1.Etatsante + "','" + cas1.NeveauRisque1 + "') ";
                    cmd.ExecuteNonQuery();

                    sqlConnection.Close();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }
            }//false means nigative
        }
Exemplo n.º 3
0
        //upadate casConfirmer
        public void updateCas(CasConfirmer Cas1)
        {
            SqlCommand cmd = new SqlCommand();
            string     connString;

            connString = ConfigurationManager.ConnectionStrings["Dbcon"].ConnectionString;
            SqlConnection sqlConnection = new SqlConnection(connString);

            try
            {
                sqlConnection.Open();

                cmd.Connection  = sqlConnection;
                cmd.CommandText = "update CasConfirmer set NAME='" + Cas1.Nom + "',CIN='" + Cas1.CIN1 + "',PhoneNumber='" + Cas1.PhoneNumber1 + "',Adresse='" + Cas1.PhoneNumber1 + "',Etatsante='" + Cas1.Etatsante + "',NeveauRisqueColor='" + Cas1.NeveauRisque1 + "')";
                cmd.ExecuteNonQuery();


                sqlConnection.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }