public bool save(ReportCommon.Consultation consultation) { try { string sql = " if exists(select 1 from tConsultation where cstGuid=@cstGuid)" + " update tConsultation set cstUserGuid=@cstUserGuid,cstSite=@cstSite,cstOrderGuid=@cstOrderGuid,cstStatus=@cstStatus" + " where cstGuid=@cstGuid" + " else " + " insert tConsultation(cstGuid,cstUserGuid,cstSite,cstOrderGuid,cstStatus,cstApplyTime,Domain) " + " VALUES(@cstGuid,@cstUserGuid,@cstSite,@cstOrderGuid,@cstStatus,getdate(),(select top 1 value from tSystemProfile where Name='domain'))" ; using (RisDAL oKodak = new RisDAL()) { using (SqlConnection conn = new SqlConnection(oKodak.ConnectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = sql; cmd.Connection = conn; cmd.Parameters.AddWithValue("@cstGuid", consultation.cstGuid); cmd.Parameters.AddWithValue("@cstUserGuid", consultation.cstUserGuid); cmd.Parameters.AddWithValue("@cstSite", consultation.cstSite); cmd.Parameters.AddWithValue("@cstOrderGuid", consultation.cstOrderGuid); cmd.Parameters.AddWithValue("@cstStatus", consultation.cstStatus); cmd.ExecuteNonQuery(); } return(true); } } catch (System.Exception ex) { System.Diagnostics.Debug.Assert(false, ex.Message); ServerPubFun.RISLog_Error(0, ex.Message, (new System.Diagnostics.StackFrame()).GetFileName(), (new System.Diagnostics.StackFrame()).GetFileLineNumber()); } return(false); }
public DataSet getMemo(string patientId, string accNo) { try { string szWhere = ""; if (!string.IsNullOrWhiteSpace(patientId)) { szWhere += " AND PatientID=@patientID"; } if (!string.IsNullOrWhiteSpace(accNo)) { szWhere += " AND (AccNo=@accNo OR ACCNO=@accNo+'^^^'+SourceDomain)"; } if (string.IsNullOrWhiteSpace(szWhere)) { szWhere = " AND 1=2"; } string sql = " SELECT TOP 200 * FROM [tReferralLog]" + " WHERE referralID IN (SELECT ReferralID FROM [tReferralList] WHERE 1=1 " + szWhere + ")" + " ORDER BY [OperateDt]"; using (RisDAL oKodak = new RisDAL()) { using (SqlConnection conn = new SqlConnection(oKodak.ConnectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = sql; cmd.Connection = conn; cmd.Parameters.AddWithValue("@patientID", patientId); cmd.Parameters.AddWithValue("@accNo", accNo); ServerPubFun.RISLog_Info(0, "getMemo, " + cmd.CommandText + ", PID=" + patientId + ", ACCNO=" + accNo, "", 0); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); return(ds); } } } catch (System.Exception ex) { System.Diagnostics.Debug.Assert(false, ex.Message); ServerPubFun.RISLog_Error(0, ex.Message, (new System.Diagnostics.StackFrame()).GetFileName(), (new System.Diagnostics.StackFrame()).GetFileLineNumber()); } return(null); }