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()); }
static Boolean UseParam(FieldItem fi, Object value) { //// 是否使用参数化 //if (Setting.Current.UserParameter) return true; if (fi.Length > 0 && fi.Length < 4000) { return(false); } // 虽然是大字段,但数据量不大时不用参数 if (fi.Type == typeof(String)) { return(value is String str && str.Length > 4000); } else if (fi.Type == typeof(Byte[])) { return(value is Byte[] str && str.Length > 4000); } return(false); }
/// <summary>从数据流读取列表,Csv格式</summary> /// <param name="list">实体列表</param> /// <param name="stream">数据流</param> /// <returns>实体列表</returns> public static IList <T> LoadCsv <T>(this IList <T> list, Stream stream) where T : IEntity { var fact = typeof(T).AsFactory(); using (var csv = new CsvFile(stream, true)) { // 匹配字段 var names = csv.ReadLine(); var fields = new FieldItem[names.Length]; for (var i = 0; i < names.Length; i++) { fields[i] = fact.Fields.FirstOrDefault(e => names[i].EqualIgnoreCase(e.Name, e.DisplayName, e.ColumnName)); } // 读取数据 while (true) { var line = csv.ReadLine(); if (line == null || line.Length == 0) { break; } var entity = (T)fact.Create(); for (var i = 0; i < fields.Length; i++) { var fi = fields[i]; if (fi != null && !line[i].IsNullOrEmpty()) { entity[fi.Name] = line[i].ChangeType(fi.Type); } } list.Add(entity); } } return(list); }
/// <summary>输出编辑框</summary> /// <param name="Html"></param> /// <param name="field"></param> /// <param name="entity"></param> /// <returns></returns> public static MvcHtmlString ForEditor(this HtmlHelper Html, FieldItem field, IEntity entity = null) { if (entity == null) { entity = Html.ViewData.Model as IEntity; } // 优先处理映射。因为映射可能是字符串 { var mhs = ForMap(Html, field, entity); if (mhs != null) { return(mhs); } } if (field.ReadOnly) { var label = $"<label class=\"form-control\">{entity[field.Name]}</label>"; return(new MvcHtmlString(label)); } if (field.Type == typeof(String) && (field.Length <= 0 || field.Length > 300)) { return(Html.ForString(field.Name, (String)entity[field.Name], field.Length)); } // 如果是实体树,并且当前是父级字段,则生产下拉 if (entity is IEntityTree) { var mhs = ForTreeEditor(Html, field, entity as IEntityTree); if (mhs != null) { return(mhs); } } return(Html.ForEditor(field.Name, entity[field.Name], field.Type)); }
public void ValidateFileStage_ManualTest() { string filename = "provozovatel.csv"; Fields fields = this.GetFields(); Assert.NotEmpty(fields.Items); FileInfo fi = this.GetFileInfo(filename); Assert.True(fi.Exists); using (TextReader fileReader = File.OpenText(fi.FullName)) { var csv = new CsvReader(fileReader); csv.Configuration.HasHeaderRecord = true; while (csv.Read()) { ExpandoObject row = csv.GetRecord <dynamic>(); foreach (KeyValuePair <string, object> key in row.ToList()) { FieldItem fieldItem = fields.GetValidator(filename, key.Key); if (fieldItem != null) { fieldItem.FieldType.Value = key.Value.ToString(); bool flag = fieldItem.FieldType.IsValid; this.Output.WriteLine( $"Type - {fieldItem.FieldType.GetType().ToString()}, Value to Validate - {key.Value.ToString()}, IsValid - {flag}"); Assert.True(flag); } } } } }
/// <summary> /// 默认条件。 /// 若有标识列,则使用一个标识列作为条件; /// 如有主键,则使用全部主键作为条件。 /// </summary> /// <param name="entity">实体对象</param> /// <returns>条件</returns> static String DefaultCondition(IEntity entity) { IEntityOperate op = EntityFactory.CreateOperate(entity.GetType()); // 标识列作为查询关键字 FieldItem fi = op.Table.Identity; if (fi != null) { return(op.MakeCondition(fi, entity[fi.Name], "=")); } // 主键作为查询关键字 FieldItem[] ps = op.Table.PrimaryKeys; // 没有标识列和主键,返回取所有数据的语句 if (ps == null || ps.Length < 1) { if (DAL.Debug) { throw new XCodeException("因为没有主键,无法给实体类构造默认条件!"); } return(null); } StringBuilder sb = new StringBuilder(); foreach (FieldItem item in ps) { if (sb.Length > 0) { sb.Append(" And "); } sb.Append(op.FormatName(item.ColumnName)); sb.Append("="); sb.Append(op.FormatValue(item, entity[item.Name])); } return(sb.ToString()); }
/// <summary>检查在指定时间后更新过的数据</summary> /// <param name="last"></param> /// <param name="start"></param> /// <param name="max"></param> /// <returns></returns> public virtual ISyncMasterEntity[] GetAllUpdated(DateTime last, Int32 start, Int32 max) { FieldItem fi = Facotry.Table.FindByName(LastUpdateName); //var where = fi == null ? null : fi > last; var where = new WhereExpression(); if (fi != null) { where &= fi > last; } var list = Facotry.FindAll(where, null, null, start, max); if (list == null || list.Count < 1) { return(null); } // 如果实体类实现了该接口,则返回 if (Facotry.Default is ISyncMasterEntity) { var rs = new ISyncMasterEntity[list.Count]; for (var i = 0; i < list.Count; i++) { rs[i] = list[i] as ISyncMasterEntity; } return(rs); } // 否则采用内置实现 else { var rs = new ISyncMasterEntity[list.Count]; for (var i = 0; i < list.Count; i++) { rs[i] = new SyncMasterEntity(this, list[i]); } return(rs); } }
private static MvcHtmlString ForMap(HtmlHelper Html, FieldItem field, IEntity entity) { var map = field.Map; // 为该字段创建下拉菜单 if (map == null || map.Provider == null) { return(null); } //// 如果映射目标列表项过多,不能使用下拉 //var fact = EntityFactory.CreateOperate(map.Provider.EntityType); //if (fact != null && fact.Count > 30) //{ // // 输出数字编辑框和标签 // var label = "<label class=\"\">{0}</label>".F(entity[field.Name]); // if (field.OriField != null) field = field.OriField; // var mhs = Html.ForEditor(field.Name, entity[field.Name], field.Type); // return new MvcHtmlString(mhs.ToString() + label); //} return(Html.ForDropDownList(map.Name, map.Provider.GetDataSource(), entity[map.Name])); }
/// <summary>从一个数据读写器加载数据。不加载关联对象。</summary> /// <param name="dr">数据读写器</param> /// <param name="entity">实体对象</param> public void LoadData(IDataReader dr, IEntity entity) { if (dr == null) { return; } // IDataReader的GetSchemaTable方法太浪费资源了 for (int i = 0; i < dr.FieldCount; i++) { String name = dr.GetName(i); Type type = null; FieldItem fi = null; if (FieldItems.TryGetValue(name, out fi)) { name = fi.Name; type = fi.Type; } SetValue(entity, name, type, dr.GetValue(i)); } }
/// <summary> /// 列表框 /// </summary> /// <param name="field"></param> /// <param name="control"></param> /// <param name="canSave"></param> protected virtual void SetFormItemListControl(FieldItem field, DropDownList control, Boolean canSave) { if (control.Items.Count < 1) { return; } String value = String.Empty + Entity[field.Name]; ListItem li = control.Items.FindByValue(value); if (li != null) { //li.Selected = true; control.SelectedValue = li.Value; } else { li = new ListItem(value, value); control.Items.Add(li); li.Selected = true; } }
/// <summary>复选框</summary> /// <param name="field">字段</param> /// <param name="control"></param> protected virtual void GetFormItemCheckBox(FieldItem field, CheckBox control) { Type type = field.Type; Object v; if (type == typeof(Boolean)) { v = control.Checked; } else if (type == typeof(Int32)) { v = control.Checked ? 1 : 0; } else { v = control.Checked; } if (!Object.Equals(Entity[field.Name], v)) { SetEntityItem(field, v); } }
static Boolean UseParam(FieldItem fi, Object value) { //return (fi.Length <= 0 || fi.Length >= 4000) && (fi.Type == typeof(Byte[]) || fi.Type == typeof(String)); if (fi.Length > 0 && fi.Length < 4000) { return(false); } // 虽然是大字段,但数据量不大时不用参数 if (fi.Type == typeof(String)) { var str = value as String; return(str != null && str.Length > 4000); } else if (fi.Type == typeof(Byte[])) { var str = value as Byte[]; return(str != null && str.Length > 4000); } return(false); }
/// <summary>标签</summary> /// <param name="field">字段</param> /// <param name="control"></param> /// <param name="canSave"></param> protected virtual void SetFormItemLabel(FieldItem field, Label control, Boolean canSave) { Type type = field.Type; if (type == typeof(DateTime)) { DateTime d = (DateTime)Entity[field.Name]; if (IsNullKey && d == DateTime.MinValue) { d = DateTime.Now; } control.Text = d.ToString("yyyy-MM-dd HH:mm:ss"); } else if (type == typeof(Decimal)) { Decimal d = (Decimal)Entity[field.Name]; control.Text = d.ToString("c"); } else { control.Text = String.Empty + Entity[field.Name]; } }
/// <summary> /// 文本框 /// </summary> /// <param name="field"></param> /// <param name="control"></param> /// <param name="canSave"></param> protected virtual void SetFormItemTextBox(FieldItem field, RealTextField control, Boolean canSave) { Type type = field.Type; Object value = Entity[field.Name]; if (type == typeof(DateTime)) { DateTime d = (DateTime)value; if (IsNullKey && d == DateTime.MinValue) { d = DateTime.Now; } (control as DatePicker).SelectedDate = d; } else { if (!SetControlValue(control, value)) { control.Text = value.ToString(); } } }
private void FormFields_Load(object sender, EventArgs e) { if (DesignMode) { return; } labDataSource.Text = DataName; FieldListClone = FieldList.Clone() as FieldsCollections; for (int i = 0; i < FieldList.Count; i++) { FieldItem temp = FieldListClone[i]; LB_fldList.Items.Add(temp.DataTableName + "->" + temp.FieldChineseName + "." + temp.FieldName); } if (FieldList.Count > 0) { LB_fldList.SetSelected(0, true); } dtFields = _dao.GetFieldList(); ShowFields(dtFields); }
public void Move(out FieldItem collisionObject) { ChangeDirection(); if (direction == MoveDirection.Right) { map.Field[(int)location.Y, (int)location.X] = new Empty(); location = new Point(location.X + 1, location.Y); collisionObject = map.Field[(int)location.Y, (int)location.X]; map.Field[(int)location.Y, (int)location.X] = this; } else if (direction == MoveDirection.Left) { map.Field[(int)location.Y, (int)location.X] = new Empty(); location = new Point(location.X - 1, location.Y); collisionObject = map.Field[(int)location.Y, (int)location.X]; map.Field[(int)location.Y, (int)location.X] = this; } else if (direction == MoveDirection.Down) { map.Field[(int)location.Y, (int)location.X] = new Empty(); location = new Point(location.X, location.Y + 1); collisionObject = map.Field[(int)location.Y, (int)location.X]; map.Field[(int)location.Y, (int)location.X] = this; } else if (direction == MoveDirection.Up) { map.Field[(int)location.Y, (int)location.X] = new Empty(); location = new Point(location.X, location.Y - 1); collisionObject = map.Field[(int)location.Y, (int)location.X]; map.Field[(int)location.Y, (int)location.X] = this; } else { collisionObject = map.Field[(int)location.Y, (int)location.X]; } }
// 피격 코루틴 public IEnumerator OnDamage(Vector2 reactVec) { // 피격 코루틴이 실행되면 mat.color = Color.red; isDamege = true; // 넉백을 실행. rigid.AddForce(reactVec * 100 * Time.deltaTime, ForceMode2D.Impulse); yield return(new WaitForSeconds(0.1f)); if (boss.curHealth > 0) { // 체력이 남아있다면 다시 원래색으로 돌려놓음. mat.color = Color.white; } else { // 체력이 0이 되면 움직임을 정지시키고, 회색으로 만든 후에, 잠시후 사라지게 만듬. rigid.velocity = Vector2.zero; anim.SetBool("isRun", false); mat.color = Color.gray; gameObject.layer = 9; boss.isDead = true; GameObject go = Instantiate(dropitem, new Vector2(0, 0), Quaternion.identity); FieldItem fi = go.GetComponent <FieldItem>(); fi.BossDrop(); Gate_set._instance.countdown(); GameManager gm = FindObjectOfType <GameManager>(); gm.curArea++; anim.enabled = false; //Destroy(boss.gameObject, 2); } yield return(new WaitForSeconds(0.3f)); isDamege = false; }
/// <summary> /// This extension defines the function to validate parameter by context condition. /// </summary> /// <param name="item">The field structure defined.</param> public static void GetContextConditionMethodDefine(this FieldItem item) { if (string.IsNullOrEmpty(item.ContextConditionParameter)) { return; } string fn = IsPredefinedConditionExpression(item.ContextConditionParameter) ? GetPredefinedConditionFunction(item.ContextConditionParameter).ToUpper() : item.ContextConditionParameter.ToUpper(); MethodInfo method = typeof(ContextConditionsExtensions) .GetMethods() .FirstOrDefault(p => p.GetCustomAttributes <ContextConditionAttribute>() .FirstOrDefault(a => a.MethodToProcess.Equals(fn)) != null); if (method == null) { throw new ArgumentOutOfRangeException( $"The Context condition {item.ContextConditionParameter} is not defined for the field {item.FieldName}."); } item.ContextCondition = (ContextConditionValidationsHandler)Delegate.CreateDelegate(typeof(ContextConditionValidationsHandler), null, method); }
public static void TestMapCreator() { var fieldString = @"##### #.P.# #####"; var normalField = new FieldItem[, ] { { new Wall(), new Wall(), new Wall(), new Wall(), new Wall() }, { new Wall(), new Coin(new Map(), new Point()), new Player(new Map(), new Point()), new Coin(new Map(), new Point()), new Wall() }, { new Wall(), new Wall(), new Wall(), new Wall(), new Wall() } }; var m = new Map(fieldString, 0).Field; for (var i = 0; i < normalField.GetLength(0); i++) { for (var j = 0; j < normalField.GetLength(1); j++) { Assert.True(normalField[i, j].GetType() == m[i, j].GetType()); } } }
private static void BuildFormItem(FieldItem field, StringBuilder sb, IEntityFactory fact) { var des = field.Description.TrimStart(field.DisplayName).TrimStart(",", ".", ",", "。"); var err = 0; var total = 12; var label = 3; var span = 4; if (err == 0 && des.IsNullOrEmpty()) { span = 0; } else if (field.Type == typeof(Boolean) || field.Type.IsEnum) { span += 1; } var input = total - label - span; var ident = new String(' ', 4 * 1); sb.AppendLine($" <label class=\"control-label col-xs-{label} col-sm-{label}\">{field.DisplayName}</label>"); sb.AppendLine($" <div class=\"input-group col-xs-{total - label} col-sm-{input}\">"); // 优先处理映射。因为映射可能是字符串 var map = field.Map; if (map?.Provider != null) { var field2 = field?.OriField ?? field; sb.AppendLine($" @Html.ForDropDownList(\"{field2.Name}\", {fact.EntityType.Name}.Meta.AllFields.First(e=>e.Name==\"{field.Name}\").Map.Provider.GetDataSource(), @entity.{map.Name})"); } else if (field.ReadOnly) sb.AppendLine($" <label class=\"form-control\">@entity.{field.Name}</label>"); else if (field.Type == typeof(String)) BuildStringItem(field, sb); else if (fact.EntityType.As<IEntityTree>() && fact.EntityType.GetValue("Setting") is IEntityTreeSetting set && set?.Parent == field.Name) sb.AppendLine($" @Html.ForEditor({fact.EntityType.Name}._.{field.Name}, entity)");
public async Task <Result> CreateFieldItem(AddFieldItemDTO dto) { Result result = new Result(); try { string itemName = dto.Name; ValidationResult valResult = await _validationService.IsValidFieldItemName(dto.FieldId.ToString(), itemName); if (!valResult.IsValid) { result.Message = valResult.Message; result.ErrorCode = ErrorCode.INVALID_INPUT; return(result); } FieldItem field = new FieldItem { FieldId = dto.FieldId, Name = dto.Name, Description = dto.Description }; _repo.Create(field); await _repo.SaveAsync(); result.Message = "Field item has been successfully added."; result.Success = true; result.Id = "FieldItem"; } catch (Exception e) { result.Message = "Error adding field item."; result.ErrorCode = ErrorCode.EXCEPTION; _logger.LogError("Error calling CreateFieldItem: {0}", e.Message); } return(result); }
static Object FormatParamValue(FieldItem fi, Object value, IEntityOperate eop) { if (value != null) return value; if (fi.IsNullable) return DBNull.Value; switch (Type.GetTypeCode(fi.Type)) { case TypeCode.Boolean: return false; case TypeCode.DBNull: case TypeCode.Empty: return DBNull.Value; case TypeCode.DateTime: return DateTime.MinValue; case TypeCode.Byte: case TypeCode.Char: case TypeCode.Decimal: case TypeCode.Double: case TypeCode.Int16: case TypeCode.Int32: case TypeCode.Int64: case TypeCode.SByte: case TypeCode.Single: case TypeCode.UInt16: case TypeCode.UInt32: case TypeCode.UInt64: return 0; case TypeCode.String: return String.Empty; default: break; } return DBNull.Value; }
private void FieldItemPropertyChange(FieldItem fieldItem) { bool isEnable = true; if (fieldItem != null) { tbColumnCaption.Text = fieldItem.Caption; cbCaptionAlignment.SelectedItem = fieldItem.CaptionAlignment; cbColumnAlignment.SelectedItem = fieldItem.ColumnAlignment; mtbWidth.Text = fieldItem.Width.ToString(); cbFieldItemNewLine.Checked = fieldItem.NewLine; cbSuppressIfDuplicated.Checked = fieldItem.SuppressIfDuplicated; mtbNewLinePosition.Text = fieldItem.NewLinePostion.ToString(); mtbFieldCells.Text = fieldItem.Cells.ToString(); cbOrderType.SelectedValue = fieldItem.Order; cbGroupType.SelectedItem = fieldItem.Group; tbGroupTotalCaption.Text = fieldItem.GroupTotalCaption; cbSumType.SelectedItem = fieldItem.Sum; tbTotalCaption.Text = fieldItem.TotalCaption; isEnable = true; } else { tbColumnCaption.Text = String.Empty; cbCaptionAlignment.SelectedIndex = 0; cbColumnAlignment.SelectedIndex = 0; mtbWidth.Text = String.Empty; cbFieldItemNewLine.Checked = false; cbSuppressIfDuplicated.Checked = false; mtbNewLinePosition.Text = String.Empty; mtbFieldCells.Text = string.Empty; cbOrderType.SelectedIndex = 0; cbGroupType.SelectedIndex = 0; tbGroupTotalCaption.Text = string.Empty; cbSumType.SelectedIndex = 0; tbTotalCaption.Text = string.Empty; isEnable = false; } tbColumnCaption.Enabled = isEnable; cbCaptionAlignment.Enabled = isEnable; cbColumnAlignment.Enabled = isEnable; mtbWidth.Enabled = isEnable; cbFieldItemNewLine.Enabled = isEnable; cbSuppressIfDuplicated.Enabled = isEnable; mtbNewLinePosition.Enabled = isEnable; mtbFieldCells.Enabled = isEnable; cbOrderType.Enabled = isEnable; cbGroupType.Enabled = isEnable; tbGroupTotalCaption.Enabled = isEnable; cbSumType.Enabled = isEnable; tbTotalCaption.Enabled = isEnable; }
// Generates content of pivotTablePart3. private void GeneratePivotTablePart3Content(PivotTablePart pivotTablePart3) { PivotTableDefinition pivotTableDefinition5 = new PivotTableDefinition(){ Name = "PivotTable1", CacheId = (UInt32Value)1U, ApplyNumberFormats = false, ApplyBorderFormats = false, ApplyFontFormats = false, ApplyPatternFormats = false, ApplyAlignmentFormats = false, ApplyWidthHeightFormats = true, DataCaption = "Values", UpdatedVersion = 5, MinRefreshableVersion = 5, UseAutoFormatting = true, ItemPrintTitles = true, CreatedVersion = 4, Indent = (UInt32Value)0U, Outline = true, OutlineData = true, MultipleFieldFilters = false, ChartFormat = (UInt32Value)13U }; Location location3 = new Location(){ Reference = "A1:B5", FirstHeaderRow = (UInt32Value)1U, FirstDataRow = (UInt32Value)1U, FirstDataColumn = (UInt32Value)1U }; PivotFields pivotFields3 = new PivotFields(){ Count = (UInt32Value)7U }; PivotField pivotField14 = new PivotField(){ NumberFormatId = (UInt32Value)14U, ShowAll = false }; Items items7 = new Items(){ Count = (UInt32Value)15U }; Item item54 = new Item(){ Index = (UInt32Value)0U }; Item item55 = new Item(){ Index = (UInt32Value)1U }; Item item56 = new Item(){ Index = (UInt32Value)2U }; Item item57 = new Item(){ Index = (UInt32Value)3U }; Item item58 = new Item(){ Index = (UInt32Value)4U }; Item item59 = new Item(){ Index = (UInt32Value)5U }; Item item60 = new Item(){ Index = (UInt32Value)6U }; Item item61 = new Item(){ Index = (UInt32Value)7U }; Item item62 = new Item(){ Index = (UInt32Value)8U }; Item item63 = new Item(){ Index = (UInt32Value)9U }; Item item64 = new Item(){ Index = (UInt32Value)10U }; Item item65 = new Item(){ Index = (UInt32Value)11U }; Item item66 = new Item(){ Index = (UInt32Value)12U }; Item item67 = new Item(){ Index = (UInt32Value)13U }; Item item68 = new Item(){ ItemType = ItemValues.Default }; items7.Append(item54); items7.Append(item55); items7.Append(item56); items7.Append(item57); items7.Append(item58); items7.Append(item59); items7.Append(item60); items7.Append(item61); items7.Append(item62); items7.Append(item63); items7.Append(item64); items7.Append(item65); items7.Append(item66); items7.Append(item67); items7.Append(item68); pivotField14.Append(items7); PivotField pivotField15 = new PivotField(){ Axis = PivotTableAxisValues.AxisRow, ShowAll = false }; Items items8 = new Items(){ Count = (UInt32Value)11U }; Item item69 = new Item(){ Index = (UInt32Value)0U }; Item item70 = new Item(){ Missing = true, Index = (UInt32Value)4U }; Item item71 = new Item(){ Missing = true, Index = (UInt32Value)3U }; Item item72 = new Item(){ Index = (UInt32Value)1U }; Item item73 = new Item(){ Index = (UInt32Value)2U }; Item item74 = new Item(){ Missing = true, Index = (UInt32Value)9U }; Item item75 = new Item(){ Missing = true, Index = (UInt32Value)8U }; Item item76 = new Item(){ Missing = true, Index = (UInt32Value)7U }; Item item77 = new Item(){ Missing = true, Index = (UInt32Value)6U }; Item item78 = new Item(){ Missing = true, Index = (UInt32Value)5U }; Item item79 = new Item(){ ItemType = ItemValues.Default }; items8.Append(item69); items8.Append(item70); items8.Append(item71); items8.Append(item72); items8.Append(item73); items8.Append(item74); items8.Append(item75); items8.Append(item76); items8.Append(item77); items8.Append(item78); items8.Append(item79); pivotField15.Append(items8); PivotField pivotField16 = new PivotField(){ DataField = true, ShowAll = false }; PivotField pivotField17 = new PivotField(){ ShowAll = false }; PivotField pivotField18 = new PivotField(){ NumberFormatId = (UInt32Value)14U, ShowAll = false }; Items items9 = new Items(){ Count = (UInt32Value)5U }; Item item80 = new Item(){ Index = (UInt32Value)0U }; Item item81 = new Item(){ Index = (UInt32Value)1U }; Item item82 = new Item(){ Index = (UInt32Value)3U }; Item item83 = new Item(){ Index = (UInt32Value)2U }; Item item84 = new Item(){ ItemType = ItemValues.Default }; items9.Append(item80); items9.Append(item81); items9.Append(item82); items9.Append(item83); items9.Append(item84); pivotField18.Append(items9); PivotField pivotField19 = new PivotField(){ ShowAll = false }; PivotField pivotField20 = new PivotField(){ ShowAll = false, DefaultSubtotal = false }; Items items10 = new Items(){ Count = (UInt32Value)5U }; Item item85 = new Item(){ Index = (UInt32Value)0U }; Item item86 = new Item(){ Index = (UInt32Value)1U }; Item item87 = new Item(){ Index = (UInt32Value)2U }; Item item88 = new Item(){ Index = (UInt32Value)3U }; Item item89 = new Item(){ Index = (UInt32Value)4U }; items10.Append(item85); items10.Append(item86); items10.Append(item87); items10.Append(item88); items10.Append(item89); pivotField20.Append(items10); pivotFields3.Append(pivotField14); pivotFields3.Append(pivotField15); pivotFields3.Append(pivotField16); pivotFields3.Append(pivotField17); pivotFields3.Append(pivotField18); pivotFields3.Append(pivotField19); pivotFields3.Append(pivotField20); RowFields rowFields3 = new RowFields(){ Count = (UInt32Value)1U }; Field field3 = new Field(){ Index = 1 }; rowFields3.Append(field3); RowItems rowItems3 = new RowItems(){ Count = (UInt32Value)4U }; RowItem rowItem11 = new RowItem(); MemberPropertyIndex memberPropertyIndex9 = new MemberPropertyIndex(); rowItem11.Append(memberPropertyIndex9); RowItem rowItem12 = new RowItem(); MemberPropertyIndex memberPropertyIndex10 = new MemberPropertyIndex(){ Val = 3 }; rowItem12.Append(memberPropertyIndex10); RowItem rowItem13 = new RowItem(); MemberPropertyIndex memberPropertyIndex11 = new MemberPropertyIndex(){ Val = 4 }; rowItem13.Append(memberPropertyIndex11); RowItem rowItem14 = new RowItem(){ ItemType = ItemValues.Grand }; MemberPropertyIndex memberPropertyIndex12 = new MemberPropertyIndex(); rowItem14.Append(memberPropertyIndex12); rowItems3.Append(rowItem11); rowItems3.Append(rowItem12); rowItems3.Append(rowItem13); rowItems3.Append(rowItem14); ColumnItems columnItems3 = new ColumnItems(){ Count = (UInt32Value)1U }; RowItem rowItem15 = new RowItem(); columnItems3.Append(rowItem15); DataFields dataFields3 = new DataFields(){ Count = (UInt32Value)1U }; DataField dataField3 = new DataField(){ Name = "Sum of Quantity", Field = (UInt32Value)2U, BaseField = 0, BaseItem = (UInt32Value)0U }; dataFields3.Append(dataField3); ChartFormats chartFormats3 = new ChartFormats(){ Count = (UInt32Value)9U }; ChartFormat chartFormat14 = new ChartFormat(){ Chart = (UInt32Value)4U, Format = (UInt32Value)0U, Series = true }; PivotArea pivotArea14 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences14 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference14 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem36 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference14.Append(fieldItem36); pivotAreaReferences14.Append(pivotAreaReference14); pivotArea14.Append(pivotAreaReferences14); chartFormat14.Append(pivotArea14); ChartFormat chartFormat15 = new ChartFormat(){ Chart = (UInt32Value)5U, Format = (UInt32Value)2U, Series = true }; PivotArea pivotArea15 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences15 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference15 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem37 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference15.Append(fieldItem37); pivotAreaReferences15.Append(pivotAreaReference15); pivotArea15.Append(pivotAreaReferences15); chartFormat15.Append(pivotArea15); ChartFormat chartFormat16 = new ChartFormat(){ Chart = (UInt32Value)6U, Format = (UInt32Value)0U, Series = true }; PivotArea pivotArea16 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences16 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference16 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem38 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference16.Append(fieldItem38); pivotAreaReferences16.Append(pivotAreaReference16); pivotArea16.Append(pivotAreaReferences16); chartFormat16.Append(pivotArea16); ChartFormat chartFormat17 = new ChartFormat(){ Chart = (UInt32Value)7U, Format = (UInt32Value)14U, Series = true }; PivotArea pivotArea17 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences17 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference17 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem39 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference17.Append(fieldItem39); pivotAreaReferences17.Append(pivotAreaReference17); pivotArea17.Append(pivotAreaReferences17); chartFormat17.Append(pivotArea17); ChartFormat chartFormat18 = new ChartFormat(){ Chart = (UInt32Value)8U, Format = (UInt32Value)1U, Series = true }; PivotArea pivotArea18 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences18 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference18 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem40 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference18.Append(fieldItem40); pivotAreaReferences18.Append(pivotAreaReference18); pivotArea18.Append(pivotAreaReferences18); chartFormat18.Append(pivotArea18); ChartFormat chartFormat19 = new ChartFormat(){ Chart = (UInt32Value)9U, Format = (UInt32Value)15U, Series = true }; PivotArea pivotArea19 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences19 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference19 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem41 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference19.Append(fieldItem41); pivotAreaReferences19.Append(pivotAreaReference19); pivotArea19.Append(pivotAreaReferences19); chartFormat19.Append(pivotArea19); ChartFormat chartFormat20 = new ChartFormat(){ Chart = (UInt32Value)10U, Format = (UInt32Value)2U, Series = true }; PivotArea pivotArea20 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences20 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference20 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem42 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference20.Append(fieldItem42); pivotAreaReferences20.Append(pivotAreaReference20); pivotArea20.Append(pivotAreaReferences20); chartFormat20.Append(pivotArea20); ChartFormat chartFormat21 = new ChartFormat(){ Chart = (UInt32Value)11U, Format = (UInt32Value)16U, Series = true }; PivotArea pivotArea21 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences21 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference21 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem43 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference21.Append(fieldItem43); pivotAreaReferences21.Append(pivotAreaReference21); pivotArea21.Append(pivotAreaReferences21); chartFormat21.Append(pivotArea21); ChartFormat chartFormat22 = new ChartFormat(){ Chart = (UInt32Value)12U, Format = (UInt32Value)3U, Series = true }; PivotArea pivotArea22 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences22 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference22 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem44 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference22.Append(fieldItem44); pivotAreaReferences22.Append(pivotAreaReference22); pivotArea22.Append(pivotAreaReferences22); chartFormat22.Append(pivotArea22); chartFormats3.Append(chartFormat14); chartFormats3.Append(chartFormat15); chartFormats3.Append(chartFormat16); chartFormats3.Append(chartFormat17); chartFormats3.Append(chartFormat18); chartFormats3.Append(chartFormat19); chartFormats3.Append(chartFormat20); chartFormats3.Append(chartFormat21); chartFormats3.Append(chartFormat22); PivotTableStyle pivotTableStyle3 = new PivotTableStyle(){ Name = "PivotStyleLight16", ShowRowHeaders = true, ShowColumnHeaders = true, ShowRowStripes = false, ShowColumnStripes = false, ShowLastColumn = true }; PivotTableDefinitionExtensionList pivotTableDefinitionExtensionList3 = new PivotTableDefinitionExtensionList(); PivotTableDefinitionExtension pivotTableDefinitionExtension3 = new PivotTableDefinitionExtension(){ Uri = "{962EF5D1-5CA2-4c93-8EF4-DBF5C05439D2}" }; pivotTableDefinitionExtension3.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); X14.PivotTableDefinition pivotTableDefinition6 = new X14.PivotTableDefinition(){ HideValuesRow = true }; pivotTableDefinition6.AddNamespaceDeclaration("xm", "http://schemas.microsoft.com/office/excel/2006/main"); pivotTableDefinitionExtension3.Append(pivotTableDefinition6); pivotTableDefinitionExtensionList3.Append(pivotTableDefinitionExtension3); pivotTableDefinition5.Append(location3); pivotTableDefinition5.Append(pivotFields3); pivotTableDefinition5.Append(rowFields3); pivotTableDefinition5.Append(rowItems3); pivotTableDefinition5.Append(columnItems3); pivotTableDefinition5.Append(dataFields3); pivotTableDefinition5.Append(chartFormats3); pivotTableDefinition5.Append(pivotTableStyle3); pivotTableDefinition5.Append(pivotTableDefinitionExtensionList3); pivotTablePart3.PivotTableDefinition = pivotTableDefinition5; }
public void Group(PointInfo startPoint, PointInfo endPoint, FieldItem.SumType sumType, int groupIndex, int[] subTotalList) { #region Variable Definition object[] cell = null; object startCell = null; object endCell = null; #endregion cell = this.ConvertPointToCell(startPoint, endPoint); startCell = cell[0]; endCell = cell[1]; CurSheet.get_Range(startCell, endCell).Subtotal(groupIndex, GetExcelSumType(sumType), subTotalList, true, false, XlSummaryRow.xlSummaryBelow); }
private void btAdd_Click(object sender, EventArgs e) { if (lbxFieldItems.SelectedIndex != -1) { List<FieldItem> list = new List<FieldItem>(); foreach (DataRowView rowView in lbxFieldItems.SelectedItems) { FieldItem field = new FieldItem(); field.ColumnName = rowView.Row["FIELD_NAME"].ToString(); field.Caption = rowView.Row["CAPTION"].ToString(); list.Add(field); } foreach (FieldItem field in list) { AddFieldItem(field); } } }
// Generates content of pivotTableCacheRecordsPart1. private void GeneratePivotTableCacheRecordsPart1Content(PivotTableCacheRecordsPart pivotTableCacheRecordsPart1) { PivotCacheRecords pivotCacheRecords1 = new PivotCacheRecords() { Count = (UInt32Value)3U }; PivotCacheRecord pivotCacheRecord1 = new PivotCacheRecord(); FieldItem fieldItem1 = new FieldItem() { Val = (UInt32Value)0U }; NumberItem numberItem4 = new NumberItem() { Val = 100D }; pivotCacheRecord1.Append(fieldItem1); pivotCacheRecord1.Append(numberItem4); PivotCacheRecord pivotCacheRecord2 = new PivotCacheRecord(); FieldItem fieldItem2 = new FieldItem() { Val = (UInt32Value)1U }; NumberItem numberItem5 = new NumberItem() { Val = 120D }; pivotCacheRecord2.Append(fieldItem2); pivotCacheRecord2.Append(numberItem5); PivotCacheRecord pivotCacheRecord3 = new PivotCacheRecord(); FieldItem fieldItem3 = new FieldItem() { Val = (UInt32Value)2U }; NumberItem numberItem6 = new NumberItem() { Val = 132D }; pivotCacheRecord3.Append(fieldItem3); pivotCacheRecord3.Append(numberItem6); pivotCacheRecords1.Append(pivotCacheRecord1); pivotCacheRecords1.Append(pivotCacheRecord2); pivotCacheRecords1.Append(pivotCacheRecord3); pivotTableCacheRecordsPart1.PivotCacheRecords = pivotCacheRecords1; }
public FieldItem Copy() { FieldItem fieldItem = new FieldItem(); fieldItem.Caption = this.Caption; fieldItem.CaptionAlignment = this.CaptionAlignment; fieldItem.Cells = this.Cells; fieldItem.ColumnAlignment = this.ColumnAlignment; fieldItem.ColumnName = this.ColumnName; fieldItem.Format = this.Format; fieldItem.Group = this.Group; fieldItem.GroupTotalCaption = this.GroupTotalCaption; fieldItem.NewLine = this.NewLine; fieldItem.NewLinePostion = this.NewLinePostion; fieldItem.Order = this.Order; fieldItem.Sum = this.Sum; fieldItem.SuppressIfDuplicated = this.SuppressIfDuplicated; fieldItem.TotalCaption = this.TotalCaption; fieldItem.Width = this.Width; return fieldItem; }
private void OnClickTemplatize(object source, LinkLabelLinkClickedEventArgs e) { if (this._propChangesPending) { this.SaveFieldProperties(); } TemplateField templateField = this._currentFieldItem.GetTemplateField(this.Control); TemplateFieldItem item = new TemplateFieldItem(this, templateField); item.LoadFieldInfo(); this._selFieldsList.Items[this._currentFieldItem.Index] = item; this._currentFieldItem = item; this._currentFieldItem.Selected = true; this.UpdateEnabledVisibleState(); }
public void Insert(int index, FieldItem item) { if (item != null) { item.SetCollection(this); } list.Insert(index, item); }
public void Remove(FieldItem item) { if (item != null) { item.SetCollection(null); } list.Remove(item); }
public int IndexOf(FieldItem item) { return list.IndexOf(item); }
public bool Contains(FieldItem item) { return list.Contains(item); }
/// <summary> /// Add a field item to collection /// </summary> /// <param name="item">field item</param> /// <returns>index of item</returns> public int Add(FieldItem item) { if (item != null) { item.SetCollection(this); } return list.Add(item); }
private void OnClickDeleteField(object source, EventArgs e) { int index = this._currentFieldItem.Index; int num2 = -1; int count = this._selFieldsList.Items.Count; if (count > 1) { if (index == (count - 1)) { num2 = index - 1; } else { num2 = index; } } this._propChangesPending = false; this._currentFieldItem.Remove(); this._currentFieldItem = null; if (num2 != -1) { this._currentFieldItem = (FieldItem) this._selFieldsList.Items[num2]; this._currentFieldItem.Selected = true; this._currentFieldItem.EnsureVisible(); this._deleteFieldButton.Focus(); } this.UpdateEnabledVisibleState(); }
// Generates content of pivotTableCacheRecordsPart1. private void GeneratePivotTableCacheRecordsPart1Content(PivotTableCacheRecordsPart pivotTableCacheRecordsPart1) { PivotCacheRecords pivotCacheRecords1 = new PivotCacheRecords(){ Count = (UInt32Value)4U }; pivotCacheRecords1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); PivotCacheRecord pivotCacheRecord1 = new PivotCacheRecord(); FieldItem fieldItem12 = new FieldItem(){ Val = (UInt32Value)0U }; FieldItem fieldItem13 = new FieldItem(){ Val = (UInt32Value)0U }; NumberItem numberItem1 = new NumberItem(){ Val = 19D }; NumberItem numberItem2 = new NumberItem(){ Val = 2375D }; FieldItem fieldItem14 = new FieldItem(){ Val = (UInt32Value)0U }; StringItem stringItem30 = new StringItem(){ Val = "sales staff G" }; pivotCacheRecord1.Append(fieldItem12); pivotCacheRecord1.Append(fieldItem13); pivotCacheRecord1.Append(numberItem1); pivotCacheRecord1.Append(numberItem2); pivotCacheRecord1.Append(fieldItem14); pivotCacheRecord1.Append(stringItem30); PivotCacheRecord pivotCacheRecord2 = new PivotCacheRecord(); FieldItem fieldItem15 = new FieldItem(){ Val = (UInt32Value)1U }; FieldItem fieldItem16 = new FieldItem(){ Val = (UInt32Value)1U }; NumberItem numberItem3 = new NumberItem(){ Val = 13D }; NumberItem numberItem4 = new NumberItem(){ Val = 15990D }; FieldItem fieldItem17 = new FieldItem(){ Val = (UInt32Value)1U }; StringItem stringItem31 = new StringItem(){ Val = "sales staff B" }; pivotCacheRecord2.Append(fieldItem15); pivotCacheRecord2.Append(fieldItem16); pivotCacheRecord2.Append(numberItem3); pivotCacheRecord2.Append(numberItem4); pivotCacheRecord2.Append(fieldItem17); pivotCacheRecord2.Append(stringItem31); PivotCacheRecord pivotCacheRecord3 = new PivotCacheRecord(); FieldItem fieldItem18 = new FieldItem(){ Val = (UInt32Value)2U }; FieldItem fieldItem19 = new FieldItem(){ Val = (UInt32Value)2U }; NumberItem numberItem5 = new NumberItem(){ Val = 4D }; NumberItem numberItem6 = new NumberItem(){ Val = 312D }; FieldItem fieldItem20 = new FieldItem(){ Val = (UInt32Value)2U }; StringItem stringItem32 = new StringItem(){ Val = "sales staff E" }; pivotCacheRecord3.Append(fieldItem18); pivotCacheRecord3.Append(fieldItem19); pivotCacheRecord3.Append(numberItem5); pivotCacheRecord3.Append(numberItem6); pivotCacheRecord3.Append(fieldItem20); pivotCacheRecord3.Append(stringItem32); PivotCacheRecord pivotCacheRecord4 = new PivotCacheRecord(); FieldItem fieldItem21 = new FieldItem(){ Val = (UInt32Value)3U }; FieldItem fieldItem22 = new FieldItem(){ Val = (UInt32Value)2U }; NumberItem numberItem7 = new NumberItem(){ Val = 29D }; NumberItem numberItem8 = new NumberItem(){ Val = 2262D }; FieldItem fieldItem23 = new FieldItem(){ Val = (UInt32Value)3U }; StringItem stringItem33 = new StringItem(){ Val = "sales staff E" }; pivotCacheRecord4.Append(fieldItem21); pivotCacheRecord4.Append(fieldItem22); pivotCacheRecord4.Append(numberItem7); pivotCacheRecord4.Append(numberItem8); pivotCacheRecord4.Append(fieldItem23); pivotCacheRecord4.Append(stringItem33); pivotCacheRecords1.Append(pivotCacheRecord1); pivotCacheRecords1.Append(pivotCacheRecord2); pivotCacheRecords1.Append(pivotCacheRecord3); pivotCacheRecords1.Append(pivotCacheRecord4); pivotTableCacheRecordsPart1.PivotCacheRecords = pivotCacheRecords1; }
private void OnClickMoveFieldUp(object source, EventArgs e) { this._fieldMovePending = true; int index = this._currentFieldItem.Index; ListViewItem item = this._selFieldsList.Items[index]; this._selFieldsList.Items.RemoveAt(index); this._selFieldsList.Items.Insert(index - 1, item); this._currentFieldItem = (FieldItem) this._selFieldsList.Items[index - 1]; this._currentFieldItem.Selected = true; this._currentFieldItem.EnsureVisible(); this.UpdateFieldPositionButtonsState(); this._fieldMovePending = false; }
// Generates content of pivotTablePart1. private void GeneratePivotTablePart1Content(PivotTablePart pivotTablePart1) { PivotTableDefinition pivotTableDefinition1 = new PivotTableDefinition(){ Name = "PivotTable1", CacheId = (UInt32Value)1U, ApplyNumberFormats = false, ApplyBorderFormats = false, ApplyFontFormats = false, ApplyPatternFormats = false, ApplyAlignmentFormats = false, ApplyWidthHeightFormats = true, DataCaption = "Values", UpdatedVersion = 5, MinRefreshableVersion = 5, UseAutoFormatting = true, ItemPrintTitles = true, CreatedVersion = 4, Indent = (UInt32Value)0U, Outline = true, OutlineData = true, MultipleFieldFilters = false, ChartFormat = (UInt32Value)15U }; Location location1 = new Location(){ Reference = "A1:B5", FirstHeaderRow = (UInt32Value)1U, FirstDataRow = (UInt32Value)1U, FirstDataColumn = (UInt32Value)1U }; PivotFields pivotFields1 = new PivotFields(){ Count = (UInt32Value)7U }; PivotField pivotField1 = new PivotField(){ NumberFormatId = (UInt32Value)14U, ShowAll = false }; Items items1 = new Items(){ Count = (UInt32Value)15U }; Item item1 = new Item(){ Index = (UInt32Value)0U }; Item item2 = new Item(){ Index = (UInt32Value)1U }; Item item3 = new Item(){ Index = (UInt32Value)2U }; Item item4 = new Item(){ Index = (UInt32Value)3U }; Item item5 = new Item(){ Index = (UInt32Value)4U }; Item item6 = new Item(){ Index = (UInt32Value)5U }; Item item7 = new Item(){ Index = (UInt32Value)6U }; Item item8 = new Item(){ Index = (UInt32Value)7U }; Item item9 = new Item(){ Index = (UInt32Value)8U }; Item item10 = new Item(){ Index = (UInt32Value)9U }; Item item11 = new Item(){ Index = (UInt32Value)10U }; Item item12 = new Item(){ Index = (UInt32Value)11U }; Item item13 = new Item(){ Index = (UInt32Value)12U }; Item item14 = new Item(){ Index = (UInt32Value)13U }; Item item15 = new Item(){ ItemType = ItemValues.Default }; items1.Append(item1); items1.Append(item2); items1.Append(item3); items1.Append(item4); items1.Append(item5); items1.Append(item6); items1.Append(item7); items1.Append(item8); items1.Append(item9); items1.Append(item10); items1.Append(item11); items1.Append(item12); items1.Append(item13); items1.Append(item14); items1.Append(item15); pivotField1.Append(items1); PivotField pivotField2 = new PivotField(){ Axis = PivotTableAxisValues.AxisRow, ShowAll = false }; Items items2 = new Items(){ Count = (UInt32Value)11U }; Item item16 = new Item(){ Index = (UInt32Value)0U }; Item item17 = new Item(){ Missing = true, Index = (UInt32Value)4U }; Item item18 = new Item(){ Missing = true, Index = (UInt32Value)3U }; Item item19 = new Item(){ Index = (UInt32Value)1U }; Item item20 = new Item(){ Index = (UInt32Value)2U }; Item item21 = new Item(){ Missing = true, Index = (UInt32Value)9U }; Item item22 = new Item(){ Missing = true, Index = (UInt32Value)8U }; Item item23 = new Item(){ Missing = true, Index = (UInt32Value)7U }; Item item24 = new Item(){ Missing = true, Index = (UInt32Value)6U }; Item item25 = new Item(){ Missing = true, Index = (UInt32Value)5U }; Item item26 = new Item(){ ItemType = ItemValues.Default }; items2.Append(item16); items2.Append(item17); items2.Append(item18); items2.Append(item19); items2.Append(item20); items2.Append(item21); items2.Append(item22); items2.Append(item23); items2.Append(item24); items2.Append(item25); items2.Append(item26); pivotField2.Append(items2); PivotField pivotField3 = new PivotField(){ DataField = true, ShowAll = false }; PivotField pivotField4 = new PivotField(){ ShowAll = false }; PivotField pivotField5 = new PivotField(){ NumberFormatId = (UInt32Value)14U, ShowAll = false }; Items items3 = new Items(){ Count = (UInt32Value)5U }; Item item27 = new Item(){ Index = (UInt32Value)0U }; Item item28 = new Item(){ Index = (UInt32Value)1U }; Item item29 = new Item(){ Index = (UInt32Value)3U }; Item item30 = new Item(){ Index = (UInt32Value)2U }; Item item31 = new Item(){ ItemType = ItemValues.Default }; items3.Append(item27); items3.Append(item28); items3.Append(item29); items3.Append(item30); items3.Append(item31); pivotField5.Append(items3); PivotField pivotField6 = new PivotField(){ ShowAll = false }; PivotField pivotField7 = new PivotField(){ ShowAll = false, DefaultSubtotal = false }; Items items4 = new Items(){ Count = (UInt32Value)5U }; Item item32 = new Item(){ Index = (UInt32Value)0U }; Item item33 = new Item(){ Index = (UInt32Value)1U }; Item item34 = new Item(){ Index = (UInt32Value)2U }; Item item35 = new Item(){ Index = (UInt32Value)3U }; Item item36 = new Item(){ Index = (UInt32Value)4U }; items4.Append(item32); items4.Append(item33); items4.Append(item34); items4.Append(item35); items4.Append(item36); pivotField7.Append(items4); pivotFields1.Append(pivotField1); pivotFields1.Append(pivotField2); pivotFields1.Append(pivotField3); pivotFields1.Append(pivotField4); pivotFields1.Append(pivotField5); pivotFields1.Append(pivotField6); pivotFields1.Append(pivotField7); RowFields rowFields1 = new RowFields(){ Count = (UInt32Value)1U }; Field field1 = new Field(){ Index = 1 }; rowFields1.Append(field1); RowItems rowItems1 = new RowItems(){ Count = (UInt32Value)4U }; RowItem rowItem1 = new RowItem(); MemberPropertyIndex memberPropertyIndex1 = new MemberPropertyIndex(); rowItem1.Append(memberPropertyIndex1); RowItem rowItem2 = new RowItem(); MemberPropertyIndex memberPropertyIndex2 = new MemberPropertyIndex(){ Val = 3 }; rowItem2.Append(memberPropertyIndex2); RowItem rowItem3 = new RowItem(); MemberPropertyIndex memberPropertyIndex3 = new MemberPropertyIndex(){ Val = 4 }; rowItem3.Append(memberPropertyIndex3); RowItem rowItem4 = new RowItem(){ ItemType = ItemValues.Grand }; MemberPropertyIndex memberPropertyIndex4 = new MemberPropertyIndex(); rowItem4.Append(memberPropertyIndex4); rowItems1.Append(rowItem1); rowItems1.Append(rowItem2); rowItems1.Append(rowItem3); rowItems1.Append(rowItem4); ColumnItems columnItems1 = new ColumnItems(){ Count = (UInt32Value)1U }; RowItem rowItem5 = new RowItem(); columnItems1.Append(rowItem5); DataFields dataFields1 = new DataFields(){ Count = (UInt32Value)1U }; DataField dataField1 = new DataField(){ Name = "Sum of Quantity", Field = (UInt32Value)2U, BaseField = 0, BaseItem = (UInt32Value)0U }; dataFields1.Append(dataField1); ChartFormats chartFormats1 = new ChartFormats(){ Count = (UInt32Value)11U }; ChartFormat chartFormat1 = new ChartFormat(){ Chart = (UInt32Value)4U, Format = (UInt32Value)0U, Series = true }; PivotArea pivotArea1 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences1 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference1 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem1 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference1.Append(fieldItem1); pivotAreaReferences1.Append(pivotAreaReference1); pivotArea1.Append(pivotAreaReferences1); chartFormat1.Append(pivotArea1); ChartFormat chartFormat2 = new ChartFormat(){ Chart = (UInt32Value)5U, Format = (UInt32Value)2U, Series = true }; PivotArea pivotArea2 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences2 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference2 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem2 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference2.Append(fieldItem2); pivotAreaReferences2.Append(pivotAreaReference2); pivotArea2.Append(pivotAreaReferences2); chartFormat2.Append(pivotArea2); ChartFormat chartFormat3 = new ChartFormat(){ Chart = (UInt32Value)6U, Format = (UInt32Value)0U, Series = true }; PivotArea pivotArea3 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences3 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference3 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem3 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference3.Append(fieldItem3); pivotAreaReferences3.Append(pivotAreaReference3); pivotArea3.Append(pivotAreaReferences3); chartFormat3.Append(pivotArea3); ChartFormat chartFormat4 = new ChartFormat(){ Chart = (UInt32Value)7U, Format = (UInt32Value)14U, Series = true }; PivotArea pivotArea4 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences4 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference4 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem4 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference4.Append(fieldItem4); pivotAreaReferences4.Append(pivotAreaReference4); pivotArea4.Append(pivotAreaReferences4); chartFormat4.Append(pivotArea4); ChartFormat chartFormat5 = new ChartFormat(){ Chart = (UInt32Value)8U, Format = (UInt32Value)1U, Series = true }; PivotArea pivotArea5 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences5 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference5 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem5 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference5.Append(fieldItem5); pivotAreaReferences5.Append(pivotAreaReference5); pivotArea5.Append(pivotAreaReferences5); chartFormat5.Append(pivotArea5); ChartFormat chartFormat6 = new ChartFormat(){ Chart = (UInt32Value)9U, Format = (UInt32Value)15U, Series = true }; PivotArea pivotArea6 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences6 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference6 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem6 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference6.Append(fieldItem6); pivotAreaReferences6.Append(pivotAreaReference6); pivotArea6.Append(pivotAreaReferences6); chartFormat6.Append(pivotArea6); ChartFormat chartFormat7 = new ChartFormat(){ Chart = (UInt32Value)10U, Format = (UInt32Value)2U, Series = true }; PivotArea pivotArea7 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences7 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference7 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem7 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference7.Append(fieldItem7); pivotAreaReferences7.Append(pivotAreaReference7); pivotArea7.Append(pivotAreaReferences7); chartFormat7.Append(pivotArea7); ChartFormat chartFormat8 = new ChartFormat(){ Chart = (UInt32Value)11U, Format = (UInt32Value)16U, Series = true }; PivotArea pivotArea8 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences8 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference8 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem8 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference8.Append(fieldItem8); pivotAreaReferences8.Append(pivotAreaReference8); pivotArea8.Append(pivotAreaReferences8); chartFormat8.Append(pivotArea8); ChartFormat chartFormat9 = new ChartFormat(){ Chart = (UInt32Value)12U, Format = (UInt32Value)3U, Series = true }; PivotArea pivotArea9 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences9 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference9 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem9 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference9.Append(fieldItem9); pivotAreaReferences9.Append(pivotAreaReference9); pivotArea9.Append(pivotAreaReferences9); chartFormat9.Append(pivotArea9); ChartFormat chartFormat10 = new ChartFormat(){ Chart = (UInt32Value)13U, Format = (UInt32Value)17U, Series = true }; PivotArea pivotArea10 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences10 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference10 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem10 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference10.Append(fieldItem10); pivotAreaReferences10.Append(pivotAreaReference10); pivotArea10.Append(pivotAreaReferences10); chartFormat10.Append(pivotArea10); ChartFormat chartFormat11 = new ChartFormat(){ Chart = (UInt32Value)14U, Format = (UInt32Value)4U, Series = true }; PivotArea pivotArea11 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences11 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference11 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem11 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference11.Append(fieldItem11); pivotAreaReferences11.Append(pivotAreaReference11); pivotArea11.Append(pivotAreaReferences11); chartFormat11.Append(pivotArea11); chartFormats1.Append(chartFormat1); chartFormats1.Append(chartFormat2); chartFormats1.Append(chartFormat3); chartFormats1.Append(chartFormat4); chartFormats1.Append(chartFormat5); chartFormats1.Append(chartFormat6); chartFormats1.Append(chartFormat7); chartFormats1.Append(chartFormat8); chartFormats1.Append(chartFormat9); chartFormats1.Append(chartFormat10); chartFormats1.Append(chartFormat11); PivotTableStyle pivotTableStyle1 = new PivotTableStyle(){ Name = "PivotStyleLight16", ShowRowHeaders = true, ShowColumnHeaders = true, ShowRowStripes = false, ShowColumnStripes = false, ShowLastColumn = true }; PivotTableDefinitionExtensionList pivotTableDefinitionExtensionList1 = new PivotTableDefinitionExtensionList(); PivotTableDefinitionExtension pivotTableDefinitionExtension1 = new PivotTableDefinitionExtension(){ Uri = "{962EF5D1-5CA2-4c93-8EF4-DBF5C05439D2}" }; pivotTableDefinitionExtension1.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); X14.PivotTableDefinition pivotTableDefinition2 = new X14.PivotTableDefinition(){ HideValuesRow = true }; pivotTableDefinition2.AddNamespaceDeclaration("xm", "http://schemas.microsoft.com/office/excel/2006/main"); pivotTableDefinitionExtension1.Append(pivotTableDefinition2); pivotTableDefinitionExtensionList1.Append(pivotTableDefinitionExtension1); pivotTableDefinition1.Append(location1); pivotTableDefinition1.Append(pivotFields1); pivotTableDefinition1.Append(rowFields1); pivotTableDefinition1.Append(rowItems1); pivotTableDefinition1.Append(columnItems1); pivotTableDefinition1.Append(dataFields1); pivotTableDefinition1.Append(chartFormats1); pivotTableDefinition1.Append(pivotTableStyle1); pivotTableDefinition1.Append(pivotTableDefinitionExtensionList1); pivotTablePart1.PivotTableDefinition = pivotTableDefinition1; }
private void OnSelIndexChangedSelFieldsList(object source, EventArgs e) { if (!this._fieldMovePending) { if (this._propChangesPending) { this.SaveFieldProperties(); } if (this._selFieldsList.SelectedItems.Count == 0) { this._currentFieldItem = null; } else { this._currentFieldItem = (FieldItem) this._selFieldsList.SelectedItems[0]; } this.SetFieldPropertyHeader(); this.UpdateEnabledVisibleState(); } }
/// <summary> /// Send the GroupType of a FieldItem object to PiEMOS. /// Populates two indices of FeedbackDigitalVals. /// </summary> /// <param name="item">the FieldItem to send infotmaion about</param> /// <param name="index1">first index to use</param> /// <param name="index2">second index to use</param> private void ReportFieldItemType(FieldItem item, int index1 = 6, int index2 = 7) { bool feedback1; bool feedback2; if (item == null) { feedback1 = false; feedback2 = false; } else if (item.GroupType == FieldItem.PlusOneBox) { feedback1 = true; feedback2 = false; } else if (item.GroupType == FieldItem.TimesTwoBox) { feedback1 = true; feedback2 = true; } else { feedback1 = false; feedback2 = true; } this.robot.FeedbackDigitalVals[index1] = feedback1; this.robot.FeedbackDigitalVals[index2] = feedback2; }
void CreateConsumableItem() { if (RandomTool.IsIn(objectStage.ConsumableDropChance)) { int tier = objectStage.ConsumableDropTier; FieldItem instance = new FieldItem(this, itemDropManager.DropItem(tier)); CreateChild(instance, PosX + 1, 0); } }
/// <summary>平均值</summary> /// <param name="field">字段</param> /// <param name="newName">聚合后as的新名称,默认空,表示跟前面字段名一致</param> /// <returns></returns> public static ConcatExpression Avg(this FieldItem field, String newName = null) => Aggregate(field, "Avg", newName);
public override void CaseAFieldLvalue(AFieldLvalue node) { Item currentFile = GetIncludeItem(node); //If the field is in a moved field, refference that field instead if (Util.GetAncestor<AFieldDecl>(node) != null) { Item i = allItems.OfType<FieldItem>().FirstOrDefault(item => item.FieldDecl == Util.GetAncestor<AFieldDecl>(node)); if (i != null) currentFile = i; } AFieldDecl decl = finalTrans.data.FieldLinks[node]; Item declItem = ((Item) allItems.OfType<FieldItem>().FirstOrDefault(item => item.FieldDecl == decl)) ?? allItems.OfType<IncludeItem>().First( item => item.Current == Util.GetAncestor<AASourceFile>(decl)); List<Item> cPath = currentFile.Path; List<Item> dPath = declItem.Path; bool movedIt = false; for (int i = 0; i < Math.Min(cPath.Count, dPath.Count); i++) { if (cPath[i] != dPath[i]) { //We have a fork. make sure that the field is visible int cI = cPath[i - 1].Children.IndexOf(cPath[i]); int dI = dPath[i - 1].Children.IndexOf(dPath[i]); if (dI < cI) {//The decl is okay break; } //Move the decl up if (declItem is FieldItem) { declItem.Parent.Children.Remove(declItem); declItem.Parent = cPath[i - 1]; } else { declItem = new FieldItem(decl, cPath[i - 1], new List<Item>()); allItems.Add(declItem); } cPath[i - 1].Children.Insert(cI, declItem); movedIt = true; break; } if (i == cPath.Count - 1) { if (i == dPath.Count - 1) { //The decl and use is in same file. Ensure that the decl is before if (Util.TokenLessThan(decl.GetName(), node.GetName())) break; //Add the decl item declItem = new FieldItem(decl, cPath[i], new List<Item>()); allItems.Add(declItem); cPath[i].Children.Add(declItem); movedIt = true; break; } else { //The decl is included here or somewhere deeper. But above the use break; } } else if (i == dPath.Count - 1) { //We have reached the file where the decl is, but the use is included deeper, so it is above. Insert decl int cI = cPath[i].Children.IndexOf(cPath[i + 1]); declItem = new FieldItem(decl, cPath[i], new List<Item>()); allItems.Add(declItem); cPath[i].Children.Insert(cI, declItem); movedIt = true; break; } } //In case we have a struct type field, we must make sure the struct is still on top if (movedIt) CaseAFieldDecl(decl); base.CaseAFieldLvalue(node); }
/// <summary>查找字段对应的控件</summary> /// <param name="field">字段</param> /// <returns></returns> protected virtual Control FindControlByField(FieldItem field) { return(FindControl(FormItemPrefix + field.Name)); }
private void DeleteFieldItem(FieldItem field) { lbxSelectedFieldItems.Items.Remove(field); for (int i = 0; i < dtField.Rows.Count; i++) { if (dtField.Rows[i].RowState == DataRowState.Deleted) { if (dtField.Rows[i]["FIELD_NAME", DataRowVersion.Original].Equals(field.ColumnName)) { dtField.Rows[i].RejectChanges(); } } } }
private XlConsolidationFunction GetExcelSumType(FieldItem.SumType sumType) { XlConsolidationFunction excelSumType = XlConsolidationFunction.xlUnknown; switch (sumType) { case FieldItem.SumType.None: excelSumType = XlConsolidationFunction.xlUnknown; break; case FieldItem.SumType.Sum: excelSumType = XlConsolidationFunction.xlSum; break; case FieldItem.SumType.Count: excelSumType = XlConsolidationFunction.xlCount; break; case FieldItem.SumType.Max: excelSumType = XlConsolidationFunction.xlMax; break; case FieldItem.SumType.Min: excelSumType = XlConsolidationFunction.xlMin; break; case FieldItem.SumType.Average: excelSumType = XlConsolidationFunction.xlAverage; break; } return excelSumType; }
/// <summary> /// 初始化窗体 /// </summary> private void InitForm() { FieldItem FIdentity = null; if (ExtGrid == null) { return; } ExtGrid.Title = Entity <TEntity> .Meta.Table.Description; foreach (FieldItem item in InitFields(Entity <TEntity> .Meta.Fields)) { if (item.IsIdentity) { FIdentity = item; } ExtAspNet.BoundField boundField1 = new ExtAspNet.BoundField(); //boundField1.DataToolTipField = item.Name; boundField1.DataField = item.Name; boundField1.DataFormatString = "{0}"; boundField1.HeaderText = item.Description; ExtGrid.Columns.Add(boundField1); } #region 编辑操作 if (Acquire(PermissionFlags.Update)) { if (FIdentity != null) { ExtAspNet.WindowField WindowField1 = new ExtAspNet.WindowField(); // <ext:WindowField Text="编辑" WindowID="Window1" Title="编辑" DataIFrameUrlFields="Id" // DataIFrameUrlFormatString="~/admin/menu_edit.aspx?id={0}" Width="50px" /> WindowField1.Text = "编辑"; WindowField1.Title = "编辑"; WindowField1.HeaderText = "编辑"; WindowField1.WindowID = "Window1"; WindowField1.DataIFrameUrlFormatString = EditIFrameUrlFormatString; WindowField1.Width = 50; WindowField1.DataIFrameUrlFields = FIdentity.Name; ExtGrid.Columns.Add(WindowField1); } } #endregion #region 除操作 if (Acquire(PermissionFlags.Delete)) { LinkButtonField DelField = new LinkButtonField(); DelField.Text = "删除"; DelField.ConfirmIcon = MessageBoxIcon.Question; DelField.ConfirmText = "确定删除此" + Entity <TEntity> .Meta.Table.Description + "?"; DelField.ConfirmTarget = Target.Top; DelField.HeaderText = "删除"; DelField.CommandName = "Delete"; DelField.Width = 50; ExtGrid.Columns.Add(DelField); } #endregion if (FIdentity != null) { ExtGrid.DataKeyNames = new String[] { FIdentity.Name } } ; BindGrid(); }
private static void BuildUser(FieldItem item, StringBuilder sb) => sb.AppendFormat(@"<td class=""text-right"">@provider.FindByID(entity.{0})</td>", item.Name);
/// <summary>sumCase子句,计算大于某个值的数量</summary> /// <param name="field">字段</param> /// <param name="value">值</param> /// <param name="newName">聚合后as的新名称</param> /// <returns></returns> public static FormatExpression SumLarge(this FieldItem field, Object value, String newName) => new FormatExpression(field, "sum(case when {0}>{1} then 1 else 0 end) " + newName, value);
// Generates content of pivotTableCacheRecordsPart2. private void GeneratePivotTableCacheRecordsPart2Content(PivotTableCacheRecordsPart pivotTableCacheRecordsPart2) { PivotCacheRecords pivotCacheRecords2 = new PivotCacheRecords(){ Count = (UInt32Value)5U }; pivotCacheRecords2.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"); PivotCacheRecord pivotCacheRecord5 = new PivotCacheRecord(); FieldItem fieldItem26 = new FieldItem(){ Val = (UInt32Value)0U }; FieldItem fieldItem27 = new FieldItem(){ Val = (UInt32Value)0U }; NumberItem numberItem9 = new NumberItem(){ Val = 13D }; NumberItem numberItem10 = new NumberItem(){ Val = 1287D }; DateTimeItem dateTimeItem14 = new DateTimeItem(){ Val = System.Xml.XmlConvert.ToDateTime("2000-01-02T04:31:50Z", System.Xml.XmlDateTimeSerializationMode.RoundtripKind) }; StringItem stringItem44 = new StringItem(){ Val = "sales staff H" }; pivotCacheRecord5.Append(fieldItem26); pivotCacheRecord5.Append(fieldItem27); pivotCacheRecord5.Append(numberItem9); pivotCacheRecord5.Append(numberItem10); pivotCacheRecord5.Append(dateTimeItem14); pivotCacheRecord5.Append(stringItem44); PivotCacheRecord pivotCacheRecord6 = new PivotCacheRecord(); FieldItem fieldItem28 = new FieldItem(){ Val = (UInt32Value)1U }; FieldItem fieldItem29 = new FieldItem(){ Val = (UInt32Value)1U }; NumberItem numberItem11 = new NumberItem(){ Val = 27D }; NumberItem numberItem12 = new NumberItem(){ Val = 11529D }; DateTimeItem dateTimeItem15 = new DateTimeItem(){ Val = System.Xml.XmlConvert.ToDateTime("2000-01-04T03:14:24Z", System.Xml.XmlDateTimeSerializationMode.RoundtripKind) }; StringItem stringItem45 = new StringItem(){ Val = "sales staff I" }; pivotCacheRecord6.Append(fieldItem28); pivotCacheRecord6.Append(fieldItem29); pivotCacheRecord6.Append(numberItem11); pivotCacheRecord6.Append(numberItem12); pivotCacheRecord6.Append(dateTimeItem15); pivotCacheRecord6.Append(stringItem45); PivotCacheRecord pivotCacheRecord7 = new PivotCacheRecord(); FieldItem fieldItem30 = new FieldItem(){ Val = (UInt32Value)2U }; FieldItem fieldItem31 = new FieldItem(){ Val = (UInt32Value)0U }; NumberItem numberItem13 = new NumberItem(){ Val = 19D }; NumberItem numberItem14 = new NumberItem(){ Val = 1881D }; DateTimeItem dateTimeItem16 = new DateTimeItem(){ Val = System.Xml.XmlConvert.ToDateTime("2000-01-03T11:10:19Z", System.Xml.XmlDateTimeSerializationMode.RoundtripKind) }; StringItem stringItem46 = new StringItem(){ Val = "sales staff J" }; pivotCacheRecord7.Append(fieldItem30); pivotCacheRecord7.Append(fieldItem31); pivotCacheRecord7.Append(numberItem13); pivotCacheRecord7.Append(numberItem14); pivotCacheRecord7.Append(dateTimeItem16); pivotCacheRecord7.Append(stringItem46); PivotCacheRecord pivotCacheRecord8 = new PivotCacheRecord(); FieldItem fieldItem32 = new FieldItem(){ Val = (UInt32Value)3U }; FieldItem fieldItem33 = new FieldItem(){ Val = (UInt32Value)2U }; NumberItem numberItem15 = new NumberItem(){ Val = 25D }; NumberItem numberItem16 = new NumberItem(){ Val = 1250D }; DateTimeItem dateTimeItem17 = new DateTimeItem(){ Val = System.Xml.XmlConvert.ToDateTime("2000-01-02T06:54:09Z", System.Xml.XmlDateTimeSerializationMode.RoundtripKind) }; StringItem stringItem47 = new StringItem(){ Val = "sales staff B" }; pivotCacheRecord8.Append(fieldItem32); pivotCacheRecord8.Append(fieldItem33); pivotCacheRecord8.Append(numberItem15); pivotCacheRecord8.Append(numberItem16); pivotCacheRecord8.Append(dateTimeItem17); pivotCacheRecord8.Append(stringItem47); PivotCacheRecord pivotCacheRecord9 = new PivotCacheRecord(); FieldItem fieldItem34 = new FieldItem(){ Val = (UInt32Value)4U }; FieldItem fieldItem35 = new FieldItem(){ Val = (UInt32Value)2U }; NumberItem numberItem17 = new NumberItem(){ Val = 16D }; NumberItem numberItem18 = new NumberItem(){ Val = 800D }; DateTimeItem dateTimeItem18 = new DateTimeItem(){ Val = System.Xml.XmlConvert.ToDateTime("2003-01-01T04:01:28Z", System.Xml.XmlDateTimeSerializationMode.RoundtripKind) }; StringItem stringItem48 = new StringItem(){ Val = "sales staff F" }; pivotCacheRecord9.Append(fieldItem34); pivotCacheRecord9.Append(fieldItem35); pivotCacheRecord9.Append(numberItem17); pivotCacheRecord9.Append(numberItem18); pivotCacheRecord9.Append(dateTimeItem18); pivotCacheRecord9.Append(stringItem48); pivotCacheRecords2.Append(pivotCacheRecord5); pivotCacheRecords2.Append(pivotCacheRecord6); pivotCacheRecords2.Append(pivotCacheRecord7); pivotCacheRecords2.Append(pivotCacheRecord8); pivotCacheRecords2.Append(pivotCacheRecord9); pivotTableCacheRecordsPart2.PivotCacheRecords = pivotCacheRecords2; }
/// <summary>把实体成员的值设置到控件上</summary> /// <param name="field">字段</param> /// <param name="control"></param> /// <param name="canSave"></param> protected virtual void SetFormItem(FieldItem field, Control control, Boolean canSave) { if (field == null || control == null) { return; } String toolTip = String.IsNullOrEmpty(field.Description) ? field.Name : field.Description; if (field.IsNullable) { toolTip = String.Format("请填写{0}!", toolTip); } else { toolTip = String.Format("必须填写{0}!", toolTip); } if (control is Label) { toolTip = null; } if (control is WebControl) { WebControl wc = control as WebControl; // 设置ToolTip if (String.IsNullOrEmpty(wc.ToolTip) && !String.IsNullOrEmpty(toolTip)) { wc.ToolTip = toolTip; } //// 必填项 //if (!field.IsNullable) SetNotAllowNull(field, control, canSave); // 设置只读,只有不能保存时才设置,因为一般都不是只读,而前端可能自己设置了控件为只读,这种情况下这里再设置就会修改前端的意思 if (!canSave) { if (wc is TextBox) { (wc as TextBox).ReadOnly = !canSave; } else { wc.Enabled = canSave; } } // 分控件处理 if (wc is TextBox) { SetFormItemTextBox(field, wc as TextBox, canSave); } else if (wc is Label) { SetFormItemLabel(field, wc as Label, canSave); } else if (wc is RadioButton) { SetFormItemRadioButton(field, wc as RadioButton, canSave); } else if (wc is CheckBox) { SetFormItemCheckBox(field, wc as CheckBox, canSave); } else if (wc is ListControl) { SetFormItemListControl(field, wc as ListControl, canSave); } else { SetControlValue(control, Entity[field.Name]); } } else { SetControlValue(control, Entity[field.Name]); //if (String.IsNullOrEmpty(control.GetValue("ToolTip") + "")) control.SetValue("ToolTip", toolTip); Object v = null; if (control.TryGetValue("ToolTip", out v) && String.IsNullOrEmpty(v + "")) { control.SetValue("", toolTip); } } }
private void OnClickAddField(object source, EventArgs e) { AvailableFieldNode selectedNode = (AvailableFieldNode) this._availableFieldsTree.SelectedNode; if (this._addFieldButton.Enabled) { if (this._propChangesPending) { this.SaveFieldProperties(); } if (!selectedNode.CreatesMultipleFields) { FieldItem item = selectedNode.CreateField(); this._selFieldsList.Items.Add(item); this._currentFieldItem = item; this._currentFieldItem.Selected = true; this._currentFieldItem.EnsureVisible(); } else { IDataSourceFieldSchema[] fieldSchemas = this.GetFieldSchemas(); FieldItem[] itemArray = selectedNode.CreateFields(this.Control, fieldSchemas); int length = itemArray.Length; for (int i = 0; i < length; i++) { this._selFieldsList.Items.Add(itemArray[i]); } this._currentFieldItem = itemArray[length - 1]; this._currentFieldItem.Selected = true; this._currentFieldItem.EnsureVisible(); } IDataSourceViewSchemaAccessor runtimeField = this._currentFieldItem.RuntimeField; if (runtimeField != null) { runtimeField.DataSourceViewSchema = this.GetViewSchema(); } this._selFieldsList.Focus(); this._selFieldsList.FocusedItem = this._currentFieldItem; this.UpdateEnabledVisibleState(); } }
/// <summary>标签,不做任何操作</summary> /// <param name="field">字段</param> /// <param name="control"></param> protected virtual void GetFormItemLabel(FieldItem field, Label control) { }
private void AddFieldItem(FieldItem field) { lbxSelectedFieldItems.Items.Add(field); DataRow[] dr = dtField.Select(string.Format("FIELD_NAME='{0}'", field.ColumnName.Replace("'", "''"))); if (dr.Length > 0) { dr[0].Delete(); } }
/// <summary>格式化数据为SQL数据</summary> /// <param name="field">字段</param> /// <param name="value">数值</param> /// <returns></returns> public static String FormatValue(FieldItem field, Object value) { return(Session.Dal.Db.FormatValue(field != null ? field.Field : null, value)); }
private void InitPage() { this._autoFieldCheck.Checked = false; this._selectedDataSourceNode = null; this._selectedCheckBoxDataSourceNode = null; this._availableFieldsTree.Nodes.Clear(); this._selFieldsList.Items.Clear(); this._currentFieldItem = null; this._propChangesPending = false; }
private void LoadFields() { DataControlFieldCollection fieldCollection = this.FieldCollection; if (fieldCollection != null) { int count = fieldCollection.Count; IDataSourceViewSchema viewSchema = this.GetViewSchema(); for (int i = 0; i < count; i++) { DataControlField runtimeField = fieldCollection[i]; FieldItem item = null; System.Type key = runtimeField.GetType(); if (key == typeof(CheckBoxField)) { item = new CheckBoxFieldItem(this, (CheckBoxField) runtimeField); } else if (key == typeof(BoundField)) { item = new BoundFieldItem(this, (BoundField) runtimeField); } else if (key == typeof(ButtonField)) { item = new ButtonFieldItem(this, (ButtonField) runtimeField); } else if (key == typeof(HyperLinkField)) { item = new HyperLinkFieldItem(this, (HyperLinkField) runtimeField); } else if (key == typeof(TemplateField)) { item = new TemplateFieldItem(this, (TemplateField) runtimeField); } else if (key == typeof(CommandField)) { item = new CommandFieldItem(this, (CommandField) runtimeField); } else if (key == typeof(ImageField)) { item = new ImageFieldItem(this, (ImageField) runtimeField); } else if (this._customFieldDesigners.ContainsKey(key)) { item = new DataControlFieldDesignerItem(this._customFieldDesigners[key], runtimeField); } else { item = new CustomFieldItem(this, runtimeField); } item.LoadFieldInfo(); IDataSourceViewSchemaAccessor accessor = item.RuntimeField; if (accessor != null) { accessor.DataSourceViewSchema = viewSchema; } this._selFieldsList.Items.Add(item); } if (this._selFieldsList.Items.Count != 0) { this._currentFieldItem = (FieldItem) this._selFieldsList.Items[0]; this._currentFieldItem.Selected = true; } } }
private void OnChangedPropertyValues(object source, PropertyValueChangedEventArgs e) { if (!this._isLoading && ((e.ChangedItem.Label == "HeaderText") || (e.ChangedItem.PropertyDescriptor.ComponentType == typeof(CommandField)))) { this._propChangesPending = true; this.SaveFieldProperties(); if (this._selFieldsList.SelectedItems.Count == 0) { this._currentFieldItem = null; } else { this._currentFieldItem = (FieldItem) this._selFieldsList.SelectedItems[0]; CommandFieldItem item = this._currentFieldItem as CommandFieldItem; if (item != null) { item.UpdateImageIndex(); } } } }
private static void BuildIP(FieldItem item, StringBuilder sb) => sb.AppendFormat(@"<td title=""@entity.{0}.IPToAddress()"">@entity.{0}</td>", item.Name);
// Generates content of pivotTablePart2. private void GeneratePivotTablePart2Content(PivotTablePart pivotTablePart2) { PivotTableDefinition pivotTableDefinition3 = new PivotTableDefinition(){ Name = "PivotTable1", CacheId = (UInt32Value)0U, ApplyNumberFormats = false, ApplyBorderFormats = false, ApplyFontFormats = false, ApplyPatternFormats = false, ApplyAlignmentFormats = false, ApplyWidthHeightFormats = true, DataCaption = "値", UpdatedVersion = 5, MinRefreshableVersion = 5, UseAutoFormatting = true, ItemPrintTitles = true, CreatedVersion = 4, Indent = (UInt32Value)0U, Outline = true, OutlineData = true, MultipleFieldFilters = false, ChartFormat = (UInt32Value)2U }; Location location2 = new Location(){ Reference = "A1:B5", FirstHeaderRow = (UInt32Value)1U, FirstDataRow = (UInt32Value)1U, FirstDataColumn = (UInt32Value)1U }; PivotFields pivotFields2 = new PivotFields(){ Count = (UInt32Value)6U }; PivotField pivotField8 = new PivotField(){ NumberFormatId = (UInt32Value)14U, ShowAll = false }; Items items5 = new Items(){ Count = (UInt32Value)6U }; Item item37 = new Item(){ Index = (UInt32Value)0U }; Item item38 = new Item(){ Index = (UInt32Value)1U }; Item item39 = new Item(){ Index = (UInt32Value)2U }; Item item40 = new Item(){ Index = (UInt32Value)3U }; Item item41 = new Item(){ Index = (UInt32Value)4U }; Item item42 = new Item(){ ItemType = ItemValues.Default }; items5.Append(item37); items5.Append(item38); items5.Append(item39); items5.Append(item40); items5.Append(item41); items5.Append(item42); pivotField8.Append(items5); PivotField pivotField9 = new PivotField(){ Axis = PivotTableAxisValues.AxisRow, ShowAll = false }; Items items6 = new Items(){ Count = (UInt32Value)11U }; Item item43 = new Item(){ Missing = true, Index = (UInt32Value)6U }; Item item44 = new Item(){ Missing = true, Index = (UInt32Value)5U }; Item item45 = new Item(){ Index = (UInt32Value)2U }; Item item46 = new Item(){ Missing = true, Index = (UInt32Value)4U }; Item item47 = new Item(){ Missing = true, Index = (UInt32Value)3U }; Item item48 = new Item(){ Index = (UInt32Value)0U }; Item item49 = new Item(){ Index = (UInt32Value)1U }; Item item50 = new Item(){ Missing = true, Index = (UInt32Value)9U }; Item item51 = new Item(){ Missing = true, Index = (UInt32Value)8U }; Item item52 = new Item(){ Missing = true, Index = (UInt32Value)7U }; Item item53 = new Item(){ ItemType = ItemValues.Default }; items6.Append(item43); items6.Append(item44); items6.Append(item45); items6.Append(item46); items6.Append(item47); items6.Append(item48); items6.Append(item49); items6.Append(item50); items6.Append(item51); items6.Append(item52); items6.Append(item53); pivotField9.Append(items6); PivotField pivotField10 = new PivotField(){ ShowAll = false }; PivotField pivotField11 = new PivotField(){ DataField = true, ShowAll = false }; PivotField pivotField12 = new PivotField(){ NumberFormatId = (UInt32Value)14U, ShowAll = false }; PivotField pivotField13 = new PivotField(){ ShowAll = false }; pivotFields2.Append(pivotField8); pivotFields2.Append(pivotField9); pivotFields2.Append(pivotField10); pivotFields2.Append(pivotField11); pivotFields2.Append(pivotField12); pivotFields2.Append(pivotField13); RowFields rowFields2 = new RowFields(){ Count = (UInt32Value)1U }; Field field2 = new Field(){ Index = 1 }; rowFields2.Append(field2); RowItems rowItems2 = new RowItems(){ Count = (UInt32Value)4U }; RowItem rowItem6 = new RowItem(); MemberPropertyIndex memberPropertyIndex5 = new MemberPropertyIndex(){ Val = 2 }; rowItem6.Append(memberPropertyIndex5); RowItem rowItem7 = new RowItem(); MemberPropertyIndex memberPropertyIndex6 = new MemberPropertyIndex(){ Val = 5 }; rowItem7.Append(memberPropertyIndex6); RowItem rowItem8 = new RowItem(); MemberPropertyIndex memberPropertyIndex7 = new MemberPropertyIndex(){ Val = 6 }; rowItem8.Append(memberPropertyIndex7); RowItem rowItem9 = new RowItem(){ ItemType = ItemValues.Grand }; MemberPropertyIndex memberPropertyIndex8 = new MemberPropertyIndex(); rowItem9.Append(memberPropertyIndex8); rowItems2.Append(rowItem6); rowItems2.Append(rowItem7); rowItems2.Append(rowItem8); rowItems2.Append(rowItem9); ColumnItems columnItems2 = new ColumnItems(){ Count = (UInt32Value)1U }; RowItem rowItem10 = new RowItem(); columnItems2.Append(rowItem10); DataFields dataFields2 = new DataFields(){ Count = (UInt32Value)1U }; DataField dataField2 = new DataField(){ Name = "Toral / Price", Field = (UInt32Value)3U, BaseField = 0, BaseItem = (UInt32Value)0U }; dataFields2.Append(dataField2); ChartFormats chartFormats2 = new ChartFormats(){ Count = (UInt32Value)2U }; ChartFormat chartFormat12 = new ChartFormat(){ Chart = (UInt32Value)0U, Format = (UInt32Value)0U, Series = true }; PivotArea pivotArea12 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences12 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference12 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem24 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference12.Append(fieldItem24); pivotAreaReferences12.Append(pivotAreaReference12); pivotArea12.Append(pivotAreaReferences12); chartFormat12.Append(pivotArea12); ChartFormat chartFormat13 = new ChartFormat(){ Chart = (UInt32Value)1U, Format = (UInt32Value)0U, Series = true }; PivotArea pivotArea13 = new PivotArea(){ Type = PivotAreaValues.Data, Outline = false, FieldPosition = (UInt32Value)0U }; PivotAreaReferences pivotAreaReferences13 = new PivotAreaReferences(){ Count = (UInt32Value)1U }; PivotAreaReference pivotAreaReference13 = new PivotAreaReference(){ Field = (UInt32Value)4294967294U, Count = (UInt32Value)1U, Selected = false }; FieldItem fieldItem25 = new FieldItem(){ Val = (UInt32Value)0U }; pivotAreaReference13.Append(fieldItem25); pivotAreaReferences13.Append(pivotAreaReference13); pivotArea13.Append(pivotAreaReferences13); chartFormat13.Append(pivotArea13); chartFormats2.Append(chartFormat12); chartFormats2.Append(chartFormat13); PivotTableStyle pivotTableStyle2 = new PivotTableStyle(){ Name = "PivotStyleLight16", ShowRowHeaders = true, ShowColumnHeaders = true, ShowRowStripes = false, ShowColumnStripes = false, ShowLastColumn = true }; PivotTableDefinitionExtensionList pivotTableDefinitionExtensionList2 = new PivotTableDefinitionExtensionList(); PivotTableDefinitionExtension pivotTableDefinitionExtension2 = new PivotTableDefinitionExtension(){ Uri = "{962EF5D1-5CA2-4c93-8EF4-DBF5C05439D2}" }; pivotTableDefinitionExtension2.AddNamespaceDeclaration("x14", "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"); X14.PivotTableDefinition pivotTableDefinition4 = new X14.PivotTableDefinition(){ HideValuesRow = true }; pivotTableDefinition4.AddNamespaceDeclaration("xm", "http://schemas.microsoft.com/office/excel/2006/main"); pivotTableDefinitionExtension2.Append(pivotTableDefinition4); pivotTableDefinitionExtensionList2.Append(pivotTableDefinitionExtension2); pivotTableDefinition3.Append(location2); pivotTableDefinition3.Append(pivotFields2); pivotTableDefinition3.Append(rowFields2); pivotTableDefinition3.Append(rowItems2); pivotTableDefinition3.Append(columnItems2); pivotTableDefinition3.Append(dataFields2); pivotTableDefinition3.Append(chartFormats2); pivotTableDefinition3.Append(pivotTableStyle2); pivotTableDefinition3.Append(pivotTableDefinitionExtensionList2); pivotTablePart2.PivotTableDefinition = pivotTableDefinition3; }