public int Commit() { if (_model != null) { try { var objs = from o in _dbContext.ABi_GR where o.GRNumber == _model.GRNumber && o.GRItemNumber == _model.GRItemNumber select o; if (objs == null || objs.Count() == 0) { return -1; } _model.GRIDs = (from o in objs select o.ABi_GR_ID).ToList(); foreach (var obj in objs) { obj.Deleted = true; } var dbTrace = new VPDAL.ABi_Trace() { UserID = _model.UserID, Data = _model.Serialize(), DateCreated = DateTime.Now, DateModified = DateTime.Now, Status = (int)Trace.eTraceStatus.eCommit, TraceType = (int)_model.GetTraceType(), Asset_IDs = Utility.MyUtility.ListToString(_model.GRIDs) }; _dbContext.AddToABi_Trace(dbTrace); _dbContext.SaveChanges(); return dbTrace.ABi_Trace_ID; } catch (Exception ex) { _logger.LogError(String.Format("GRDelete.Commit(Model:{0})", _model.Serialize()), ex); } } return -1; }
public int Commit() { if (_model != null) { try { var objs = from o in _dbContext.ABi_PO where o.PONumber == _model.PONumber && o.POItemNumber == _model.POItemNumber && o.Deletion == false select o; if (objs != null && objs.Count() > 0) { var po = objs.First(); po.Deletion = true; _model.ABi_PO_ID = po.ABi_PO_ID; var dbTrace = new VPDAL.ABi_Trace() { UserID = _model.UserID, Data = _model.Serialize(), DateCreated = DateTime.Now, DateModified = DateTime.Now, Status = (int)Trace.eTraceStatus.eCommit, TraceType = (int)_model.GetTraceType(), Asset_IDs = _model.ABi_PO_ID.ToString() }; _dbContext.AddToABi_Trace(dbTrace); _dbContext.SaveChanges(); return dbTrace.ABi_Trace_ID; } } catch (Exception ex) { _logger.LogError(String.Format("Commit. {0}", _model.Serialize()), ex); } } return -1; }
public int Commit() { if (_model != null) { try { var delObjs = from o in _dbContext.ABi_Invoice where o.ABi_Invoice_ID == _model.InvoiceID select o; //if (delObjs != null && delObjs.Count() > 0) { var delObj = delObjs.First(); delObj.Deleted = true; delObj.DateModified = DateTime.Now; var dbTrace = new VPDAL.ABi_Trace() { UserID = _model.GetUserID(), Data = _model.Serialize(), DateCreated = DateTime.Now, DateModified = DateTime.Now, Status = (int)Trace.eTraceStatus.eCommit, TraceType = (int)_model.GetTraceType(), Asset_IDs = Convert.ToString(_model.InvoiceID) }; _dbContext.AddToABi_Trace(dbTrace); _dbContext.SaveChanges(); return dbTrace.ABi_Trace_ID; } } catch (Exception ex) { _logger.LogError(String.Format("IVDelete.Commit(TraceID:{0})", _model.Serialize()), ex); } } return -1; }
public int Commit() { if (_model != null) { try { var dbTrace = new VPDAL.ABi_Trace() { UserID = _model.GetUserID(), Data = _model.Serialize(), DateCreated = DateTime.Now, DateModified = DateTime.Now, Status = (int)Trace.eTraceStatus.eCommit, TraceType = (int)_model.GetTraceType(), Asset_IDs = Convert.ToString(_model.InvoiceID) }; _dbContext.AddToABi_Trace(dbTrace); _dbContext.SaveChanges(); return dbTrace.ABi_Trace_ID; } catch (Exception ex) { _logger.LogError(String.Format("IVUpdate.Commit(TraceID:{0})", _model.Serialize()), ex); } } return -1; }
public int Commit() { if (_model!=null) { try { int _userId = _model.GetUserID(); var objs = from o in _dbContext.ABi_Invoice join u in _dbContext.ABi_Vendor on o.ABi_Vendor_ID equals u.ABi_Vendor_ID join r in _dbContext.ABi_Admin_Users on u.VendorCode equals r.Username where o.InvoiceNumber == _model.InvoiceNumber && (o.Deleted == null || o.Deleted == false) && r.ABi_Admin_Users_ID == _userId select o; if (objs != null && objs.Count() > 0) { var dbTrace = new VPDAL.ABi_Trace() { UserID = _model.GetUserID(), Data = _model.Serialize(), DateCreated = DateTime.Now, DateModified = DateTime.Now, Status = (int)Trace.eTraceStatus.eCommit, TraceType = (int)_model.GetTraceType(), Asset_IDs = Convert.ToString(objs.First().ABi_Invoice_ID) }; _dbContext.AddToABi_Trace(dbTrace); _dbContext.SaveChanges(); return dbTrace.ABi_Trace_ID; } } catch (Exception ex) { _logger.LogError(String.Format("IVNew.Commit(TraceID:{0})", _model.Serialize()), ex); } } return -1; }