public static ReturnObject InsertPerson(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 createdById = person.FirstOrDefault(x => x.Key == "CreatedById")?.Value; var createdOn = person.FirstOrDefault(x => x.Key == "CreatedOn")?.Value; var modifiedById = person.FirstOrDefault(x => x.Key == "ModifiedById")?.Value; var modifiedOn = person.FirstOrDefault(x => x.Key == "ModifiedOn")?.Value; var parsedDateOfBirth = dateOfBirth == null ? dateOfBirth : DateTime.Parse(dateOfBirth).ToString(CultureInfo.InvariantCulture); var parsedCreatedOn = createdOn == null ? createdOn : DateTime.Parse(createdOn).ToString(CultureInfo.InvariantCulture); var parsedModifiedOn = modifiedOn == null ? modifiedOn : DateTime.Parse(modifiedOn).ToString(CultureInfo.InvariantCulture); var returnValue = SharedService.ExecutePostSqlStoredProcedure("[bbu].[Person_create]", 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("@createdById", createdById), new SqlParameter("@createdOn", parsedCreatedOn), new SqlParameter("@modifiedById", modifiedById), new SqlParameter("@modifiedOn", parsedModifiedOn), 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 DataTable GetBankAccountReportData() { var records = SharedService.ExecuteGetDtSqlStoredProcedure("[bbu].[Report_invoice_bankaccount]", null); return(records); }
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 }); } }
public static List <Dictionary <string, object> > QueryActiveMonths() { var records = SharedService.ExecuteGetSqlStoredProcedure("[bbu].[Paymentperiod_queryactivepaymentperiods]", null); return(records); }