private async Task <bool> _CheckValidTo(ISession session, IEntity entity, IEntityWalker walker, DateTime dtValidTo, CancellationToken ct) { string uidLicence = entity.GetValue("UID_Licence"); // do not check Empty values if (DbVal.IsEmpty(uidLicence, ValType.String)) { return(true); } if (DbVal.IsEmpty(dtValidTo, ValType.Date)) { return(true); } // Get VailidFrom Licence DateTime dtValidToLicence = await walker.GetValueAsync <DateTime>("FK(UID_Licence).ValidTo", ct).ConfigureAwait(false); // Date in Licence is defined ? if (!DbVal.IsEmpty(dtValidToLicence, ValType.Date)) { // and smaler than our Date? if (dtValidToLicence < dtValidTo) { // Get Licence-Display string strLicence = await entity.Columns["UID_Licence"].GetDisplayValueAsync(session, ct).ConfigureAwait(false); // throw exception throw new ViException(2133215, ExceptionRelevance.EndUser, strLicence, dtValidToLicence); } } return(true); }
private void _Load(VI.Controls.Interfaces.ITreeListControl treeList, bool loadApps) { ITreeListProxy proxy = treeList.Proxy; using (new UpdateHelper(treeList)) { proxy.Clear(); // Daten holen und prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null) { return; } IColDbObject col = Connection.CreateCol("MachineAppsInfo"); col.Prototype["displayname"].IsDisplayItem = true; col.Prototype["CurrentlyActive"].IsDisplayItem = true; col.Prototype["Installdate"].IsDisplayItem = true; col.Prototype["deinstalldate"].IsDisplayItem = true; col.Prototype["revision"].IsDisplayItem = true; col.Prototype["UID_OS"].IsDisplayItem = true; col.Prototype["UID_InstallationType"].IsDisplayItem = true; col.Prototype.WhereClause = SqlFormatter.AndRelation(!FormTool.CanSee(dbobject, "UID_HardWare") ? "1=2" : SqlFormatter.UidComparison("UID_Hardware", dbobject["UID_HardWare"].New.String), SqlFormatter.Comparison("AppsNotDriver", loadApps, ValType.Bool)); col.Prototype.OrderBy = "Displayname, Installdate, DeInstallDate"; col.Load(CollectionLoadType.ForeignDisplays); foreach (IColElem elem in col) { ITreeListNode node = proxy.AddNode(elem.GetDisplayValue("displayname"), (int)VI.ImageLibrary.StockImage.ApplicationProfile); ITreeListItemSmall item = proxy.CreateCheckBoxItem(elem.GetValue("CurrentlyActive").Bool); item.Enabled = false; proxy.AddItem(node, item); DateTime date = elem.GetValue("Installdate").Date; item = proxy.AddItem(node, DbVal.IsEmpty(date, ValType.Date) ? "" : date.ToString()); item.Data = date; date = elem.GetValue("deinstalldate").Date; item = proxy.AddItem(node, DbVal.IsEmpty(date, ValType.Date) ? "" : date.ToString()); item.Data = date; item = proxy.AddItem(node, elem["Revision"]); item.Data = elem.GetValue("Revision").Int; proxy.AddItem(node, elem.GetDisplayValue("UID_OS")); proxy.AddItem(node, elem.GetDisplayValue("UID_InstallationType")); } } }
public override async Task <Diff> OnSavingAsync(IEntity entity, LogicReadWriteParameters parameters, CancellationToken cancellationToken) { LogicParameter lp = new LogicParameter(entity, parameters, cancellationToken); if (!entity.IsLoaded && DbVal.IsEmpty(entity.GetValue <int>("OrderNumber"), ValType.Int)) { await _SetRightOrderNumber(lp).ConfigureAwait(false);; } if (!entity.IsLoaded) { await ModProfile.IsUniqueAKProfile(lp).ConfigureAwait(false); } if (!entity.IsDeleted()) { await _HandleTroubleProduct(lp).ConfigureAwait(false); } return(await base.OnSavingAsync(entity, parameters, cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Will be executed before the object is saved to the database. /// </summary> protected override void OnSaving() { if (!DbObject.IsLoaded && DbVal.IsEmpty(DbObject.GetValue("OrderNumber").Int, ValType.Int)) { _SetRightOrderNumber(); } ModProfile.CheckAndSetOSMode(DbObject, "OSMode", DbObject["OsMode"].New.String); if (!DbObject.IsLoaded) { ModProfile.IsUniqueAKProfile(DbObject); } if (!DbObject.IsDeleted) { _HandleTroubleProduct(); } base.OnSaving(); }