public contactComms getContactCommId(Guid contactCommId) { contactComms data = new contactComms(); if (contactCommId == Guid.Empty) { return(null); } using (contactCommDatabaseLogicLayer contactCommDatabase = new contactCommDatabaseLogicLayer()) { SqlDataReader reader = contactCommDatabase.getContactCommId(contactCommId); while (reader.Read()) { data.id = reader.IsDBNull(0) ? Guid.Empty : reader.GetGuid(0); data.contactId = reader.IsDBNull(1) ? Guid.Empty : reader.GetGuid(1); data.commType = reader.IsDBNull(2) ? 0 : reader.GetInt32(2); data.commValue = reader.IsDBNull(3) ? string.Empty : reader.GetString(3); } reader.Close(); contactCommDatabase.connectionWizard(); } return(data); }
void getContactComm(Guid contactCommID) { contactCommService contactCommService = new contactCommService(); dataComm = contactCommService.getContactCommId(contactCommID); cmbCommTypes.SelectedValue = dataComm.commType; txtCommValue.Text = dataComm.commValue; }
public int updateContactComm(contactComms data) { int resultInt = 0; command = new SqlCommand("updateContactComms", connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("@id", SqlDbType.UniqueIdentifier).Value = data.id; command.Parameters.Add("@commType", SqlDbType.Int).Value = data.commType; command.Parameters.Add("@commValue", SqlDbType.NVarChar).Value = data.commValue; connectionWizard(); resultInt = command.ExecuteNonQuery(); connectionWizard(); return(resultInt); }
public int addNewComm(contactComms data) { int resultInt = 0; command = new System.Data.SqlClient.SqlCommand("addNewContactComm", connection); command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.Add("@id", SqlDbType.UniqueIdentifier).Value = data.id; command.Parameters.Add("@contactId", SqlDbType.UniqueIdentifier).Value = data.contactId; command.Parameters.Add("@commType", SqlDbType.Int).Value = data.commType; command.Parameters.Add("@commValue", SqlDbType.NVarChar).Value = data.commValue; command.Parameters.Add("@createDate", SqlDbType.DateTime).Value = data.createDate; connectionWizard(); resultInt = command.ExecuteNonQuery(); connectionWizard(); return(resultInt); }
public int addNewComm(Guid contactId, int commType, string commValue) { if (contactId == Guid.Empty || commType == 0 || string.IsNullOrEmpty(commValue)) { return(0); } contactComms data = new contactComms() { id = Guid.NewGuid(), commType = commType, commValue = commValue, contactId = contactId, createDate = DateTime.Now }; using (contactCommDatabaseLogicLayer commDatabaseLogicLayer = new contactCommDatabaseLogicLayer()) { return(commDatabaseLogicLayer.addNewComm(data)); } }
public int updateContactComm(Guid id, int commType, string commValue) { int resultInt = 0; if (id == Guid.Empty || commType == 0 || string.IsNullOrEmpty(commValue)) { return(0); } contactComms updateData = new contactComms(); updateData.id = id; updateData.commType = commType; updateData.commValue = commValue; using (contactCommDatabaseLogicLayer contactCommDatabase = new contactCommDatabaseLogicLayer()) { resultInt = contactCommDatabase.updateContactComm(updateData); } return(resultInt); }