Exemplo n.º 1
0
        public static List <EntitySatis> SatisListesi()
        {
            List <EntitySatis> degerler = new List <EntitySatis>();
            SqlCommand         komut    = new SqlCommand("SATISLAR", Baglanti.bgl);

            komut.CommandType = CommandType.StoredProcedure;
            if (komut.Connection.State != ConnectionState.Open)
            {
                komut.Connection.Open();
            }
            SqlDataReader dr = komut.ExecuteReader();

            while (dr.Read())
            {
                EntitySatis ent = new EntitySatis();
                ent.Satisid    = int.Parse(dr["SATISID"].ToString());
                ent.Urunad     = dr["URUNAD"].ToString();
                ent.Personelad = dr["PERSONEL"].ToString();
                ent.Musteriad  = dr["MUSTERI"].ToString();
                ent.Fiyat      = decimal.Parse(dr["TUTAR"].ToString());
                degerler.Add(ent);
            }
            dr.Close();
            return(degerler);
        }
Exemplo n.º 2
0
        public static EntitySatis SatisGetirById(int?id)
        {
            EntitySatis entitySatis = new EntitySatis();
            SqlCommand  command     = MyExtensions.CreateCommandAndOpenConnection(ResourceSatis.spSatislarById, Baglanti.connection);

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@p1", id);

            SqlDataReader dr = command.ExecuteReader();

            while (dr.Read())
            {
                entitySatis.SatisId    = Convert.ToInt32(dr[ResourceSatis.SATISID]);
                entitySatis.Urun       = dr[ResourceSatis.URUNAD].ToString();
                entitySatis.Personel   = dr[ResourceSatis.PERSONEL].ToString();
                entitySatis.Musteri    = dr[ResourceSatis.MUSTERI].ToString();
                entitySatis.Tutar      = Convert.ToDecimal(dr[ResourceSatis.TUTAR]);
                entitySatis.MusteriId  = Convert.ToInt32(dr[ResourceSatis.MUSTERIID]);
                entitySatis.UrunId     = Convert.ToInt32(dr[ResourceSatis.URUNID]);
                entitySatis.PersonelId = Convert.ToInt32(dr[ResourceSatis.PERID]);
            }

            dr.Close();
            return(entitySatis);
        }
Exemplo n.º 3
0
        public static List <EntitySatis> SatisListesi()
        {
            List <EntitySatis> degerler = new List <EntitySatis>();
            SqlCommand         komut    = new SqlCommand("SATISLAR", Baglanti.baglanti);

            komut.CommandType = CommandType.StoredProcedure;

            if (komut.Connection.State != ConnectionState.Open)
            {
                komut.Connection.Open();
            }

            SqlDataReader dr = komut.ExecuteReader();

            while (dr.Read())
            {
                EntitySatis ent = new EntitySatis();
                ent.SatisId    = int.Parse(dr["SATISID"].ToString());
                ent.UrunAd     = dr["URUNAD"].ToString();
                ent.PersonelAd = dr["PERSONEL"].ToString();    //PROSEDÜRÜ YAZARKEN PERSONEL OLARAK ETİKETLEDİK. O YÜZDEN BURADA TEK TEK AT SOYAD YAZMAK YERİNE O TAGİ YAZARSAN İKİSİNİ DE YAZDIRIR
                //  ent.PersonelSoyad = dr["PERSONELSOYAD"].ToString();
                ent.MusteriAd = dr["MUSTERIM"].ToString();
                //    ent.MusteriSoyad = dr["MUSTERISOYAD"].ToString();
                //        ent.Fiyat = decimal.Parse(dr["TUTAR"].ToString());
                degerler.Add(ent);
            }
            dr.Close();
            return(degerler);
        }
Exemplo n.º 4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            EntitySatis ent = new EntitySatis();

            ent.Fiyat    = decimal.Parse(TextBox3.Text);
            ent.Urun     = byte.Parse(DropDownUrun.SelectedValue);
            ent.Personel = byte.Parse(DropDownPersonel.SelectedValue);
            ent.Musteri  = byte.Parse(DropDownMusteri.SelectedValue);
            BLLSatis.BLLSatisEkle(ent);
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            EntitySatis entitySatis = BLLSatis.SatisGetirById(Convert.ToByte(Request.QueryString["id"]));

            txtSatisId.Text    = entitySatis.SatisId.ToString();
            txtSatisTutar.Text = entitySatis.Tutar.ToString();
            SetUrunlerToDropdown(entitySatis);
            SetPersonellerToDropdown(entitySatis);
            SetMusterilerToDropdown(entitySatis);
        }
Exemplo n.º 6
0
 public static int BLLSatisEkle(EntitySatis m)
 {
     if (m.Personel != 0 & m.Urun != 0 & m.Musteri != 0)
     {
         return(DALSatis.SatisEkle(m));
     }
     else
     {
         return(-1);
     }
 }
