fn_show_lamp_control_history() private méthode

private fn_show_lamp_control_history ( string username, byte password ) : IQueryable
username string
password byte
Résultat IQueryable
Exemple #1
0
        /// <summary>
        /// PSP 18.2
        /// Logfile in einer Liste retourgeben
        /// </summary>
        /// <param name="username">Username</param>
        /// <param name="password">Passwort</param>
        /// <returns>Liste des Datentyp's "fn_show_lamp_control_history_Result" </returns>
        public static List<fn_show_lamp_control_history_Result> GetLogFileComplete(string username, string password)
        {
            Byte[] pwhash = HelperClass.GetHash(password);
            using (itin18_aktEntities cont = new itin18_aktEntities())
            {
                List<fn_show_lamp_control_history_Result> tmp = new List<fn_show_lamp_control_history_Result>();

                try
                {

                    List<fn_show_lamp_control_history_Result> db = cont.fn_show_lamp_control_history(username, pwhash).ToList();
                    if (db.Count <= 0)
                    {
                        tmp.Add(new fn_show_lamp_control_history_Result { address = "", lamp_name = "Keine Daten" });
                    }
                    else
                    {
                    foreach (var item in db)
                    {
                            tmp.Add(item);
                    }
                    }
                    return tmp;
                }
                catch (Exception e)
                {
                    //Fehlermeldung in die leere Liste hinzufügen, die FM wird als name eingetragen
                    tmp.Add(new fn_show_lamp_control_history_Result { address = "", lamp_name = "Keine Datenbankverbindung" });
                    tmp.Add(new fn_show_lamp_control_history_Result { address = "", lamp_name = "No database connection" });

                    return tmp;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// PSP 18.1
        /// Logfile wird von Begindatum bis Endedatum in einer Liste retourgegeben
        /// </summary>
        /// <param name="username">Username</param>
        /// <param name="password">Passwort</param>
        /// <param name="beginDate">Begindatum</param>
        /// <param name="endDate">Endedatum</param>
        /// <returns>Liste des Datentyp's "fn_show_lamp_control_history_Result" </returns>
        public static List<fn_show_lamp_control_history_Result> GetLogFile(string username, string password, DateTime beginDate, DateTime endDate)
        {
            Byte[] pwhash = HelperClass.GetHash(password);
            using (itin18_aktEntities cont = new itin18_aktEntities())
            {
                List<fn_show_lamp_control_history_Result> tmp = new List<fn_show_lamp_control_history_Result>();
            
                try
                {

                    List<fn_show_lamp_control_history_Result> db = cont.fn_show_lamp_control_history(username, pwhash).ToList();

                    foreach (var item in db)
                    {
                        if (Convert.ToDateTime((item.date).Value.ToShortDateString()) >= Convert.ToDateTime(beginDate.ToShortDateString()) 
                         && Convert.ToDateTime((item.date).Value.ToShortDateString()) <= Convert.ToDateTime(endDate))
                        {
                            tmp.Add(item);
                        }
                    }
                    if (tmp.Count <= 0)
                    {
                        tmp.Add(new fn_show_lamp_control_history_Result { address = "", lamp_name = "Keine Daten" });
                    }
                    return tmp;
                }
                catch (Exception e)
                {
                    //Fehlermeldung in die leere Liste hinzufügen, die FM wird als name eingetragen
                    tmp.Add(new fn_show_lamp_control_history_Result { address = "", lamp_name = "Keine Datenbankverbindung" });
                    tmp.Add(new fn_show_lamp_control_history_Result { address = "", lamp_name = "No database connection" });

                    return tmp;
                }
            }
        }