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);
        }
Пример #2
0
        /// <summary>
        /// Gibt es in der Datenbank bereits neuere Einträge für Installationen?
        /// </summary>
        /// <param name="lastModified">Letzte Modifikation des Feedback-Files.</param>
        /// <param name="account"></param>
        /// <param name="machine"></param>
        public bool NewerInstallDataDoesExist(DateTime lastModified, ISingleDbObject account, ISingleDbObject machine)
        {
            var exec = Conn.CreateSqlExecutor(ConnectData.PublicKey);
            var sql  = GetCountOfNewerStatement(lastModified, account, machine);

            int cnt = (int)DbVal.ConvertTo(exec.SqlExecuteScalar(sql), ValType.Int);

            return(cnt > 0);
        }
 /// <summary>
 /// hat sich der Wert der Spalte geändert, wird UpdatePathVII auf TRUE gesetzt
 /// </summary>
 private void UpdatePathVII_ValueSet(object sender, ColumnEventArgs e)
 {
     using (NoRightsCheck())
     {
         if (DbVal.Compare(e.OldValue, e.NewValue, e.Column.ColDef.Type) != 0)
         {
             SetValue("UpdatePathVII", 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"));
                }
            }
        }
Пример #5
0
        public virtual string GetData(string column)
        {
            DbVal dbVal = _data[column] as DbVal;

            if (dbVal == null)
            {
                throw new Exception(String.Format("Invalid Columnname {0} for GetData in ObjectBase.", column));
            }

            return(dbVal.ToString());
        }
Пример #6
0
        public ObjectServer(IDataReader rData)
        {
            DbVal  dbVal;
            string strColumn;

            for (int iCol = 0; iCol < rData.FieldCount; iCol++)
            {
                // get the data
                dbVal = new DbVal(rData.GetValue(iCol));

                strColumn = rData.GetName(iCol).ToLowerInvariant();

                // add to data hash
                _data.Add(strColumn, dbVal);
            }
        }
Пример #7
0
        /// <summary>
        /// FormMethode Copy
        /// </summar>
        public void FormMethod_Copy()
        {
            try
            {
                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                if (m_Combo1.SelectedIndex >= 0 && m_Combo1.SelectedIndex <= 4)
                {
                    if (FormTool.ShowQuestion("SDL_FormApplicationProfileCopyAll_Question_ApplyChanges", MessageBoxButtons.YesNo) != DialogResult.Yes)
                    {
                        return;
                    }
                }

                object starttime = DbVal.MinDate;

                if (m_Option2.Checked)
                {
                    starttime = DbVal.ToUniversalTime(m_DateTimePicker1.Value, TimeZoneInfo.Local);
                }

                switch (m_Combo1.SelectedIndex)
                {
                case 0:
                    dbobject.Custom.CallMethod("SvrCopy", "CopyCL2FDS", "", "", starttime, m_StrDestDomain, false /*m_Checkbox1.Checked*/);
                    break;

                case 1:
                    dbobject.Custom.CallMethod("SvrCopy", "CopyCL2TAS", "", "", starttime, m_StrDestDomain, false /*m_Checkbox1.Checked*/);
                    break;
                }
            }
            catch (Exception ex)
            {
                // Fehler melden
                VI.FormBase.ExceptionMgr.Instance.HandleException(
                    new FormCustomizerException(929001, ex, GetString("SDL_FormApplicationProfileCopyAll_Copy").Replace("&", "")), this);
            }
        }
Пример #8
0
        public static bool ExistsCopyJobs(NodeType nodeType, string strUID_Server, string strUID_Profile)
        {
            ISingleDbObject dbObject;
            string          strScript;
            bool            bReturn = false;

            switch (nodeType)
            {
            case NodeType.AppProfile:
                dbObject  = clsMain.Instance.CurrentConnection.Connection.CreateSingle("ApplicationProfile");
                strScript = "VI_AE_ApplicationProfileCopyRunning";
                break;

            case NodeType.DrvProfile:
                dbObject  = clsMain.Instance.CurrentConnection.Connection.CreateSingle("DriverProfile");
                strScript = "VI_AE_DriverProfileCopyRunning";
                break;

            case NodeType.MacType:
                dbObject  = clsMain.Instance.CurrentConnection.Connection.CreateSingle("MachineType");
                strScript = "VI_AE_MachineTypeCopyRunning";
                break;

            default:
                return(false);
            }

            ScriptRunner scr = new ScriptRunner(
                clsMain.Instance.CurrentConnection.Connection.Scripts["scripts"],
                dbObject);

            // Script Exists ???
            if (scr.Class.HasMethod(strScript))
            {
                bReturn = new DbVal(scr.Eval(strScript, new object[] { strUID_Server, strUID_Profile })).Bool;
            }
            else
            {
                bReturn = false;                        // No script, no check
            }
            return(bReturn);
        }
        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();
        }
        /// <summary>
        ///
        /// </summary>
        private void Copy()
        {
            try
            {
                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null || dbobject.Custom == null)
                {
                    return;
                }

                using (new VI.Controls.WaitCursor())
                {
                    object starttime = DbVal.MinDate;

                    if (m_Option2.Checked)
                    {
                        starttime = DbVal.ToUniversalTime(m_DateTimePicker1.Value, TimeZoneInfo.Local);
                    }

                    switch (m_Combo1.SelectedIndex)
                    {
                    case 0:
                        dbobject.Custom.CallMethod("SvrCopy", "CopyFDS2CL", "", "", starttime, "");
                        break;

                    case 1:

                        if (m_Combo2.SelectedIndex >= 0)
                        {
                            dbobject.Custom.CallMethod("SvrCopy", "CopyFDS_P2FDS_C", "",
                                                       m_ColAppServer[m_Combo2.SelectedIndex]["UID_Server"].ToString(), starttime, "");
                            break;
                        }
                        else
                        {
                            FormTool.ShowMessage("SDL_FormApplicationProfileCopyAll_Message_ChildServer");
                        }

                        break;

                    case 2:

                        if (m_Combo2.SelectedIndex >= 0)
                        {
                            dbobject.Custom.CallMethod("SvrCopy", "CopyFDS_C2FDS_P", "",
                                                       m_ColAppServer[m_Combo2.SelectedIndex]["UID_Server"].ToString(), starttime, "");
                            break;
                        }
                        else
                        {
                            FormTool.ShowMessage("SDL_FormApplicationProfileCopyAll_Message_ChildServer");
                        }

                        break;

                    case 3:
                        dbobject.Custom.CallMethod("SvrCopy", "CopyFDS2TAS", "", "", starttime, "");
                        break;

                    case 4:
                        dbobject.Custom.CallMethod("SvrCopy", "CopyTAS2FDS", "", "", starttime, "");
                        break;

                    default:
                        FormTool.ShowMessage("SDL_FormApplicationProfileCopyAll_Message_Action");
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                // Fehler melden
                HandleException(ex);
            }
        }
        /// <summary>
        /// FormMethode Copy
        /// </summary>
        public void FormMethod_Copy()
        {
            try
            {
                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject?.Custom == null)
                {
                    return;
                }

                if (m_Combo1.SelectedIndex == 0 || m_Combo1.SelectedIndex == 1 || m_Combo1.SelectedIndex == 4 ||
                    ((m_Combo1.SelectedIndex == 2 || m_Combo1.SelectedIndex == 3) && m_Combo2.SelectedIndex >= 0))
                {
                    if (FormTool.ShowQuestion("SDL_FormApplicationProfileCopyAll_Question_ApplyChanges", MessageBoxButtons.YesNo) != DialogResult.Yes)
                    {
                        return;
                    }
                }

                object starttime = DbVal.MinDate;

                if (m_Option2.Checked)
                {
                    starttime = DbVal.ToUniversalTime(m_DateTimePicker1.Value, TimeZoneInfo.Local);
                }

                switch (m_Combo1.SelectedIndex)
                {
                case 0:
                    dbobject.Custom.CallMethod("SvrCopy", "CopyTAS2FDS", "", "", starttime, "", false /*m_Checkbox1.Checked*/);
                    break;

                case 1:
                    dbobject.Custom.CallMethod("SvrCopy", "CopyFDS2CL", "", "", starttime, "", false /*m_Checkbox1.Checked*/);
                    break;

                case 2:

                    if (m_Combo2.SelectedIndex >= 0)
                    {
                        dbobject.Custom.CallMethod("SvrCopy", "CopyFDS_P2FDS_C", "",
                                                   m_ColAppServer[m_Combo2.SelectedIndex]["UID_Server"].ToString(), starttime, "", false /*m_Checkbox1.Checked*/);
                    }
                    else
                    {
                        FormTool.ShowMessage("SDL_FormApplicationProfileCopyAll_Message_ChildServer");
                    }

                    break;

                case 3:

                    if (m_Combo2.SelectedIndex >= 0)
                    {
                        dbobject.Custom.CallMethod("SvrCopy", "CopyFDS_C2FDS_P",
                                                   m_ColAppServer[m_Combo2.SelectedIndex]["UID_Server"].ToString(), "", starttime, "", false /*m_Checkbox1.Checked*/);
                    }
                    else
                    {
                        FormTool.ShowMessage("SDL_FormApplicationProfileCopyAll_Message_ChildServer");
                    }

                    break;

                case 4:
                    dbobject.Custom.CallMethod("SvrCopy", "CopyFDS2TAS", "", "", starttime, "", false /*m_Checkbox1.Checked*/);
                    break;

                default:
                    FormTool.ShowMessage("SDL_FormApplicationProfileCopyAll_Message_Action");
                    break;
                }
            }
            catch (Exception ex)
            {
                // Fehler melden
                ExceptionMgr.Instance.HandleException(
                    new FormCustomizerException(929001, ex, GetString("SDL_FormApplicationProfileCopyAll_Copy").Replace("&", "")), this);
            }
        }
Пример #13
0
 public async Task <T> Dereference <T>(DbVal <T> value) where T : IDbItem
 => await Repos <T>().Read(value.ToId());