Exemplo n.º 1
0
 public bool DeleteContact(ContactObject contact)
 {
     try
     {
         Config.Conn.Execute("DELETE FROM dat_Contact WHERE ContactId = @ContactId", contact);
     }
     catch { return(false); }
     return(true);
 }
Exemplo n.º 2
0
        public static void Add(int mainId, string EmployeeId)
        {
            ContactObject co = new ContactObject();

            co.MainId = mainId;
            if (co.SetNames(EmployeeId))
            {
                co.Save();
            }
        }
Exemplo n.º 3
0
 public ContactData(ContactObject co)
 {
     FirstName  = co.Name.FirstName();
     MiddleName = co.Name.MiddelName();
     LastName   = co.Name.LastName();
     Phone      = co.Phone;
     Location   = co.Location;
     EmployeeId = co.EmployeeId;
     WorkOrg    = co.WorkOrg;
     OrcidId    = co.OrcidId;
 }
Exemplo n.º 4
0
 public ContactObject SaveContact(ContactObject contact)
 {
     if (contact.ContactId > 0) // Update
     {
         string sql = @"
             UPDATE  dat_Contact
             SET     [Name] = @Name,
                     Phone = @Phone,
                     Location = @Location,
                     EmployeeId = @EmployeeId,
                     WorkOrg = @WorkOrg,
                     OrcidId = @OrcidId
             WHERE   ContactId = @ContactId";
         Config.Conn.Execute(sql, contact);
     }
     else
     {
         string sql = @"
             INSERT INTO dat_Contact (
                 MainId,
                 [Name],
                 Phone,
                 Location,
                 EmployeeId,
                 WorkOrg,
                 OrcidId
             )
             VALUES (
                 @MainId,
                 @Name,
                 @Phone,
                 @Location,
                 @EmployeeId,
                 @WorkOrg,
                 @OrcidId
             )
             SELECT CAST(SCOPE_IDENTITY() AS INT)";
         contact.ContactId = Config.Conn.Query <int>(sql, contact).Single();
     }
     return(contact);
 }