public static ReturnObject UpdateFuneral(List <KeyValue> funeral) { try { var id = funeral.FirstOrDefault(x => x.Key == "Id")?.Value; var graveNumber = funeral.FirstOrDefault(x => x.Key == "GraveNumber")?.Value; var informantId = funeral.FirstOrDefault(x => x.Key == "InformantId")?.Value; var doctorId = funeral.FirstOrDefault(x => x.Key == "DoctorId")?.Value; var nextOfKinId = funeral.FirstOrDefault(x => x.Key == "NextOfKinId")?.Value; var homeAffairsOfficerId = funeral.FirstOrDefault(x => x.Key == "HomeAffairsOfficerId")?.Value; var mortuaryId = funeral.FirstOrDefault(x => x.Key == "MortuaryId")?.Value; var cemeteryId = funeral.FirstOrDefault(x => x.Key == "CemeteryId")?.Value; var burialDate = funeral.FirstOrDefault(x => x.Key == "BurialDate")?.Value; var modifiedById = funeral.FirstOrDefault(x => x.Key == "ModifiedById")?.Value; var parsedBurialDate = burialDate == null ? null : DateTime.Parse(burialDate).ToString(CultureInfo.InvariantCulture); var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Funeral_update]", new List <SqlParameter> { new SqlParameter("@id", id), new SqlParameter("@graveNumber", graveNumber), new SqlParameter("@informantId", informantId), new SqlParameter("@doctorId", doctorId), new SqlParameter("@nextOfKinId", nextOfKinId), new SqlParameter("@homeAffairsOfficerId", homeAffairsOfficerId), new SqlParameter("@mortuaryId", mortuaryId), new SqlParameter("@cemeteryId", cemeteryId), new SqlParameter("@burialDate", parsedBurialDate), new SqlParameter("@modifiedById", modifiedById) }); if (returnValue == 1) { return(new ReturnObject() { Id = id, State = "success", Message = "record was successfully updated!" }); } return(new ReturnObject() { Id = id, State = "error", Message = "an error occured while updating this record!" }); } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject UpdatePerson(List <KeyValue> person) { try { var id = person.FirstOrDefault(x => x.Key == "Id")?.Value; var firstName = person.FirstOrDefault(x => x.Key == "FirstName")?.Value; var lastName = person.FirstOrDefault(x => x.Key == "LastName")?.Value; var saIdNumber = person.FirstOrDefault(x => x.Key == "SAIdNumber")?.Value; var dateOfBirth = person.FirstOrDefault(x => x.Key == "DateOfBirth")?.Value; var genderId = person.FirstOrDefault(x => x.Key == "GenderId")?.Value; var contactNumber = person.FirstOrDefault(x => x.Key == "ContactNumber")?.Value; var emailAddress = person.FirstOrDefault(x => x.Key == "EmailAddress")?.Value; var addressId = person.FirstOrDefault(x => x.Key == "AddressId")?.Value; var modifiedById = person.FirstOrDefault(x => x.Key == "ModifiedById")?.Value; var parsedDateOfBirth = dateOfBirth == null ? dateOfBirth : DateTime.Parse(dateOfBirth).ToString(); var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Person_update]", new List <SqlParameter> { new SqlParameter("@id", id), new SqlParameter("@firstName", firstName), new SqlParameter("@lastName", lastName), new SqlParameter("@saIdNumber", saIdNumber), new SqlParameter("@dateOfBirth", parsedDateOfBirth), new SqlParameter("@genderId", genderId), new SqlParameter("@contactNumber", contactNumber), new SqlParameter("@emailAddress", emailAddress), new SqlParameter("@addressId", addressId), new SqlParameter("@modifiedById", modifiedById) }); if (returnValue == 1) { return(new ReturnObject() { Id = id, State = "success", Message = "record was successfully updated!" }); } return(new ReturnObject() { Id = id, State = "error", Message = "an error occured while updating this record!" }); } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject InsertPayment(List <KeyValue> payment) { try { var id = payment.FirstOrDefault(x => x.Key == "Id")?.Value; var monthId = payment.FirstOrDefault(x => x.Key == "MonthId")?.Value; var yearId = payment.FirstOrDefault(x => x.Key == "YearId")?.Value; var memberId = payment.FirstOrDefault(x => x.Key == "MemberId")?.Value; var amount = payment.FirstOrDefault(x => x.Key == "Amount")?.Value; var paymentDate = payment.FirstOrDefault(x => x.Key == "PaymentDate")?.Value; var documentId = payment.FirstOrDefault(x => x.Key == "DocumentId")?.Value; var paymentPeriodId = payment.FirstOrDefault(x => x.Key == "PaymentPeriodId")?.Value; var createdOn = payment.FirstOrDefault(x => x.Key == "CreatedOn")?.Value; var createdById = payment.FirstOrDefault(x => x.Key == "CreatedById")?.Value; var parsedPaymentDate = paymentDate == null ? paymentDate : DateTime.Parse(paymentDate).ToString(); var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Payment_create]", new List <SqlParameter> { new SqlParameter("@id", id), new SqlParameter("@monthId", monthId), new SqlParameter("@yearId", yearId), new SqlParameter("@memberId", memberId), new SqlParameter("@amount", amount), new SqlParameter("@paymentDate", parsedPaymentDate), new SqlParameter("@documentId", documentId), new SqlParameter("@createdOn", createdOn), new SqlParameter("@createdById", createdById), new SqlParameter("@stateId", 1) }); if (returnValue == 1) { return(new ReturnObject() { Id = id, State = "success", Message = "record was successfully created!" }); } return(new ReturnObject() { Id = id, State = "error", Message = "an error occured while creating this record!" }); } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject InsertAddress(List <KeyValue> address) { try { var Id = address.FirstOrDefault(x => x.Key == "Id")?.Value; var fullAddress = address.FirstOrDefault(x => x.Key == "FullAddress")?.Value; var streetNumber = address.FirstOrDefault(x => x.Key == "StreetNumber")?.Value; var streetAddress = address.FirstOrDefault(x => x.Key == "StreetAddress")?.Value; var subLocality = address.FirstOrDefault(x => x.Key == "SubLocality")?.Value; var city = address.FirstOrDefault(x => x.Key == "City")?.Value; var province = address.FirstOrDefault(x => x.Key == "Province")?.Value; var country = address.FirstOrDefault(x => x.Key == "Country")?.Value; var postalCode = address.FirstOrDefault(x => x.Key == "PostalCode")?.Value; var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Address_create]", new List <SqlParameter> { new SqlParameter("@id", Id), new SqlParameter("@fullAddress", fullAddress), new SqlParameter("@streetNumber", streetNumber), new SqlParameter("@streetAddress", streetAddress), new SqlParameter("@subLocality", subLocality), new SqlParameter("@city", city), new SqlParameter("@province", province), new SqlParameter("@country", country), new SqlParameter("@postalCode", postalCode), new SqlParameter("@stateId", 1) }); if (returnValue == 1) { return(new ReturnObject() { Id = Id, State = "success", Message = "record was successfully created!" }); } else { return new ReturnObject() { Id = Id, State = "error", Message = "an error occured while creating this record!" } }; } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static void SetNextNumber(string numberConfigurationId, string entityName, int nextNumber) { SharedService.ExecutePostSqlStoredProcedure("[bbu].[Numberconfiguration_updatenextnumber]", new List <SqlParameter> { new SqlParameter("@id", numberConfigurationId), new SqlParameter("@entityName", entityName), new SqlParameter("@nextNumber", nextNumber) }); }
public static ReturnObject InsertFuneralDocument(List <KeyValue> funeralDocument, byte[] image) { try { var id = funeralDocument.FirstOrDefault(x => x.Key == "Id")?.Value; var name = funeralDocument.FirstOrDefault(x => x.Key == "Name")?.Value; var description = funeralDocument.FirstOrDefault(x => x.Key == "Description")?.Value; var funeralId = funeralDocument.FirstOrDefault(x => x.Key == "FuneralId")?.Value; var createdById = funeralDocument.FirstOrDefault(x => x.Key == "CreatedById")?.Value; var createdOn = funeralDocument.FirstOrDefault(x => x.Key == "CreatedOn")?.Value; var modifiedById = funeralDocument.FirstOrDefault(x => x.Key == "ModifiedById")?.Value; var modifiedOn = funeralDocument.FirstOrDefault(x => x.Key == "ModifiedOn")?.Value; var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Funeraldocument_create]", new List <SqlParameter> { new SqlParameter("@id", id), new SqlParameter("@name", name), new SqlParameter("@description", description), new SqlParameter("@funeralId", funeralId), new SqlParameter("@createdById", createdById), new SqlParameter("@createdOn", createdOn), new SqlParameter("@modifiedById", modifiedById), new SqlParameter("@modifiedOn", modifiedOn), new SqlParameter("@stateId", 1) }); if (returnValue == 1) { return(new ReturnObject() { Id = id, State = "success", Message = "record was successfully created!" }); } else { return new ReturnObject() { Id = "", State = "error", Message = "an error occured while creating this record!" } }; } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject InsertFuneralBoughtItem(List <KeyValue> funeralBoughtItem) { try { var Id = funeralBoughtItem.FirstOrDefault(x => x.Key == "Id")?.Value; var name = funeralBoughtItem.FirstOrDefault(x => x.Key == "Name")?.Value; var amount = funeralBoughtItem.FirstOrDefault(x => x.Key == "Amount")?.Value; var quantity = funeralBoughtItem.FirstOrDefault(x => x.Key == "Quantity")?.Value; var funeralId = funeralBoughtItem.FirstOrDefault(x => x.Key == "FuneralId")?.Value; var supplierId = funeralBoughtItem.FirstOrDefault(x => x.Key == "SupplierId")?.Value; var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Funeralboughtitem_create]", new List <SqlParameter> { new SqlParameter("@id", Id), new SqlParameter("@name", name), new SqlParameter("@amount", amount), new SqlParameter("@quantity", quantity), new SqlParameter("@funeralId", funeralId), new SqlParameter("@supplierId", supplierId), new SqlParameter("@stateId", 1) }); if (returnValue == 1) { return(new ReturnObject() { Id = Id, State = "success", Message = "record was successfully created!" }); } else { return new ReturnObject() { Id = Id, State = "error", Message = "an error occured while creating this record!" } }; } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject InsertDocument(List <KeyValue> document, byte[] fileContent) { try { var id = document.FirstOrDefault(x => x.Key == "Id")?.Value; var name = document.FirstOrDefault(x => x.Key == "Name")?.Value; var fileName = document.FirstOrDefault(x => x.Key == "FileName")?.Value; var mimeType = document.FirstOrDefault(x => x.Key == "MimeType")?.Value; var size = document.FirstOrDefault(x => x.Key == "Size")?.Value; var createdById = document.FirstOrDefault(x => x.Key == "CreatedById")?.Value; var createdOn = document.FirstOrDefault(x => x.Key == "CreatedOn")?.Value; var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Document_create]", new List <SqlParameter> { new SqlParameter("@id", id), new SqlParameter("@fileName", fileName), new SqlParameter("@mimeType", mimeType), new SqlParameter("@size", size), new SqlParameter("@fileContent", fileContent), new SqlParameter("@createdOn", createdOn), new SqlParameter("@createdById", createdById), new SqlParameter("@stateId", 1) }); if (returnValue == 1) { return(new ReturnObject() { Id = id, State = "success", Message = "record was successfully created!" }); } return(new ReturnObject() { Id = "", State = "error", Message = "an error occured while creating this record!" }); } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject InsertDeceased(List <KeyValue> deceased) { try { var personId = deceased.FirstOrDefault(x => x.Key == "PersonId")?.Value; var dateOfDeath = deceased.FirstOrDefault(x => x.Key == "DateOfDeath")?.Value; var placeOfDeath = deceased.FirstOrDefault(x => x.Key == "PlaceOfDeath")?.Value; var whereWasTheBodyRetrieved = deceased.FirstOrDefault(x => x.Key == "WhereWasTheBodyRetrieved")?.Value; var causeOfDeath = deceased.FirstOrDefault(x => x.Key == "CauseOfDeath")?.Value; var parsedDateOfDeath = dateOfDeath == null ? dateOfDeath : DateTime.Parse(dateOfDeath).ToString(); var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Deceased_create]", new List <SqlParameter> { new SqlParameter("@personId", personId), new SqlParameter("@dateOfDeath", parsedDateOfDeath), new SqlParameter("@placeOfDeath", placeOfDeath), new SqlParameter("@whereWasTheBodyRetrieved", whereWasTheBodyRetrieved), new SqlParameter("@causeOfDeath", causeOfDeath), new SqlParameter("@stateId", 1) }); if (returnValue == 1) { return(new ReturnObject() { Id = personId, State = "success", Message = "record was successfully created!" }); } else { return new ReturnObject() { Id = personId, State = "error", Message = "an error occured while creating this record!" } }; } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject InsertHospital(List <KeyValue> hospital) { try { var id = hospital.FirstOrDefault(x => x.Key == "Id")?.Value; var name = hospital.FirstOrDefault(x => x.Key == "Name")?.Value; var addressId = hospital.FirstOrDefault(x => x.Key == "AddressId")?.Value; var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Hospital_create]", new List <SqlParameter> { new SqlParameter("@id", id), new SqlParameter("@name", name), new SqlParameter("@addressId", addressId), new SqlParameter("@stateId", 1) }); if (returnValue == 1) { return(new ReturnObject() { Id = id, State = "success", Message = "record was successfully created!" }); } return(new ReturnObject() { Id = "", State = "error", Message = "an error occured while creating this record!" }); } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject InsertDoctor(List <KeyValue> doctor) { try { var personId = doctor.FirstOrDefault(x => x.Key == "PersonId")?.Value; var hospitalId = doctor.FirstOrDefault(x => x.Key == "HospitalId")?.Value; var practiceNumber = doctor.FirstOrDefault(x => x.Key == "PracticeNumber")?.Value; var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Doctor_create]", new List <SqlParameter> { new SqlParameter("@personId", personId), new SqlParameter("@hospitalId", hospitalId), new SqlParameter("@PracticeNumber", practiceNumber), new SqlParameter("@stateId", 1) }); if (returnValue == 1) { return(new ReturnObject() { Id = personId, State = "success", Message = "record was successfully created!" }); } return(new ReturnObject() { Id = personId, State = "error", Message = "an error occured while creating this record!" }); } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject UpdateNextOfKin(List <KeyValue> nextOfKin) { try { var personId = nextOfKin.FirstOrDefault(x => x.Key == "Id")?.Value; var relationshipToDeceased = nextOfKin.FirstOrDefault(x => x.Key == "RelationshipToDeceased")?.Value; var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[NextOfKin_update]", new List <SqlParameter> { new SqlParameter("@personId", personId), new SqlParameter("@relationshipToDeceased", relationshipToDeceased), }); if (returnValue == 1) { return(new ReturnObject() { Id = personId, State = "success", Message = "record was successfully updated!" }); } else { return new ReturnObject() { Id = personId, State = "error", Message = "an error occured while updating this record!" } }; } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject InsertInformant(List <KeyValue> informant) { try { var personId = informant.FirstOrDefault(x => x.Key == "PersonId")?.Value; var relationshipToDeceased = informant.FirstOrDefault(x => x.Key == "RelationshipToDeceased")?.Value; var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Informant_create]", new List <SqlParameter> { new SqlParameter("@personId", personId), new SqlParameter("@relationshipToDeceased", relationshipToDeceased), new SqlParameter("@stateId", 1) }); if (returnValue == 1) { return(new ReturnObject() { Id = personId, State = "success", Message = "record was successfully created!" }); } return(new ReturnObject() { Id = personId, State = "error", Message = "an error occured while creating this record!" }); } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject UpdateSupplier(List <KeyValue> supplier) { try { var id = supplier.FirstOrDefault(x => x.Key == "Id")?.Value; var name = supplier.FirstOrDefault(x => x.Key == "Name")?.Value; var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Supplier_update]", new List <SqlParameter> { new SqlParameter("@id", id), new SqlParameter("@name", name) }); if (returnValue == 1) { return(new ReturnObject() { Id = id, State = "success", Message = "record was successfully updated!" }); } return(new ReturnObject() { Id = id, State = "error", Message = "an error occured while updating this record!" }); } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject DeactivateNextOfKin(Guid nextOfKinId) { try { var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Homeaffairsofficer_deactivate]", new List <SqlParameter> { new SqlParameter("@id", nextOfKinId) }); if (returnValue == 1) { return(new ReturnObject() { Id = nextOfKinId.ToString(), State = "success", Message = "record was successfully updated!" }); } return(new ReturnObject() { Id = nextOfKinId.ToString(), State = "error", Message = "an error occured while updating this record!" }); } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }
public static ReturnObject InsertFuneral(List <KeyValue> funeral) { try { var Id = funeral.FirstOrDefault(x => x.Key == "Id")?.Value; var funeralNumber = funeral.FirstOrDefault(x => x.Key == "FuneralNumber")?.Value; var graveNumber = funeral.FirstOrDefault(x => x.Key == "GraveNumber")?.Value; var deceasedId = funeral.FirstOrDefault(x => x.Key == "DeceasedId")?.Value; var informantId = funeral.FirstOrDefault(x => x.Key == "InformantId")?.Value; var doctorId = funeral.FirstOrDefault(x => x.Key == "DoctorId")?.Value; var nextOfKinId = funeral.FirstOrDefault(x => x.Key == "NextOfKinId")?.Value; var homeAffairsOfficerId = funeral.FirstOrDefault(x => x.Key == "HomeAffairsOfficerId")?.Value; var mortuaryId = funeral.FirstOrDefault(x => x.Key == "MortuaryId")?.Value; var cemeteryId = funeral.FirstOrDefault(x => x.Key == "CemeteryId")?.Value; var createdById = funeral.FirstOrDefault(x => x.Key == "CreatedById")?.Value; var createdOn = funeral.FirstOrDefault(x => x.Key == "CreatedOn")?.Value; var modifiedById = funeral.FirstOrDefault(x => x.Key == "ModifiedById")?.Value; var modifiedOn = funeral.FirstOrDefault(x => x.Key == "ModifiedOn")?.Value; var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Funeral_create]", new List <SqlParameter> { new SqlParameter("@id", Id), new SqlParameter("@funeralNumber", funeralNumber), new SqlParameter("@graveNumber", graveNumber), new SqlParameter("@deceasedId", deceasedId), new SqlParameter("@informantId", informantId), new SqlParameter("@doctorId", doctorId), new SqlParameter("@nextOfKinId", nextOfKinId), new SqlParameter("@homeAffairsOfficerId", homeAffairsOfficerId), new SqlParameter("@mortuaryId", mortuaryId), new SqlParameter("@cemeteryId", cemeteryId), new SqlParameter("@createdById", createdById), new SqlParameter("@createdOn", createdOn), new SqlParameter("@modifiedById", modifiedById), new SqlParameter("@modifiedOn", modifiedOn), new SqlParameter("@stateId", 1) }); if (returnValue == 1) { return(new ReturnObject() { Id = Id, State = "success", Message = "record was successfully created!" }); } else { return new ReturnObject() { Id = Id, State = "error", Message = "an error occured while creating this record!" } }; } catch (Exception ex) { return(new ReturnObject() { Id = "", State = "error", Message = ex.Message }); } }