Example #1
0
        /// <summary>
        /// HARD clear lock for given name and version in databas,
        /// so that other test cases can use the same test data.
        /// </summary>
        /// <param name="request">ClearLockRequestDC contains the name and version of activity</param>
        /// <returns>StatusReplyDC contains information about the database command execution</returns>
        public static StatusReplyDC ClearLock(ClearLockRequestDC request)
        {
            Database db = null;
            string cmd = null;
            StatusReplyDC statusReply = new StatusReplyDC();
            int retValue = 0;
            try
            {
                db = DatabaseFactory.CreateDatabase();
                cmd = string.Format(@"UPDATE dbo.Activity SET Locked=0, LockedBy=Null WHERE Name='{0}' AND Version = '{1}'", request.Name, request.Version);

                retValue = db.ExecuteNonQuery(CommandType.Text, cmd);

                if (retValue < 0)
                {
                    statusReply.ErrorMessage = "Update lock fields were not succesful.";
                }
            }
            catch (Exception ex)
            {
                statusReply.ErrorMessage = String.Format("DAL.ClearLock call. Error code: {0}. Error message: {1}", -99, ex.Message);
            }

            return statusReply;
        }
 /// <summary>
 /// Clear the lock for activites with name and version
 /// </summary>
 /// <param name="request">The name&version of activity</param>
 /// <returns>StatusReplyDC contains information about the database command execution</returns>
 public StatusReplyDC ClearLock(ClearLockRequestDC request)
 {
     return DAL.DAL.ClearLock(request);
 }
        /// <summary>
        /// Clear lock field from etblStoreActivities
        /// </summary>
        /// <param name="name">The name of activity</param>
        /// <param name="version">The version of activity</param>
        private void ClearLockForActivity(string name, string version)
        {
            ClearLockRequestDC request = new ClearLockRequestDC();
            request.Name = name;
            request.Version = version;
            request.Incaller = IN_CALLER;
            request.IncallerVersion = IN_CALLER_VERSION;

            try
            {
                testProxy.ClearLock(request);
            }
            catch (FaultException e)
            {
                Assert.Fail("Failed to clear lock from etblStoreActivities: {0}", e.Message);
            }
            catch (Exception ex)
            {
                Assert.Fail("Failed to clear lock from etblStoreActivities: {0}", ex.Message);
            }
        }