protected virtual void AddBusinessObjects(BaseBusinessObject o) { if (BusinessObjects.Count == 0) { BusinessObjects.Add(PrimaryBusinessObject); } BusinessObjects.Add(o); }
public bool CheckSaveBaseDataEnable(OPEntityCmdSaveCheck cmd) { BaseBusinessObject _BaseBusinessObject = new BaseBusinessObject(); #region 动态实体解析 Type type = ObjectHelper.GetSingleObjectTypeByName(cmd.Namespace, cmd.EntityTypeName); Type listType = ObjectHelper.GetListObjectTypeByName(cmd.Namespace, cmd.EntityTypeName); var itemList = typeof(JsonUtil).GetMethod("fromJson").MakeGenericMethod(listType)?.Invoke(null, new object[] { cmd.EntityJson }); #endregion object result = typeof(BaseBusinessObject).GetMethod("CheckSaveBaseDataEnable").MakeGenericMethod(type)?.Invoke(_BaseBusinessObject, new object[] { itemList, cmd.fields }); return((bool)result); }
private static void EditEntity(BaseBusinessObject modelBO, BaseBusinessObject editBO, int key) { foreach (PropertyInfo prop in listTypes[key].GetProperties()) { //foreach (var type in listTypes) { try { if (!listTypes.Contains(prop.PropertyType)) { if (simpleList.Contains(prop.PropertyType.Name.ToLower())) //"int", "decimal", "float", "string" { if (prop.PropertyType.Name.ToLower() == "string" && prop.GetValue(editBO) != "") { prop.SetValue(modelBO, prop.GetValue(editBO)); } else if (prop.PropertyType.Name.ToLower().Contains("int") && (int)prop.GetValue(editBO) != 0) { System.Diagnostics.Debug.WriteLine(prop.Name + ": " + prop.GetValue(editBO)); prop.SetValue(modelBO, prop.GetValue(editBO)); } else if (prop.PropertyType.Name.ToLower().Contains("decimal") && (decimal)prop.GetValue(editBO) != 0) //decimal { System.Diagnostics.Debug.WriteLine(prop.Name + ": " + prop.GetValue(editBO)); prop.SetValue(modelBO, prop.GetValue(editBO)); } else if (prop.PropertyType.Name.ToLower().Contains("float") && (float)prop.GetValue(editBO) != 0) //decimal { System.Diagnostics.Debug.WriteLine(prop.Name + ": " + prop.GetValue(editBO)); prop.SetValue(modelBO, prop.GetValue(editBO)); } else if (prop.PropertyType.Name.ToLower().Contains("byte[]") && (byte[])prop.GetValue(editBO) != null) //decimal { System.Diagnostics.Debug.WriteLine(prop.Name + ": " + prop.GetValue(editBO)); prop.SetValue(modelBO, prop.GetValue(editBO)); } } } if (prop.PropertyType.Name.Contains("DateTime") || prop.PropertyType.Name.Contains("TimeSpan")) { prop.SetValue(modelBO, prop.GetValue(editBO)); //System.Diagnostics.Debug.WriteLine(prop.PropertyType.Name + ": " + prop.GetValue(editBO)); } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); } //} } }
protected override string GetPropertyDisplayedValue(BaseBusinessObject obj, int objIndex, string name, int row) { string value = ""; switch (objIndex) { case 0: IDOItems Items = (IDOItems)PrimaryBusinessObject; value = Items.GetPropertyDisplayedValue(name, row); break; default: break; } return(value); }
public object GetEntityByBatchField(OPEntityCmdBase cmd) { BaseBusinessObject _BaseBusinessObject = new BaseBusinessObject(); #region 动态实体解析 Type type = ObjectHelper.GetSingleObjectTypeByName(cmd.Namespace, cmd.EntityTypeName); #endregion object itemList = typeof(BaseBusinessObject).GetMethod("GetEntityByBatchField").MakeGenericMethod(type)?.Invoke(_BaseBusinessObject, new object[] { cmd.Tag }); return(itemList); // List <MenuInfo> itemList = JsonUtil.fromJson<List<MenuInfo>>(cmd.EntityJson); //return _SysInfoBusiness.NoTransactionOPEntitys<MenuInfo>(itemList, eopType); }
/// <summary> /// Actualiza los campos de auditoría antes de guardar el Objeto que hereda de BaseBusinessObject /// </summary> /// <param name="item">Objeto a guardar</param> /// <param name="usuarioSistema">Objeto Usuario para guardarlo en el campo de auditoria</param> protected virtual void CheckObjectBeforeSave(BaseBusinessObject item, Usuario usuarioSistema) { if (item != null) { //Se obtiene la fecha del servidor de base de datos DateTime dtSystem = new UtilidadesDA().GetSystemDatetime(); if (item.Version == 0) { //item.CreatedDT = DateTime.Now; item.CreatedDT = dtSystem; item.CreatedBy = usuarioSistema.UserName; } item.UpdatedDT = dtSystem; //item.UpdatedDT = DateTime.Now; item.UpdatedBy = usuarioSistema.UserName; } }
protected override string GetPropertyDisplayedValue(BaseBusinessObject obj, int objIndex, string name, int row) { string value = ""; switch (objIndex) { case 0: IDOPurchaseOrders POs = (IDOPurchaseOrders)PrimaryBusinessObject; value = POs.GetPropertyDisplayedValue(name, row); break; case 1: IDOPurchaseOrderLines poLines = (IDOPurchaseOrderLines)GetSecondObject(objIndex); value = poLines.GetPropertyDisplayedValue(name, row); break; default: break; } return(value); }
/// <summary> /// 保存角色跟菜单项的关系 /// </summary> /// <param name="RoleInfoId"></param> /// <param name="insertItem"></param> /// <returns></returns> public bool SaveRoleMenuRelationship(string RoleInfoId, List <RoleMenuRelationship> insertItem) { BaseBusinessObject _BaseBusinessObject = new BaseBusinessObject(); List <RoleMenuRelationship> itemDel = _BaseBusinessObject.GetEntityByField <RoleMenuRelationship>("RoleInfoId", RoleInfoId); bool rel = BaseEntityFac.TransactionOPEntitys <RoleMenuRelationship>((cn, transaction) => { bool result = false; result = BaseEntityFac.TransactionOPEntitysAdd <RoleMenuRelationship>(cn, transaction, EOPType.Delete, itemDel); result = BaseEntityFac.TransactionOPEntitysAdd <RoleMenuRelationship>(cn, transaction, EOPType.Insert, insertItem); return(result); } ); return(rel); }
public bool NoTransactionOPEntitys(OPEntityCmd cmd) { BaseBusinessObject _BaseBusinessObject = new BaseBusinessObject(); #region 动态实体解析 Type type = ObjectHelper.GetSingleObjectTypeByName(cmd.Namespace, cmd.EntityTypeName); Type listType = ObjectHelper.GetListObjectTypeByName(cmd.Namespace, cmd.EntityTypeName); var itemList = typeof(JsonUtil).GetMethod("fromJson").MakeGenericMethod(listType)?.Invoke(null, new object[] { cmd.EntityJson }); #endregion EOPType eopType = (EOPType)cmd.optype; object result = typeof(BaseBusinessObject).GetMethod("NoTransactionOPEntitys").MakeGenericMethod(type)?.Invoke(_BaseBusinessObject, new object[] { itemList, eopType }); return((bool)result); // List <MenuInfo> itemList = JsonUtil.fromJson<List<MenuInfo>>(cmd.EntityJson); //return _SysInfoBusiness.NoTransactionOPEntitys<MenuInfo>(itemList, eopType); }
public List <MenuInfo> UpdateLanguageMenus(List <MenuInfo> itemList, string languageCode) { if (itemList == null) { return(itemList); } BaseBusinessObject bbo = new BaseBusinessObject(); foreach (var item in itemList) { List <MenuInfoLanguage> itemLanguage = bbo.GetEntityByField <MenuInfoLanguage>("MenuInfoId", item.MenuInfoId); if (itemLanguage != null && itemLanguage.Count > 0) { MenuInfoLanguage mil = itemLanguage.Find(x => x.LanguageCode == languageCode); if (mil != null) { item.MenuName = mil.MenuName;//多国语言 } } } return(itemList); }
protected virtual string GetPropertyDisplayedValue(BaseBusinessObject obj, int objIndex, string name, int row) { //called by UpdateAdapterLists; return(""); }
protected override string GetPropertyDisplayedValue(BaseBusinessObject obj, int objIndex, string name, int row) { return(base.GetPropertyDisplayedValue(obj, objIndex, name, row)); }