Exemplo n.º 1
0
 public bool updateTreatment(TreatmentDTO t)
 {
     try
     {
         string query = "update Treatment set cost=" + t.Cost + " where name='" + t.Name + "'";
         c.sqlComm = new SqlCommand(query, c.sqlConn);
         c.sqlConn.Open();
         c.sqlComm.ExecuteNonQuery();
         c.sqlConn.Close();
         return(true);
     }
     catch (Exception e)
     {
         c.sqlConn.Close();
         return(false);
     }
 }
Exemplo n.º 2
0
        public bool addTreatment(TreatmentDTO t)
        {
            try
            {
                string query = "insert into Treatment (Name, Cost) values ('" + t.Name + "'," + t.Cost + ")";

                c.sqlComm = new SqlCommand(query, c.sqlConn);
                c.sqlConn.Open();
                c.sqlComm.ExecuteNonQuery();
                c.sqlConn.Close();

                query     = "CREATE TABLE " + t.Name + " (tID int primary key identity, pID int, dID int, tooth varchar(50), quantity int, cost int, paid int, date varchar(50));";
                c.sqlComm = new SqlCommand(query, c.sqlConn);
                c.sqlConn.Open();
                c.sqlComm.ExecuteNonQuery();
                c.sqlConn.Close();
                return(true);
            }
            catch (Exception e)
            {
                c.sqlConn.Close();
                return(false);
            }
        }