/// <summary> /// Parent Constructor /// </summary> /// <param name="parent">parent parent</param> public MField(MTab parent) : base(parent.GetCtx(), 0, parent.Get_TrxName()) { //this(parent.GetCtx(), 0, parent.Get_TrxName()); SetClientOrg(parent); SetAD_Tab_ID(parent.GetAD_Tab_ID()); }
/// <summary> /// After save of Tab /// </summary> /// <param name="newRecord"></param> /// <param name="success"></param> /// <returns></returns> protected override bool AfterSave(bool newRecord, bool success) { if (!success) { return(false); } // check if there is any change in MaintainVersionOnApproval field on Tab if (Is_ValueChanged("MaintainVerOnApproval")) { int windowID = GetAD_Window_ID(); int SeqNo = GetSeqNo(); // Get all tabs from current window which have greater sequence than current tab int[] TabIDs = MTab.GetAllIDs("AD_Tab", "AD_Window_ID = " + windowID + " AND SeqNo > " + SeqNo, Get_TrxName()); // if there are tabs with sequence greater than current tab if (TabIDs.Length > 0) { string tabs = string.Join(",", TabIDs); // Update MaintainVerOnApproval field to the value set in current field of current tab in all tabs with greater // sequence of current tab int updateCount = DB.ExecuteQuery("UPDATE AD_Tab SET MaintainVerOnApproval = '" + (IsMaintainVerOnApproval() ? "Y" : "N") + "' WHERE AD_Tab_ID IN (" + tabs + ")", null, Get_TrxName()); if (updateCount < 0) { log.Info("UPDATE AD_Tab SET MaintainVerOnApproval = '" + (IsMaintainVerOnApproval() ? "Y" : "N") + "' WHERE AD_Tab_ID IN (" + tabs + ")"); } } } return(true); }
/// <summary> ///Parent Constructor /// </summary> /// <param name="parent">parent</param> /// <param name="from">from copy from</param> public MTab(MWindow parent, MTab from) : this(parent.GetCtx(), 0, parent.Get_Trx()) { CopyValues(from, this); SetClientOrg(parent); SetAD_Window_ID(parent.GetAD_Window_ID()); SetEntityType(parent.GetEntityType()); }
/// <summary> /// Copy Constructor /// </summary> /// <param name="parent">parent</param> /// <param name="from">from copy from</param> public MField(MTab parent, MField from) : base(parent.GetCtx(), 0, parent.Get_TrxName()) { //this(parent.getCtx(), 0, parent.get_TrxName()); // copyValues(from, this); SetClientOrg(parent); SetAD_Tab_ID(parent.GetAD_Tab_ID()); SetEntityType(parent.GetEntityType()); }
/// <summary> /// Get the Parent Table /// </summary> /// <param name="tab"></param> /// <returns></returns> public MTable GetParentTable(MWindow win, MTab currentTab) { MTab[] tabs = win.GetTabs(false, null); MTab tab = tabs[currentTab.GetTabLevel()]; if (currentTab.GetTabLevel() == 0) { return(null); } return(MTable.Get(GetCtx(), tab.GetAD_Table_ID())); }
/// <summary> ///Get MTab from Cache /// </summary> /// <param name="ctx">context</param> /// <param name="AD_Tab_ID">id</param> /// <returns>MTab</returns> public static MTab Get(Ctx ctx, int AD_Tab_ID) { int key = (int)AD_Tab_ID; MTab retValue = (MTab)s_cache[key]; if (retValue != null) { return(retValue); } retValue = new MTab(ctx, AD_Tab_ID, null); if (retValue.Get_ID() != 0) { s_cache.Add(key, retValue); } return(retValue); }