コード例 #1
0
        public static AED_Trainer GetAED(System.Guid Guid)
        {
            DBAccess db = new DBAccess();

            db.AddGuid("Guid", Guid);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectByGuid));

            if (dr.HasRows)
            {
                AED_Trainer c = new AED_Trainer();
                while (dr.Read())
                {
                    Populate(dr, c);
                }
                dr.Close();
                return(c);
            }
            else
            {
                dr.Close();
                return(null);
            }
        }
コード例 #2
0
        public static DataSet GetEyeWashbyGUID_DS(Guid GuID)
        {
            DBAccess db = new DBAccess();

            db.AddGuid("Guid", GuID);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectByGuid);

            return(ds);
        }
コード例 #3
0
        public static List <AED_Service> GetServicesByAED(int AED_FK)
        {
            List <AED_Service> result = new List <AED_Service>();
            int      ID = -1;
            DBAccess db = new DBAccess();

            db.AddInt("AED_FK", AED_FK);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            SqlDataReader dr = default(SqlDataReader);

            try
            {
                dr = (System.Data.SqlClient.SqlDataReader)(db.ExecuteReader(_SQLSelectByAED));
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        ID = System.Convert.ToInt32(dr.DBtoInt("ID"));
                        result.Add(AED_Service.GetService(ID));
                    }
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return(result);
        }
コード例 #4
0
        public static System.Collections.Generic.List <FirstAidBag_Service> GetBatteryListExpiredEmail(int CompanyID)
        {
            System.Collections.Generic.List <FirstAidBag_Service> result = new System.Collections.Generic.List <FirstAidBag_Service>();
            int      ID = -1;
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            SqlDataReader dr = default(SqlDataReader);

            try
            {
                dr = (System.Data.SqlClient.SqlDataReader)(db.ExecuteReader(_SQLSelectAllExpiredEmail));
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        ID = System.Convert.ToInt32(dr.DBtoInt("ID"));
                        result.Add(FirstAidBag_Service.GetService(ID));
                    }
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return(result);
        }
コード例 #5
0
        private static void AddParms(ref DBAccess db, Agents c)
        {
            var with_1 = c;

            db.AddGuid("AgentID", with_1.AgentID);
            db.AddNVarChar("CompanyName", with_1.CompanyName, 50);
            db.AddNVarChar("Title", with_1.Title, 50);

            db.AddNVarChar("Name", with_1.Name, 50);
            db.AddNVarChar("FirstName", with_1.FirstName, 50);
            db.AddNVarChar("LastName", with_1.LastName, 50);

            db.AddNVarChar("Address1", with_1.Address1, 50);
            db.AddNVarChar("Address2", with_1.Address2, 50);
            db.AddNVarChar("City", with_1.City, 50);
            db.AddNVarChar("ZipCode", with_1.ZipCode, 50);
            db.AddNVarChar("State", with_1.State, 50);
            db.AddInt("CountryID", with_1.CountryID);

            db.AddNVarChar("Email", with_1.Email, 250);
            db.AddNVarChar("OrdreEmail", with_1.OrdreEmail, 250);

            db.AddNVarChar("Phone", with_1.Phone, 16);
            db.AddNVarChar("CellPhone", with_1.CellPhone, 16);
            db.AddNVarChar("Fax", with_1.Fax, 16);

            db.AddInt("Status", (System.Int32)with_1.Status);

            db.AddNVarChar("UserID", with_1.UserID, 50);
            db.AddBoolean("ServiceAgent", with_1.ServiceAgent);

            db.AddNVarChar("AgentSignaturImg", with_1.AgentSignaturImg, 255);

            AddParmsStandard(db, c);
        }
コード例 #6
0
        public static void LogUserActivity(Guid UserID, string action)
        {
            //Call the sproc_UpdateUsersCurrentActivity sproc
            DBAccess db = new DBAccess(MembershipConnectionString);

            db.AddGuid("UserID", UserID);
            db.AddNVarChar("action", action, 256);
            db.AddDateTime("ApplicationName", DateTime.UtcNow);

            try
            {
                int retval = db.ExecuteNonQuery("dbo.sproc_UpdateUsersCurrentActivity");
            }
            catch (Exception)
            {
            }

            //Using myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("MembershipConnectionString").ConnectionString)
            //    Dim myCommand As New SqlCommand("dbo.sproc_UpdateUsersCurrentActivity", myConnection)
            //    myCommand.CommandType = CommandType.StoredProcedure

            //    myCommand.Parameters.AddWithValue("@UserId", UserId)
            //    myCommand.Parameters.AddWithValue("@Action", action)
            //    myCommand.Parameters.AddWithValue("@CurrentTimeUtc", DateTime.UtcNow)

            //    'Execute the sproc
            //    myConnection.Open()
            //    myCommand.ExecuteNonQuery()
            //    myConnection.Close()
            //End Using
        }
