public string AddResultsStatus(ClsOrder order, string test) { try { string strQuery = "INSERT Orders.ResultsStatus(orderId,resultsStatus,test, locationId) " + " VALUES(@orderId,@resultsStatus ,@test, @locationId)"; using (Cmd = new CacheCommand(strQuery, GetConnection())) { Cmd.Parameters.Add("@OrderId", order.orderId); Cmd.Parameters.Add("@resultsStatus", "Pending"); Cmd.Parameters.Add("@test", test); Cmd.Parameters.Add("@locationId", order.locationId); Cmd.ExecuteNonQuery(); } } catch (Exception e) { throw new Exception("ERROR: AddResultsStatus() " + e.Message); } finally { CacheConnect.Close(); } return(""); }
public string AddOrderStatus(ClsOrder order) { try { string strQuery = "INSERT Orders.OrderStatus(orderId,accessioned,demographicChange,ordersModified,partialResults,referredtosupplier,resultsfinal, locationId) " + " VALUES(@orderId,@accessioned ,@demographicChange,@ordersModified,@partialResults,@referredtosupplier,@resultsfinal, @locationId)"; using (Cmd = new CacheCommand(strQuery, GetConnection())) { Cmd.Parameters.Add("@OrderId", order.orderId); Cmd.Parameters.Add("@accessioned", "N"); Cmd.Parameters.Add("@demographicChange", "N"); Cmd.Parameters.Add("@ordersModified", "N"); Cmd.Parameters.Add("@partialResults", "N"); Cmd.Parameters.Add("@referredtosupplier", "N"); Cmd.Parameters.Add("@resultsfinal", "N"); Cmd.Parameters.Add("@locationId", order.locationId); Cmd.ExecuteNonQuery(); } } catch (Exception e) { throw new Exception("ERROR: AddOrderStatus() " + e.Message); } finally { CacheConnect.Close(); } return(""); }
public void AddOrganization() { try { using (Cmd = new CacheCommand("INSERT HICL.Organization VALUES('001','Dr. Prouse','CLIENT')", GetConnection())) { Cmd.ExecuteNonQuery(); } } finally { CacheConnect.Close(); } }
public void AddApplication() { try { using (Cmd = new CacheCommand("INSERT HICL.Application VALUES('RW','TS','" + Helper.GetHash("supplier") + "', null,null,'002' )", GetConnection())) { Cmd.ExecuteNonQuery(); } } finally { CacheConnect.Close(); } }
public void AddLog(String AppId, String recordType, String eventData) { try { string strQuery = "INSERT HICL.AuditLog(AppId,actDate,eventData,recordType ) VALUES('" + AppId + "','" + DateTime.Now.ToString("yyyyMMdd HH:mm:ss") + "','" + eventData + "','" + recordType + "')"; Cmd = new CacheCommand(strQuery, GetConnection()); //Cmd.Parameters.Add("@AppId", AppId); //Cmd.Parameters.Add("@actDate", ); //Cmd.Parameters.Add("@eventData", eventData); //Cmd.Parameters.Add("@recordType", recordType); Cmd.ExecuteNonQuery(); } finally { CacheConnect.Close(); } }
private void CreateIndexesIfNotExist(CacheConnection connection) { using (CacheCommand checkUserIndex = new CacheCommand(CheckUserNameIndexQuery, connection), checkRoleIndex = new CacheCommand(CheckRoleNameIndexQuery, connection)) { if ((int)checkUserIndex.ExecuteScalar() == 0) { using (var createUserIndex = new CacheCommand(UserNameIndexQuery, connection)) createUserIndex.ExecuteNonQuery(); } if ((int)checkRoleIndex.ExecuteScalar() == 0) { using (var createRoleIndex = new CacheCommand(RoleNameIndexQuery, connection)) createRoleIndex.ExecuteNonQuery(); } } }
public void AddTest() { try { Cmd = new CacheCommand("INSERT Orders.Tests VALUES('FSH','FSH','500')", GetConnection()); Cmd.ExecuteNonQuery(); Cmd = new CacheCommand("INSERT Orders.Tests VALUES('TSH','TSH','500')", GetConnection()); Cmd.ExecuteNonQuery(); Cmd = new CacheCommand("INSERT Orders.Tests VALUES('LH','LH','500')", GetConnection()); Cmd.ExecuteNonQuery(); Cmd = new CacheCommand("INSERT Orders.Tests VALUES('VAL','VAL','500')", GetConnection()); Cmd.ExecuteNonQuery(); } finally { CacheConnect.Close(); } }
public Boolean delete(string id) { CacheCommand cc; if (MessageBox.Show("削除しますか", "削除", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { cc = new CacheCommand("DELETE FROM ADBK WHERE AID = ?", adbksrc.conn); CacheParameter cp = new CacheParameter("id", CacheDbType.NVarChar); cp.Value = id; cc.Parameters.Add(cp); cc.ExecuteNonQuery(); return(true); } catch (Exception err) { MessageBox.Show("削除エラー" + err.Message); return(false); } } return(false); }
public void AddResult(ClsPostResult result) { try { //Add Log AddLog(result.appId, "AddOrder", "RemoteIP:" + result.remoteIP + ";" + result.orderId); //Check if result exist Cmd = new CacheCommand("DELETE from Results.Results where orderId= '" + result.orderId + "' and OrderCode = '" + result.orderCode + "'", GetConnection()); //dt.Load(Cmd.ExecuteReader()); Cmd.ExecuteNonQuery(); //if (dt.Rows.Count == 0) //{ string strQuery = "INSERT Results.Results(FileName,Client,OrderCode,OrderId,ResultBinaryStream,ResultType,ResultName,ResultDate,Flag , NormalRange ,Units ,ResultText , locationId )" + " VALUES(@FileName,@Client,@OrderCode,@OrderId,@ResultBinaryStream ,@ResultType,@ResultName,@ResultDate , @Flag , @NormalRange ,@Units , @ResultText , @locationId )"; Cmd = new CacheCommand(strQuery, GetConnection()); //} //else //{ // string strQuery = "UPDATE Results.Results SET FileName = @FileName, Client=@Client ,ResultBinaryStream = @ResultBinaryStream, ResultType=@ResultType,ResultName=@ResultName,ResultDate=@ResultDate,Flag=@Flag , NormalRange=@NormalRange , Units=@Units, ResultText=@ResultText " + // " Where OrderId = @OrderId and OrderCode=@OrderCode"; // Cmd = new CacheCommand(strQuery, GetConnection()); //} Cmd.Parameters.Add("@locationId", result.locationId); Cmd.Parameters.Add("@Flag", result.resultFlag); Cmd.Parameters.Add("@NormalRange", result.normalRange); Cmd.Parameters.Add("@Units", result.resultUnits); Cmd.Parameters.Add("@Client", result.clientId); Cmd.Parameters.Add("@OrderCode", result.orderCode); Cmd.Parameters.Add("@OrderId", result.orderId); Cmd.Parameters.Add("@ResultType", result.resultType); Cmd.Parameters.Add("@ResultName", result.resultName); Cmd.Parameters.Add("@ResultDate", DateTime.Now.ToString("yyyyMMdd HH:mm:ss")); Cmd.Parameters.Add("@ResultText", result.resultText); // Now insert two files from disk as streams // Open binary file and read into byte[] Cmd.Parameters.Add("@FileName", result.fileName); //FileStream fbs = new System.IO.FileStream("test.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite); //int filebLen = (int)fbs.Length; //byte[] filebData = new byte[file //fbs.Read(filebData, 0, (int)filebLen); //fbs.Close(); //Cmd.Parameters.Add() CacheParameter para = new CacheParameter("@ResultBinaryStream", result.resultBinaryStream); para.Size = result.resultBinaryStream.Length; Cmd.Parameters.Add(para); Cmd.ExecuteNonQuery(); } catch (Exception e) { if (e.Message.Contains("ClientIndex")) { throw new Exception("Result for order Id: " + result.orderId + " and order code:" + result.orderCode + " exists in the system."); } else { throw e; } } finally { CacheConnect.Close(); } }
public string AddOrder(ClsOrder order) { try { //Add Log AddLog(order.appId, "AddOrder", "RemoteIP:" + order.remoteIP + ";" + order.ToString()); string strQuery = "INSERT Orders.Login(OrderId,Alt1,Alt10,Alt2,Alt3,Alt4,Alt5,Alt6,Alt7,Alt9,AppId,ClientComments,ClientFileNumber,ClientId,ClientName,CollectionDate,CollectionTime,DOB,FirstName,LastName," + "MiddleName,Orders,PatientAddress1,PatientAddress2,PatientAddressCity,PatientAddressCountry,PatientAddressPostalCode,PatientAddressProvince,PatientCellPhone,PatientHomePhone,PatientPHN,Priority,Received,Sex, Locationid) " + " VALUES(@OrderId,@Alt1,@Alt10,@Alt2,@Alt3,@Alt4,@Alt5,@Alt6,@Alt7,@Alt9,@AppId,@ClientComments,@ClientFileNumber,@ClientId,@ClientName,@CollectionDate,@CollectionTime,@DOB,@FirstName,@LastName," + "@MiddleName,@Orders,@PatientAddress1,@PatientAddress2,@PatientAddressCity,@PatientAddressCountry,@PatientAddressPostalCode,@PatientAddressProvince,@PatientCellPhone,@PatientHomePhone,@PatientPHN,@Priority,@Received,@Sex, @Locationid)"; using (Cmd = new CacheCommand(strQuery, GetConnection())) { Cmd.Parameters.Add("@OrderId", order.orderId); Cmd.Parameters.Add("@Alt1", order.alt1); Cmd.Parameters.Add("@Alt10", order.alt10); Cmd.Parameters.Add("@Alt2", order.alt2); Cmd.Parameters.Add("@Alt3", order.alt3); Cmd.Parameters.Add("@Alt4", order.alt4); Cmd.Parameters.Add("@Alt5", order.alt5); Cmd.Parameters.Add("@Alt6", order.alt6); Cmd.Parameters.Add("@Alt7", order.alt7); Cmd.Parameters.Add("@Alt9", order.alt9); Cmd.Parameters.Add("@AppId", order.appId); Cmd.Parameters.Add("@ClientComments", order.clientComments); Cmd.Parameters.Add("@ClientFileNumber", order.clientFileNumber); Cmd.Parameters.Add("@ClientId", order.clientId); Cmd.Parameters.Add("@ClientName", order.clientName); Cmd.Parameters.Add("@CollectionDate", order.collectionDate); Cmd.Parameters.Add("@CollectionTime", order.collectionTime); Cmd.Parameters.Add("@DOB", order.dOB); Cmd.Parameters.Add("@FirstName", order.firstName); Cmd.Parameters.Add("@LastName", order.lastName); Cmd.Parameters.Add("@MiddleName", order.middleName); Cmd.Parameters.Add("@Orders", order.orders); Cmd.Parameters.Add("@PatientAddress1", order.patientAddress1); Cmd.Parameters.Add("@PatientAddress2", order.patientAddress2); Cmd.Parameters.Add("@PatientAddressCity", order.patientAddressCity); Cmd.Parameters.Add("@PatientAddressCountry", order.patientAddressCountry); Cmd.Parameters.Add("@PatientAddressPostalCode", order.patientAddressPostalCode); Cmd.Parameters.Add("@PatientAddressProvince", order.patientAddressProvince); Cmd.Parameters.Add("@PatientCellPhone", order.patientCellPhone); Cmd.Parameters.Add("@PatientHomePhone", order.patientHomePhone); Cmd.Parameters.Add("@PatientPHN", order.patientPHN); Cmd.Parameters.Add("@Priority", order.priority); Cmd.Parameters.Add("@Received", DateTime.Now.ToString("yyyyMMdd HH:mm:ss")); Cmd.Parameters.Add("@Sex", order.sex); Cmd.Parameters.Add("@Locationid", order.locationId); Cmd.ExecuteNonQuery(); } } catch (Exception e) { if (e.Message.Contains("OrderIdIndex")) { throw new Exception("Order with orderId: " + order.orderId + " exists in the system."); } else { throw e; } } finally { CacheConnect.Close(); } return(""); }