Ejemplo n.º 1
0
        private int DeleteTblPurchaseOrderDetailRequest(TblPurchaseOrderDetailRequest row)
        {
            using (var context = new WorkFlowManagerDBEntities())
            {
                var oldRow = (from e in context.TblPurchaseOrderDetailRequests
                              where e.Iserial == row.Iserial
                              select e).SingleOrDefault();
                if (oldRow != null)
                {
                    context.DeleteObject(oldRow);
                }

                context.SaveChanges();
            }
            return(row.Iserial);
        }
Ejemplo n.º 2
0
        private TblPurchaseOrderDetailRequest UpdateOrInsertTblPurchaseOrderDetailRequest(TblPurchaseOrderDetailRequest newRow, int index, out int outindex)
        {
            outindex = index;
            using (var context = new WorkFlowManagerDBEntities())
            {
                var oldRow = (from e in context.TblPurchaseOrderDetailRequests
                              where e.Iserial == newRow.Iserial
                              select e).SingleOrDefault();
                if (oldRow != null)
                {
                    SharedOperation.GenericUpdate(oldRow, newRow, context);
                }
                else
                {
                    newRow.RemaningQty = newRow.Qty;
                    context.TblPurchaseOrderDetailRequests.AddObject(newRow);
                }
                context.SaveChanges();

                return(newRow);
            }
        }