private YellowstonePathology.Business.Test.AccessionOrder BuildFromSQL(string masterAccessionNo, bool aquireLock) { YellowstonePathology.Business.User.SystemIdentity systemIdentity = new YellowstonePathology.Business.User.SystemIdentity(YellowstonePathology.Business.User.SystemIdentityTypeEnum.CurrentlyLoggedIn); AccessionOrderBuilder accessionOrderBuilder = new AccessionOrderBuilder(); XElement document = null; SqlCommand cmd = new SqlCommand(); cmd.CommandText = "AOGWGetByMasterAccessionNo"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@MasterAccessionNo", SqlDbType.VarChar).Value = masterAccessionNo; cmd.Parameters.Add("@AquireLock", SqlDbType.Bit).Value = aquireLock; cmd.Parameters.Add("@LockAquiredById", SqlDbType.VarChar).Value = systemIdentity.User.UserId; cmd.Parameters.Add("@LockAquiredByUserName", SqlDbType.VarChar).Value = systemIdentity.User.UserName; cmd.Parameters.Add("@LockAquiredByHostName", SqlDbType.VarChar).Value = System.Environment.MachineName; cmd.Parameters.Add("@TimeLockAquired", SqlDbType.DateTime).Value = DateTime.Now; using (SqlConnection cn = new SqlConnection(YellowstonePathology.Business.Properties.Settings.Default.CurrentConnectionString)) { cn.Open(); cmd.Connection = cn; using (XmlReader xmlReader = cmd.ExecuteXmlReader()) { if (xmlReader.Read() == true) { document = XElement.Load(xmlReader, LoadOptions.PreserveWhitespace); } } } accessionOrderBuilder.Build(document); return(accessionOrderBuilder.AccessionOrder); }
private YellowstonePathology.Business.Test.AccessionOrder BuildFromSQL(string masterAccessionNo, bool aquireLock) { YellowstonePathology.Business.User.SystemIdentity systemIdentity = new YellowstonePathology.Business.User.SystemIdentity(YellowstonePathology.Business.User.SystemIdentityTypeEnum.CurrentlyLoggedIn); AccessionOrderBuilder accessionOrderBuilder = new AccessionOrderBuilder(); XElement document = null; SqlCommand cmd = new SqlCommand(); cmd.CommandText = "AOGWGetByMasterAccessionNo"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@MasterAccessionNo", SqlDbType.VarChar).Value = masterAccessionNo; cmd.Parameters.Add("@AquireLock", SqlDbType.Bit).Value = aquireLock; cmd.Parameters.Add("@LockAquiredById", SqlDbType.VarChar).Value = systemIdentity.User.UserId; cmd.Parameters.Add("@LockAquiredByUserName", SqlDbType.VarChar).Value = systemIdentity.User.UserName; cmd.Parameters.Add("@LockAquiredByHostName", SqlDbType.VarChar).Value = System.Environment.MachineName; cmd.Parameters.Add("@TimeLockAquired", SqlDbType.DateTime).Value = DateTime.Now; using (SqlConnection cn = new SqlConnection(YellowstonePathology.Business.Properties.Settings.Default.CurrentConnectionString)) { cn.Open(); cmd.Connection = cn; using (XmlReader xmlReader = cmd.ExecuteXmlReader()) { if (xmlReader.Read() == true) { document = XElement.Load(xmlReader, LoadOptions.PreserveWhitespace); } } } accessionOrderBuilder.Build(document); return accessionOrderBuilder.AccessionOrder; }