コード例 #7
0
        /// <summary>
        /// Get New Content by GUID
        /// </summary>
        /// <param name="GUID"></param>
        /// <remarks></remarks>
        public PageContent(System.Guid GUID)
        {
            // VBConversions Note: Non-static class variable initialization is below.  Class variables cannot be initially assigned non-static values in C#.
            _PublishDate = DateTime.Today;


            if (GUID != System.Guid.Empty)
            {
                DBAccess db = new DBAccess();
                db.AddGuid("GUID", GUID);
                SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectByGuid));
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        Populate(dr, this);
                    }
                    dr.Close();
                }
                else
                {
                    dr.Close();
                }
            }
        }
コード例 #8
0
        public static tilbudHeader GetTilbudByCompany(int CompanyID)
        {
            DBAccess     db = new DBAccess();
            tilbudHeader c  = new tilbudHeader();

            db.AddInt("CompanyID", CompanyID);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectByCompany));

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Populate(dr, c);
                }
                dr.Close();
                return(c);
            }
            else
            {
                dr.Close();
                return(c); //Nothing
            }
        }
コード例 #9
0
        public static System.Collections.Generic.List <AED_Battery> GetBatteryList(int AED_FK)
        {
            System.Collections.Generic.List <AED_Battery> result = new System.Collections.Generic.List <AED_Battery>();
            int      ID = -1;
            DBAccess db = new DBAccess();

            db.AddInt("AED_FK", AED_FK);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            SqlDataReader dr = default(SqlDataReader);

            //Try
            dr = (System.Data.SqlClient.SqlDataReader)(db.ExecuteReader(_SQLSelectByAED));
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    ID = System.Convert.ToInt32(dr.DBtoInt("ID"));
                    result.Add(AED_Battery.GetBattery(ID));
                }
            }
            dr.Close();
            //Catch ex As Exception
            //Throw ex
            //End Try

            return(result);
        }
コード例 #10
0
        public static System.Collections.Generic.List <Aiva> GetAivaList()
        {
            System.Collections.Generic.List <Aiva> result = new System.Collections.Generic.List <Aiva>();
            int      ID = -1;
            DBAccess db = new DBAccess();

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            SqlDataReader dr = default(SqlDataReader);

            try
            {
                dr = (System.Data.SqlClient.SqlDataReader)(db.ExecuteReader(_SQLSelectAll));
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        Aiva pc = new Aiva();
                        Populate(dr, pc);
                        result.Add(pc);
                    }
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return(result);
        }
コード例 #11
0
        public static DataSet Search_EyeWash(string Search)
        {
            DataSet  ds     = new DataSet();
            DataSet  dsTemp = new DataSet();
            bool     flag   = false;
            DBAccess db     = new DBAccess();

            string[] arr = Search.Split(' ');
            foreach (string s in arr)
            {
                db.AddNVarChar("Search", s, 50);

                db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
                db.AddGuid("AgentID", CurrentUserID);

                dsTemp = db.ExecuteDataSet(_SQLSelectBySearch);
                db.Parameters.Clear();
                //If dsTemp.Tables.Count > 0 Then
                ds.Merge(dsTemp);
                if (flag == false)
                {
                    DataColumn[] pk = new DataColumn[2];
                    pk[0] = ds.Tables[0].Columns["ID"];
                    ds.Tables[0].PrimaryKey = pk;
                    flag = true;
                }
                //End If
            }
            return(ds);
        }
コード例 #12
0
        public static DataSet GetEyeWash_SearchAll(string Postnr, string SerialNo)
        {
            DataSet  ds     = new DataSet();
            DataSet  dsTemp = new DataSet();
            bool     flag   = false;
            DBAccess db     = new DBAccess();

            //Dim arr As String() = Search.Split(" "c)
            //For Each s As String In arr
            db.AddNVarChar("Postnr", Postnr, 50);
            db.AddNVarChar("SerialNo", SerialNo, 50);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            //	EXEC	@return_value = [vicjos1_sysadm].[Co2Db_EyeWash_Search]
            //			@SerialNo = ''
            //		,	@Postnr =   '3400'
            //		,	@IsAgent = 0
            //		,	@AgentID = null
            dsTemp = db.ExecuteDataSet(_SQLSearch);
            db.Parameters.Clear();

            ds.Merge(dsTemp);
            if (flag == false)
            {
                DataColumn[] pk = new DataColumn[2];
                pk[0] = ds.Tables[0].Columns["ID"];
                ds.Tables[0].PrimaryKey = pk;
                flag = true;
            }

            return(ds);
        }
