public ActionResult CommonSelectDialog(string enumName, int id) { //公用的选择框的对话框窗体 List <EnumData> list = new List <EnumData>(); try { IEnumDataService enumService = IocMvcFactoryHelper.GetInterface <IEnumDataService>(); list = enumService.QueryEnumMember(enumName); } catch (Exception ex) { list = new List <EnumData>(); } ViewData["Id"] = id; return(View(list)); }
public JsonResult SaveEnum(SampleRequestParam param) { Common.Data.JsonData json = new Common.Data.JsonData() { Result = true }; int ev = 0; if (!int.TryParse(param.Value, out ev)) { json.Message = AppLanguage.Lang.Tip_EnumValueIsDigit; return(Json(json)); } IEnumDataService enumBll = IocMvcFactoryHelper.GetInterface <IEnumDataService>(); json = enumBll.Add(new EnumData() { Name = param.Name, Code = param.Code, Value = ev, Remark = param.Desc }); return(Json(json)); }
public EnumController(IEnumTypeService enumTypeService, IEnumDataService enumDataService) { this._enumTypeService = enumTypeService; this._enumDataService = enumDataService; }
static void OrmIocFactory() { if (propertyVal.Count > 0) {//存储字典非空出来 } string connString = InitAppSetting.LogicDBConnString; InterfaceIocHelper ioc = new InterfaceIocHelper(); string dir = NowAppDirHelper.GetNowAppDir(AppCategory.WebApp); // 获取到的目录 E:\Code\DayDayStudy\PickUpData\HRApp\HRApp.Web\ string dllDir = dir + "bin\\"; #region dll路径配置 Dictionary <MvcLevel, AssemblyData> mvc = new Dictionary <MvcLevel, AssemblyData>(); mvc.Add(MvcLevel.DAL, new AssemblyData() { AssemblyName = "HRApp.Infrastructure.dll", Namespace = "HRApp.Infrastructure" }); mvc.Add(MvcLevel.Bll, new AssemblyData() { AssemblyName = "HRApp.ApplicationService.dll", Namespace = "HRApp.ApplicationService" }); #endregion propertyVal.Add("SqlConnString", connString); propertyVal.Add(typeof(IEnumDataRepository).Name + ".SqlConnString", InitAppSetting.AccountDBConnString); //账号库 propertyVal.Add(typeof(IEnumDataService).Name + ".SqlConnString", InitAppSetting.AccountDBConnString); //账号库 propertyVal.Add(typeof(IAppAccountRepository).Name + ".SqlConnString", InitAppSetting.AccountDBConnString); //账号库 propertyVal.Add(typeof(IAppAccountService).Name + ".SqlConnString", InitAppSetting.AccountDBConnString); //账号库 propertyVal.Add(typeof(IMenuRepository).Name + ".SqlConnString", InitAppSetting.AccountDBConnString); //账号库 propertyVal.Add(typeof(IDataFromOtherRepository).Name + ".SqlConnString", InitAppSetting.QueryUinDB); //这个是用于系统中查询其他库的数据切换操作 #region dal层属性 #region Account DB IEnumDataRepository enumDal = ioc.IocConvert <IEnumDataRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(EnumDataRepository).Name); ioc.IocFillProperty(enumDal, propertyVal); IAppAccountRepository accountDal = ioc.IocConvert <IAppAccountRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(AppAccountRepository).Name); ioc.IocFillProperty(accountDal, propertyVal); IMenuRepository menuDal = ioc.IocConvert <IMenuRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(MenuRepository).Name); ioc.IocFillProperty(menuDal, propertyVal); #endregion #region log --all ILogDataRepository logDal = ioc.IocConvert <ILogDataRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(LogDataRepository).Name); ioc.IocFillProperty(logDal, propertyVal); #endregion IAppRepository appDal = ioc.IocConvert <IHRApp.Infrastructure.IAppRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(AppRepository).Name); ioc.IocFillProperty <IAppRepository, IAppRepository>(appDal, propertyVal); IAppSettingRepository appSettingDal = ioc.IocConvert <IAppSettingRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(AppSettingRepository).Name); ioc.IocFillProperty(appSettingDal, propertyVal); IOrganizationRepository organzeDal = ioc.IocConvert <IOrganizationRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(OrganizationRepository).Name); ioc.IocFillProperty(organzeDal, propertyVal); IContactDataRepository contacterDal = ioc.IocConvert <IContactDataRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(ContactDataRepository).Name); ioc.IocFillProperty(contacterDal, propertyVal); IMaybeSpecialRepository maybeSpecialDal = ioc.IocConvert <IMaybeSpecialRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(MaybeSpecialRepository).Name); ioc.IocFillProperty <IMaybeSpecialRepository>(maybeSpecialDal, propertyVal); ISpecialSpellNameRepository speicalSpellDal = ioc.IocConvert <ISpecialSpellNameRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(SpecialSpellNameRepository).Name); ioc.IocFillProperty <ISpecialSpellNameRepository>(speicalSpellDal, propertyVal); IDataFromOtherRepository dataFormOtherDal = ioc.IocConvert <IDataFromOtherRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(DataFromOtherRepository).Name); ioc.IocFillProperty <IDataFromOtherRepository>(dataFormOtherDal, propertyVal); IReportEnumDataRepository reportDal = ioc.IocConvert <IReportEnumDataRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(ReportEnumDataRepository).Name); ioc.IocFillProperty <IReportEnumDataRepository>(reportDal, propertyVal); IRelyTableRepository relyDal = ioc.IocConvert <IRelyTableRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(RelyTableRepository).Name); ioc.IocFillProperty <IRelyTableRepository>(relyDal, propertyVal); IEmailDataRepository emailDal = ioc.IocConvert <IEmailDataRepository>(dllDir, mvc[MvcLevel.DAL].AssemblyName, mvc[MvcLevel.DAL].Namespace, typeof(EmailDataRepository).Name); ioc.IocFillProperty <IEmailDataRepository>(emailDal, propertyVal); #endregion #region orm中dal层实例化存储到字典中 propertyVal.Add(typeof(ILogDataRepository).Name, logDal); propertyVal.Add(typeof(IEnumDataRepository).Name, enumDal); propertyVal.Add(typeof(IAppAccountRepository).Name, accountDal); propertyVal.Add(typeof(IAppRepository).Name, appDal); propertyVal.Add(typeof(IAppSettingRepository).Name, appSettingDal); propertyVal.Add(typeof(IMenuRepository).Name, menuDal); propertyVal.Add(typeof(IOrganizationRepository).Name, organzeDal); propertyVal.Add(typeof(IContactDataRepository).Name, contacterDal); propertyVal.Add(typeof(IMaybeSpecialRepository).Name, maybeSpecialDal); propertyVal.Add(typeof(ISpecialSpellNameRepository).Name, speicalSpellDal); propertyVal.Add(typeof(IDataFromOtherRepository).Name, dataFormOtherDal); propertyVal.Add(typeof(IReportEnumDataRepository).Name, reportDal); propertyVal.Add(typeof(IRelyTableRepository).Name, relyDal); propertyVal.Add(typeof(IEmailDataRepository).Name, emailDal); #endregion #region 业务层 IEnumDataService enumBll = ioc.IocConvert <IEnumDataService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(EnumDataService).Name); ioc.IocFillProperty <IEnumDataService, EnumDataService>(enumBll, propertyVal); propertyVal.Add(typeof(IEnumDataService).Name, enumBll); IAppAccountService accountBll = ioc.IocConvert <IAppAccountService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(AppAccountService).Name); ioc.IocFillProperty <IAppAccountService, AppAccountService>(accountBll, propertyVal); propertyVal.Add(typeof(IAppAccountService).Name, accountBll); //构造函数的参数注入 判断构造函数的参数是否需要进行注入 IAppDataService appService = ioc.IocConvert <IAppDataService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(AppDataService).Name); ioc.IocFillProperty <IAppDataService, AppDataService>(appService, propertyVal); propertyVal.Add(typeof(IAppDataService).Name, appService); IAppSettingService appSetService = ioc.IocConvert <IAppSettingService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(AppSettingService).Name); ioc.IocFillProperty <IAppSettingService, AppSettingService>(appSetService, propertyVal); //属性和字段注入 propertyVal.Add(typeof(IAppSettingService).Name, appSetService); IMenuService menuService = ioc.IocConvert <IMenuService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(MenuService).Name); ioc.IocFillProperty <IMenuService, MenuService>(menuService, propertyVal); propertyVal.Add(typeof(IMenuService).Name, menuService); IOrganizationService organzeService = ioc.IocConvert <IOrganizationService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(OrganizationService).Name); ioc.IocFillProperty <IOrganizationService, OrganizationService>(organzeService, propertyVal); propertyVal.Add(typeof(IOrganizationService).Name, organzeService); IContactDataService contactService = ioc.IocConvert <IContactDataService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(ContactDataService).Name); ioc.IocFillProperty <IContactDataService, ContactDataService>(contactService, propertyVal); propertyVal.Add(typeof(IContactDataService).Name, contactService); IMaybeSpecialService maybeSpeiclaService = ioc.IocConvert <IMaybeSpecialService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(MaybeSpecialService).Name); ioc.IocFillProperty <IMaybeSpecialService, MaybeSpecialService>(maybeSpeiclaService, propertyVal); propertyVal.Add(typeof(IMaybeSpecialService).Name, maybeSpeiclaService); ISpecialSpellNameService specialSpellService = ioc.IocConvert <ISpecialSpellNameService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(SpecialSpellNameService).Name); ioc.IocFillProperty <ISpecialSpellNameService, SpecialSpellNameService>(specialSpellService, propertyVal); propertyVal.Add(typeof(ISpecialSpellNameService).Name, specialSpellService); IDataFromOtherService dataFormService = ioc.IocConvert <IDataFromOtherService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(DataFromOtherService).Name); ioc.IocFillProperty <IDataFromOtherService, DataFromOtherService>(dataFormService, propertyVal); propertyVal.Add(typeof(IDataFromOtherService).Name, dataFormService); IReportEnumDataService reportBll = ioc.IocConvert <IReportEnumDataService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(ReportEnumDataService).Name); ioc.IocFillProperty <IReportEnumDataService, ReportEnumDataService>(reportBll, propertyVal); propertyVal.Add(typeof(IReportEnumDataService).Name, reportBll); IRelyTableService relyBll = ioc.IocConvert <IRelyTableService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(RelyTableService).Name); ioc.IocFillProperty <IRelyTableService>(relyBll, propertyVal); propertyVal.Add(typeof(IRelyTableService).Name, relyBll); IEmailDataService emailBll = ioc.IocConvert <IEmailDataService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(EmailDataService).Name); ioc.IocFillProperty <IEmailDataService>(emailBll, propertyVal); propertyVal.Add(typeof(IEmailDataService).Name, emailBll); ILogDataService logBll = ioc.IocConvert <ILogDataService>(dllDir, mvc[MvcLevel.Bll].AssemblyName, mvc[MvcLevel.Bll].Namespace, typeof(LogDataService).Name); ioc.IocFillProperty <ILogDataService>(logBll, propertyVal); propertyVal.Add(typeof(ILogDataService).Name, logBll); #endregion }
public EnumDataCache() { this._enumTypeService = EngineContext.Current.Resolve <IEnumTypeService>(); this._enumDataService = EngineContext.Current.Resolve <IEnumDataService>(); }