public ActionResult _InsertFlowRoute(GridCommand command, TransportFlowRoute flowRoute)
        {
            var dbFlowRoute = new TransportFlowRoute();
            var maxSeq = this.genericMgr.FindAll<object>("select Max(tf.Sequence) from TransportFlowRoute tf where tf.Flow=?", flowRoute.Flow);
            if (maxSeq != null && maxSeq.Count > 0 && maxSeq.FirstOrDefault() != null)
            {
                dbFlowRoute.Sequence = ((int)maxSeq.FirstOrDefault())+1;
            }
            else
            {
                dbFlowRoute.Sequence = 1;
            }

            dbFlowRoute.ShipAddress = flowRoute.ShipAddress;
            dbFlowRoute.ShipAddressDescription = flowRoute.ShipAddressDescription;
            dbFlowRoute.Flow = flowRoute.Flow;
            this.genericMgr.Create(dbFlowRoute);
            GridModel<TransportFlowRoute> GridModel = new GridModel<TransportFlowRoute>();
            GridModel.Total = (int)this.genericMgr.FindAll<long>("select count(*) from TransportFlowRoute tf where tf.Flow=?", dbFlowRoute.Flow)[0];
            var result = this.genericMgr.FindAll<TransportFlowRoute>("from TransportFlowRoute tf where tf.Flow=? order by Sequence", dbFlowRoute.Flow);
            this.FillCodeDetailDescription<TransportFlowRoute>(result);
            GridModel.Data = result;
            return PartialView(GridModel);
        }
 public ActionResult _UpdateFlowRoute(GridCommand command, TransportFlowRoute flowRoute)
 {
     var dbFlowRoute = this.genericMgr.FindById<TransportFlowRoute>(flowRoute.Id);
     dbFlowRoute.Sequence = flowRoute.Sequence;
     dbFlowRoute.ShipAddress = flowRoute.ShipAddress;
     dbFlowRoute.ShipAddressDescription = flowRoute.ShipAddressDescription;
     dbFlowRoute.Flow = flowRoute.Flow;
     this.genericMgr.Update(dbFlowRoute);
     GridModel<TransportFlowRoute> GridModel = new GridModel<TransportFlowRoute>();
     GridModel.Total = (int)this.genericMgr.FindAll<long>("select count(*) from TransportFlowRoute tf where tf.Flow=?", dbFlowRoute.Flow)[0];
     var result = this.genericMgr.FindAll<TransportFlowRoute>("from TransportFlowRoute tf where tf.Flow=? order by Sequence", dbFlowRoute.Flow);
     this.FillCodeDetailDescription<TransportFlowRoute>(result);
     GridModel.Data = result;
     return PartialView(GridModel);
 }