示例#1
0
        public IlacEntity IDyeGoreIlacGetir(int ilacID)
        {
            cmd = new SqlCommand("Select * From Ilaclar Where IlacID = @IlacID", conn);

            cmd.Parameters.AddWithValue("@IlacID", ilacID);

            IlacEntity currentIlac = null;

            try
            {
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();

                reader.Read();



                currentIlac = new IlacEntity()
                {
                    IlacID  = (int)reader["IlacID"],
                    IlacAdi = reader["IlacAdi"].ToString()
                };
                reader.Close();
                return(currentIlac);
            }
            catch
            {
                return(currentIlac);
            }
            finally
            {
                conn.Close();
            }
        }
示例#2
0
        public int IlacEkle(IlacEntity ilac)
        {
            cmd = new SqlCommand("Insert Into Ilaclar Values(@IlacID,@IlacAdi)", conn);

            AddParametersToCommand(ilac);

            conn.Open();
            int result = cmd.ExecuteNonQuery();

            conn.Close();
            return(result);
        }
示例#3
0
        public int IlacGuncelle(IlacEntity ilac)
        {
            cmd = new SqlCommand("Update Ilaclar Set IlacID=@IlacID, IlacAdi=@IlacAdi", conn);


            AddParametersToCommand(ilac);

            conn.Open();
            int result = cmd.ExecuteNonQuery();

            conn.Close();
            return(result);
        }
示例#4
0
        public IlacEntity ReceteIlaclari(string receteNo)
        {
            IlacEntity receteIlaclari = new IlacEntity();

            cmd = new SqlCommand("Select i.IlacAdi from Ilaclar i Join Receteler re on i.IlacID=re.IlacID Where re.ReceteNo=@receteNo", conn);
            cmd.Parameters.AddWithValue("@receteNo", receteNo);

            conn.Open();
            SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);

            if (reader.Read())
            {
                receteIlaclari.IlacAdi = reader.GetString(0);
            }
            reader.Close();
            return(receteIlaclari);
        }
示例#5
0
        private void button1_Click(object sender, EventArgs e)
        {
            HastaEntity hasta = new HastaEntity();

            hasta            = _hastaDAL.ReceteNoyaHastaGetir(txtReceteNo.Text);
            lblAdSoyad.Text  = hasta.HastaAd + " " + hasta.HastaSoyad;
            lblCinsiyet.Text = hasta.HastaCinsiyet.ToString();
            lblDtarihi.Text  = hasta.HastaDTarihi.ToShortDateString();
            lblMHal.Text     = hasta.MedeniHal.ToString();
            lblTc.Text       = hasta.HastaTC;

            IlacEntity ilac = new IlacEntity();

            ilac = _ilacDAL.ReceteIlaclari(txtReceteNo.Text);
            lstIlac.Items.Clear();
            lstIlac.Items.Add(ilac.IlacAdi);
        }
示例#6
0
 void AddParametersToCommand(IlacEntity ilac)
 {
     cmd.Parameters.AddWithValue("@IlacID", ilac.IlacID);
     cmd.Parameters.AddWithValue("@IlacAdi", ilac.IlacAdi);
 }