public ActionResult _UpdateFlowCarrier(GridCommand command, TransportFlowCarrier flowCarrier) { var dbFlowCarrier = this.genericMgr.FindById<TransportFlowCarrier>(flowCarrier.Id); dbFlowCarrier.Carrier = flowCarrier.Carrier; dbFlowCarrier.CarrierName = flowCarrier.CarrierName; dbFlowCarrier.TransportMode = flowCarrier.TransportMode; dbFlowCarrier.PriceList = flowCarrier.PriceList; this.genericMgr.Update(dbFlowCarrier); GridModel<TransportFlowCarrier> GridModel = new GridModel<TransportFlowCarrier>(); GridModel.Total = (int)this.genericMgr.FindAll<long>("select count(*) from TransportFlowCarrier tf where tf.Flow=?", dbFlowCarrier.Flow)[0]; var result = this.genericMgr.FindAll<TransportFlowCarrier>("from TransportFlowCarrier tf where tf.Flow=? order by Sequence", dbFlowCarrier.Flow); this.FillCodeDetailDescription<TransportFlowCarrier>(result); GridModel.Data = result; return PartialView(GridModel); }
public ActionResult _InsertFlowCarrier(GridCommand command, TransportFlowCarrier flowCarrier) { var dbFlowCarrier = new TransportFlowCarrier(); var maxSeq = this.genericMgr.FindAll<int>("select Max(tf.Sequence) from TransportFlowCarrier tf where tf.Flow=?", flowCarrier.Flow); if (maxSeq != null && maxSeq.Count > 0) { dbFlowCarrier.Sequence = maxSeq.FirstOrDefault(); } else { dbFlowCarrier.Sequence = 1; } dbFlowCarrier.Carrier = flowCarrier.Carrier; dbFlowCarrier.CarrierName = flowCarrier.CarrierName; dbFlowCarrier.TransportMode = flowCarrier.TransportMode; dbFlowCarrier.PriceList = flowCarrier.PriceList; dbFlowCarrier.Flow = flowCarrier.Flow; this.genericMgr.Create(dbFlowCarrier); GridModel<TransportFlowCarrier> GridModel = new GridModel<TransportFlowCarrier>(); GridModel.Total = (int)this.genericMgr.FindAll<long>("select count(*) from TransportFlowCarrier tf where tf.Flow=?", dbFlowCarrier.Flow)[0]; var result = this.genericMgr.FindAll<TransportFlowCarrier>("from TransportFlowCarrier tf where tf.Flow=? order by Sequence", dbFlowCarrier.Flow); this.FillCodeDetailDescription<TransportFlowCarrier>(result); GridModel.Data = result; return PartialView(GridModel); }