//add by roger.xue private void AddDefaultRoute(GridRecord row) { MOFacade moFacade = new MOFacade(this.DataProvider); DefaultItem2Route defroute = (DefaultItem2Route)moFacade.GetDefaultItem2Route(ItemCode); // 如果有选择默认途程 if (row.Items.FindItemByKey("DefaultItemRoute").Value.ToString().ToLower() == "true") { if (defroute == null || defroute.RouteCode != row.Items.FindItemByKey("RouteCode").Value.ToString()) { bool bIsNew = false; if (defroute == null) { defroute = new DefaultItem2Route(); bIsNew = true; } defroute.ItemCode = ItemCode; defroute.RouteCode = row.Items.FindItemByKey("RouteCode").Value.ToString(); defroute.MDate = FormatHelper.TODateInt(DateTime.Now); defroute.MTime = FormatHelper.TOTimeInt(DateTime.Now); if (bIsNew == true) moFacade.AddDefaultItem2Route(defroute); else moFacade.UpdateDefaultItem2Route(defroute); } } else if (row.Items.FindItemByKey("DefaultItemRoute").Value.ToString().ToLower() == "false" && defroute != null && defroute.RouteCode == row.Items.FindItemByKey("RouteCode").Value.ToString()) { moFacade.DeleteDefaultItem2Route(defroute); } }