public BizComboBox CreateComboBox(Combo_Box combo, DocDef def) { var result = new BizComboBox(); AddChildren(result, combo, def); InitComboBox(result, combo, def); return(result); }
private void InitComboBox(BizComboBox control, Table_Column controlData, AttrDef attrDef) { control.Rows = 0; control.IsRadio = false; //control.AttributeDefId = controlData.Attribute_Id; /*if (control.AttributeDefId != null) * { * //if (!controlData.Attribute_DefsReference.IsLoaded) controlData.Attribute_DefsReference.Load(); * * InitComboBox(control, attrDef /*controlData.Attribute_Defs#1#); * }*/ InitControl(control, controlData); // AddQueryItems(control, controlData); // Вызывает ошибку дублирования QueryItems }
private void InitComboBox(BizComboBox control, Combo_Box controlData, DocDef def) { AttrDef attrDef = null; if (def != null) { if (controlData.Attribute_Id != null) { attrDef = def.Attributes.FirstOrDefault(a => a.Id == controlData.Attribute_Id); } if (attrDef == null && controlData.Attribute_Name != null) { attrDef = def.Attributes.FirstOrDefault(a => String.Equals(a.Name, controlData.Attribute_Name, StringComparison.OrdinalIgnoreCase)); } } control.Rows = controlData.Rows ?? 0; control.IsRadio = controlData.Is_Radio ?? false; if (attrDef != null) { control.AttributeDefId = attrDef.Id; control.AttributeName = attrDef.Name; } else { var attrName = controlData.Attribute_Name ?? String.Empty; SystemIdent attrIdent; if (SystemIdentConverter.TryConvert(attrName, out attrIdent)) { control.Ident = attrIdent; control.AttributeName = attrName; //InitComboBox(control, attrIdent); } } control.DetailAttributeId = controlData.Detail_Attribute_Id; control.DetailAttributeName = controlData.Detail_Attribute_Name; /*if (attrDef != null) * { * //if (!controlData.Attribute_DefsReference.IsLoaded) controlData.Attribute_DefsReference.Load(); * * InitComboBox(control, attrDef /*controlData.Attribute_Defs#1#); * } */ InitControl(control, controlData); // AddQueryItems(control, controlData); // Вызывает ошибку дублирования QueryItems }
private void InitComboBox(BizComboBox control, Editor controlData, AttrDef attrDef) { control.Rows = controlData.Rows ?? 0; // control.AttributeDefId = controlData.Attribute_Id; // control.AttributeName = controlData.Attribute_Name ?? String.Empty; // if (!controlData.Attribute_DefsReference.IsLoaded) controlData.Attribute_DefsReference.Load(); /* * if (attrDef == null) * InitComboBoxItems(control, null); * else * InitComboBox(control, attrDef /*controlData.Attribute_Defs#1#);*/ InitControl(control, controlData); AddQueryItems(control, controlData); }
/*[Obsolete("Устаревший метод")] * private static BizDataControl CreateTypeEditor(Attribute_Def def) * { * BizDataControl result = null; * * switch (def.Type_Id) * { * case (short)CissaDataType.Int: * result = new BizEditInt * { * MaxValue = Convert.ToInt32(def.Max_Value), * MinValue = Convert.ToInt32(def.Min_Value), * MaxLength = (uint?)def.Max_Length ?? 0 * }; * break; * case (short)CissaDataType.Float: * result = new BizEditFloat * { * MaxValue = Convert.ToInt32(def.Max_Value), * MinValue = Convert.ToInt32(def.Min_Value), * MaxLength = (uint?)def.Max_Length ?? 0 * }; * break; * case (short)CissaDataType.Currency: * result = new BizEditCurrency * { * MaxValue = Convert.ToInt32(def.Max_Value), * MinValue = Convert.ToInt32(def.Min_Value), * MaxLength = (uint?)def.Max_Length ?? 0 * }; * break; * case (short)CissaDataType.Text: * result = new BizEditText * { * MaxLength = (uint?)def.Max_Length ?? 0 * }; * break; * case (short)CissaDataType.DateTime: * result = new BizEditDateTime(); * break; * case (short)CissaDataType.Bool: * result = new BizEditBool(); * break; * case (short)CissaDataType.Enum: * result = new BizComboBox(); * break; * case (short)CissaDataType.Organization: * result = new BizEditText {MaxLength = 1000, ReadOnly = true}; * break; * case (short)CissaDataType.DocumentState: * result = new BizEditText { MaxLength = 1000, ReadOnly = true}; * break; * } * * return result; * }*/ private static BizDataControl CreateTypeEditor(Control control, AttrDef def) { if (def == null) { return(null); } BizDataControl result = null; switch (def.Type.Id) { case (short)CissaDataType.Int: result = new BizEditInt { AttributeDefId = def.Id, AttributeName = def.Name, MaxValue = Convert.ToInt32(def.MaxValue), MinValue = Convert.ToInt32(def.MinValue), MaxLength = (uint)def.MaxLength }; break; case (short)CissaDataType.Float: result = new BizEditFloat { AttributeDefId = def.Id, AttributeName = def.Name, MaxValue = Convert.ToInt32(def.MaxValue), MinValue = Convert.ToInt32(def.MinValue), MaxLength = (uint)def.MaxLength }; break; case (short)CissaDataType.Currency: result = new BizEditCurrency { AttributeDefId = def.Id, AttributeName = def.Name, MaxValue = Convert.ToInt32(def.MaxValue), MinValue = Convert.ToInt32(def.MinValue), MaxLength = (uint)def.MaxLength }; break; case (short)CissaDataType.Text: result = new BizEditText { AttributeDefId = def.Id, AttributeName = def.Name, MaxLength = (uint)def.MaxLength }; break; case (short)CissaDataType.DateTime: result = new BizEditDateTime { AttributeDefId = def.Id, AttributeName = def.Name }; break; case (short)CissaDataType.Bool: result = new BizEditBool { AttributeDefId = def.Id, AttributeName = def.Name }; break; case (short)CissaDataType.Enum: result = new BizComboBox { AttributeDefId = def.Id, AttributeName = def.Name }; break; case (short)CissaDataType.Organization: if (control.Read_Only ?? false) { result = new BizEditText { MaxLength = 800, ReadOnly = true, AttributeDefId = def.Id, AttributeName = def.Name } } ; else { result = new BizComboBox { AttributeDefId = def.Id, AttributeName = def.Name } }; break; case (short)CissaDataType.DocumentState: result = new BizEditText { MaxLength = 800, ReadOnly = true, AttributeDefId = def.Id, AttributeName = def.Name }; break; case (short)CissaDataType.Blob: result = new BizEditFile { ReadOnly = control.Read_Only ?? false, AttributeDefId = def.Id, AttributeName = def.Name }; break; case (short)CissaDataType.User: result = new BizComboBox { ReadOnly = control.Read_Only ?? false, AttributeDefId = def.Id, AttributeName = def.Name }; break; case (short)CissaDataType.ClassOfDocument: case (short)CissaDataType.AuthorOfDocument: case (short)CissaDataType.OrganizationOfDocument: case (short)CissaDataType.OrgUnitOfDocument: case (short)CissaDataType.StateOfDocument: case (short)CissaDataType.DocumentId: result = new BizEditText { MaxLength = 800, ReadOnly = true, AttributeDefId = def.Id, AttributeName = def.Name }; break; case (short)CissaDataType.CreateTimeOfDocument: result = new BizEditDateTime { ReadOnly = true, AttributeDefId = def.Id, AttributeName = def.Name }; break; } return(result); }