예제 #1
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;
            }
        }
예제 #2
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;
        }
예제 #3
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.Name);
                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);
            }

        }