public ActionResult Save(PriceInfos priceinfo) { if (priceinfo.ID > 0)//编辑 { return(Json(SaveEdit(priceinfo).toJson())); } else//新增 { return(Json(SaveCreate(priceinfo).toJson())); } }
public ActionResult Edit(int Id) { ViewBag.CurrencyList = GetCurrencySelectList(); ViewBag.CryptoList = GetCryptoSelectList(); PriceInfos priceinfo = new PriceInfos(); if (Id > 0) { priceinfo = FoundationDB.PriceInfoDb.GetById(Id); priceinfo.Markup = priceinfo.Markup * 100; } return(PartialView(priceinfo)); }
public SaveResult Create(PriceInfos model, int userId, string userName) { model.LastUpdateDate = DateTime.UtcNow; // Create ActionLog ActionLog actionLog = new ActionLog(); actionLog.IPAddress = GetClientIPAddress(); actionLog.AccountId = userId; actionLog.CreateTime = DateTime.UtcNow; actionLog.ModuleCode = typeof(AccountBLL).FullName + ".Create"; actionLog.Username = userName; actionLog.LogContent = "Create PriceInfos " + model.ID; ActionLogBLL ab = new ActionLogBLL(); ab.Create(actionLog); return(new SaveResult(FoundationDB.PriceInfoDb.Insert(model))); }
private SaveResult <int> SaveCreate(Currency cur) { List <PriceInfos> list = new List <PriceInfos>(); if (cur.IsFixedPrice) { foreach (Currency item in FoundationDB.CurrencyDb.GetList()) { PriceInfos pi = new PriceInfos(); pi.CryptoID = cur.ID; pi.CurrencyID = item.ID; pi.LastUpdateDate = DateTime.Now; pi.Price = Convert.ToDecimal(Request.Form[item.Code]); list.Add(pi); } } CurrencyBLL cb = new CurrencyBLL(); return(cb.Create(cur, list, UserId, UserName)); }
private SaveResult <int> SaveCreate(Cryptocurrencies cur) { List <PriceInfos> list = new List <PriceInfos>(); CryptocurrenciesBLL ab = new CryptocurrenciesBLL(); PriceInfoAgent pia = new PriceInfoAgent(); var result = ab.Create(cur, UserId, UserName); if (cur.IsFixedPrice) { foreach (Currency item in FoundationDB.CurrencyDb.GetList()) { PriceInfos pi = new PriceInfos(); pi.CryptoID = result.Data; pi.CurrencyID = item.ID; pi.LastUpdateDate = DateTime.Now; pi.Price = Convert.ToDecimal(Request.Form[item.Code]); list.Add(pi); } pia.Insert(list); } return(result); }
public SaveResult Update(PriceInfos model, int userId, string userName) { var oldPrice = FoundationDB.PriceInfoDb.GetById(model.ID); oldPrice.Markup = model.Markup; oldPrice.Price = model.Price; oldPrice.LastUpdateDate = DateTime.UtcNow; // Create ActionLog ActionLog actionLog = new ActionLog(); actionLog.IPAddress = GetClientIPAddress(); actionLog.AccountId = userId; actionLog.CreateTime = DateTime.UtcNow; actionLog.ModuleCode = typeof(AccountBLL).FullName + ".Update"; actionLog.Username = userName; actionLog.LogContent = "Update PriceInfos " + model.ID; ActionLogBLL ab = new ActionLogBLL(); ab.Create(actionLog); return(new SaveResult(FoundationDB.PriceInfoDb.Update(oldPrice))); }
private SaveResult SaveEdit(PriceInfos priceinfo) { PriceInfoAgent ab = new PriceInfoAgent(); return(ab.Update(priceinfo, UserId, UserName)); }