public DialogResult ShowDialog(string message, string caption, DialogType dialogType = DialogType.Message, DialogButtons dialogButtons = DialogButtons.OK) { MessageBoxImage messageBoxImage = GetMessageBoxImageFromDialogType(dialogType); MessageBoxButton messageBoxButton = EnumUtil.Convert(dialogButtons, MessageBoxButton.OK); return(EnumUtil.Convert(MessageBox.Show(message ?? string.Empty, caption ?? string.Empty, messageBoxButton, messageBoxImage), DialogResult.None)); }
public IEnumerable <string> GetOperator(OperateRightEventArgs e) { if (e.Style.Style == PageStyle.List) { if (e.Row == null) { if (fOperators.Contains(UpdateKind.Insert)) { return(EnumUtil.Convert(RightConst.INSERT)); } return(null); } else { List <string> result = new List <string>(2); if (fOperators.Contains(UpdateKind.Update)) { result.Add(RightConst.UPDATE); } if (fOperators.Contains(UpdateKind.Delete)) { result.Add(RightConst.DELETE); } if (result.Count == 0) { return(null); } return(result); } } return(null); }
private void ProcessIdRootNode(string rootId) { DataRow row; if (!UseCustomParamBuilder) { row = fSelector.TrySelectRowWithKeys(rootId); } else { IParamBuilder builder = fSelector.CreateParamBuilder(null, new string[] { fDefinition.IdField }, rootId); builder = GetCustomParamBuilder(builder); row = fSelector.TrySelectRow(builder); } if (row != null) { fRootParentId = row[fDefinition.ParentIdField].ToString(); } else { fRootParentId = DbTreeDefinition.DEFAULT_PARENT_VALUE; fRootNodes = Enumerable.Empty <ITreeNode>(); SetTopLevel(null); } if (row != null) { // 由于在CreateNode的时候需要检测RootId,所以必须先给RootParentId赋值,然后才能创建Node ITreeNode root = CreateNode(row); fRootNodes = EnumUtil.Convert(root); SetTopLevel(root); } }
public void EnumsCanNotBeConvertedIfTheNamesDoNotMatch() { Assert.Throws <ArgumentException>(() => { _ = EnumUtil.Convert <Foo, Bar>(Foo.NOT_DEFINED_IN_BAR); }); }
public IMetaData CreateObject(params object[] args) { IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args); ITableSchemeEx scheme; ISingleMetaData masterMeta; switch (input.Style.Style) { case PageStyle.Insert: case PageStyle.Update: case PageStyle.Detail: masterMeta = Master.CreateSingleMetaData(); return(new Tk5MultipleMetaData(input, EnumUtil.Convert(masterMeta), DetailItems)); //return new Tk5SingleNormalMetaData(scheme, input, this); //break; case PageStyle.List: masterMeta = Master.CreateSingleMetaData(); scheme = masterMeta.CreateSourceScheme(input); return(new Tk5ListMetaData(scheme, input, masterMeta)); case PageStyle.Custom: bool shouldReturn; IMetaData result = CreateDetailListMeta(input, DetailItems, out shouldReturn); if (shouldReturn) { return(result); } break; } return(null); }
private static Tk5MultipleMetaData CreateMultipleMetaData(IInputData input, BaseMDSingleMetaDataConfig master, IEnumerable <DetailSingleMetaDataConfig> details) { ISingleMetaData masterMeta = master.CreateSingleMetaData(); return(new Tk5MultipleMetaData(input, EnumUtil.Convert(masterMeta), details)); }
public static IParamBuilder CreateParamBuilder(string filterSql, params IParamBuilder[] builders) { TkDebug.AssertArgumentNullOrEmpty(filterSql, "filterSql", null); IParamBuilder builder = CreateSql(filterSql); return(CreateParamBuilder(EnumUtil.Convert(builder, builders))); }
public static void UpdateTableResolvers(TkDbContext context, Action <Transaction> applyData, bool sort, TableResolver resolver, IEnumerable <TableResolver> resolvers) { TkDebug.AssertArgumentNull(resolver, "resolver", null); TkDebug.AssertArgumentNull(resolvers, "resolvers", null); UpdateTableResolvers(context, applyData, sort, EnumUtil.Convert(resolver, resolvers)); }
public void AddToDataSet(DataSet dataSet) { TkDebug.AssertArgumentNull(dataSet, "dataSet", this); DataTable table = EnumUtil.Convert(this).CreateTable(GetTableName()); dataSet.Tables.Add(table); }
public BaseListSearch CreateObject(params object[] args) { IFieldInfoIndexer indexer = ObjectUtil.ConfirmQueryObject <IFieldInfoIndexer>(this, args); IFieldInfo current = ObjectUtil.ConfirmQueryObject <IFieldInfo>(this, args); var fields = EnumUtil.Convert(current, GetFieldInfoList(indexer)); return(new MultipleFieldListSearch(fields.ToArray())); }
public void Clean(string cacheName) { TkDebug.AssertArgumentNullOrEmpty(cacheName, nameof(cacheName), this); ICache cache = GetCache(cacheName); if (cache != null) { CacheUtil.TryCleanCache(EnumUtil.Convert(cache)); } }
protected virtual void CommitData() { var updateResolvers = EnumUtil.Convert(MainResolver, ChildResolvers); if (fNonUIResolvers == null) { UpdateUtil.UpdateTableResolvers(Context, InternalApplyDatas, updateResolvers); } else { UpdateUtil.UpdateTableResolvers(Context, InternalApplyDatas, EnumUtil.Convert(updateResolvers, fNonUIResolvers)); } }
public IMetaData CreateObject(params object[] args) { IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args); ITableSchemeEx scheme; ISingleMetaData masterMeta; switch (input.Style.Style) { case PageStyle.Insert: case PageStyle.Update: case PageStyle.Detail: masterMeta = Master.CreateSingleMetaData(); IEnumerable <ISingleMetaData> oneToOneMeta; if (OneToOneTables == null) { oneToOneMeta = null; } else { oneToOneMeta = (from item in OneToOneTables select item.CreateSingleMetaData()); } var data = new Tk5MultipleMetaData(input, EnumUtil.Convert(masterMeta, oneToOneMeta), OneToManyTables); return(data); case PageStyle.List: masterMeta = Master.CreateSingleMetaData(); scheme = masterMeta.CreateSourceScheme(input); return(new Tk5ListMetaData(scheme, input, masterMeta)); case PageStyle.Custom: if (MetaDataUtil.StartsWith(input.Style, "DetailList")) { int index = input.QueryString["Index"].Value <int>(); TkDebug.Assert(OneToManyTables != null && OneToManyTables.Count > index, string.Format(ObjectUtil.SysCulture, "第{0}项metaData配置不存在", index + 1), this); var config = OneToManyTables[index]; var detailMetaData = config.CreateSingleMetaData(); scheme = detailMetaData.CreateSourceScheme(input); InputDataProxy proxy = new InputDataProxy(input, (PageStyleClass)PageStyle.List); Tk5ListMetaData meta = new Tk5ListMetaData(scheme, proxy, detailMetaData, config.TableOutput?.CreateObject()); return(meta); } break; } return(null); }
public IMetaData CreateObject(params object[] args) { IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args); ITableSchemeEx scheme; ISingleMetaData masterMeta; switch (input.Style.Style) { case PageStyle.Insert: case PageStyle.Update: masterMeta = Main.CreateSingleMetaData(); scheme = masterMeta.CreateSourceScheme(input); return(new Tk5SingleNormalMetaData(scheme, input, masterMeta)); case PageStyle.List: masterMeta = Main.CreateSingleMetaData(); scheme = masterMeta.CreateSourceScheme(input); return(new Tk5ListMetaData(scheme, input, masterMeta)); case PageStyle.Detail: masterMeta = Main.CreateSingleMetaData(); return(new Tk5MultipleMetaData(input, EnumUtil.Convert(masterMeta), Details)); case PageStyle.Custom: if (Details == null) { return(null); } if (MetaDataUtil.StartsWith(input.Style, "DetailList")) { int index = input.QueryString["Index"].Value <int>(); if (index < Details.Count) { var detail = Details[index]; InputDataProxy proxy = new InputDataProxy(input, (PageStyleClass)PageStyle.List); masterMeta = detail.CreateSingleMetaData(); scheme = masterMeta.CreateSourceScheme(input); return(new Tk5ListMetaData(scheme, proxy, masterMeta, detail.TableOutput?.CreateObject())); } return(null); } break; } return(null); }
public IMetaData CreateObject(params object[] args) { IInputData input = ObjectUtil.ConfirmQueryObject <IInputData>(this, args); ITableSchemeEx scheme; ISingleMetaData masterMeta; switch (input.Style.Style) { case PageStyle.Insert: case PageStyle.Update: case PageStyle.Detail: masterMeta = Master.CreateSingleMetaData(); return(new Tk5MultipleMetaData(input, EnumUtil.Convert(masterMeta), EnumUtil.Convert(Detail))); //return new Tk5SingleNormalMetaData(scheme, input, this); //break; case PageStyle.List: masterMeta = Master.CreateSingleMetaData(); scheme = masterMeta.CreateSourceScheme(input); return(new Tk5ListMetaData(scheme, input, masterMeta)); case PageStyle.Custom: if (input.Style.Operation == "DetailList") { var detailMeta = Detail.CreateSingleMetaData(); scheme = detailMeta.CreateSourceScheme(input); InputDataProxy proxy = new InputDataProxy(input, (PageStyleClass)PageStyle.List); return(new Tk5ListMetaData(scheme, proxy, detailMeta, Detail.TableOutput?.CreateObject())); } var metaData = SchemeUtil.CreateVueMetaData(input, Master, EnumUtil.Convert(Detail)); if (metaData != null) { return(metaData); } break; } return(null); }
public void Process(Bitmap imgSource, IProcessorCommand command) { if (imgSource == null || !Actions.ContainsKey(command.Command)) { return; } var action = Actions[command.Command]; var channel = EnumUtil.Convert <ARGBChannel>(command.Parameter.ToUpper()); var data = imgSource.GetBitmapData(); var bof = data.GetBof(); var pixelBytes = imgSource.GetPixelBytes(); var byteCount = pixelBytes * data.Width; Parallel.For(0, data.Height, y => { var currentPointer = bof + y * data.Stride; for (var x = 0; x < byteCount; x += pixelBytes) { action.Process(currentPointer, x, channel); } }); imgSource.UnlockBits(data); }
protected override void OnSetFullPath(string path) { Files = EnumUtil.Convert(path); }
public UserVideoMassMessage(string user, string title, string description, string mediaId) : this(EnumUtil.Convert(user), title, description, mediaId) { }
public WebPostException(string message, FieldErrorInfo errorField) : this(message, EnumUtil.Convert(errorField)) { }
public UserMpNewsMassMessage(string user, string mediaId) : this(EnumUtil.Convert(user), mediaId) { }
public Bar EnumsAreConvertedIfTheyHaveTheSameName(Foo source) { return(EnumUtil.Convert <Foo, Bar>(source)); }
public UserTextMassMessage(string user, string content) : this(EnumUtil.Convert(user), content) { }
protected void FillListDataSet(IInputData input, int pageNumber, int pageSize, int start) { ParamBuilderContainer condition = CreateListCondition(input); IOperateRight operateRight = null; if (TabSheets != null && TabSheets.Count > 0) { var selectedTab = GetSelectTabSheet(input); selectedTab.Selected = true; condition.Add(selectedTab.ParamBuilder); DataSet.Tables.Add(TabSheets.CreateTable("TabSheet")); } if (input.QueryString["GetData"] != "Page" && !input.IsPost) { MainResolver.FillCodeTable(input.Style); CreateListOperators(input, ref operateRight); } ListSortInfo listInfo = new ListSortInfo(input); string orderby = null; if (input.IsPost) { orderby = SetPostListInfo(input, condition, listInfo); } else { orderby = SetGetListInfo(input, condition, listInfo); } CountInfo pageInfo = CreatePageInfo(input, pageNumber, pageSize, condition); DataSet.Tables.Add(EnumUtil.Convert(pageInfo).CreateTable("Count")); DataSet.Tables.Add(EnumUtil.Convert(listInfo).CreateTable("Sort")); if (pageInfo.TotalCount <= 0) { OnFilledListTables(new FilledListEventArgs(input.IsPost, pageNumber, pageSize, pageInfo.TotalCount, orderby, MainResolver, input.PostObject, condition)); return; } int recCount = pageSize * pageNumber + start; string whereSql = condition.IsEmpty ? string.Empty : "WHERE " + condition.Sql; var listContext = FillListTable(MainResolver.ListFields, GetTableName(Context), MainResolver.GetKeyFieldArray(), whereSql, orderby, recCount, pageSize); SqlSelector selector = new SqlSelector(Context, DataSet); using (selector) { ISimpleAdapter adapter = selector; adapter.SetSql(listContext.ListSql, condition); Context.ContextConfig.SetListData(listContext, adapter, DataSet, recCount, pageSize, FillTableName); MainResolver.AddVirtualFields(); if (Operators != null) { if (operateRight == null) { operateRight = Operators.Right.CreateObject(); } var allOperators = Operators.Operators; if (allOperators != null) { CreateRowOperators(input, operateRight, allOperators); } } MainResolver.Decode(input.Style); OnFilledListTables(new FilledListEventArgs(input.IsPost, pageNumber, pageSize, pageInfo.TotalCount, orderby, MainResolver, input.PostObject, condition)); } }
private static IEnumerable <Tk5FieldInfoEx> CreateIndex() { Tk5FieldInfoEx field = new Tk5FieldInfoEx(new IndexField(), (PageStyleClass)PageStyle.List); return(EnumUtil.Convert(field)); }