Beispiel #1
0
        public void CommitTest()
        {
            ModelPODelete m = new ModelPODelete()
            {
                UserID = 1513,
                PONumber = "4500211285",
                POItemNumber = "00010"
            };
            PODelete target = new PODelete(m); // TODO: Initialize to an appropriate value
            //int expected = 0; // TODO: Initialize to an appropriate value
            int actual;
            actual = target.Commit();
            Assert.IsTrue(actual > 0);

            VPDAL.ABInvVPEntities dbContext = new VPDAL.ABInvVPEntities();
            var objs = dbContext.ABi_PO.Top("10");

            //Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
Beispiel #2
0
        public int Rollback()
        {
            try
            {
                var objs = from o in _dbContext.ABi_Trace
                           where o.ABi_Trace_ID == _traceInfo.TraceID
                           select o;

                if (objs != null && objs.Count() > 0)
                {
                    var trace = objs.First();
                    _model = new ModelPODelete();
                    if (trace.TraceType == (int)_model.GetTraceType() && trace.Status == (int)Trace.eTraceStatus.eCommit)
                    {
                        _model = (ModelPODelete)_model.Deserialize(trace.Data);
                        var pos = from o in _dbContext.ABi_PO
                                 where o.ABi_PO_ID == _model.ABi_PO_ID
                                 select o;

                        if (pos != null && pos.Count() > 0)
                        {
                            var po = pos.First();
                            po.Deletion = false;

                            trace.Status = (int)VPBLL.Trace.eTraceStatus.eRollback;
                            trace.DateModified = DateTime.Now;
                            return _dbContext.SaveChanges();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(String.Format("GRDelete.Rollback(TraceID:{0})", _traceInfo.TraceID), ex);
            }
            return -1;
        }
Beispiel #3
0
 public PODelete(ModelPODelete m)
 {
     _model = m;
 }