예제 #1
0
 public void GetFirmalar()
 {
     try
     {
         this.firmaBindingSource.DataSource = FirmaMethods.GetSelect();
     }
     catch (Exception ex)
     {
         Commons.Status(Commons.GetErrorCode("FST", 2) + ex.Message);
     }
 }
예제 #2
0
 public void GetData()
 {
     try
     {
         this.firmaBindingSource.DataSource = FirmaMethods.GetSelect();
         isRecord = false;
     }
     catch (Exception ex)
     {
         Commons.Status(Commons.GetErrorCode("FFR", 2) + ex.Message);
     }
 }
예제 #3
0
        public static List <Stok> GetSelect()
        {
            List <Stok> rvStok = new List <Stok>();

            using (MConnection conneciton = new MConnection(MClientProvider.OleDb, Commons.ConnectionStringName))
            {
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Closed:
                    conneciton.Open();
                    break;
                }
                using (MCommand cmd = new MCommand(CommandType.Text, "select * from Stok", conneciton))
                {
                    using (IDataReader IDR = cmd.ExecuteReader())
                    {
                        List <Firma> pFirmalar = FirmaMethods.GetSelect();
                        Firma        f         = null;
                        while (IDR.Read())
                        {
                            f = pFirmalar.Find(x => x.ID.Equals(MConvert.NullToInt(IDR["FirmaID"])));
                            if (f == null)
                            {
                                f     = new Firma();
                                f.Adi = L.Bilinmeyen;
                            }
                            rvStok.Add(new Stok(
                                           MConvert.NullToInt(IDR["ID"]),
                                           MConvert.NullToInt(IDR["KategoriID"]),
                                           MConvert.NullToInt(IDR["UrunID"]),
                                           MConvert.NullToInt(IDR["FirmaID"]),
                                           MConvert.NullToFloat(IDR["Fiyat"]),
                                           MConvert.NullToFloat(IDR["KarOran"]),
                                           MConvert.NullToDateTime(IDR["EklenmeTarihi"]),
                                           MConvert.NullToDateTime(IDR["GuncellemeTarihi"]),
                                           f));
                        }
                        IDR.Close();
                    }
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rvStok);
        }
예제 #4
0
 public void GetFirmalar()
 {
     try
     {
         List <Firma> f = FirmaMethods.GetSelect();
         f.Add(new Firma {
             ID = 0, Adi = L.YeniTedarikciFirma
         });
         this.firmaBindingSource.DataSource = f;
     }
     catch (Exception ex)
     {
         Commons.Status(Commons.GetErrorCode("FST", 18) + ex.Message);
     }
 }
예제 #5
0
 public void GetFirmalar()
 {
     try
     {
         List <Firma> f = FirmaMethods.GetSelect();
         f.Add(new Firma {
             ID = 0, Kod = "...", Adi = L.TumFirmalaraUygula
         });
         this.firmaBindingSource.DataSource = f;
     }
     catch (Exception ex)
     {
         Commons.Status(Commons.GetErrorCode("FKS", 2) + ex.Message);
     }
 }
예제 #6
0
        public static Stok GetStok(Stok p)
        {
            Stok rvStok = new Stok();

            using (MConnection conneciton = new MConnection(MClientProvider.OleDb, Commons.ConnectionStringName))
            {
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Closed:
                    conneciton.Open();
                    break;
                }
                using (MCommand cmd = new MCommand(CommandType.Text, "select top 1  * from Stok where KategoriID=@KategoriID and UrunID=@UrunID and FirmaID=@FirmaID", conneciton))
                {
                    cmd.Parameters.Add("KategoriID", p.KategoriID, MSqlDbType.Int);
                    cmd.Parameters.Add("UrunID", p.UrunID, MSqlDbType.Int);
                    cmd.Parameters.Add("FirmaID", p.FirmaID, MSqlDbType.Int);
                    using (IDataReader IDR = cmd.ExecuteReader())
                    {
                        List <Firma> pFirmalar = FirmaMethods.GetSelect();
                        while (IDR.Read())
                        {
                            rvStok = new Stok(MConvert.NullToInt(IDR["ID"]), MConvert.NullToInt(IDR["KategoriID"]), MConvert.NullToInt(IDR["UrunID"]), MConvert.NullToInt(IDR["FirmaID"]), MConvert.NullToFloat(IDR["Fiyat"]), MConvert.NullToFloat(IDR["KarOran"]), MConvert.NullToDateTime(IDR["EklenmeTarihi"]), MConvert.NullToDateTime(IDR["GuncellemeTarihi"]),
                                              pFirmalar.Find(x => x.ID.Equals(MConvert.NullToInt(IDR["FirmaID"]))));
                        }
                        IDR.Close();
                    }
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rvStok);
        }