Exemple #1
0
        private void btnSatis_Click(object sender, EventArgs e)
        {
            DialogResult cvp = MessageBox.Show("Satış yapılacak. Emin misiniz?", "Satış Onayı", MessageBoxButtons.YesNo);

            try
            {
                if (cvp == DialogResult.Yes)
                {
                    DateTimePicker tarihcikis = new DateTimePicker();
                    string         barkod     = txtbarkod.Text;
                    stokModel      s          = new stokModel {
                        cikistarih = tarihcikis.Value.Date, satisfiyat = int.Parse(txtSatisFiyat.Text), barkod = barkod
                    };

                    if (sb.SatisYap(s))
                    {
                        MessageBox.Show("Satış Yapıldı");
                    }
                }
            }
            catch (Exception ex)
            {
                hata = ex.Message;
                MessageBox.Show(hata);
            }
        }
Exemple #2
0
 public stokModel satisBilgiGetir(string barkod)
 {
     try
     {
         stokModel      sm = null;
         SqlParameter[] p  = { new SqlParameter("@barkod", barkod) };
         SqlDataReader  dr = hlp.ExecuteReader("Select tblStok.ayarID,tblKategori.kategoriAd,tblStok.gram, tblStok.milyem, tblFirma.firmaAd from tblStok inner join  tblKategori on tblKategori.kategoriID=tblStok.kategoriID  inner join tblFirma on tblFirma.firmaID=tblStok.firmaID where tblStok.barkod=@barkod", p);
         if (dr.Read())
         {
             sm = new stokModel {
                 ayarID = Convert.ToInt32(dr[0]), kategoriAd = dr[1].ToString(), gram = dr[2].ToString(), milyem = dr[3].ToString(), firmaAd = dr[4].ToString()
             };
         }
         dr.Close();
         return(sm);
     }
     catch (SqlException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            DialogResult cvp = MessageBox.Show("Ürün Güncellenecek. Emin misiniz?", "Güncelleme Onayı", MessageBoxButtons.YesNo);

            if (cvp == DialogResult.Yes)
            {
                stokModel s = new stokModel {
                    barkod = txtBarkod.Text, ayarID = Convert.ToInt32(cmbAyar.SelectedItem), kategoriID = Convert.ToInt32(cmbKategori.SelectedValue), firmaID = Convert.ToInt32(cmbFirma.SelectedValue), gram = decimal.Parse(txtGram.Text), milyem = decimal.Parse(txtMilyem.Text)
                };

                if (satis.UrunGuncelle(s))
                {
                    MessageBox.Show("Güncelleme Yapıldı");
                }
            }
        }
Exemple #4
0
        public bool SatisYap(stokModel s)
        {
            try
            {
                SqlParameter[] p = { new SqlParameter("@cikistarih", s.cikistarih), new SqlParameter("@satisfiyat", s.satisfiyat), new SqlParameter("@barkod", s.barkod) };

                int sonuc = hlp.ExecuteNonQuery("Update tblStok Set cikistarih=@cikistarih,satisfiyat=@satisfiyat Where barkod=@barkod", p);
                return(sonuc > 0);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #5
0
        public bool UrunGuncelle(stokModel s)
        {
            try
            {
                SqlParameter[] p = { new SqlParameter("@ayar", s.ayarID), new SqlParameter("@kategori", s.kategoriID), new SqlParameter("@firma", s.firmaID), new SqlParameter("@gram", s.gram), new SqlParameter("@milyem", s.milyem), new SqlParameter("@barkod", s.barkod) };

                int sonuc = hlp.ExecuteNonQuery("Update tblStok Set ayarID=@ayar,kategoriID=@kategori, firmaID=@firma,gram=@gram,milyem=@milyem Where barkod=@barkod", p);
                return(sonuc > 0);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #6
0
        public bool BarkodEkle(stokModel s)
        {
            try
            {
                SqlParameter[] p = { new SqlParameter("@barkod", s.barkod), new SqlParameter("@urunID", s.urunID) };

                int sonuc = hlp.ExecuteNonQuery("Update tblStok Set barkod=@barkod Where urunID=@urunID", p);
                return(sonuc > 0);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string    barkod = txtbarkod.Text;
                stokModel sm     = sb.satisBilgiGetir(barkod);
                lblAyar.Text     = sm.ayarID.ToString();
                lblKategori.Text = sm.kategoriAd;
                lblFirma.Text    = sm.firmaAd;
                lblMilyem.Text   = sm.milyem.ToString();
                lblGram.Text     = sm.gram.ToString();



                double a = Convert.ToDouble(sm.milyem);
                double b = 0.912;
                double c = double.Parse(label11.Text, System.Globalization.CultureInfo.InvariantCulture);
                double d = Convert.ToDouble(sm.gram);
                txtTutar.Text = ((a / b) * c * d).ToString("#");

                lblAyar.Visible       = true;
                lblAyar2.Visible      = true;
                lblGram.Visible       = true;
                lblGram2.Visible      = true;
                lblFirma.Visible      = true;
                lblFirma2.Visible     = true;
                lblKategori.Visible   = true;
                lblKategori2.Visible  = true;
                lblMilyem.Visible     = true;
                lblMilyem2.Visible    = true;
                label1.Visible        = true;
                btnSatis.Visible      = true;
                txtSatisFiyat.Visible = true;
            }
            catch (Exception)
            {
                MessageBox.Show("Hata! Barkod veritabanında bulunamadı!");
            }
        }
Exemple #8
0
        public bool urunEkle(stokModel s)
        {
            try
            {
                SqlParameter[] p = { new SqlParameter("@ayar",       s.ayarID),
                                     new SqlParameter("@kategori",   s.kategoriID),
                                     new SqlParameter("@gram",       s.gram),
                                     new SqlParameter("@milyem",     s.milyem),
                                     new SqlParameter("@giristarih", s.giristarih),
                                     new SqlParameter("@firma",      s.firmaID), };
                return(hlp.ExecuteNonQuery("Insert into tblStok(ayarID,kategoriID,gram,milyem,giristarih,firmaID)values(@ayar,@kategori,@gram,@milyem,@giristarih,@firma);", p) > 0);
            }
            catch (SqlException)
            {
#if DEBUG
                throw;
#endif
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                sm = satis.satisBilgiGetir(txtBarkod.Text);

                cmbAyar.SelectedItem = sm.ayarID.ToString();


                cmbKategori.DataSource    = hlp.GetDataTable("select kategoriID,kategoriAd from tblKategori", null);
                cmbKategori.DisplayMember = "kategoriAd";
                cmbKategori.ValueMember   = "kategoriID";
                cmbKategori.SelectedValue = sm.kategoriID;



                cmbFirma.DataSource    = hlp.GetDataTable("select firmaID, firmaAd from tblFirma", null);
                cmbFirma.DisplayMember = "firmaAd";
                cmbFirma.ValueMember   = "firmaID";
                cmbFirma.SelectedValue = sm.firmaID;

                string gram   = sm.gram.ToString();
                string milyem = sm.milyem.ToString();


                gram           = gram.Replace(',', '.');
                milyem         = milyem.Replace(',', '.');
                txtGram.Text   = gram;
                txtMilyem.Text = milyem;
                //cmbKategori.SelectedValue = sm.kategoriID;
            }
            catch (Exception)
            {
                MessageBox.Show("Hata");
            }
        }
Exemple #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult cvp = MessageBox.Show("Ürün Eklenecek. Emin misiniz?", "Ürün Ekleme", MessageBoxButtons.YesNo);
                if (cvp == DialogResult.Yes)
                {
                    DateTimePicker datetimepicker1 = new DateTimePicker();
                    stokModel      stok            = new stokModel {
                        ayarID = Convert.ToInt32(cmbAyar.Text), kategoriID = Convert.ToInt32(cmbKategori.SelectedValue), gram = decimal.Parse(textBox1.Text, CultureInfo.InvariantCulture), milyem = decimal.Parse(textBox2.Text, CultureInfo.InvariantCulture), giristarih = datetimepicker1.Value.Date, firmaID = Convert.ToInt32(cmbFirma.SelectedValue)
                    };
                    stokBL stk = new stokBL();
                    if (stk.urunEkle(stok))
                    {
                        int       urunid   = stk.IDno(null);
                        string    barkodno = String.Format("{0:D6}", urunid);
                        stokModel s        = new stokModel {
                            barkod = barkodno, urunID = urunid
                        };
                        satis.BarkodEkle(s);
                        label7.Text  = barkodno;
                        barkodyazisi = string.Concat(urunid, cmbKategori.Text);
                        Zen.Barcode.Code128BarcodeDraw barcode = Zen.Barcode.BarcodeDrawFactory.Code128WithChecksum;
                        pictureBox1.Image = barcode.Draw(label7.Text, 30);
                        pictureBox1.Size  = pictureBox1.Image.Size;
                        #region digerbarkod
                        //Guid.NewGuid7
                        //ZXing.BarcodeWriter barcode2 = new ZXing.BarcodeWriter();
                        //barcode2.Format = ZXing.BarcodeFormat.CODE_128;
                        //pictureBox1.Image = barcode2.Write(label7.Text);

                        //pictureBox1.Image = Resize_Picture(pictureBox1.Image, (int)(pictureBox1.Image.Width * 0.7f), 0);

                        //var setting = new Spire.Barcode.BarcodeSettings();
                        //setting.Type = Spire.Barcode.BarCodeType.Code128;
                        //setting.Data = label7.Text;
                        //setting.AutoResize = false;
                        ////setting.ImageHeight = 8;
                        //setting.ShowTopText = false;
                        //setting.Unit = GraphicsUnit.Millimeter;
                        //setting.X = 15;
                        //Spire.Barcode.BarCodeGenerator barcode3 = new Spire.Barcode.BarCodeGenerator(setting);
                        //pictureBox1.Image = barcode3.GenerateImage();
                        #endregion
                        PrintDocument print     = new PrintDocument();
                        var           paperSize = new PaperSize("USER", 80, 20);
                        paperSize.RawKind = (int)PaperKind.Custom;
                        //print.PrinterSettings.DefaultPageSettings.PaperSize = paperSize;
                        //print.PrinterSettings.DefaultPageSettings.Margins = new Margins(7, 0, 0, 0);
                        print.PrintPage += Print_PrintPage;
                        print.Print();
                        MessageBox.Show("Ekleme İşlemi Başarılı");
                    }
                    else
                    {
                        MessageBox.Show("Hata");
                    }
                }

                #region EskiKod
                string yazi = cmbKategori.Text;
                yazi = yazi.ToLower();
                yazi = yazi.Replace('ö', 'o');
                yazi = yazi.Replace('ç', 'c');
                yazi = yazi.Replace('ü', 'u');
                yazi = yazi.Replace('ğ', 'g');
                yazi = yazi.Replace('ş', 's');
                yazi = yazi.Replace('ı', 'i');
                yazi = yazi.Replace(' ', '_');
                #endregion
            }
            catch (Exception)
            {
                MessageBox.Show("Hatalı Giriş Yaptınız!");
            }
        }