private void PurchaseCash() { try { frmLogin.Log.Info(string.Format("A Cash purchase has been made:{0}{1}{2}", Environment.NewLine, AllRawValues, SellTotalCurrent)); CultureInfo tr = new CultureInfo("tr-TR"); Currenty dailySell = currentyBindingSource.Current as Currenty; if (dailySell != null) { dailySell.bakiye += Convert.ToDecimal(SellTotalCurrent); Current_Details dailySellDetail = new Current_Details() { current_id = dailySell.id, text = string.Format("{0}{1}Veresiye", AllRawValues, Environment.NewLine), price = Convert.ToDecimal(SellTotalCurrent), reg_date = DateTime.Now.ToString("dd MMMM yyyy dddd hh:mm", tr) }; PurchaseToDB(dailySellDetail); } Feature dailyFeature = (db.Features.Where(a => a.id == 1)).SingleOrDefault(); Currenty dailySellDate = db.Currenties.Where(u => u.auth_name == dailyFeature.name).SingleOrDefault(); dailySellDate.bakiye += Convert.ToDecimal(SellTotalCurrent); Current_Details dailySellDetailt = new Current_Details() { current_id = dailySellDate.id, text = string.Format("{0}{1}Veresiye", AllRawValues, Environment.NewLine), price = Convert.ToDecimal(SellTotalCurrent), reg_date = DateTime.Now.ToString("dd MMMM yyyy dddd hh:mm", tr) }; PurchaseToDB(dailySellDetailt); } catch (Exception ex) { frmLogin.Log.Error("Somethink went wrong", ex); } }
public frmEditCariDetail(Current_Details obj) { InitializeComponent(); db = new CloudEntities(); if (obj == null) { currentDetailsBindingSource.DataSource = new Current_Details(); Current_Details newDetail = currentDetailsBindingSource.Current as Current_Details; newDetail.current_id = BarcoS.Classes.Views.MainForms.frmCariDetail.cariIDGlobal; db.Current_Details.Add(newDetail); } else { currentDetailsBindingSource.DataSource = obj; db.Current_Details.Attach(currentDetailsBindingSource.Current as Current_Details); } }
private void PurchaseToDB(Current_Details dailySellDetail) { db.Current_Details.Add(dailySellDetail); db.SaveChanges(); ListCurrenties(); }