protected override OutputData DoGet(IInputData input) { Tk5TableResolver getResovler = new Tk5TableResolver(@"Weixin\CorpTagDept.xml", this); using (getResovler) { DataTable table = getResovler.CreateVirtualTable(); IParamBuilder builder = SqlParamBuilder.CreateEqualSql(Context, "CU_USER_ID", TkDataType.Int, input.QueryString["UserId"]); string dept = DbUtil.ExecuteScalar(SQL, Context, builder).ToString(); QuoteStringList list = dept.Value<QuoteStringList>(); if (list != null) { List<int> deptList = list.ConvertToList<int>(); if (deptList != null) { foreach (var item in deptList) { DataRow userRow = table.NewRow(); userRow["DeparmentId"] = item; table.Rows.Add(userRow); } getResovler.Decode(input.Style); } } input.CallerInfo.AddInfo(DataSet); } return OutputData.Create(DataSet); }
public override OutputData DoAction(IInputData input) { using (WeixinMassResolver massResolver = new WeixinMassResolver(this)) using (TaxDocumentResolver docResolver = new TaxDocumentResolver(this)) { string docId = input.QueryString["DocId"]; DataRow docRow = docResolver.SelectRowWithKeys(docId); string massId = docRow["MassId"].ToString(); if (string.IsNullOrEmpty(massId)) { docResolver.SetCommands(AdapterCommand.Update); massId = massResolver.NewRow(docId); docRow.BeginEdit(); docRow["MassId"] = massId; docRow["MassFlag"] = 0; docRow.EndEdit(); UpdateUtil.UpdateTableResolvers(null, docResolver, massResolver); } string retUrl = input.QueryString["RetUrl"]; if (!string.IsNullOrEmpty(retUrl)) retUrl = "&RetUrl=" + HttpUtility.UrlEncode(retUrl); string url = string.Format("~/Library/WebUpdateXmlPage.tkx?Source=CXCS/WeixinMass&MassId={0}{1}", massId, retUrl); return OutputData.Create(url); } }
protected override OutputData DoGet(IInputData input) { using (TableResolver resolver = PlugInFactoryManager.CreateInstance<TableResolver>( ResolverPlugInFactory.REG_NAME, "TaxDocument", this)) { MetaDataTableResolver metaResolver = resolver as MetaDataTableResolver; string conditionStr = string.Empty; if (metaResolver != null) { Dictionary<string, string> query = new Dictionary<string, string> { { "Title", input.QueryString["Title"] } }; IParamBuilder builder = metaResolver.GetQueryCondition(new QueryConditionObject(false, query)); if (builder != null) { QueryCondition condition = new QueryCondition(query, builder); conditionStr = "&Condition=" + HttpUtility.UrlEncode(condition.ToEncodeString()); } } string url = WebUtil.ResolveUrl("~/Library/WebListXmlPage.tkx?Source=Cxcs/FaGui"); return OutputData.Create(url + conditionStr); } }
public OutputData Insert(IInputData input, object instance) { WeMaterialUploadObject mediaObject = instance.Convert<WeMaterialUploadObject>(); WeVideoMaterial material = new WeVideoMaterial(mediaObject.ServerPath, mediaObject.Title, mediaObject.Introduction); var res = material.Add(); return OutputData.CreateToolkitObject(KeyData.Empty); }
public OutputData Update(IInputData input, object instance) { ServiceAccount account = instance.Convert<ServiceAccount>(); account.Update(); return OutputData.CreateToolkitObject(KeyData.Empty); }
public OutputData Insert(IInputData input, object instance) { MpNewsArticle article = instance as MpNewsArticle; WeNewsMaterial news = new WeNewsMaterial(article); news.Add(); return OutputData.CreateToolkitObject(new KeyData(article.Title, article.Content)); }
public Tuple<ListSortInfo, CountInfo, object> CreatePageInfo(IInputData input, int pageNumber, int pageSize) { ListSortInfo list = new ListSortInfo(input); CountInfo pageInfo = new CountInfo(Count, 0, Count == 0 ? 1 : Count); return Tuple.Create<ListSortInfo, CountInfo, object>(list, pageInfo, null); }
public override OutputData DoAction(IInputData input) { PageStyle style = input.Style.Style; if (input.IsPost) { BasePostObject obj = input.PostObject.Convert<BasePostObject>(); using (ReportDataResolver resolver = new ReportDataResolver(this)) { UpdateKind kind = style == PageStyle.Insert ? UpdateKind.Insert : UpdateKind.Update; DataRow row = resolver.UpdateRow(obj, kind); return OutputData.CreateToolkitObject(new KeyData("Company", row["Company"].ToString())); } } else { ReportObjectData obj = null; switch (style) { case PageStyle.Insert: obj = new ReportObjectData(input.QueryString["Company"], input.QueryString["ReportName"]); break; case PageStyle.Update: using (ReportDataResolver resolver = new ReportDataResolver(this)) { obj = resolver.ReadRow(input); } break; } input.CallerInfo.AddInfo(obj.CallerInfo); return OutputData.CreateObject(obj); } }
public object CreateNew(IInputData input) { WeServiceUploadImgObject result = new WeServiceUploadImgObject() { Account = input.QueryString["Account"] }; return result; }
public OutputData DoAction(IInputData input) { IUserInfo userInfo = WebGlobalVariable.Info; Dictionary<string, string> result = new Dictionary<string, string>(); result["Title"] = WebAppSetting.WebCurrent.AppFullName; result["Description"] = WebAppSetting.WebCurrent.AppDescription; return OutputData.CreateObject(result); }
public object Execute(object controller, IInputData inputData) { if (inputData.HttpMethod.HasValue) { foreach (var pair in commands) { if (pair.Key.Is(inputData.HttpMethod.Value)) return pair.Value.Execute(controller,inputData); } } return commands.First().Value.Execute(controller,inputData); }
public OutputData DoAction(IInputData input) { WebGlobalVariable.Session.Abandon(); var emptyCookie = new HttpCookie(RightConst.USER_INFO_COOKIE_NAME, null); WebGlobalVariable.Response.Cookies.Set(emptyCookie); string url = WebAppSetting.WebCurrent.LogOnPath; return OutputData.Create(url); }
public OutputData Insert(IInputData input, object instance) { WeServiceUploadImgObject uploadObj = instance.Convert<WeServiceUploadImgObject>(); if (string.IsNullOrEmpty(uploadObj.FileName)) throw new WebPostException("没有上传头像文件"); byte[] fileData = File.ReadAllBytes(uploadObj.ServerPath); WeixinResult res = ServiceAccount.UploadHeadImg(uploadObj.Account, uploadObj.FileName, fileData); return OutputData.CreateToolkitObject(KeyData.Empty); }
public OutputData Update(IInputData input, object instance) { BasePasswordData passwd = instance.Convert<BasePasswordData>(); InternalAccount account = new InternalAccount(passwd.UserId, passwd.Password); account.Update(); return OutputData.CreateToolkitObject(KeyData.Empty); }
public object CreateNew(IInputData input) { LogOnData data = new LogOnData(); var request = WebGlobalVariable.Request; var logonName = request.Cookies[COOKIE_NAME]; if (logonName != null && !string.IsNullOrEmpty(logonName.Value)) data.LogOnName = logonName.Value; return data; }
public OutputData DoAction(IInputData input) { string openId = input.QueryString["OpenId"]; string text = input.QueryString["Text"]; TextServiceMessage msg = new TextServiceMessage(openId, text); msg.Send(); return OutputData.CreateToolkitObject(new KeyData("OK", string.Empty)); }
public OutputData Insert(IInputData input, object instance) { InternalAccount account = instance as InternalAccount; TkDebug.AssertNotNull(account, "account", this); string password = account.GetNewPassword("InternalAccount"); ServiceAccount.Add(account.Account + "@" + WeixinSettings.Current.WeixinAccount, account.NickName, password); return OutputData.CreateToolkitObject(new KeyData(account.Account, account.NickName)); }
public OutputData Update(IInputData input, object instance) { BasePasswordData passwd = instance.Convert<BasePasswordData>(); using (EmptyDbDataSource source = new EmptyDbDataSource()) using (UserResolver resolver = new UserResolver(source)) { return ChangePasswd(resolver, passwd); } }
public override OutputData DoAction(IInputData input) { using (TaxDocumentResolver docResolver = new TaxDocumentResolver(this)) using (WeixinMassResolver massResolver = new WeixinMassResolver(this)) using (WeixinMassDetailResolver detailResolver = new WeixinMassDetailResolver(this)) { DataRow row = massResolver.Query(input.QueryString); if (row["SendFlag"].Value<int>() == 4) // 已发送的不在发送 return OutputData.Create("-2"); massResolver.SetCommands(AdapterCommand.Update); docResolver.SetCommands(AdapterCommand.Update); DateTime current = DateTime.Now; row.BeginEdit(); row["SendFlag"] = 4; row["SendDate"] = row["UpdateDate"] = current; row["SendId"] = row["UpdateId"] = BaseGlobalVariable.UserId; row.EndEdit(); MpNewsMassMessage msg = new MpNewsMassMessage(); string basePath = Path.Combine(BaseAppSetting.Current.AppPath, @"..\pic\sys\"); string path = Path.Combine(basePath, "hzwtitle.jpg"); //MediaId mId = WeUtil.UploadFile(MediaType.Image, path); string mediaId = WeDataUtil.GetMediaId(MediaType.Image, path); DataRow docRow = UpdateDocRow(docResolver, row, current, 4); msg.AddArticle(CreateArticle(docRow, mediaId)); detailResolver.SelectWithParam(string.Empty, "ORDER BY WMD_ORDER_NUM", "MassId", input.QueryString["MassId"]); DataTable childTable = detailResolver.HostTable; if (childTable != null) { foreach (DataRow childRow in childTable.Rows) { docRow = UpdateDocRow(docResolver, childRow, current, 2); path = Path.Combine(basePath, string.Format("A{0}.jpg", docRow["Catelog"])); mediaId = WeDataUtil.GetMediaId(MediaType.Image, path); msg.AddArticle(CreateArticle(docRow, mediaId)); } } UpdateUtil.UpdateTableResolvers(null, docResolver, massResolver); var media_Id = msg.UploadMessage(); var users = WeFanContainter.GetAllUsers(); var result = msg.Send(users); if (result > 0) return OutputData.Create("0"); return OutputData.Create("-1"); } }
public OutputData Delete(IInputData input, string id) { CorpDepartmentCollection deptList; var dept = FindDept(id, out deptList); deptList.Department.Remove(dept); dept.Delete(); WeDataUtil.SaveData(WeCorpConst.CORP_DEPT_NAME, deptList); return OutputData.CreateToolkitObject(new KeyData(dept)); }
public OutputData Insert(IInputData input, object instance) { WeGroupProxy group = instance.Convert<WeGroupProxy>(); WeGroup newGroup = WeGroup.CreateGroup(group.Name); var groups = WeDataUtil.GetCacheData<WeGroupCollection>(WeDataConst.WEGROUP_NAME); groups.Groups.Add(newGroup); WeDataUtil.SaveData(WeDataConst.WEGROUP_NAME, groups); return OutputData.CreateToolkitObject(new KeyData(newGroup)); }
public OutputData Update(IInputData input, object instance) { CorpDepartmentProxy dept = instance.Convert<CorpDepartmentProxy>(); CorpDepartmentCollection deptList; var oldDept = FindDept(dept.Id, out deptList); oldDept.Name = dept.Name; oldDept.Update(); WeDataUtil.SaveData(WeCorpConst.CORP_DEPT_NAME, deptList); return OutputData.CreateToolkitObject(new KeyData(oldDept)); }
public OutputData Insert(IInputData input, object instance) { CorpDepartmentProxy dept = instance.Convert<CorpDepartmentProxy>(); var deptList = WeDataUtil.GetCacheData<CorpDepartmentCollection>( WeCorpConst.CORP_DEPT_NAME); var lastNode = deptList.Department[deptList.Department.Count - 1]; var newDept = CorpDepartment.Create(dept.ParentId, dept.Name, lastNode.Id + 1); deptList.Department.Add(newDept); WeDataUtil.SaveData(WeCorpConst.CORP_DEPT_NAME, deptList); return OutputData.CreateToolkitObject(new KeyData(newDept)); }
public override OutputData DoAction(IInputData input) { DateTime current = DateTime.Today; DateTime firstMonth = new DateTime(current.Year, current.Month, 1); DateTime endMonth = firstMonth.AddMonths(1); TkDbContext context = Context; FieldItem field = new FieldItem("WM_SEND_DATE", TkDataType.DateTime); IParamBuilder builder = ParamBuilder.CreateParamBuilder( SqlParamBuilder.CreateSingleSql(context, field, ">=", firstMonth), SqlParamBuilder.CreateSingleSql(context, field, "<", "WM_SEND_DATE1", endMonth)); int count = DbUtil.ExecuteScalar("SELECT COUNT(*) FROM CS_WEIXIN_MASS", context, builder) .Value<int>(); return OutputData.Create(count.ToString()); }
public OutputData DoAction(IInputData input) { IUserInfo userInfo = WebGlobalVariable.Info; Dictionary<string, string> result = new Dictionary<string, string>(); result["Menu"] = WebGlobalVariable.SessionGbl.AppRight.CreateMenu(userInfo); result["UserName"] = userInfo.UserName; result["StartUrl"] = WebUtil.ResolveUrl(input.QueryString["StartUrl"]); result["HomeUrl"] = WebUtil.ResolveUrl("~/Library/WebModuleContentPage.tkx?Source=UserManager/MainPage&StartUrl=" + HttpUtility.UrlEncode(WebAppSetting.WebCurrent.HomePath)); result["FullName"] = WebAppSetting.WebCurrent.AppFullName; result["ShortName"] = WebAppSetting.WebCurrent.AppShortName; return OutputData.CreateObject(result); }
public override OutputData DoAction(IInputData input) { string source = input.QueryString["Source"]; string path = Path.Combine(BaseAppSetting.Current.XmlPath, @"Import", source + ".xml"); ImportConfigXml config = new ImportConfigXml(); config.ReadXmlFromFile(path); string filePath = @"C:\Users\zll\Downloads\角色.xls"; var meta = config.Import.MetaData.CreateObject(input); Tk5ListMetaData data = meta as Tk5ListMetaData; var resolver = config.Import.Resolver.CreateObject(this); MetaDataTableResolver metaResolver = resolver as MetaDataTableResolver; TkDebug.AssertNotNull(metaResolver, "metaResolver", this); ImportError errResult = new ImportError(); var dataSet = ExcelImporter.ExcelImport(filePath, data, errResult); FieldErrorInfoCollection importResult = metaResolver.Import(dataSet, input); if (importResult.Count > 0) { var positions = (from item in importResult orderby item.Position descending select item.Position).Distinct(); foreach (var errorInfo in importResult) { DataRow errorRow = dataSet.Tables[errorInfo.TableName].Rows[errorInfo.Position]; ImportWarningItem errorItem = new ImportWarningItem(errorRow["OriginalRowNum"].Value<int>(), resolver.GetFieldInfo(errorInfo.NickName).DisplayName, (string)errorRow[errorInfo.NickName], errorInfo.Message); errResult.Add(errorItem); } foreach (var index in positions) { resolver.HostTable.Rows.RemoveAt(index); } } DataSet webReport = null; if (errResult.Count > 0) { byte[] dataFile = ExcelUtil.ExcelReport(filePath, data, errResult); webReport = ExcelUtil.DataSetReport(filePath, data, errResult); } return OutputData.CreateObject(new ImportResultData(DataSet, webReport, errResult)); }
public OutputData Update(IInputData input, object instance) { WeGroupProxy group = instance.Convert<WeGroupProxy>(); var groups = WeDataUtil.GetCacheData<WeGroupCollection>(WeDataConst.WEGROUP_NAME); var oldGroup = groups.Groups[group.Id]; if (oldGroup == null) throw new WebPostException(string.Format(ObjectUtil.SysCulture, "提交数据有错误,无法找到Id为{0}的Group", group.Id)); oldGroup.Name = group.Name; oldGroup.Update(); WeDataUtil.SaveData(WeDataConst.WEGROUP_NAME, groups); return OutputData.CreateToolkitObject(new KeyData(oldGroup)); }
public OutputData Insert(IInputData input, object instance) { LogOnData data = instance.Convert<LogOnData>(); using (UserResolver resolver = new UserResolver(this)) { IUserInfo userInfo = resolver.CheckUserLogOn(data.LogOnName, data.Password, 0); if (userInfo == null) { } WebGlobalVariable.SessionGbl.AppRight.Initialize(userInfo); var response = WebGlobalVariable.Response; HttpCookie cookie = new HttpCookie(COOKIE_NAME, data.LogOnName) { Expires = DateTime.Now.AddDays(30) }; response.Cookies.Set(cookie); CookieUserInfo cookieInfo = new CookieUserInfo(data, userInfo); cookie = new HttpCookie(RightConst.USER_INFO_COOKIE_NAME, cookieInfo.Encode()) { Expires = GetExpireDate() }; response.Cookies.Set(cookie); WebSuccessResult result; var request = WebGlobalVariable.Request; string retUrl = request.QueryString["RetURL"]; if (!string.IsNullOrEmpty(retUrl)) result = new WebSuccessResult(retUrl); else { WebAppSetting appSetting = WebAppSetting.WebCurrent; if (string.IsNullOrEmpty(appSetting.MainPath)) result = new WebSuccessResult(appSetting.HomePath); else { string url = HttpUtility.UrlEncode(appSetting.HomePath); string mainUrl = UriUtil.AppendQueryString(appSetting.MainPath, "StartUrl=" + url); result = new WebSuccessResult(mainUrl); } } return OutputData.CreateToolkitObject(result); } }
public OutputData Insert(IInputData input, object instance) { WeMaterialUploadObject mediaObject = instance.Convert<WeMaterialUploadObject>(); byte[] fileData = File.ReadAllBytes(mediaObject.ServerPath); string fileName = ""; if (string.IsNullOrEmpty(mediaObject.Name)) { fileName = mediaObject.FileName; } else { fileName = mediaObject.Name + Path.GetExtension(mediaObject.FileName); } WeOtherMaterial material = new WeOtherMaterial(fileName, fileData); var res = material.Add(); return OutputData.CreateToolkitObject(KeyData.Empty); }
public OutputData DoAction(IInputData input) { NPOIRead.CreateExcelTemplate(fMetaData); string strName = @"D:\ImportTest.xls"; ResultHolder rh = new ResultHolder(); DataSet dSet = null; try { dSet = NPOIRead.ExcelImport(strName, fMetaData, rh); } catch { } return OutputData.Create(dSet); }
public OutputData DoAction(IInputData input) { string regName = input.QueryString["RegName"]; EasySearch easySearch = PlugInFactoryManager.CreateInstance <EasySearch>( EasySearchPlugInFactory.REG_NAME, regName); IConfigCreator <ITree> creator = easySearch as IConfigCreator <ITree>; string url; if (creator != null) { url = string.Format(ObjectUtil.SysCulture, "~/c/source/C/EasySearchTreeDialog?RegName={0}&InitValue={1}", regName, input.QueryString["InitValue"]); } else { url = string.Format(ObjectUtil.SysCulture, "~/c/source/C/EasySearchDialog?RegName={0}&RefValue={1}&Addition={2}", regName, input.QueryString["RefValue"], input.QueryString["Addition"]); } return(OutputData.Create(url)); }
private IUseCaseInvoker Invoker <TResponse>(IInputData <TResponse> inputData) where TResponse : IOutputData { var requestType = inputData.GetType(); if (invokers.TryGetValue(requestType, out var searchedInvoker)) { return(searchedInvoker); } if (!handlerTypes.TryGetValue(requestType, out var handlerType)) { throw new Exception($"No registered any usecase for this inputData(RequestType : {inputData.GetType().Name}"); } var invoker = invokers.GetOrAdd(requestType, _ => { var handlerInstance = provider.GetService(handlerType); return(invokerFactory.Generate(handlerType, handlerInstance.GetType(), provider)); }); return(invoker); }
public void SetPageData(ISource source, IInputData input, OutputData outputData, object pageData) { ISupportDialog dialog = pageData as ISupportDialog; if (dialog != null) { switch (fConfig.Mode) { case PageDataMode.Normal: dialog.SetDialogMode(false); break; case PageDataMode.Dialog: dialog.SetDialogMode(true); break; case PageDataMode.EditDialog: dialog.SetDialogMode(input.Style.Style == PageStyle.Insert || input.Style.Style == PageStyle.Update); break; } } }
protected override void DefaultUpdateAction(IInputData input) { base.DefaultUpdateAction(input); if (Operators != null && input.Style.Style == PageStyle.Detail) { if (MainResolver.HostTable.Rows.Count > 0) { MakeOperateRight(input); } } MetaDataTableResolver metaResolver = MainResolver as MetaDataTableResolver; if (metaResolver != null) { metaResolver.Decode(input.Style); if (input.Style.Style == PageStyle.Update) { metaResolver.FillCodeTable(input.Style); } } }
private FieldListOrder ParseSortParams2(IInputData input) { string jsonOrder = input.QueryString["JsonOrder"]; FieldListOrder order; if (input.IsPost || string.IsNullOrEmpty(jsonOrder)) { if (!string.IsNullOrEmpty(OrderBy)) { order = FieldListOrder.FromSqlString(MainResolver, OrderBy); } else { order = new FieldListOrder(); } } else { order = FieldListOrder.FromJson(jsonOrder); } return(order); }
private void PostData(IInputData input) { DataSet postDataSet = input.PostObject.Convert <DataSet>(); FieldErrorInfoCollection errors = new FieldErrorInfoCollection(); MetaDataTableResolver metaResolver = MainResolver as MetaDataTableResolver; if (metaResolver != null) { metaResolver.CheckFirstConstraints(input, errors); } switch (input.Style.Style) { case PageStyle.Update: MainResolver.Update(postDataSet, input); break; } if (metaResolver != null) { metaResolver.CheckLaterConstraints(input, errors); } errors.CheckError(); }
/// <summary> /// Creates a new instance of the visualizer which will display a cube in the current working array. /// </summary> /// <param name="renderContext"></param> /// <param name="inputData"></param> /// <param name="backgroundWorker"></param> /// <param name="camera"></param> public ActiveCubeVisualizer(IRenderContext renderContext, IInputData inputData, VisualizerBackgroundWorker backgroundWorker, ICamera camera) { _renderContext = renderContext; _inputData = inputData; _backgroundWorker = backgroundWorker; _camera = camera; _pen = new SolidColorPen(Color.Red, CullMode.None); // we want to draw the outside surfaces of the currently worked on cube and its outline // currently this requires 2 meshes: one with the surfaces as triangles (for coloring) and one with only the outline as lines // if we used e.g. only the first mesh, the pen would also draw lines across the surfaces which we don't want // again: inefficient, but we don't care because it doesn't have to be efficient var cube = new TextureMeshDescriptionBuilder(); var box = new BoundingBox(Vector3.Zero, Vector3.One); cube.AddRoom(box, Vector2.One); _visualizerMesh = renderContext.MeshCreator.CreateMesh(cube); var cube2 = new LineMeshDescriptionBuilder(); cube2.AddBox(box, Color.Black); _visualizerLineMesh = renderContext.MeshCreator.CreateMesh(cube2); _cubesPerTick = 1; }
public ISource CreateObject(params object[] args) { IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args); CheckPageStyle(input.Style); switch (input.Style.Style) { case PageStyle.Insert: return(CreateSource <IInsertObjectSource>(ObjectSource, (source) => new InsertObjectSource(source))); case PageStyle.Update: return(CreateSource <IUpdateObjectSource>(ObjectSource, (source) => new UpdateObjectSource(source))); case PageStyle.Delete: return(CreateSource <IDeleteObjectSource>(ObjectSource, (source) => new DeleteObjectSource(source))); case PageStyle.Detail: var detailSource = CreateSource <IDetailObjectSource>(ObjectSource, (source) => new DetailObjectSource(source)); if (DetailOperators != null) { detailSource.Convert <DetailObjectSource>().Operators = DetailOperators.CreateObject(); } return(detailSource); case PageStyle.List: return(CreateListSource(input)); case PageStyle.Custom: return(CreateCustomSource(input)); } return(null); }
protected override void DefaultUpdateAction(IInputData input) { base.DefaultUpdateAction(input); if (Operators != null && input.Style.Style == PageStyle.Detail) { if (MainResolver.HostTable.Rows.Count > 0) { MakeOperateRight(input); } } MetaDataTableResolver metaResolver = MainResolver as MetaDataTableResolver; Decode(input, metaResolver); if (FillDetailData) { foreach (TableResolver resolver in ChildResolvers) { metaResolver = resolver as MetaDataTableResolver; Decode(input, metaResolver); } } }
private OutputData DoPost(IInputData input) { PreparePostObject(input); switch (input.Style.Style) { case PageStyle.Insert: DefaultInsertAction(input); break; case PageStyle.Update: DefaultUpdateAction(input); break; default: TkDebug.ThrowImpossibleCode(this); break; } PostData(input); Commit(input); return(OutputData.CreateToolkitObject(MainResolver.CreateKeyData())); }
private void MakeOperateRight(DetailObjectModel model, IInputData input) { if (Operators == null) { return; } IEnumerable <Operator> listOpertors = null; var operateRight = Operators.Right.CreateObject(); if (operateRight == null) { var allOpertors = Operators.Operators; if (allOpertors != null) { listOpertors = from item in allOpertors select new Operator(item, this, input); } } else { var rights = operateRight.GetOperator( new ObjectOperateRightEventArgs(input.Style, model.Object)); var allOpertors = Operators.Operators; if (rights != null && allOpertors != null) { listOpertors = from item in allOpertors join right in rights on item.Id equals right select new Operator(item, this, input); } } if (listOpertors != null) { model.DetailOperators = listOpertors; } }
/// <summary> /// Pushes input data to this Device's controller. /// </summary> /// <param name="stream">Stream supplying the input data</param> /// <param name="inData">IInputData to push to the controller</param> public override void PushInputData(IDAQInputStream stream, IInputData inData) { try { var deviceParameters = DeviceParametersForInput(DateTimeOffset.Now.UtcDateTime).Data; IInputData convertedData = inData.DataWithConversion( m => ConvertInput(m, deviceParameters) ); var config = MergeDeviceParametersIntoConfiguration(Configuration, deviceParameters); log.DebugFormat("Pushing InputData with parameters {0} (units {1})", config, UnitsForScaleFactorUnits(deviceParameters.ScaleFactorUnits)); this.Controller.PushInputData(this, convertedData.DataWithExternalDeviceConfiguration(this, config)); } catch (Exception ex) { log.DebugFormat("Error pushing data to controller: {0} ({1})", ex.Message, ex); throw; } }
public OutputData DoAction(IInputData input) { HttpRequest request = WebGlobalVariable.Request; IFormFileCollection fileCollection = request.ReadFormAsync().GetAwaiter().GetResult().Files; IFormFile file = fileCollection["Filedata"]; if (file?.Length > 0 && !string.IsNullOrEmpty(file.FileName)) { UploadInfo upload = new WebUploadInfo(file); try { using (FileStream stream = new FileStream(upload.ServerPath, FileMode.OpenOrCreate, FileAccess.Write)) { file.CopyTo(stream); } return(OutputData.CreateToolkitObject(new WebUploadResult(upload))); } catch (Exception ex) { return(OutputData.CreateToolkitObject(new WebErrorResult(ex.Message))); } } return(OutputData.CreateToolkitObject(new WebErrorResult("没有上传文件"))); }
public override OutputData DoAction(IInputData input) { IEnumerable <ITreeNode> nodes; string initValue = input.QueryString["InitValue"]; if (string.IsNullOrEmpty(initValue)) { string id = input.QueryString["id"]; if (id == "#" || string.IsNullOrEmpty(id)) // Root { nodes = Tree.RootNodes; } else { nodes = Tree.GetChildNodes(id); } } else { nodes = Tree.GetDisplayTreeNodes(initValue); } return(OutputData.CreateToolkitObject(nodes.ToArray())); }
public override OutputData DoAction(IInputData input) { throw new NotImplementedException(); }
public InputData(IInputData baseData, IEnumerable <IMeasurement> derivedData) : base(baseData, derivedData) { this.InputTime = baseData.InputTime; }
protected InputData(IInputData data, IPipelineNodeConfiguration config) : base(data, config) { this.InputTime = data.InputTime; }
public string GetTemplateFile(ISource source, IInputData input, OutputData outputData) { return(WebRazorUtil.GetTemplateFile("Detail/template.cshtml")); }
/// <summary> /// Given a dataset and the isolevel this will return the polygons that make up the provided cube. /// </summary> /// <param name="inputData"></param> /// <param name="isolevel"></param> /// <param name="cube">A bounding box that represents the data to check. Currently all values must be castable to ints.</param> /// <returns>Null or empty list when the cube contains no data to polygonize, otherwise list with all vertices that make up the polygon. List is always a multiple of 3.</returns> public List <VertexPositionNormal> Polygonize(IInputData inputData, int isolevel, BoundingBox cube) { var p0 = new Vector3(cube.Min.X, cube.Min.Y, cube.Min.Z); var p1 = new Vector3(cube.Max.X, cube.Min.Y, cube.Min.Z); var p2 = new Vector3(cube.Max.X, cube.Min.Y, cube.Max.Z); var p3 = new Vector3(cube.Min.X, cube.Min.Y, cube.Max.Z); var p4 = new Vector3(cube.Min.X, cube.Max.Y, cube.Min.Z); var p5 = new Vector3(cube.Max.X, cube.Max.Y, cube.Min.Z); var p6 = new Vector3(cube.Max.X, cube.Max.Y, cube.Max.Z); var p7 = new Vector3(cube.Min.X, cube.Max.Y, cube.Max.Z); var values = new int[8]; // iterate through all 8 points of the cube // bottom first, clockwise order int Map(Vector3 p) => inputData[(int)p.X, (int)p.Y, (int)p.Z]; values[0] = Map(p0); values[1] = Map(p1); values[2] = Map(p2); values[3] = Map(p3); values[4] = Map(p4); values[5] = Map(p5); values[6] = Map(p6); values[7] = Map(p7); // bitwise add up all the values that are below the surface var index = 0; if (values[0] < isolevel) { index |= 1; } if (values[1] < isolevel) { index |= 2; } if (values[2] < isolevel) { index |= 4; } if (values[3] < isolevel) { index |= 8; } if (values[4] < isolevel) { index |= 16; } if (values[5] < isolevel) { index |= 32; } if (values[6] < isolevel) { index |= 64; } if (values[7] < isolevel) { index |= 128; } var edgeTableValue = _edgeTable[index]; if (edgeTableValue == 0) { return(null); } // look up where vertices and surface intersect with the cube if ((edgeTableValue & 1) != 0) { _vertexPositions[0] = VertexInterpolate(isolevel, p0, p1, values[0], values[1]); } if ((edgeTableValue & 2) != 0) { _vertexPositions[1] = VertexInterpolate(isolevel, p1, p2, values[1], values[2]); } if ((edgeTableValue & 4) != 0) { _vertexPositions[2] = VertexInterpolate(isolevel, p2, p3, values[2], values[3]); } if ((edgeTableValue & 8) != 0) { _vertexPositions[3] = VertexInterpolate(isolevel, p3, p0, values[3], values[0]); } if ((edgeTableValue & 16) != 0) { _vertexPositions[4] = VertexInterpolate(isolevel, p4, p5, values[4], values[5]); } if ((edgeTableValue & 32) != 0) { _vertexPositions[5] = VertexInterpolate(isolevel, p5, p6, values[5], values[6]); } if ((edgeTableValue & 64) != 0) { _vertexPositions[6] = VertexInterpolate(isolevel, p6, p7, values[6], values[7]); } if ((edgeTableValue & 128) != 0) { _vertexPositions[7] = VertexInterpolate(isolevel, p7, p4, values[7], values[4]); } if ((edgeTableValue & 256) != 0) { _vertexPositions[8] = VertexInterpolate(isolevel, p0, p4, values[0], values[4]); } if ((edgeTableValue & 512) != 0) { _vertexPositions[9] = VertexInterpolate(isolevel, p1, p5, values[1], values[5]); } if ((edgeTableValue & 1024) != 0) { _vertexPositions[10] = VertexInterpolate(isolevel, p2, p6, values[2], values[6]); } if ((edgeTableValue & 2048) != 0) { _vertexPositions[11] = VertexInterpolate(isolevel, p3, p7, values[3], values[7]); } // generate the triangles from the vertexlist var triangles = new List <VertexPositionNormal>(); var indexList = new List <int>(); var arr = _triangleTable[index]; for (int i = 0; arr[i] != -1; i += 3) { var a = _vertexPositions[arr[i + 2]]; var b = _vertexPositions[arr[i + 1]]; var c = _vertexPositions[arr[i + 0]]; var side1 = a - c; var side2 = a - b; var normal = Vector3.Cross(side1, side2); if (_clockwise) { normal = -normal; } var tri = new[] { // fill in inverse order as we cull counterclockwise new VertexPositionNormal(a, normal), new VertexPositionNormal(b, normal), new VertexPositionNormal(c, normal) }; if (!_clockwise) { tri = tri.Reverse().ToArray(); } triangles.AddRange(tri); } return(triangles); }
public override OutputData DoAction(IInputData input) { try { string docId = input.QueryString["DocId"]; using (TaxDocumentResolver destResolver = new TaxDocumentResolver(this)) { DataRow row = destResolver.TrySelectRowWithParam("SourceId", docId); if (row != null) { throw new WebPostException("已经复制过该文档!"); } var toolSource = new EmptyDbDataSource() { Context = DbContextUtil.CreateDbContext("Tools") }; using (toolSource) using (var srcResolver = new TaxDocumentResolver(toolSource)) using (var srcAttachResolver = new DocAttachmentResolver(toolSource)) using (var destAttachResolver = new DocAttachmentResolver(this)) { srcResolver.SelectWithKeys(docId); srcAttachResolver.SelectWithParam("DocId", docId); DataSetUtil.CopyDataTable(srcResolver.HostTable, destResolver.HostTable); destResolver.SetCommands(AdapterCommand.Insert); string id = null; string keyField = destResolver.KeyField; foreach (DataRow destRow in destResolver.HostTable.Rows) { id = destResolver.CreateUniId(); destRow.BeginEdit(); destRow["SourceId"] = destRow[keyField]; destRow[keyField] = id; destRow.EndEdit(); } DataTable attachTable = srcAttachResolver.HostTable; if (attachTable == null) { UpdateUtil.UpdateTableResolvers(null, destResolver); } else { DataTable destAttachTable = destAttachResolver.SelectTableStructure(); DataSetUtil.CopyDataTable(attachTable, destAttachTable); foreach (DataRow attachRow in destAttachTable.Rows) { attachRow.BeginEdit(); attachRow["AttId"] = destAttachResolver.CreateUniId(); attachRow["DocId"] = id; attachRow.EndEdit(); } destAttachResolver.SetCommands(AdapterCommand.Insert); UpdateUtil.UpdateTableResolvers(null, destResolver, destAttachResolver); } return(OutputData.CreateToolkitObject(destResolver.CreateKeyData())); } } } catch (WebPostException ex) { return(OutputData.CreateToolkitObject(ex.CreateErrorResult())); } }
protected override void CreateListOperators(IInputData input, ref IOperateRight operateRight) { base.CreateListOperators(input, ref operateRight); }
public object Query(IInputData input, string id) { var groups = WeDataUtil.GetCacheData <WeGroupCollection>(WeDataConst.WEGROUP_NAME); return(groups.Groups[id]); }
public object CreateNew(IInputData input) { return(new WeGroup()); }
public object Query(IInputData input, string id) { return(new BasePasswordData(input.QueryString["UserId"], input.QueryString["UserName"])); }
public ICalculationResult Calculate(IInputData inputData) { var output = inputData.Probability1 * inputData.Probability2; return(new CalculationResult(inputData, output)); }
public void Commit(IInputData input) { OnCommittingData(new CommittingDataEventArgs(input)); CommitData(); OnCommittedData(new CommittedDataEventArgs(input)); }
protected override IParamBuilder CreateCustomCondition(IInputData input) { return(fChildInfo.CreateDetailParamBuilder(fMasterResolver, input)); }
public virtual void SetPageData(ISource source, IInputData input, OutputData outputData, object pageData) { }
public string GetEngineName(ISource source, IInputData input, OutputData outputData) { return(RazorUtil.TOOLKIT_ENGINE_NAME); }
public object GetDefaultPageData(ISource source, IInputData input, OutputData outputData) { return(new NormalDetailData()); }