Exemplo n.º 7
0
        public static int SatisEkle(EntitySatis satisDeger)
        {
            SqlCommand command = MyExtensions.CreateCommandAndOpenConnection(ResourceSatis.InsertSatisSorgu, Baglanti.connection);

            command.Parameters.AddWithValue(ResourceSatis.Parameter1, satisDeger.UrunId);
            command.Parameters.AddWithValue(ResourceSatis.Parameter2, satisDeger.PersonelId);
            command.Parameters.AddWithValue(ResourceSatis.Parameter3, satisDeger.MusteriId);
            command.Parameters.AddWithValue(ResourceSatis.Parameter4, satisDeger.Tutar);

            return(command.ExecuteNonQuery());
        }
Exemplo n.º 8
0
 public static int SatisGuncelle(EntitySatis entitySatis)
 {
     if (entitySatis.UrunId > 0 &&
         entitySatis.PersonelId > 0 &&
         entitySatis.MusteriId > 0 &&
         entitySatis.Tutar > 0)
     {
         return(DALSatis.SatisGuncelle(entitySatis));
     }
     return(-1);
 }
Exemplo n.º 9
0
        public static int SatisGuncelle(EntitySatis satisDeger)
        {
            SqlCommand command = MyExtensions.CreateCommandAndOpenConnection(ResourceSatis.UpdateSatisSorgu, Baglanti.connection);

            command.Parameters.AddWithValue(ResourceSatis.IdParameter, satisDeger.SatisId);
            command.Parameters.AddWithValue(ResourceSatis.PersonelParam, satisDeger.PersonelId);
            command.Parameters.AddWithValue(ResourceSatis.MusteriParam, satisDeger.MusteriId);
            command.Parameters.AddWithValue(ResourceSatis.UrunParam, satisDeger.UrunId);
            command.Parameters.AddWithValue(ResourceSatis.TutarParam, satisDeger.Tutar);

            return(command.ExecuteNonQuery());
        }
Exemplo n.º 10
0
        protected void btnKaydet_Click(object sender, EventArgs e)
        {
            EntitySatis entitySatis = new EntitySatis();

            entitySatis.UrunId     = Convert.ToByte(cmbUrun.SelectedValue);
            entitySatis.PersonelId = Convert.ToByte(cmbPersonel.SelectedValue);
            entitySatis.MusteriId  = Convert.ToByte(cmbMusteri.SelectedValue);
            entitySatis.Tutar      = Convert.ToDecimal(txtSatisTutar.Text);

            int sonuc = BLLSatis.SatisEkle(entitySatis);

            MyPresentationExtensions.ShowErrorMessageOrRedirect(sonuc, ResourceSatis.SatislarSayfasi, ResourceSatis.SatisEkleError);
        }
Exemplo n.º 11
0
        private void SetMusterilerToDropdown(EntitySatis entitySatis)
        {
            if (cmbMusteri.Items.Count == 0)
            {
                List <EntityMusteri> musteriList = BLLMusteri.BLLMusteriListele();

                foreach (var item in musteriList)
                {
                    cmbMusteri.Items.Add(new ListItem(item.MusteriAd + ' ' + item.MusteriSoyad, item.MusteriId.ToString()));
                }
                cmbMusteri.SelectedValue = entitySatis.MusteriId.ToString();
            }
        }
Exemplo n.º 12
0
        private void SetPersonellerToDropdown(EntitySatis entitySatis)
        {
            if (cmbPersonel.Items.Count == 0)
            {
                List <EntityPersonel> personelList = BLLPersonel.PersonelListele();

                foreach (var item in personelList)
                {
                    cmbPersonel.Items.Add(new ListItem(item.PersonelAd + ' ' + item.PersonelSoyad, item.PersonelId.ToString()));
                }
                cmbPersonel.SelectedValue = entitySatis.PersonelId.ToString();
            }
        }
Exemplo n.º 13
0
        private void SetUrunlerToDropdown(EntitySatis entitySatis)
        {
            if (cmbUrun.Items.Count == 0)
            {
                List <EntityUrun> urunList = BLLUrun.UrunListele();

                foreach (var item in urunList)
                {
                    cmbUrun.Items.Add(new ListItem(item.UrunAd, item.UrunId.ToString()));
                }
                cmbUrun.SelectedValue = entitySatis.UrunId.ToString();
            }
        }
Exemplo n.º 14
0
        public static int SatisEkle(EntitySatis u)
        {
            SqlCommand komut1 = new SqlCommand("insert into TBLSATIS (URUN,PERSONEL,TUTAR,MUSTERI) values (@U1,@U2,@U3,@U4)", Baglanti.bgl);

            if (komut1.Connection.State != ConnectionState.Open)
            {
                komut1.Connection.Open();
            }
            komut1.Parameters.AddWithValue("@U1", u.Urun);
            komut1.Parameters.AddWithValue("@U2", u.Personel);
            komut1.Parameters.AddWithValue("@U3", u.Fiyat);
            komut1.Parameters.AddWithValue("@U4", u.Musteri);
            return(komut1.ExecuteNonQuery());
        }