Esempio n. 1
0
        public static void DeleteContactpersonType(ContactPersonType ct)
        {
            string      sSQL = "DELETE ContactPersonType Where Name = @Name";
            DbParameter par1 = Database.AddParameter("@Name", ct.Name);

            Database.ModifyData(sSQL, par1);
        }
Esempio n. 2
0
        //Ophalen uit de database
        public static ObservableCollection <ContactPerson> GetContactPersons()
        {
            ObservableCollection <ContactPerson> list = new ObservableCollection <ContactPerson>();

            String       sSQL   = "SELECT * FROM [ContactPerson]";
            DbDataReader reader = Database.GetData(sSQL);



            while (reader.Read())
            {
                ContactPerson c = new ContactPerson();


                int ID = (int)reader["ID"];
                c.ID      = Convert.ToString(ID);
                c.Name    = !Convert.IsDBNull((string)reader["Name"]) ? (string)reader["Name"] : "";
                c.Company = !Convert.IsDBNull((string)reader["Company"]) ? (string)reader["Company"] : "";
                c.JobRole = ContactPersonType.GetJobeRoleByID(Convert.ToString(reader["JobRole"]));

                c.City      = !Convert.IsDBNull((string)reader["City"]) ? (string)reader["City"] : "";
                c.Email     = !Convert.IsDBNull((string)reader["EMail"]) ? (string)reader["EMail"] : "";
                c.Phone     = !Convert.IsDBNull((string)reader["Phone"]) ? (string)reader["Phone"] : "";
                c.Cellphone = !Convert.IsDBNull((string)reader["CellPhone"]) ? (string)reader["CellPhone"] : "";


                list.Add(c);
            }
            return(list);
        }
Esempio n. 3
0
        //Insert in de database
        public static void InsertContactpersonType(ContactPersonType ct)
        {
            String sSQL = "INSERT INTO ContactPersonType (Name) VALUES (@Name)";

            DbParameter par1 = Database.AddParameter("@Name", ct._Name);

            Database.ModifyData(sSQL, par1);
        }
Esempio n. 4
0
        //Update in de database
        public static void UpdateContactpersonType(ContactPersonType ct)
        {
            String sSQL = "UPDATE ContactPersonType SET Name = @Name WHERE ID = @ID";

            DbParameter par1 = Database.AddParameter("@Name", ct._Name);
            DbParameter par2 = Database.AddParameter("@ID", ct._ID);

            Database.ModifyData(sSQL, par1, par2);
        }
Esempio n. 5
0
        //Alle contacttypes ophalen uit de database
        public static ObservableCollection <ContactPersonType> GetTypes()
        {
            ObservableCollection <ContactPersonType> list = new ObservableCollection <ContactPersonType>();

            String       sSQL   = "SELECT * FROM ContactPersonType";
            DbDataReader reader = Database.GetData(sSQL);

            while (reader.Read())
            {
                ContactPersonType ct = new ContactPersonType();

                /// herwerken!!!!!!!!!!!!!!!!!!!!!!!!!!
                ///
                int ID = (int)reader["ID"];
                ct.ID   = Convert.ToString(ID);
                ct.Name = !Convert.IsDBNull((string)reader["Name"]) ? (string)reader["Name"] : "";

                list.Add(ct);
            }
            return(list);
        }
Esempio n. 6
0
        public static ContactPersonType GetJobeRoleByName(ContactPersonType ct)
        {
            ObservableCollection <ContactPersonType> lijst = ContactPersonType.GetTypes();

            return(lijst.Where(cpt => cpt == ct).SingleOrDefault());
        }
Esempio n. 7
0
        public static ContactPersonType GetJobeRoleByID(String JobRoleID)
        {
            ObservableCollection <ContactPersonType> lijst = ContactPersonType.GetTypes();

            return(lijst.Where(ct => ct._ID == JobRoleID).SingleOrDefault());
        }