//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); } }
private void DeleteDefaultRoute(Item2Route item2Route) { MOFacade moFacade = new MOFacade(this.DataProvider); DefaultItem2Route defroute = (DefaultItem2Route)moFacade.GetDefaultItem2Route(ItemCode); if (defroute != null && defroute.RouteCode == item2Route.RouteCode) { moFacade.DeleteDefaultItem2Route(defroute); } }
protected DataRow GetGridRow(object obj) { MOFacade moFacade = new MOFacade(this.DataProvider); DefaultItem2Route defroute = (DefaultItem2Route)moFacade.GetDefaultItem2Route(ItemCode); bool bIsDefRoute = (defroute != null && defroute.RouteCode == ((Route)obj).RouteCode); DataRow row = this.DtSource.NewRow(); row["RouteCode"] = ((Route)obj).RouteCode.ToString(); row["RouteDescription"] = ((Route)obj).RouteDescription.ToString(); row["DefaultItemRoute"] = bIsDefRoute.ToString().ToLower(); row["EffectiveDate"] = FormatHelper.ToDateString(((Route)obj).EffectiveDate); row["InvalidDate"] = FormatHelper.ToDateString(((Route)obj).InvalidDate); row["MaintainUser"] = ((Route)obj).GetDisplayText("MaintainUser"); row["MaintainDate"] = FormatHelper.ToDateString(((Route)obj).MaintainDate); row["IsReference"] = ""; row["IsOPBOMUsed"] = ((Route)obj).EAttribute1; return row; }