internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.LabelPriceMarkup)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.LabelPriceMarkup obj = (Indico.DAL.LabelPriceMarkup)eObj; // set the Indico.BusinessObjects.LabelPriceMarkupBO properties this.ID = obj.ID; this.Markup = obj.Markup; this.Label = (obj.LabelReference.EntityKey != null && obj.LabelReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.LabelReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.PriceLevel = (obj.PriceLevelReference.EntityKey != null && obj.PriceLevelReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.PriceLevelReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.DistributorSendMailCount)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.DistributorSendMailCount obj = (Indico.DAL.DistributorSendMailCount)eObj; // set the Indico.BusinessObjects.DistributorSendMailCountBO properties this.ID = obj.ID; this.Count = obj.Count; this.Distributor = (obj.DistributorReference.EntityKey != null && obj.DistributorReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.DistributorReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.WeeklyProductionCapacity = (obj.WeeklyProductionCapacityReference.EntityKey != null && obj.WeeklyProductionCapacityReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.WeeklyProductionCapacityReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.EmbroideryImage)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.EmbroideryImage obj = (Indico.DAL.EmbroideryImage)eObj; // set the Indico.BusinessObjects.EmbroideryImageBO properties this.ID = obj.ID; this.Extension = obj.Extension; this.Filename = obj.Filename; this.IsRequested = obj.IsRequested; this.Size = obj.Size; this.EmbroideryDetails = (obj.EmbroideryDetailsReference.EntityKey != null && obj.EmbroideryDetailsReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.EmbroideryDetailsReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.DefaultValuesPriceList)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.DefaultValuesPriceList obj = (Indico.DAL.DefaultValuesPriceList)eObj; // set the Indico.BusinessObjects.DefaultValuesPriceListBO properties this.ID = obj.ID; this.CreatedDate = obj.CreatedDate; this.CreativeDesign = obj.CreativeDesign; this.ModifiedDate = obj.ModifiedDate; this.Position1 = obj.Position1; this.Position2 = obj.Position2; this.Position3 = obj.Position3; this.StudioDesign = obj.StudioDesign; this.ThirdPartyDesign = obj.ThirdPartyDesign; this.Creator = (obj.CreatorReference.EntityKey != null && obj.CreatorReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.CreatorReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.Modifier = (obj.ModifierReference.EntityKey != null && obj.ModifierReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.ModifierReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.DistributorPriceLevelCostHistory)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.DistributorPriceLevelCostHistory obj = (Indico.DAL.DistributorPriceLevelCostHistory)eObj; // set the Indico.BusinessObjects.DistributorPriceLevelCostHistoryBO properties this.ID = obj.ID; this.Distributor = obj.Distributor; this.IndicoCost = obj.IndicoCost; this.ModifiedDate = obj.ModifiedDate; this.Modifier = obj.Modifier; this.PriceLevelCost = obj.PriceLevelCost; this.PriceTerm = obj.PriceTerm; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.ItemAttribute)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.ItemAttribute obj = (Indico.DAL.ItemAttribute)eObj; // set the Indico.BusinessObjects.ItemAttributeBO properties this.ID = obj.ID; this.Description = obj.Description; this.Name = obj.Name; this.Item = (obj.ItemReference.EntityKey != null && obj.ItemReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.ItemReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.Parent = (obj.ParentReference.EntityKey != null && obj.ParentReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.ParentReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.PriceHistroy)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.PriceHistroy obj = (Indico.DAL.PriceHistroy)eObj; // set the Indico.BusinessObjects.PriceHistroyBO properties this.ID = obj.ID; this.ConvertionFactor = obj.ConvertionFactor; this.CreatedDate = obj.CreatedDate; this.Creator = obj.Creator; this.FabricCode = obj.FabricCode; this.FactoryCost = obj.FactoryCost; this.IndimanCost = obj.IndimanCost; this.Pattern = obj.Pattern; this.PriceLevel = obj.PriceLevel; this.PriceLevelCost = obj.PriceLevelCost; this.Remarks = obj.Remarks; this.Price = (obj.PriceReference.EntityKey != null && obj.PriceReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.PriceReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.PatternSupportFabric)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.PatternSupportFabric obj = (Indico.DAL.PatternSupportFabric)eObj; // set the Indico.BusinessObjects.PatternSupportFabricBO properties this.ID = obj.ID; this.FabConstant = obj.FabConstant; this.CostSheet = (obj.CostSheetReference.EntityKey != null && obj.CostSheetReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.CostSheetReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.Fabric = (obj.FabricReference.EntityKey != null && obj.FabricReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.FabricReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.PatternHistory)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.PatternHistory obj = (Indico.DAL.PatternHistory)eObj; // set the Indico.BusinessObjects.PatternHistoryBO properties this.ID = obj.ID; this.Meassage = obj.Meassage; this.ModifiedDate = obj.ModifiedDate; this.Modifier = (obj.ModifierReference.EntityKey != null && obj.ModifierReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.ModifierReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.Pattern = (obj.PatternReference.EntityKey != null && obj.PatternReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.PatternReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.PackingListCartonItem)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.PackingListCartonItem obj = (Indico.DAL.PackingListCartonItem)eObj; // set the Indico.BusinessObjects.PackingListCartonItemBO properties this.ID = obj.ID; this.Count = obj.Count; this.PackingList = (obj.PackingListReference.EntityKey != null && obj.PackingListReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.PackingListReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.Size = (obj.SizeReference.EntityKey != null && obj.SizeReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.SizeReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.ProductionPlanning)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.ProductionPlanning obj = (Indico.DAL.ProductionPlanning)eObj; // set the Indico.BusinessObjects.ProductionPlanningBO properties this.ID = obj.ID; this.SewingDate = obj.SewingDate; this.OrderDetail = (obj.OrderDetailReference.EntityKey != null && obj.OrderDetailReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.OrderDetailReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.ProductionLine = (obj.ProductionLineReference.EntityKey != null && obj.ProductionLineReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.ProductionLineReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.WeeklyProductionCapacity = (obj.WeeklyProductionCapacityReference.EntityKey != null && obj.WeeklyProductionCapacityReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.WeeklyProductionCapacityReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.WeeklyProductionCapacityDetails)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.WeeklyProductionCapacityDetails obj = (Indico.DAL.WeeklyProductionCapacityDetails)eObj; // set the Indico.BusinessObjects.WeeklyProductionCapacityDetailsBO properties this.ID = obj.ID; this.Efficiency = obj.Efficiency; this.FivePcsCapacity = obj.FivePcsCapacity; this.SampleCapacity = obj.SampleCapacity; this.TotalCapacity = obj.TotalCapacity; this.Workers = obj.Workers; this.ItemType = (obj.ItemTypeReference.EntityKey != null && obj.ItemTypeReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.ItemTypeReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.WeeklyProductionCapacity = (obj.WeeklyProductionCapacityReference.EntityKey != null && obj.WeeklyProductionCapacityReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.WeeklyProductionCapacityReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.VisualLayoutAccessory)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.VisualLayoutAccessory obj = (Indico.DAL.VisualLayoutAccessory)eObj; // set the Indico.BusinessObjects.VisualLayoutAccessoryBO properties this.ID = obj.ID; this.Accessory = (obj.AccessoryReference.EntityKey != null && obj.AccessoryReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.AccessoryReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.AccessoryColor = (obj.AccessoryColorReference.EntityKey != null && obj.AccessoryColorReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.AccessoryColorReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.VisualLayout = (obj.VisualLayoutReference.EntityKey != null && obj.VisualLayoutReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.VisualLayoutReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.InvoiceOrder)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.InvoiceOrder obj = (Indico.DAL.InvoiceOrder)eObj; // set the Indico.BusinessObjects.InvoiceOrderBO properties this.ID = obj.ID; this.FactoryPrice = obj.FactoryPrice; this.IndimanPrice = obj.IndimanPrice; this.Invoice = (obj.InvoiceReference.EntityKey != null && obj.InvoiceReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.InvoiceReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this.OrderDetail = (obj.OrderDetailReference.EntityKey != null && obj.OrderDetailReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.OrderDetailReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
/// <summary> /// 通知MVC缓存更新缓存的实体 /// </summary> /// <param name="entity"></param> /// <param name="action"></param> public void MvcCacheClear(TEntity entity, string action) { string strModelCode = entity.GetType().Name; BLLCommonServices.MVCCacheSV.EntityAction act; switch (action) { case "Add": act = BLLCommonServices.MVCCacheSV.EntityAction.Add; break; case "Modify": act = BLLCommonServices.MVCCacheSV.EntityAction.Modify; break; case "Delete": act = BLLCommonServices.MVCCacheSV.EntityAction.Delete; break; default: act = BLLCommonServices.MVCCacheSV.EntityAction.None; break; } if (entity is System.Data.Objects.DataClasses.EntityObject) { System.Data.Objects.DataClasses.EntityObject ent = entity as System.Data.Objects.DataClasses.EntityObject; string strFormId = entity.GetType().GetProperties().FirstOrDefault().GetValue(entity, null).ToString(); if (strFormId != "" || strFormId != null) { BLLCommonServices.Utility.MvcCacheClearAsync(strModelCode, strFormId, act); } } }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.UserLogin)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.UserLogin obj = (Indico.DAL.UserLogin)eObj; // set the Indico.BusinessObjects.UserLoginBO properties this.ID = obj.ID; this.DateLogin = obj.DateLogin; this.DateLogout = obj.DateLogout; this.IpAddress = obj.IpAddress; this.SessionId = obj.SessionId; this.Success = obj.Success; this.User = (obj.UserReference.EntityKey != null && obj.UserReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.UserReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
public static void RefreshOrder(System.Data.Objects.DataClasses.EntityObject o) { if (o.EntityState == EntityState.Added) { SystemHelper.TMSContext.Detach(o); o = null; } else if (o.EntityState == EntityState.Modified) { SystemHelper.TMSContext.Refresh(System.Data.Objects.RefreshMode.StoreWins, o); } }
private void Button_Click(object sender, RoutedEventArgs e) { //vwBrunvollAuftragsbestand p = (vwBrunvollAuftragsbestand)ProjekteView.CurrentItem; System.Data.Objects.DataClasses.EntityObject p = (System.Data.Objects.DataClasses.EntityObject)ProjekteView.CurrentItem; var x = p.EntityKey.EntityKeyValues[0]; this.Visibility = Visibility.Hidden; var ep = new EditProjekt((int)x.Value); ep.ShowDialog(); this.Visibility = Visibility.Visible; // MainWindow mw = new MainWindow((int)x.Value); //// this.NavigationService.Navigate(mw); }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.EmailLogo)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.EmailLogo obj = (Indico.DAL.EmailLogo)eObj; // set the Indico.BusinessObjects.EmailLogoBO properties this.ID = obj.ID; this.EmailLogoPath = obj.EmailLogoPath; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.AcquiredVisulaLayoutName)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.AcquiredVisulaLayoutName obj = (Indico.DAL.AcquiredVisulaLayoutName)eObj; // set the Indico.BusinessObjects.AcquiredVisulaLayoutNameBO properties this.ID = obj.ID; this.CreatedDate = obj.CreatedDate; this.Name = obj.Name; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.FabricCodeType)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.FabricCodeType obj = (Indico.DAL.FabricCodeType)eObj; // set the Indico.BusinessObjects.FabricCodeTypeBO properties this.ID = obj.ID; this.Description = obj.Description; this.Name = obj.Name; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.QuoteChangeEmailList)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.QuoteChangeEmailList obj = (Indico.DAL.QuoteChangeEmailList)eObj; // set the Indico.BusinessObjects.QuoteChangeEmailListBO properties this.ID = obj.ID; this.IsCC = obj.IsCC; this.User = (obj.UserReference.EntityKey != null && obj.UserReference.EntityKey.EntityKeyValues.Count() > 0) ? (int)((System.Data.EntityKeyMember)obj.UserReference.EntityKey.EntityKeyValues.GetValue(0)).Value : 0; this._doNotUpdateDALObject = false; }
internal void SetBO(System.Data.Objects.DataClasses.EntityObject eObj) { this._doNotUpdateDALObject = true; // Check the received type if (eObj.GetType() != typeof(Indico.DAL.Currency)) { throw new FormatException("Received wrong parameter type..."); } Indico.DAL.Currency obj = (Indico.DAL.Currency)eObj; // set the Indico.BusinessObjects.CurrencyBO properties this.ID = obj.ID; this.Code = obj.Code; this.Country = obj.Country; this.Name = obj.Name; this.Symbol = obj.Symbol; this._doNotUpdateDALObject = false; }
public string GetValueA(System.Data.Objects.DataClasses.EntityObject eob) { return("smt"); }
/// <summary> /// 删除"我的单据" /// </summary> /// <param name="entity">源实体</param> public static void RemoveMyRecord <TEntity>(object entity) { try { //PersonalRecordServiceClient client = new PersonalRecordServiceClient(); string strSystype = string.Empty, strSysName = string.Empty, strModelCode = string.Empty, strFormId = string.Empty, strIsForward = string.Empty; bool isKeyField = false; Type a = entity.GetType(); PropertyInfo[] piSource = a.GetProperties(); var n = from m in piSource where m.Name == "CHECKSTATE" || m.Name == "CHECKSTATES" || m.Name == "AUDITSTATE" select m; if (n == null) { return; } if (n.Count() == 0) { return; } strSysName = GetSysName(a.FullName); strSystype = GetSystypeByName(strSysName); strModelCode = a.Name; strIsForward = "0"; foreach (PropertyInfo prop in piSource) { if (prop.PropertyType.BaseType == typeof(System.Data.Objects.DataClasses.EntityReference) || prop.PropertyType.BaseType == typeof(System.Data.Objects.DataClasses.RelatedEnd) || prop.PropertyType == typeof(System.Data.EntityState) || prop.PropertyType == typeof(System.Data.EntityKey) || prop.PropertyType.BaseType == typeof(System.Data.Objects.DataClasses.EntityObject)) { continue; } if (entity is System.Data.Objects.DataClasses.EntityObject) { System.Data.Objects.DataClasses.EntityObject ent = entity as System.Data.Objects.DataClasses.EntityObject; if (ent != null && ent.EntityKey != null && ent.EntityKey.EntityKeyValues != null && ent.EntityKey.EntityKeyValues.Count() > 0) { foreach (var key in ent.EntityKey.EntityKeyValues) { if (key.Key == prop.Name) { isKeyField = true; object obj = prop.GetValue(entity, null); if (obj != null) { strFormId = obj.ToString(); } break; } } if (isKeyField && !string.IsNullOrEmpty(strFormId)) { break; } } } } if (!isKeyField || string.IsNullOrEmpty(strFormId)) { return; } //T_PF_PERSONALRECORD entSubmit = client.GetPersonalRecordModelByModelID(strSystype, strModelCode, strFormId, strIsForward); //if (entSubmit == null) //{ // return; //} //if (!string.IsNullOrEmpty(entSubmit.PERSONALRECORDID)) //{ // client.DeletePersonalRecord(entSubmit.PERSONALRECORDID); //} } catch (Exception ex) { Tracer.Debug(ex.ToString()); } }
/// <summary> /// 添加我的单据 edit ljx /// </summary> /// <typeparam name="TEntity"></typeparam> /// <param name="entity"></param> /// <param name="strIsForward">传递过来的参数默认为0</param> /// <param name="createuserid">添加人ID,替换属人ID</param> public static void SubmitMyRecord <TEntity>(object entity, string strIsForward, string createuserid) { try { //如果为空 直接退出 if (string.IsNullOrEmpty(createuserid)) { return; } if (string.IsNullOrEmpty(strIsForward)) { strIsForward = "0";//如果为空,默认为0 } //PersonalRecordServiceClient client = new PersonalRecordServiceClient(); string strSystype = string.Empty, strSysName = string.Empty, strFormName = string.Empty, strModelCode = string.Empty, strModelDesp = string.Empty, strFormId = string.Empty, strSubmitXmlObj = string.Empty; Type a = entity.GetType(); PropertyInfo[] piSource = a.GetProperties(); var n = from m in piSource where m.Name == "CHECKSTATE" || m.Name == "CHECKSTATES" || m.Name == "AUDITSTATE" select m; if (n == null) { return; } if (n.Count() == 0) { return; } strSysName = GetSysName(a.FullName); strSystype = GetSystypeByName(strSysName); strModelCode = a.Name; strFormName = GetResourceValue(strModelCode); bool bIsExcludeTable = false; bIsExcludeTable = CheckExcludeTable(strSystype, strModelCode); if (bIsExcludeTable) { return; } T_PF_PERSONALRECORD entSubmit = null; foreach (PropertyInfo prop in piSource) { if (prop.PropertyType.BaseType == typeof(System.Data.Objects.DataClasses.EntityReference) || prop.PropertyType.BaseType == typeof(System.Data.Objects.DataClasses.RelatedEnd) || prop.PropertyType == typeof(System.Data.EntityState) || prop.PropertyType == typeof(System.Data.EntityKey) || prop.PropertyType.BaseType == typeof(System.Data.Objects.DataClasses.EntityObject)) { continue; } if (entity is System.Data.Objects.DataClasses.EntityObject) { System.Data.Objects.DataClasses.EntityObject ent = entity as System.Data.Objects.DataClasses.EntityObject; if (ent != null && ent.EntityKey != null && ent.EntityKey.EntityKeyValues != null && ent.EntityKey.EntityKeyValues.Count() > 0) { bool isKeyField = false; foreach (var key in ent.EntityKey.EntityKeyValues) { if (key.Key == prop.Name) { isKeyField = true; object obj = prop.GetValue(entity, null); if (obj != null) { strFormId = obj.ToString(); } break; } } if (isKeyField) { //if (entSubmit == null && !string.IsNullOrEmpty(strFormId)) //{ // entSubmit = client.GetPersonalRecordModelByModelID(strSystype, strModelCode, strFormId, strIsForward); //} continue; } } if (entSubmit == null) { entSubmit = new T_PF_PERSONALRECORD(); entSubmit.PERSONALRECORDID = System.Guid.NewGuid().ToString(); entSubmit.SYSTYPE = strSystype; entSubmit.MODELCODE = strModelCode; entSubmit.MODELID = strFormId; entSubmit.ISFORWARD = strIsForward; } ; if (entSubmit != null) { Type b = entSubmit.GetType(); PropertyInfo[] piTarget = b.GetProperties(); //prop.Name object valueTemp = prop.GetValue(entity, null); try { string strMemberName = prop.Name; if (strMemberName == "CHECKSTATE" || strMemberName == "CHECKSTATES" || strMemberName == "AUDITSTATE") { strMemberName = "CHECKSTATE"; } var q = from t in piTarget where t.Name == strMemberName select t; if (q.Count() == 0) { continue; } PropertyInfo piTemp = q.FirstOrDefault(); if (valueTemp == null) { if (piTemp.PropertyType.Name == "String") { valueTemp = ""; } else if (piTemp.PropertyType.FullName.Contains("System.DateTime")) { DateTime dtTemp = new DateTime(); valueTemp = dtTemp; } else if (piTemp.PropertyType.FullName.Contains("System.Decimal")) { valueTemp = 0; } } else { if (string.IsNullOrEmpty(valueTemp.ToString())) { if (piTemp.PropertyType.Name == "String") { valueTemp = ""; } else if (piTemp.PropertyType.FullName.Contains("System.DateTime")) { DateTime dtTemp = new DateTime(); valueTemp = dtTemp; } else if (piTemp.PropertyType.FullName.Contains("System.Decimal")) { valueTemp = 0; } } } if (piTemp.CanWrite) { if (piTemp.PropertyType.Name == "String") { piTemp.SetValue(entSubmit, valueTemp.ToString(), null); } else if (piTemp.PropertyType.FullName.Contains("System.Decimal")) { piTemp.SetValue(entity, Convert.ToDecimal(valueTemp), null); } else { piTemp.SetValue(entSubmit, valueTemp, null); } } } catch (Exception ex) { string e = ex.ToString(); Tracer.Debug("我的单据调用发生了错误:" + ex.ToString() + entSubmit.MODELCODE + " " + entSubmit.MODELID); } } } } switch (entSubmit.CHECKSTATE) { case "0": strSubmitXmlObj = SetSubmitXmlObj(strSysName, strFormName, strFormId, "Edit"); strModelDesp = GetModelDescription(entSubmit.CREATEDATE.Value, strModelCode, "您{0}的[{1}]还未提交!"); break; case "1": strSubmitXmlObj = SetSubmitXmlObj(strSysName, strFormName, strFormId, "Audit"); strModelDesp = GetModelDescription(entSubmit.CREATEDATE.Value, strModelCode, "您{0}的[{1}]正在审核中!"); break; case "2": strSubmitXmlObj = SetSubmitXmlObj(strSysName, strFormName, strFormId, "View"); strModelDesp = GetModelDescription(entSubmit.CREATEDATE.Value, strModelCode, "您{0}的[{1}]已经审核通过!"); break; case "3": strSubmitXmlObj = SetSubmitXmlObj(strSysName, strFormName, strFormId, "View"); strModelDesp = GetModelDescription(entSubmit.CREATEDATE.Value, strModelCode, "您{0}的[{1}]已审核未通过!"); break; default: strSubmitXmlObj = SetSubmitXmlObj(strSysName, strFormName, strFormId, "View"); strModelDesp = GetModelDescription(entSubmit.CREATEDATE.Value, strModelCode, "您{0}的[{1}],还未提交!"); break; } entSubmit.MODELDESCRIPTION = strModelDesp; entSubmit.CONFIGINFO = strSubmitXmlObj; if (!string.IsNullOrEmpty(createuserid)) { entSubmit.OWNERID = createuserid; } //if (entSubmit != null) //{ // Tracer.Debug("开始调用我的单据服务:"); // Tracer.Debug("CHECKSTATE:" + entSubmit.CHECKSTATE); // Tracer.Debug("CONFIGINFO:" + entSubmit.CONFIGINFO); // Tracer.Debug("CREATEDATE:" + entSubmit.CREATEDATE.ToString()); // Tracer.Debug("ISFORWARD:" + entSubmit.ISFORWARD); // Tracer.Debug("ISVIEW:" + entSubmit.ISVIEW); // Tracer.Debug("MODELCODE:" + entSubmit.MODELCODE); // Tracer.Debug("MODELDESCRIPTION:" + entSubmit.MODELDESCRIPTION); // Tracer.Debug("MODELID:" + entSubmit.MODELID); // Tracer.Debug("OWNERCOMPANYID:" + entSubmit.OWNERCOMPANYID); // Tracer.Debug("OWNERDEPARTMENTID:" + entSubmit.OWNERDEPARTMENTID); // Tracer.Debug("OWNERID:" + entSubmit.OWNERID); // Tracer.Debug("OWNERPOSTID:" + entSubmit.OWNERPOSTID); // Tracer.Debug("PERSONALRECORDID:" + entSubmit.PERSONALRECORDID); // Tracer.Debug("SYSTYPE:" + entSubmit.SYSTYPE); // //Tracer.Debug("单据ID:"+entSubmit.MODELID + "模块名称:"+entSubmit.CONFIGINFO); //} //if (client.AddPersonalRecord(entSubmit)) //{ // Tracer.Debug("模块" + entSubmit.MODELCODE + "ID:" + entSubmit.MODELID + "调用了我的单据新建服务" + "成功!"); //} //else //{ // Tracer.Debug("模块" + entSubmit.MODELCODE + "ID:" + entSubmit.MODELID + "调用了我的单据新建服务" + "失败!"); //} //if (entSubmit.EntityKey != null) //{ // Tracer.Debug("调用了我的单据更新服务" + System.DateTime.Now.ToString()); // client.UpdatePersonalRecord(entSubmit); //} //else //{ // Tracer.Debug("调用了我的单据新建服务" + System.DateTime.Now.ToString()); // client.AddPersonalRecord(entSubmit); //} } catch (Exception ex) { Tracer.Debug("我的单据出现错误:" + ex.ToString() + System.DateTime.Now.ToString()); } }