private void DrawLinkButton(DevExpress.XtraVerticalGrid.Events.CustomDrawRowValueCellEventArgs e) { if (this.ABCGrid == null || (this.ABCGrid.OwnerView != null && this.ABCGrid.OwnerView.Mode != ViewMode.Design)) { if (e.Row != null && e.Row.Tag is ABCGridColumn.ColumnConfig && String.IsNullOrWhiteSpace(this.ABCGrid.TableName) == false && e.CellValue != null && e.CellValue.GetType() == typeof(int)) { Boolean isDraw = false; EditorRow gridRow = e.Row as EditorRow; String strTableName = this.ABCGrid.TableName; if (gridRow.Properties.FieldName.Contains(":") == false) { if (ForeignColumnList.TryGetValue(gridRow.Properties.FieldName, out isDraw) == false) { if (DataStructureProvider.IsForeignKey(strTableName, gridRow.Properties.FieldName)) { ForeignColumnList.Add(gridRow.Properties.FieldName, true); } else { ForeignColumnList.Add(gridRow.Properties.FieldName, false); } } } else { DataCachingProvider.AccrossStructInfo acrrosInfo = DataCachingProvider.GetAccrossStructInfo(strTableName, ABCHelper.DataConverter.ConvertToGuid(e.CellValue), e.Row.Properties.FieldName); if (acrrosInfo != null && (acrrosInfo.FieldName == DataStructureProvider.GetNOColumn(acrrosInfo.TableName) || acrrosInfo.FieldName == DataStructureProvider.GetNAMEColumn(acrrosInfo.TableName))) { isDraw = true; } } if (isDraw) { e.Graphics.DrawImage(ABCControls.ABCImageList.GetImage16x16("DocLink"), e.Bounds.Location); Rectangle r = e.Bounds; r.Width -= 18; r.X += 18; e.Appearance.DrawString(e.Cache, e.CellText, r); e.Handled = true; } } } }
public void RunFocusedLink( ) { if (String.IsNullOrWhiteSpace(this.ABCGrid.TableName) == false) { if (this.ABCGrid == null || (this.ABCGrid.OwnerView != null && this.ABCGrid.OwnerView.Mode != ViewMode.Design)) { String strTableName = this.ABCGrid.TableName; String strFieldName = VGrid.FocusedRow.Properties.FieldName; String strLinkTableName = String.Empty; Guid iLinkID = Guid.Empty; EditorRow gridRow = this.VGrid.FocusedRow as EditorRow; object objCellValue = this.VGrid.GetCellValue(gridRow, VGrid.FocusedRecord); if (objCellValue == null || objCellValue.GetType() != typeof(Guid)) { return; } if (gridRow.Properties.FieldName.Contains(":")) { DataCachingProvider.AccrossStructInfo acrrosInfo = DataCachingProvider.GetAccrossStructInfo(strTableName, ABCHelper.DataConverter.ConvertToGuid(objCellValue), gridRow.Properties.FieldName); if (acrrosInfo != null && (acrrosInfo.FieldName == DataStructureProvider.GetNOColumn(acrrosInfo.TableName) || acrrosInfo.FieldName == DataStructureProvider.GetNAMEColumn(acrrosInfo.TableName))) { strLinkTableName = acrrosInfo.TableName; iLinkID = acrrosInfo.TableID; } } else if (DataStructureProvider.IsForeignKey(strTableName, strFieldName)) { strLinkTableName = DataStructureProvider.GetTableNameOfForeignKey(strTableName, strFieldName); iLinkID = ABCHelper.DataConverter.ConvertToGuid(objCellValue); } if (iLinkID != Guid.Empty) { if (this.ABCGrid.OwnerView != null) { ABCScreen.ABCScreenHelper.Instance.RunLink(strLinkTableName, this.ABCGrid.OwnerView.Mode, false, iLinkID, ABCScreenAction.None); } else { ABCScreen.ABCScreenHelper.Instance.RunLink(strLinkTableName, ViewMode.Runtime, false, iLinkID, ABCScreenAction.None); } } } } }
public static String GetNameValue(BusinessObject obj) { if (obj == null) { return(String.Empty); } string strName = DataStructureProvider.GetNAMEColumn(obj.AATableName); if (String.IsNullOrWhiteSpace(strName)) { strName = DataStructureProvider.GetNOColumn(obj.AATableName); } object objReturn = ABCDynamicInvoker.GetValue(obj, strName); if (objReturn != null) { return(objReturn.ToString()); } return(String.Empty); }
public String GetNameByID(Guid iObjectID) { BusinessObject obj = GetObjectByID(iObjectID); return((String)ABCDynamicInvoker.GetValue(obj, DataStructureProvider.GetNAMEColumn(TableName))); }
public void InvalidateControl( ) { if (EditControl == null && String.IsNullOrWhiteSpace(UIControlType) == false) { #region Design - FirstTIme EditControl = (IABCBindableControl)ABCBusinessEntities.ABCDynamicInvoker.CreateInstanceObject(Type.GetType(UIControlType)); EditControl.DataSource = this.DataSource; EditControl.DataMember = this.DataMember; EditControl.TableName = this.TableName; if (this.DataMember.Contains(":")) { SetToReadOnly(); } #endregion } if (EditControl != null) { EditControl.DataSource = this.DataSource; EditControl.DataMember = this.DataMember; EditControl.TableName = this.TableName; this.layoutControl1.Controls.Add((this.EditControl as Control)); this.LayoutItem.Control = (this.EditControl as Control); #region DisplayImage if (this.DataMember.Contains(":")) { DataCachingProvider.AccrossStructInfo acrrosInfo = DataCachingProvider.GetAccrossStructInfo(TableName, this.DataMember); if (acrrosInfo != null && (acrrosInfo.FieldName == DataStructureProvider.GetNOColumn(acrrosInfo.TableName) || acrrosInfo.FieldName == DataStructureProvider.GetNAMEColumn(acrrosInfo.TableName))) { STViewsInfo viewIfo = (STViewsInfo) new STViewsController().GetObject(String.Format("SELECT * FROM STViews WHERE [MainTableName] = '{0}' ", acrrosInfo.TableName)); if (viewIfo != null) { this.DisplayImage = true; } } } else if (DataStructureProvider.IsForeignKey(TableName, this.DataMember)) { String strPKTableName = DataStructureProvider.GetTableNameOfForeignKey(TableName, this.DataMember); STViewsInfo viewIfo = (STViewsInfo) new STViewsController().GetObject(String.Format("SELECT * FROM STViews WHERE [MainTableName] = '{0}' ", strPKTableName)); if (viewIfo != null) { this.DisplayImage = true; } } #endregion if (DataStructureProvider.IsNOColumn(this.TableName, this.DataMember)) { ReadOnly = true; } #region Permission DataCachingProvider.AccrossStructInfo accross = DataCachingProvider.GetAccrossStructInfo(this.TableName, this.DataMember); if (ABCScreen.ABCScreenHelper.Instance.CheckFieldPermission(accross.TableName, accross.FieldName, FieldPermission.AllowView) == false) { isAllowView = false; ReadOnly = true; } if (ReadOnly == false) { ReadOnly = !ABCScreen.ABCScreenHelper.Instance.CheckFieldPermission(accross.TableName, accross.FieldName, FieldPermission.AllowEdit); } #endregion if (isAllowView) { (this.EditControl as DevExpress.XtraEditors.BaseEdit).CustomDisplayText += new DevExpress.XtraEditors.Controls.CustomDisplayTextEventHandler(ABCBindingBaseEdit_CustomDisplayText); } if (ReadOnly) { SetToReadOnly(); } else { if (this.EditControl is DevExpress.XtraEditors.BaseEdit && (this.EditControl as DevExpress.XtraEditors.BaseEdit).Properties != null) { (this.EditControl as DevExpress.XtraEditors.BaseEdit).Properties.AppearanceFocused.BackColor = Color.Bisque; } } } UpdateLabelText(); }
void LayoutItem_MouseUp(object sender, MouseEventArgs e) { //if ( OwnerView!=null&&OwnerView.Mode!=ViewMode.Design) //{ if (e.Button == System.Windows.Forms.MouseButtons.Left && this.DisplayImage && EditControl != null && this.LayoutItem.TextSize.Width - 18 < e.X && e.X < this.LayoutItem.TextSize.Width) { BindingSource binding = (this.EditControl as Control).DataBindings[0].DataSource as BindingSource; BusinessObject busObj = binding.DataSource as BusinessObject; #region Link by ID object obj = EditControl.GetType().GetProperty("EditValue").GetValue(EditControl, null); Guid iID = ABCHelper.DataConverter.ConvertToGuid(obj); String strLinkTableName = String.Empty; Guid iLinkID = Guid.Empty; if (this.DataMember.Contains(":")) { DataCachingProvider.AccrossStructInfo acrrosInfo = DataCachingProvider.GetAccrossStructInfo(busObj, iID, this.DataMember); if (acrrosInfo != null && (acrrosInfo.FieldName == DataStructureProvider.GetNOColumn(acrrosInfo.TableName) || acrrosInfo.FieldName == DataStructureProvider.GetNAMEColumn(acrrosInfo.TableName))) { strLinkTableName = acrrosInfo.TableName; iLinkID = acrrosInfo.TableID; } } else if (DataStructureProvider.IsForeignKey(TableName, this.DataMember)) { strLinkTableName = DataStructureProvider.GetTableNameOfForeignKey(TableName, this.DataMember); iLinkID = iID; } else { strLinkTableName = TableName; iLinkID = BusinessObjectHelper.GetIDValue(busObj); } if (iLinkID != Guid.Empty && String.IsNullOrWhiteSpace(strLinkTableName) == false) { ABCScreen.ABCScreenHelper.Instance.RunLink(strLinkTableName, this.OwnerView.Mode, false, iLinkID, ABCScreenAction.None); return; } #endregion if (String.IsNullOrWhiteSpace(this.LinkScreen) == false) { String[] strArrays = this.ParamFields.Split(';'); object[] lstParams = new object[strArrays.Length]; for (int i = 0; i < strArrays.Length; i++) { object objParam = strArrays[i]; if (DataStructureProvider.IsTableColumn(busObj.AATableName, strArrays[i])) { objParam = ABCBusinessEntities.ABCDynamicInvoker.GetValue(busObj, strArrays[i]); } lstParams[i] = objParam; } ABCScreen.ABCScreenHelper.Instance.RunLink(this.LinkScreen, this.OwnerView.Mode, false, ABCScreenAction.None, lstParams); } } //} }