public static NGNumber GetNumber(PbBaseControlInfo pbCtl) { PbBaseTextInfo pbDec = new PbBaseTextInfo(); if (pbCtl.ControlType == PbControlType.DecimalText) { pbDec = (PbDecimalTextInfo)pbCtl; } if (pbCtl.ControlType == PbControlType.IntText) { pbDec = (PbIntTextInfo)pbCtl; } NGNumber ngNum = new NGNumber(); ngNum.ID = pbDec.Id; ngNum.Name = pbDec.Name; ngNum.MustInput = pbDec.IsMustInput; ngNum.FieldLabel = pbDec.LeftText; ngNum.DecimalPrecision = pbDec.ColumnInfo.Precision; ngNum.XType = "ngNumber"; ngNum.Visible = pbDec.Visible; ngNum.MustInput = pbDec.IsMustInput; ngNum.Protect = pbDec.IsProtect; ngNum.FieldStyle = GetRgb(pbDec.TextColor); ngNum.LabelStyle = GetRgb(pbDec.LabelTextColor); return(ngNum); }
public static BaseField GetNumber(PbBaseControlInfo pbCtl) { PbBaseTextInfo pbDec = new PbBaseTextInfo(); if (pbCtl.ControlType == PbControlType.DecimalText) { pbDec = (PbDecimalTextInfo)pbCtl; } if (pbCtl.ControlType == PbControlType.IntText) { pbDec = (PbIntTextInfo)pbCtl; } NumberField ngNum = new NumberField(); ngNum.ID = pbDec.Id; ngNum.Name = pbDec.Name; ngNum.MustInput = pbDec.IsMustInput; ngNum.FieldLabel = pbDec.LeftText; ngNum.XType = "ngNumber"; return(ngNum); }
public static List <ExtGridColumn> GetListColumns(IList <PbBaseTextInfo> pbcontrols) { SortedList <int, PbBaseControlInfo> list = new SortedList <int, PbBaseControlInfo>(); List <ExtGridColumn> columns = new List <ExtGridColumn>(); foreach (PbBaseControlInfo item in pbcontrols) { if (list.ContainsKey(item.XPos)) //如果x坐标重复,则跳过 //0000000038 这里有重复的 { continue; } list.Add(item.XPos, item);//以x坐标排序 } foreach (KeyValuePair <int, PbBaseControlInfo> element in list) { PbBaseTextInfo textInfo = element.Value as PbBaseTextInfo; if (textInfo != null) { ExtGridColumn col = new ExtGridColumn(); col.Header = textInfo.LeftText; col.DataIndex = textInfo.Name; col.Datatype = SqlTypeConverter.ConvertToExtControl(textInfo.ColumnInfo.ColumnDataType); ExtControlBase column = ControlConverter.ConvertToExtControl(textInfo); //转换下xtype的类型; col.editor.XType = column.XType; if (col.editor.XType == "ngRadio") { var temp = column as NGRadio; col.editor.Items = temp.Items; } columns.Add(col); } } return(columns); }
private static void CommonAssignment(PbBaseTextInfo baseTextInfo, DwDbColumn dwDbColumn, DwText dwText, DwColumn dc, SqlDbType dbType, string dwAuthName) { try { if (string.IsNullOrEmpty(dwAuthName)) { baseTextInfo.FullName = dc.Name; } else { baseTextInfo.FullName = dwAuthName + "." + dc.Name; } baseTextInfo.Height = dc.Height; baseTextInfo.MaxLength = dc.MaxLength; baseTextInfo.Name = dc.Name; baseTextInfo.TextColor = dc.Color; baseTextInfo.Visible = dc.Visible; baseTextInfo.DefaultValue = dc.DefaultValue; baseTextInfo.Tag = dc.Tag; baseTextInfo.Format = dc.Format; baseTextInfo.EditMask = dc.EditMask; //赋上必输和保护 baseTextInfo.IsMustInput = dc.Mustinput; baseTextInfo.IsProtect = dc.Protect; baseTextInfo.SingleText = dc.SingleText; //是否为单独标签 baseTextInfo.TextArea = dc.TextArea; //是否为多行文本框 baseTextInfo.ColSpan = dc.ColSpan; //列占位数 baseTextInfo.MultiSelect = dc.MultiSelect; //是否多选帮助 baseTextInfo.YPos = dc.YPos; baseTextInfo.Color = dc.Color; //设置grid某一列字体的颜色 baseTextInfo.backgroundColor = dc.BackgroundColor; //设置grid某一列背景颜色 //设置列的保护属性表达式 if (dc.ProtectExp.Contains("if")) { PbExpressionImp pbExpressionImp = new PbExpressionImp(); pbExpressionImp.Expression = dc.ProtectExp; pbExpressionImp.ExpressionType = (PbExpressionType)17; baseTextInfo.IsReadOnlyExpressionImp = pbExpressionImp; } if (dwText == null) { baseTextInfo.LeftText = string.Empty; baseTextInfo.XPos = dc.XPos; baseTextInfo.Width = dc.Width; baseTextInfo.LabelWidth = dc.Width; } else { baseTextInfo.LeftText = dwText.Text; baseTextInfo.XPos = dwText.XPos; baseTextInfo.LabelTextColor = dwText.LabelTextColor; if (dc.ControlType == DwControlType.CheckBoxEdit && dc.XPos < dwText.XPos)//checkbox的情况要单独讨论,考虑到标签是在选择框的右边。 { baseTextInfo.Width = dwText.XPos + dwText.Width - dc.XPos; baseTextInfo.LabelWidth = dwText.Width + dc.Width; } else { baseTextInfo.Width = dc.XPos - dwText.XPos + dc.Width; if (dc.XPos == dwText.XPos) { baseTextInfo.LabelWidth = dc.Width; } else { baseTextInfo.LabelWidth = dc.XPos - dwText.XPos; } } } baseTextInfo.ColumnInfo.ColumnDataType = dbType; string[] arrayStr = dwDbColumn.DbName.Split('.'); Debug.Assert(arrayStr.Length == 2); baseTextInfo.ColumnInfo.ColumnName = arrayStr[1]; if (string.IsNullOrEmpty(dwAuthName)) { baseTextInfo.ColumnInfo.TableName = arrayStr[0]; } else { baseTextInfo.ColumnInfo.TableName = dwAuthName; } //if (!string.IsNullOrEmpty(dwDbColumn.SummaryType)) //{ // switch (dwDbColumn.SummaryType) // { // case "avg": // dwDbColumn.SummaryType = "average"; // break; // case "count": // dwDbColumn.SummaryType = "count"; // break; // case "max": // dwDbColumn.SummaryType = "max"; // break; // case "min": // dwDbColumn.SummaryType = "min"; // break; // case "sum": // dwDbColumn.SummaryType = "sum"; // break; // } // baseTextInfo.SummaryType = dwDbColumn.SummaryType; //} } catch (Exception ex) { string msg = ex.Message; throw; } }
public static List <ExtGridColumn> GetListColumns(IList <PbBaseTextInfo> pbcontrols) { SortedList <int, PbBaseControlInfo> list = new SortedList <int, PbBaseControlInfo>(); List <ExtGridColumn> columns = new List <ExtGridColumn>(); foreach (PbBaseControlInfo item in pbcontrols) { if (list.ContainsKey(item.XPos)) //如果x坐标重复,则跳过 //0000000038 这里有重复的 { continue; } list.Add(item.XPos, item);//以x坐标排序 } foreach (KeyValuePair <int, PbBaseControlInfo> element in list) { PbBaseTextInfo textInfo = element.Value as PbBaseTextInfo; if (textInfo != null) { ExtGridColumn col = new ExtGridColumn(); if (textInfo.Name.Equals("t_sum")) { continue; } col.Header = textInfo.LeftText; col.DataIndex = textInfo.Name; col.Datatype = SqlTypeConverter.ConvertToExtControl(textInfo.ColumnInfo.ColumnDataType); col.DefaultValue = textInfo.DefaultValue; col.Width = textInfo.Width; //Grid每一列的宽度 col.RgbColor = ControlConverter.GetRgb(textInfo.Color); //grid列的字体颜色 col.BackgroundColor = ControlConverter.GetRgb(textInfo.backgroundColor); //grid列的背景颜色 ExtControlBase column = ControlConverter.ConvertToExtControl(textInfo); //转换下xtype的类型; col.Protect = column.Protect; col.MustInput = column.MustInput; col.Format = column.Format; col.EditMask = column.EditMask; col.editor.XType = column.XType; if (col.editor.XType == "ngCustomFormHelp" || col.editor.XType == "ngRichHelp") { var temp = column as NGHelpBase; if (temp.Helpid == "itemdata") { col.DataIndex = "itemid"; col.Header = "物资"; col.editor.ValueField = "phid"; col.editor.DisplayField = "itemname"; col.editor.ListFields = "itemid,c_name,spec,msname"; col.editor.ListHeadTexts = "编码,名称,规格,单位"; col.editor.Helpid = temp.Helpid; } else { col.editor.ValueField = temp.ValueField; col.editor.DisplayField = temp.DisplayField; col.editor.ListFields = temp.ListFields; col.editor.ListHeadTexts = temp.ListHeadTexts; col.editor.CmpName = temp.CmpName; col.editor.OutFilter = temp.OutFilter; col.editor.Helpid = temp.Helpid; col.editor.MultiSelect = temp.MultiSelect; } } else if (col.editor.XType == "ngComboBox") { if (column is NGComboBox) { NGComboBox temp = column as NGComboBox; col.editor.QueryMode = temp.QueryMode; col.editor.Data = temp.Data; } else if (column is NGCommonHelp) { NGCommonHelp temp = column as NGCommonHelp; col.editor.QueryMode = temp.QueryMode; col.editor.Data = temp.Data; } } else if (col.editor.XType == "ngRadio") { var temp = column as NGRadio; col.editor.Items = temp.Items; } columns.Add(col); } } return(columns); }