コード例 #13
0
        public static System.Collections.Generic.List <AED_Trainer> GetAEDTrainerList(int CompanyID)
        {
            System.Collections.Generic.List <AED_Trainer> result = new System.Collections.Generic.List <AED_Trainer>();
            int      ID = -1;
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            SqlDataReader dr = default(SqlDataReader);

            try
            {
                dr = (System.Data.SqlClient.SqlDataReader)(db.ExecuteReader(_SQLSelectIDByCompany));
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        ID = System.Convert.ToInt32(dr.DBtoInt("ID"));
                        result.Add(AED_Trainer.GetAED(ID));
                    }
                }
                dr.Close();
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return(result);
        }
コード例 #14
0
        public static DataSet GetEyeWashsByCriteriaDS(string fieldnames, string criteria, params SqlParameter[] @params)
        {
            DBAccess db    = new DBAccess();
            string   query = "";

            query += "SELECT ";
            if (fieldnames.Trim() != "")
            {
                query += fieldnames;
            }
            else
            {
                query += " * ";
            }
            query += " FROM vw_Co2Db_EyeWash ";
            query += " WHERE ( @IsAgent = 0 OR ( @IsAgent = 1 AND [AgentID] = @AgentID ) )";
            if (criteria != "")
            {
                query += " AND (" + criteria + ")";
            }

            db.CommandType = CommandType.Text;
            db.CommandText = query;
            db.AddRange(@params);
            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(); //(_SQLSelectByGuid)

            return(ds);
        }
コード例 #15
0
        public static System.Collections.Generic.List <EyeWash> GetListSoonExpired(int CompanyID)
        {
            System.Collections.Generic.List <EyeWash> result = new System.Collections.Generic.List <EyeWash>();
            int      ID = -1;
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            SqlDataReader dr = default(SqlDataReader);

            //Try
            dr = (System.Data.SqlClient.SqlDataReader)(db.ExecuteReader(_SQLSelectAllSoonExpired));
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    ID = System.Convert.ToInt32(dr.DBtoInt("ID"));
                    result.Add(EyeWash.GetEyeWash(ID));
                }
            }
            dr.Close();
            //Catch ex As Exception
            //    Throw ex
            //End Try

            return(result);
        }
コード例 #16
0
        private static void AddParms(ref DBAccess db, CampaignCompany rec)
        {
            var with_1 = rec;

            db.AddInt("CompanyID", with_1.CompanyID);
            db.AddInt("CampaignID", with_1.CampaignID);
            db.AddInt("Status", (System.Int32)with_1.Status);

            db.AddGuid("ResponsibleID", with_1.ResponsibleID);
            db.AddNVarChar("ResponsibleName", with_1.ResponsibleName, 50);
            db.AddNVarChar("ResponsibleEmail", with_1.ResponsibleEmail, 255);

            db.AddNVarChar("ContactPerson", with_1.ContactPerson, 50);
            db.AddBoolean("ContactedByPhone", with_1.ContactedByPhone);

            db.AddBoolean("MeetingHeld", with_1.MeetingHeld);
            db.AddBoolean("CampaignSale", with_1.CampaignSale);
            db.AddMoney("CampaignSaleAmount", (double)with_1.CampaignSaleAmount);
            db.AddBoolean("ExpectedSale", with_1.ExpectedSale);
            db.AddMoney("ExpectedSaleAmount", (double)with_1.ExpectedSaleAmount);

            db.AddNVarChar("Notes", with_1.Notes, -1);

            AddParmsStandard(db, rec);
        }
コード例 #17
0
        public static DataSet GetAllAED()
        {
            DBAccess db = new DBAccess();

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectAll);

            return(ds);
        }
コード例 #18
0
        public static DataSet GetAllEyeWash()
        {
            DBAccess db = new DBAccess();

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            //db.Parameters.Add(New SqlParameter("@sUserName", username))
            DataSet ds = db.ExecuteDataSet(_SQLSelectAll);

            return(ds);
        }
コード例 #19
0
        public static DataSet GetAivaByCompanyDS(int CompanyID)
        {
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);
            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectCompanyID);

            return(ds);
        }
コード例 #20
0
        public static int GetEyeWashcountByCompany(int CompanyID)
        {
            int      res = 0;
            DBAccess db  = new DBAccess();

            db.AddInt("CompanyID", CompanyID);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            res = Funktioner.ToInt(db.ExecuteScalar(_SQLCountByCompany));
            return(res);
        }
コード例 #21
0
        public static DataSet GetBottleByEYE(int EYE_FK)
        {
            DBAccess db = new DBAccess();

            db.AddInt("EYE_FK", EYE_FK);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectByEYE);

            return(ds);
        }
