//this procedure inserts a new system user public void InsertSystemUserInfo(CommonExchange.SysAccess userInfo, ref CommonExchange.SysAccess newUserInfo) { newUserInfo.UserId = PrimaryKeys.GetNewSystemUserId(userInfo); using (SqlCommand sqlComm = new SqlCommand()) { sqlComm.Connection = userInfo.Connection; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "dental.InsertSystemUserInfo"; sqlComm.Parameters.Add("@system_user_id", SqlDbType.VarChar).Value = newUserInfo.UserId; sqlComm.Parameters.Add("@system_user_name", SqlDbType.VarChar).Value = newUserInfo.UserName; sqlComm.Parameters.Add("@system_user_password", SqlDbType.VarChar).Value = newUserInfo.Password; sqlComm.Parameters.Add("@system_user_status", SqlDbType.Bit).Value = newUserInfo.UserStatus; sqlComm.Parameters.Add("@access_code", SqlDbType.VarChar).Value = newUserInfo.AccessCode; sqlComm.Parameters.Add("@last_name", SqlDbType.VarChar).Value = newUserInfo.LastName; sqlComm.Parameters.Add("@first_name", SqlDbType.VarChar).Value = newUserInfo.FirstName; sqlComm.Parameters.Add("@middle_name", SqlDbType.VarChar).Value = newUserInfo.MiddleName; sqlComm.Parameters.Add("@position", SqlDbType.VarChar).Value = newUserInfo.Position; sqlComm.Parameters.Add("@created_by", SqlDbType.VarChar).Value = userInfo.UserId; sqlComm.ExecuteNonQuery(); } } //----------------------------
} //----------------------------- //this procedure inserts a new payment details public void InsertPaymentDetails(CommonExchange.SysAccess userInfo, ref CommonExchange.PaymentDetails paymentInfo) { paymentInfo.ReceiptNo = PrimaryKeys.GetNewReceiptNoPaymentDetails(userInfo); using (SqlCommand sqlComm = new SqlCommand()) { sqlComm.Connection = userInfo.Connection; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "dental.InsertPaymentDetails"; sqlComm.Parameters.Add("@receipt_no", SqlDbType.VarChar).Value = paymentInfo.ReceiptNo; sqlComm.Parameters.Add("@sysid_registration", SqlDbType.VarChar).Value = paymentInfo.RegistrationSystemId; sqlComm.Parameters.Add("@date_paid", SqlDbType.DateTime).Value = DateTime.Parse(paymentInfo.DatePaid); sqlComm.Parameters.Add("@amount", SqlDbType.Decimal).Value = paymentInfo.Amount; sqlComm.Parameters.Add("@discount", SqlDbType.Decimal).Value = paymentInfo.Discount; sqlComm.Parameters.Add("@payment_type", SqlDbType.TinyInt).Value = paymentInfo.PaymentType; sqlComm.Parameters.Add("@bank_name", SqlDbType.VarChar).Value = paymentInfo.BankName; sqlComm.Parameters.Add("@check_no", SqlDbType.VarChar).Value = paymentInfo.CheckNo; sqlComm.Parameters.Add("@card_number", SqlDbType.VarChar).Value = paymentInfo.CardNumber; sqlComm.Parameters.Add("@card_type", SqlDbType.VarChar).Value = paymentInfo.CardType; sqlComm.Parameters.Add("@card_expire", SqlDbType.VarChar).Value = paymentInfo.CardExpire; sqlComm.Parameters.Add("@created_by", SqlDbType.VarChar).Value = userInfo.UserId; sqlComm.ExecuteNonQuery(); } } //------------------------------
//this procedure inserts a new procedure information public void InsertProcedureInformation(CommonExchange.SysAccess userInfo, ref CommonExchange.Procedure procedureInfo) { procedureInfo.ProcedureSystemId = PrimaryKeys.GetNewSysIDProcedureInformation(userInfo); using (SqlCommand sqlComm = new SqlCommand()) { sqlComm.Connection = userInfo.Connection; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "dental.InsertProcedureInformation"; sqlComm.Parameters.Add("@sysid_procedure", SqlDbType.VarChar).Value = procedureInfo.ProcedureSystemId; sqlComm.Parameters.Add("@procedure_name", SqlDbType.VarChar).Value = procedureInfo.ProcedureName; sqlComm.Parameters.Add("@amount", SqlDbType.Decimal).Value = procedureInfo.Amount; sqlComm.Parameters.Add("@created_by", SqlDbType.VarChar).Value = userInfo.UserId; sqlComm.ExecuteNonQuery(); } } //--------------------------------
//this procedure inserts a new patient registration public void InsertPatientRegistration(CommonExchange.SysAccess userInfo, ref CommonExchange.Registration regInfo) { regInfo.RegistrationSystemId = PrimaryKeys.GetNewSysIDPatientRegistration(userInfo); using (SqlCommand sqlComm = new SqlCommand()) { sqlComm.Connection = userInfo.Connection; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "dental.InsertPatientRegistration"; sqlComm.Parameters.Add("@sysid_registration", SqlDbType.VarChar).Value = regInfo.RegistrationSystemId; sqlComm.Parameters.Add("@sysid_patient", SqlDbType.VarChar).Value = regInfo.PatientSystemId; sqlComm.Parameters.Add("@registration_date", SqlDbType.DateTime).Value = DateTime.Parse(regInfo.RegistrationDate); sqlComm.Parameters.Add("@created_by", SqlDbType.VarChar).Value = userInfo.UserId; sqlComm.ExecuteNonQuery(); } } //------------------------------
//this procedure inserts a new patient information public void InsertPatientInformation(CommonExchange.SysAccess userInfo, ref CommonExchange.Patient patientInfo) { patientInfo.PatientSystemId = PrimaryKeys.GetNewSysIDPatientInformation(userInfo); using (SqlCommand sqlComm = new SqlCommand()) { sqlComm.Connection = userInfo.Connection; sqlComm.CommandType = CommandType.StoredProcedure; sqlComm.CommandText = "dental.InsertPatientInformation"; sqlComm.Parameters.Add("@sysid_patient", SqlDbType.VarChar).Value = patientInfo.PatientSystemId; sqlComm.Parameters.Add("@last_name", SqlDbType.VarChar).Value = patientInfo.LastName; sqlComm.Parameters.Add("@first_name", SqlDbType.VarChar).Value = patientInfo.FirstName; sqlComm.Parameters.Add("@middle_name", SqlDbType.VarChar).Value = patientInfo.MiddleName; sqlComm.Parameters.Add("@home_address", SqlDbType.VarChar).Value = patientInfo.HomeAddress; sqlComm.Parameters.Add("@phone_nos", SqlDbType.VarChar).Value = patientInfo.PhoneNos; sqlComm.Parameters.Add("@birthdate", SqlDbType.DateTime).Value = DateTime.Parse(patientInfo.BirthDate); sqlComm.Parameters.Add("@e_mail", SqlDbType.VarChar).Value = patientInfo.Email; sqlComm.Parameters.Add("@medical_history", SqlDbType.VarChar).Value = patientInfo.MedicalHistory; sqlComm.Parameters.Add("@emergency_info", SqlDbType.VarChar).Value = patientInfo.EmergencyInfo; if (patientInfo.ImageBytes != null && !String.IsNullOrEmpty(patientInfo.ImagePath) && !String.IsNullOrEmpty(patientInfo.ImageExtension)) { sqlComm.Parameters.Add("@pic", SqlDbType.VarBinary).Value = patientInfo.ImageBytes; sqlComm.Parameters.Add("@extension_name", SqlDbType.VarChar).Value = patientInfo.ImageExtension; } else { sqlComm.Parameters.Add("@pic", SqlDbType.VarBinary).Value = DBNull.Value; sqlComm.Parameters.Add("@extension_name", SqlDbType.VarChar).Value = DBNull.Value; } sqlComm.Parameters.Add("@created_by", SqlDbType.VarChar).Value = userInfo.UserId; sqlComm.ExecuteNonQuery(); } } //------------------------------------