Example #1
0
        public static int Insert(Firma p)
        {
            using (Firma temp = FirmaMethods.GetFirma(p))
            {
                if (temp != null & temp.ID > 0)
                {
                    return(temp.ID);
                }
            }
            int rowsAffected = 0;

            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, "insert into Firma (Kod,Adi,Yetkili,Telefon,Mail,Adres,Period) values(@Kod,@Adi,@Yetkili,@Telefon,@Mail,@Adres,@Period)", conneciton))
                {
                    cmd.Parameters.Add("Kod", p.Kod, MSqlDbType.VarChar);
                    cmd.Parameters.Add("Adi", p.Adi, MSqlDbType.NVarChar);
                    cmd.Parameters.Add("Yetkili", p.Yetkili, MSqlDbType.NVarChar);
                    cmd.Parameters.Add("Telefon", p.Telefon, MSqlDbType.VarChar);
                    cmd.Parameters.Add("Mail", p.Mail, MSqlDbType.VarChar);
                    cmd.Parameters.Add("Adres", p.Adres, MSqlDbType.NVarChar);
                    cmd.Parameters.Add("Period", p.Period, MSqlDbType.TinyInt);
                    if (cmd.ExecuteNonQuery() > 0)
                    {
                        cmd.Parameters.Clear();
                        cmd.CommandText = "SELECT @@IDENTITY";
                        rowsAffected    = MConvert.NullToInt(cmd.ExecuteScalar());
                    }
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rowsAffected);
        }
Example #2
0
 public TeklifDetay(int pSiraNo, Int64 pID, Int64 pTeklifID, int pStokID, int pKategoriID, int pFirmaID, string pFirmaAdi, string pUrunAdi, float pBirimFiyati, float pKarOrani, float pMiktar, string pBirim, float pAdet, float pKdv, float pKur1, float pKur2)
 {
     this.m_SiraNo      = pSiraNo;
     this.m_ID          = pID;
     this.m_TeklifID    = pTeklifID;
     this.m_StokID      = pStokID;
     this.m_KategoriID  = pKategoriID;
     this.m_FirmaID     = pFirmaID;
     this.m_FirmaAdi    = pFirmaAdi;
     this.m_UrunAdi     = pUrunAdi;
     this.m_BirimFiyati = pBirimFiyati;
     this.m_KarOrani    = pKarOrani;
     this.m_Miktar      = pMiktar;
     this.m_Birim       = pBirim;
     this.m_Adet        = pAdet;
     this.m_Kdv         = pKdv;
     this.m_Kur1        = pKur1;
     this.m_Kur2        = pKur2;
     if (this.m_StokID > 0)
     {
         this.m_StokObject = StokMethods.GetStok(this.m_StokID);
     }
     else
     {
         this.m_StokObject = new Stok();
     }
     if (this.m_FirmaID > 0)
     {
         this.m_FirmaObject = FirmaMethods.GetFirma(this.m_FirmaID);
         this.m_FirmaAdi    = this.m_FirmaObject.Adi;
     }
     else
     {
         this.m_FirmaObject         = new Firma();
         this.m_FirmaObject.Adi     = this.FirmaAdi;
         this.m_FirmaObject.Telefon = " --- ";
         this.m_FirmaObject.Adres   = " --- ";
     }
 }
Example #3
0
        public static Stok GetStok(int pID)
        {
            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 ID=@ID", conneciton))
                {
                    cmd.Parameters.Add("ID", pID, MSqlDbType.Int);
                    using (IDataReader IDR = cmd.ExecuteReader())
                    {
                        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"]), FirmaMethods.GetFirma(MConvert.NullToInt(IDR["FirmaID"])));
                        }
                        IDR.Close();
                    }
                }
                switch (conneciton.State)
                {
                case System.Data.ConnectionState.Open:
                    conneciton.Close();
                    break;
                }
            }
            return(rvStok);
        }