public int ModifyContact(ContactInfo Contact) { return contactManage.UpDate(Contact); }
public int CreateContact(ContactInfo Contact) { return contactManage.Insert(Contact); }
private SQLiteParameter[] Parameter(ContactInfo Contact) { return new SQLiteParameter[] { new SQLiteParameter("@Id",Contact.Id), new SQLiteParameter("@UserId",Contact.UserId), new SQLiteParameter("@Name",Contact.Name), new SQLiteParameter("@Address",Contact.Address) }; }
public int Insert(ContactInfo Contact) { try { return SqliteHelper.ExecuteNoQuery(System.Data.CommandType.Text, "insert into hm_contact (UserId,Name,Address)values(@UserId,@Name,@Address)", Parameter(Contact)); } catch { return -1; } }
public int UpDate(ContactInfo Contact) { try { return SqliteHelper.ExecuteNoQuery(System.Data.CommandType.Text, "update hm_contact set UserId = @UserId,Name = @Name,Address = @Address where Id = @Id", Parameter(Contact)); } catch { return -1; } }