コード例 #22
0
        public static EyeWash GetEyeWashbyGuid(Guid GuID)
        {
            DBAccess db = new DBAccess();
            EyeWash  c  = new EyeWash();

            db.AddGuid("Guid", GuID);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectByGuid));

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Populate(dr, c);
                }
            }
            dr.Close();
            return(c);
        }
コード例 #23
0
        public static FirstAidBag_Service GetService(System.Guid Guid)
        {
            FirstAidBag_Service c  = new FirstAidBag_Service();
            DBAccess            db = new DBAccess();

            db.AddGuid("Guid", Guid);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectByGuid));

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    Populate(dr, c);
                }
            }
            dr.Close();
            return(c);
        }
コード例 #24
0
        public static DataSet GetAllTilbud(TilbudStatusEnum status)
        {
            DBAccess db = new DBAccess();

            db.AddInt("status", System.Convert.ToInt32(status));

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectByStatus);

            return(ds);
        }
コード例 #25
0
        public static DataSet GetBatteryByAED(int AED_FK)
        {
            DBAccess db = new DBAccess();

            db.AddInt("AED_FK", AED_FK);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectByAED);

            return(ds);
        }
コード例 #26
0
        public static DataSet GetEyeWashbyBilagStatus(int CompanyID, int BilagStatus)
        {
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);
            db.AddInt("BilagStatus", BilagStatus);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectByBilagStatus);

            return(ds);
        }
コード例 #27
0
 private static void AddParms(ref DBAccess db, tilbudHeader c)
 {
     db.AddInt("Status", (System.Int32)c.Status);
     db.AddInt("CompanyID", c.CompanyID);
     db.AddDateTime("Opretdato", c.Opretdato);
     db.AddDateTime("Udlobdato", c.Udlobdato);
     db.AddInt("AnsvarligID", c.AnsvarligID);
     db.AddGuid("AnsvarligGUID", c.AnsvarligGUID);
     db.AddNVarChar("KontaktEmail", c.KontaktEmail, 250);
     db.AddNVarChar("KontaktPerson", c.KontaktPerson, 50);
     db.AddNVarChar("Noter", c.Noter, -1);
     db.AddNVarChar("TilbudsTillaeg", c.TilbudsTillaeg, -1);
     db.AddDecimal("Transport", c.Transport);
     AddParmsStandard(db, c);
 }
コード例 #28
0
        public static DataSet SelectAllExpired(int CompanyID, int Status, int ExpireTime, DateTime ExpireDate)
        {
            DBAccess db = new DBAccess();

            db.AddInt("CompanyID", CompanyID);
            db.AddInt("Status", Status);
            db.AddInt("ExpireTime", ExpireTime);
            db.AddDateTime("ExpireDate", ExpireDate);

            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            DataSet ds = db.ExecuteDataSet(_SQLSelectAllExpired);

            return(ds);
        }
コード例 #29
0
        public static List <EyeWash> GetEyeWashsByCriteria(string OrderBY, string criteria, params SqlParameter[] @params)
        {
            DBAccess db = new DBAccess();
            //Dim conn As SqlConnection = DataFunctions.GetConnection()
            string query = "";

            query += "SELECT ";
            if (OrderBY != "")
            {
                query += " TOP (100) PERCENT ";
            }
            query += " * FROM vw_Co2Db_EyeWash ";
            query += " WHERE ( @IsAgent = 0 OR ( @IsAgent = 1 AND [AgentID] = @AgentID ) )";
            if (criteria != "")
            {
                query += " AND (" + criteria + ")";
            }
            if (OrderBY != "")
            {
                query += " ORDER BY " + OrderBY;
            }

            //Dim cmd As New SqlCommand(query, conn)
            db.CommandType = CommandType.Text;
            db.CommandText = query;
            db.AddRange(@params);
            db.AddBoolean("IsAgent", AdgangsKontrol.IsAgent());
            db.AddGuid("AgentID", CurrentUserID);

            db.Open();
            SqlDataReader dr = (SqlDataReader)(db.ExecuteReader());  //cmd.ExecuteReader()

            List <EyeWash> list = new List <EyeWash>();

            while (dr.Read())
            {
                EyeWash _EyeWash = new EyeWash();
                EyeWash.Populate(dr, _EyeWash);
                list.Add(_EyeWash);
            }

            db.Dispose();

            return(list);
        }
コード例 #30
0
 public EyeWash(System.Guid GUID)
 {
     if (GUID != System.Guid.Empty)
     {
         DBAccess db = new DBAccess();
         db.AddGuid("GUID", GUID);
         SqlDataReader dr = (SqlDataReader)(db.ExecuteReader(_SQLSelectByGuid));
         if (dr.HasRows)
         {
             while (dr.Read())
             {
                 Populate(dr, this);
             }
             dr.Close();
         }
         else
         {
             dr.Close();
         }
     }
 }