public static int UpdateSubjectMedicationQuantity(int medicationId, int quantity, int subjectId) { SubjectMedicationModel data = new SubjectMedicationModel { MedicationId = medicationId, Quantity = quantity, SubjectId = subjectId }; string sql = @"update dbo.SubjectsInventory set Quantity = Quantity + @Quantity where MedicationId = @MedicationId and SubjectId = @SubjectId;"; return(SqlDataAccess.SaveData(sql, data)); }
public static int CreateAccount(string firstName, string lastName, string emailAddress, string password, bool tenant, string propertyCode) { AccountModel data = new AccountModel { FirstName = firstName, LastName = lastName, EmailAddress = emailAddress, Password = password, Tenant = tenant, PropertyCode = propertyCode }; string sql = @"INSERT INTO dbo.Account (FirstName, LastName, EmailAddress, Password, Tenant, PropertyCode) VALUES (@FirstName, @LastName, @EmailAddress, @Password, @Tenant, @PropertyCode);"; return(SqlDataAccess.SaveData(sql, data)); }
public static int CreateRegistration(int UserId, string firstName, string lastName, string email, string subject, string phoneNum) { Registration data = new Registration { UserID = UserId, FirstName = firstName, LastName = lastName, Email = email, Subject = subject, PhoneNum = phoneNum, }; string sql = @"insert into dbo.Registration (UserID, FirstName, LastName, Email, Subject, PhoneNum) values (@UserID,@FirstName, @LastName, @Email, @Subject, @PhoneNum);"; return(SqlDataAccess.SaveData(sql, data)); }
public static int CreateAuction(DateTime date, DateTime end_Date, string status, string description, double price) { AuctionModel data = new AuctionModel { Date = date, End_Date = end_Date, Status = status, Description = description, Price = price }; string sql = @"insert into dbo.Auction (Date, End_Date, Status, Description, Price) values (@Date, @End_Date, @Status, @Description, @Price);"; return(SqlDataAccess.SaveData(sql, data)); }
public static int UpdateSubject(int subjectNumber, string gender, DateTime dateOfBirth, int siteNumber) { SubjectModel data = new SubjectModel { SubjectNumber = subjectNumber, Gender = gender, DateOfBirth = dateOfBirth, SiteNumber = siteNumber }; string sql = @"update dbo.Subject set Gender = @Gender, DateOfBirth = @DateOfBirth, SiteNumber = @SiteNumber where SubjectNumber = @SubjectNumber;"; return(SqlDataAccess.SaveData(sql, data)); }
public static int CreateContact(string firstName, string lastName, string company, string phone, string email) { //Map data to a contact model ContactModel data = new ContactModel { FirstName = firstName, LastName = lastName, Company = company, Phone = phone, Email = email }; //create sql statement to insert contact into table using parameterized sql string sql = @"insert into dbo.ContactTable (FirstName, LastName, Company, Phone, Email) values (@FirstName, @LastName, @Company, @Phone, @Email)"; //executes the statement and returns number of rows affected return(SqlDataAccess.SaveData(sql, data)); }
public static int CreatePerson(string personId, string firstName, string lastName, string emailAddress, DateTime dob, string gender, string phoneNumber) { var gen = (gender == "male") ? "1" : "0"; PersonM data = new PersonM { PersonId = personId, FirstName = firstName, LastName = lastName, EmailAddress = emailAddress, DateOfBirth = dob, Gender = gen, PhoneNumber = phoneNumber }; string sql = @"INSERT INTO dbo.Person (PersonId,FirstName,LastName, EmailAddress ,DateOfBirth, PhoneNumber) VALUES (@PersonId, @FirstName, @LastName, @EmailAddress, @DateOfBirth, @PhoneNumber);"; return(SqlDataAccess.SaveData(sql, data)); }
public static void AlterContact(int id, string firstName, string lastName, string company, string phone, string email) { //Map data to a contact model ContactModel data = new ContactModel { Id = id, FirstName = firstName, LastName = lastName, Company = company, Phone = phone, Email = email }; //create sql statement to edit contact in table using parameterized sql string sql = @"UPDATE dbo.ContactTable SET FirstName = @FirstName, LastName = @LastName, Company = @Company, Phone = @Phone, Email = @Email WHERE Id = @Id"; //executes the statement SqlDataAccess.SaveData(sql, data); }
public static int CreateComplaint(int tenantId, int propertyManagerId, DateTime incidentDate, string details, int complaintStatusId, int complaintTypeId) { ComplaintModel data = new ComplaintModel { TenantId = tenantId, PropertyManagerId = propertyManagerId, IncidentDate = incidentDate, Details = details, ComplaintStatusId = complaintStatusId, ComplaintTypeId = complaintTypeId }; string sql = @"INSERT INTO dbo.Complaint (TenantId, PropertyManagerId, IncidentDate, Details, ComplaintStatusId, ComplaintTypeId) VALUES (@TenantId, @PropertyManagerId, @IncidentDate, @Details, @ComplaintStatusId, @ComplaintTypeId);"; return(SqlDataAccess.SaveData(sql, data)); }
public static int UpdateComplaint(int id, DateTime incidentDate, string details, int complaintStatusId, int complaintTypeId, string feedback) { ComplaintModel data = new ComplaintModel { Id = id, IncidentDate = incidentDate, Details = details, ComplaintStatusId = complaintStatusId, ComplaintTypeId = complaintTypeId, Feedback = feedback }; string sql = @"UPDATE dbo.Complaint SET IncidentDate = @IncidentDate, Details = @Details, ComplaintStatusId = @ComplaintStatusId, ComplaintTypeId = @ComplaintTypeId, Feedback = @feedback WHERE Id = @Id;"; return(SqlDataAccess.SaveData(sql, data)); }