public static int Delete(Doviz p) { 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, "delete from Doviz where ID=@ID", conneciton)) { cmd.Parameters.Add("ID", p.ID, MSqlDbType.Int); rowsAffected = cmd.ExecuteNonQuery(); } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rowsAffected); }
public static int Update(Doviz p) { 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, "Update Doviz SET Cinsi=@Cinsi,Kuru=@Kuru,Tarih=@Tarih where ID=@ID", conneciton)) { cmd.Parameters.Add("Cinsi", p.Cinsi.ToUpper(), MSqlDbType.VarChar); cmd.Parameters.Add("Kuru", p.Kuru, MSqlDbType.Float); cmd.Parameters.Add("Tarih", p.Tarih, MSqlDbType.DateTime); cmd.Parameters.Add("ID", p.ID, MSqlDbType.Int); rowsAffected = cmd.ExecuteNonQuery(); } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rowsAffected); }
public static Doviz GetDoviz(int pID) { Doviz rvDoviz = new Doviz(); 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 Doviz where ID=@ID", conneciton)) { cmd.Parameters.Add("ID", pID, MSqlDbType.Int); using (IDataReader IDR = cmd.ExecuteReader()) { while (IDR.Read()) { rvDoviz = new Doviz(MConvert.NullToInt(IDR["ID"]), MConvert.NullToString(IDR["Cinsi"]), MConvert.NullToFloat(IDR["Kuru"]), MConvert.NullToDateTime(IDR["Tarih"])); } IDR.Close(); } } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rvDoviz); }
private void kaydetButton_Click(object sender, EventArgs e) { try { bool isOkey = false; Doviz kur1 = this.kur1CalcEdit.Tag as Doviz; if ((decimal)kur1.Kuru != this.kur1CalcEdit.Value) { kur1.Kuru = BAYMYO.UI.Converts.NullToFloat(this.kur1CalcEdit.Value); kur1.Tarih = DateTime.Now; if (kur1.ID > 0) { isOkey = DovizMethods.Update(kur1) > 0; } else { isOkey = DovizMethods.Insert(kur1) > 0; } } Doviz kur2 = this.kur2CalcEdit.Tag as Doviz; if ((decimal)kur2.Kuru != this.kur2CalcEdit.Value) { kur2.Kuru = BAYMYO.UI.Converts.NullToFloat(this.kur2CalcEdit.Value); kur2.Tarih = DateTime.Now; if (kur2.ID > 0) { isOkey = DovizMethods.Update(kur2) > 0; } else { isOkey = DovizMethods.Insert(kur2) > 0; } } if (isOkey) { Commons.Status("Doviz kayıt işlemi gerçekleştirildi!"); Commons.CurrentDoviz(); } } catch (Exception ex) { Commons.Status(Commons.GetErrorCode("FDV", 3) + ex.Message); } }
public static Doviz GetDoviz(CommandType cmdType, string sqlQuery, MParameterCollection parameters) { Doviz rvDoviz = new Doviz(); 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(cmdType, sqlQuery, conneciton)) { if (parameters != null) { foreach (MParameter item in parameters) { cmd.Parameters.Add(item); } } using (IDataReader IDR = cmd.ExecuteReader()) { while (IDR.Read()) { rvDoviz = new Doviz(MConvert.NullToInt(IDR["ID"]), MConvert.NullToString(IDR["Cinsi"]), MConvert.NullToFloat(IDR["Kuru"]), MConvert.NullToDateTime(IDR["Tarih"])); } IDR.Close(); } } switch (conneciton.State) { case System.Data.ConnectionState.Open: conneciton.Close(); break; } } return(rvDoviz); }
public void Remove(Doviz obj) { this.List.Remove(obj); }
public int IndexOf(Doviz obj) { return(this.List.IndexOf(obj)); }
public bool Contains(Doviz obj) { return(this.List.Contains(obj)); }
public void Insert(int index, Doviz obj) { this.List.Insert(index, obj); }
public int Add(Doviz obj) { return(this.List.Add(obj)); }