public ActionResult _UpdateRelationship(FlowRelationship flowRelationship, string id)
 {
     if (CheckFlowRelationship(flowRelationship))
     {
         FlowRelationship upflowRelationship = base.genericMgr.FindById<FlowRelationship>(Convert.ToInt32(id));
         upflowRelationship.ProdLine = flowRelationship.ProdLine;
         upflowRelationship.Flow = flowRelationship.Flow;
         this.genericMgr.Update(upflowRelationship);
         SaveSuccessMessage("修改成功。");
     }
     return PartialView(new GridModel<FlowRelationship>(this.genericMgr.FindAll<FlowRelationship>()));
 }
 private bool CheckFlowRelationship(FlowRelationship flowRelationship)
 {
     bool hasError = false;
     if (string.IsNullOrWhiteSpace(flowRelationship.ProdLine))
     {
         hasError = true;
         SaveErrorMessage("生产线不能为空。");
     }
     if (string.IsNullOrWhiteSpace(flowRelationship.Flow))
     {
         hasError = true;
         SaveErrorMessage("物流路线不能为空。");
     }
     if (this.genericMgr.FindAllWithNativeSql<int>(" select isnull(count(*),0) as counts from CUST_FlowRelationship where ProdLine=? and Flow=? and Id <>? ", new object[] { flowRelationship.ProdLine, flowRelationship.Flow, flowRelationship.Id }, new IType[] { NHibernate.NHibernateUtil.String, NHibernate.NHibernateUtil.String, NHibernate.NHibernateUtil.Int32 })[0] > 0)
     {
         hasError = true;
         SaveErrorMessage("生产线+物流路线已经维护,请确认!");
     }
     return !hasError;
 }
 public ActionResult _InsertRelationship(FlowRelationship flowRelationship)
 {
     if (CheckFlowRelationship(flowRelationship))
     {
         this.genericMgr.Create(flowRelationship);
         SaveSuccessMessage("添加成功。");
     }
     return PartialView(new GridModel<FlowRelationship>(this.genericMgr.FindAll<FlowRelationship>()));
 }