public static void Insert(SecurityCheckHistory history) { var db = DataBaseHelper.Open(); history.Id = LastIdSvc.GetNextTableId("SecurityCheckHistories"); db.SecurityCheckHistories.Insert(history); }
public ActionResult Create(SecurityCheckerEditModel model) { Company company = CompanySvc.LoadById(model.CompanyId); switch (model.SecurityLevel) { case 0: this.StopByAgriculturalProductId(model.ProductId, model.ProductType); break; case 1: break; case 2: this.StopProduct(model.ProductId, model.ProductType); break; case 3: break; default: break; } IIdentity id = HttpContext.User.Identity; var user = UserSvc.LoadByUserName(id.Name); SecurityCheckHistory history = new SecurityCheckHistory { InsertBy = user, InsertDate= DateTime.Now, InsertReason = model.InsertReason, ProductName = model.ProductName, ProductType = model.ProductType, ProductOwer = company, ProductId = model.ProductId, ProductTypeName = model.ProductTypeName, SecurityLevel = model.SecurityLevel }; SecurityCheckSvc.Insert(history); return RedirectToAction("Index"); }