Exemple #1
0
        private static Contactperson VerwerkRij(IDataRecord rij)
        {
            Contactperson type = new Contactperson();

            type.ID = Convert.ToInt32(rij["ID"].ToString());
            type.Name = rij["Name"].ToString();
            type.Company = rij["Company"].ToString();
            type.City = rij["City"].ToString();

            type.JobRole = ContactpersonType.GetContactPersonTypeByID(Convert.ToInt32( rij["JobRole"].ToString()));
            type.Phone = rij["Phone"].ToString();
            type.Cellphone = rij["Cellphone"].ToString();
            type.Email = rij["Email"].ToString();
            return type;
        }
Exemple #2
0
        public static void AddType(Contactperson SelectedContactPerson)
        {
            try
            {

                DbParameter paramName = Database.AddParameter("@Name", SelectedContactPerson.Name);
                DbParameter paramCompany = Database.AddParameter("@Company", SelectedContactPerson.Company);
                DbParameter paramCity = Database.AddParameter("@City", SelectedContactPerson.City);
                DbParameter paramJobrole = Database.AddParameter("@JobRole", SelectedContactPerson.JobRole.ID);
                DbParameter paramPhone = Database.AddParameter("@Phone", SelectedContactPerson.Phone);
                DbParameter paramCellphone = Database.AddParameter("@Cellphone", SelectedContactPerson.Cellphone);
                DbParameter paramEmail = Database.AddParameter("@Email", SelectedContactPerson.Email);

                Database.ModifyData("INSERT INTO ContactPerson (Name,Company,JobRole,City,Email,Phone,Cellphone) values (@Name,@Company,@JobRole,@City,@Email,@Phone,@Cellphone)", paramName, paramCompany, paramCity, paramJobrole, paramPhone, paramCellphone, paramEmail);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

        }
Exemple #3
0
        public static void DeleteType(Contactperson SelectedContactPerson)
        {
            try
            {
                DbParameter paramName = Database.AddParameter("@Name", SelectedContactPerson.Name);

                Database.ModifyData("DELETE FROM ContactPerson WHERE Name = @Name", paramName);
            }
            catch (Exception e)
            {

                throw e;
            }
        }
Exemple #4
0
        public static void EditCp(Contactperson cp)
        {
            try
            {
   

                string sql = "UPDATE ContactPerson SET Name=@name,Company = @company,JobRole = @role,City = @city,Email=@email,Phone = @phone,Cellphone= @cell WHERE ID=@ID;";

                DbParameter par1 = Database.AddParameter("@name", cp.Name);
                DbParameter par2 = Database.AddParameter("@company", cp.Company);
                DbParameter par3 = Database.AddParameter("@role", cp.JobRole);
                DbParameter par4 = Database.AddParameter("@city", cp.City);
                DbParameter par5 = Database.AddParameter("@email", cp.Email);
                DbParameter par6 = Database.AddParameter("@phone", cp.Phone);
                DbParameter par7 = Database.AddParameter("@cell", cp.Cellphone);
                DbParameter parID = Database.AddParameter("@ID", Convert.ToInt32(cp.ID));

                Database.ModifyData(sql, par1,par2,par3,par4,par5,par6,par7, parID);



            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                throw ex;
            }
        }
 private void AddContactPerson()
 {
     Contactperson person = new Contactperson();
     ContactPersons.Add(person);
     SelectedContactPersoon = person;
 }