public static XPObjectSpaceProvider CreateObjectSpaceProvider(string connectionString) { XpoTypesInfoHelper.ForceInitialize(); ITypesInfo typesInfo = XpoTypesInfoHelper.GetTypesInfo(); XpoTypeInfoSource xpoTypeInfoSource = XpoTypesInfoHelper.GetXpoTypeInfoSource(); RegisterBOTypes(typesInfo); ConnectionStringDataStoreProvider dataStoreProvider = new ConnectionStringDataStoreProvider(connectionString); return(new XPObjectSpaceProvider(dataStoreProvider, typesInfo, xpoTypeInfoSource)); }
private static XPObjectSpaceProvider CreateObjectSpaceProvider(string CompanyId) //TODO use companyID { XpoTypesInfoHelper.ForceInitialize(); ITypesInfo typesInfo = XpoTypesInfoHelper.GetTypesInfo(); XpoTypeInfoSource xpoTypeInfoSource = XpoTypesInfoHelper.GetXpoTypeInfoSource(); RegisterBOTypes(typesInfo); ConnectionStringDataStoreProvider dataStoreProvider = new ConnectionStringDataStoreProvider(MSSqlConnectionProvider.GetConnectionString("weedware101.database.windows.net,1433", "demodbjose", "*.mk3247", "demodbjose")); return(new XPObjectSpaceProvider(dataStoreProvider, typesInfo, xpoTypeInfoSource)); }
public void OpenNavigationItem(ActionPortalEventArgs appArgs, string objTypeName) { // Get type from full name Assembly asm = typeof(CashDiscipline.Module.BusinessObjects.SetOfBooks).Assembly; Type objType = asm.GetType(objTypeName); // otherwise, get type from short name if (objType == null) { objType = XpoTypesInfoHelper.GetTypesInfo().PersistentTypes.FirstOrDefault( x => x.Name == objTypeName).Type; } var nav = new NavigationHelper(); nav.OpenNavigationItem(appArgs.Application, appArgs.ObjectSpace, appArgs.ShowViewParameters, objType); }
//controllerTypeName = "CashDiscipline.Module.Controllers.Cash.CashFlowViewController" public void ExecuteChoiceActionByCaptionPath(ActionPortalEventArgs appArgs, string objTypeName, string controllerTypeName, string actionId, string captionPath) { Assembly asm = typeof(CashDiscipline.Module.BusinessObjects.SetOfBooks).Assembly; Type objType = asm.GetType(objTypeName); if (objType == null) { objType = XpoTypesInfoHelper.GetTypesInfo().PersistentTypes.FirstOrDefault( x => x.Name == objTypeName).Type; } Type controllerType = asm.GetType(controllerTypeName); ExecuteChoiceActionByCaptionPath(appArgs, objType, controllerType, actionId, captionPath); }
public HttpResponseMessage FarmerProduction_XAF() { try { XpoTypesInfoHelper.GetTypesInfo(); XafTypesInfo.Instance.RegisterEntity(typeof(FarmerProduction)); XPObjectSpaceProvider directProvider = new XPObjectSpaceProvider(scc, null); IObjectSpace ObjectSpace = directProvider.CreateObjectSpace(); IList <FarmerProduction> collection = ObjectSpace.GetObjects <FarmerProduction>(CriteriaOperator.Parse(" GCRecord is null and IsActive = 1", null)); if (collection != null) { List <user.FarmerProductionModel> list = new List <user.FarmerProductionModel>(); foreach (FarmerProduction row in collection) { user.FarmerProductionModel productionModel = new user.FarmerProductionModel(); productionModel.Oid = row.Oid; productionModel.Production = row.AnimalSeedOid.SeedName; list.Add(productionModel); } return(Request.CreateResponse(HttpStatusCode.OK, list)); } else { UserError err = new UserError(); err.code = ""; // error จากสาเหตุอื่นๆ จะมีรายละเอียดจาก system แจ้งกลับ err.message = "No data"; // Return resual return(Request.CreateResponse(HttpStatusCode.BadRequest, err)); } } catch (Exception ex) { //Error case เกิดข้อผิดพลาด UserError err = new UserError(); err.code = "6"; // error จากสาเหตุอื่นๆ จะมีรายละเอียดจาก system แจ้งกลับ err.message = ex.Message; // Return resual return(Request.CreateResponse(HttpStatusCode.BadRequest, err)); } }