Ejemplo n.º 1
0
        public void wkfproGetNextTask(DbTransaction tran, int userId, string sessionID, out string entityType, out int entityId, out string functionType, out int lockId, out DateTime lockAcquired, out DateTime lockExpired)
        {
            string spName = "";

            try
            {
                spName = "wkfproGetNextTask";
                DbCommand dbCommand = base.DB.GetStoredProcCommand(spName);

                dbCommand.Parameters.Clear();
                base.DB.AddInParameter(dbCommand, "@UserId", DbType.Int64, userId);
                base.DB.AddInParameter(dbCommand, "@SessionId", DbType.String, sessionID);
                base.DB.AddOutParameter(dbCommand, "@EntityType", DbType.String, 1);
                base.DB.AddOutParameter(dbCommand, "@EntityId", DbType.Int64, 0);
                base.DB.AddOutParameter(dbCommand, "@FunctionType", DbType.String, 1);
                base.DB.AddOutParameter(dbCommand, "@LockId", DbType.Int64, 0);
                base.DB.AddOutParameter(dbCommand, "@LockAcquiredDateTime", DbType.DateTime, 0);
                base.DB.AddOutParameter(dbCommand, "@LockTimeoutDateTime", DbType.DateTime, 0);

                if (tran != null)
                {
                    base.DB.ExecuteNonQuery(dbCommand, tran);
                }
                else
                {
                    base.DB.ExecuteNonQuery(dbCommand);
                }

                entityType   = DataReaderHelper.GetString(base.DB.GetParameterValue(dbCommand, "@EntityType"));
                entityId     = DataReaderHelper.GetInt(base.DB.GetParameterValue(dbCommand, "@EntityId"));
                functionType = DataReaderHelper.GetString(base.DB.GetParameterValue(dbCommand, "@FunctionType"));
                lockId       = DataReaderHelper.GetInt(base.DB.GetParameterValue(dbCommand, "@LockId"));
                lockAcquired = DataReaderHelper.GetDateTime(base.DB.GetParameterValue(dbCommand, "@LockAcquiredDateTime"));
                lockExpired  = DataReaderHelper.GetDateTime(base.DB.GetParameterValue(dbCommand, "@LockTimeoutDateTime"));
            }
            catch (SqlException ex)
            {
                throw new DacSqlException(ex);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                base.ReleaseConnection();
            }
        }
Ejemplo n.º 2
0
        public void fralokLockSteal(DbTransaction tran, int entityId, string entityType, string lockContext, string lockTimeoutType, int userId, string sessionId, int functionTypeId, out int lockId, out DateTime lockAcquired, out DateTime lockTimeout)
        {
            string spName = "";

            try
            {
                spName = "fralokLockSteal";
                DbCommand dbCommand = base.DB.GetStoredProcCommand(spName);

                dbCommand.Parameters.Clear();
                base.DB.AddInParameter(dbCommand, "@ObjectId", DbType.Int32, entityId);
                base.DB.AddInParameter(dbCommand, "@ObjectType", DbType.String, entityType);
                base.DB.AddInParameter(dbCommand, "@LockContext", DbType.String, lockContext);
                base.DB.AddInParameter(dbCommand, "@LockTimeOutType", DbType.String, lockTimeoutType);
                base.DB.AddInParameter(dbCommand, "@UserId", DbType.Int32, userId);
                base.DB.AddInParameter(dbCommand, "@SessionId", DbType.String, sessionId);
                base.DB.AddInParameter(dbCommand, "@FunctionTypeId", DbType.Int32, functionTypeId);
                base.DB.AddOutParameter(dbCommand, "@LockId", DbType.Int32, 0);
                base.DB.AddOutParameter(dbCommand, "@LockAcquiredDateTime", DbType.DateTime, 0);
                base.DB.AddOutParameter(dbCommand, "@LockTimeoutDateTime", DbType.DateTime, 0);

                if (tran != null)
                {
                    base.DB.ExecuteNonQuery(dbCommand, tran);
                }
                else
                {
                    base.DB.ExecuteNonQuery(dbCommand);
                }

                lockId       = DataReaderHelper.GetInt(base.DB.GetParameterValue(dbCommand, "@LockId"));
                lockAcquired = DataReaderHelper.GetDateTime(base.DB.GetParameterValue(dbCommand, "@LockAcquiredDateTime"));
                lockTimeout  = DataReaderHelper.GetDateTime(base.DB.GetParameterValue(dbCommand, "@LockTimeoutDateTime"));
            }
            catch (SqlException ex)
            {
                throw new DacSqlException(ex);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                base.ReleaseConnection();
            }
        }
Ejemplo n.º 3
0
        public User GetUsers(string userName, string passWord)
        {
            User        _user      = null;
            string      sqlCommand = "select * from User where Deleted=0 and LoginID=" + userName + " and Password="******"PhoneNumber");
                _user.Password              = DataReaderHelper.GetString(dr, "Password");
                _user.LoginID               = DataReaderHelper.GetString(dr, "LoginID");
                _user.UserType              = DataReaderHelper.GetInt16(dr, "UserType");
                _user.Name                  = DataReaderHelper.GetString(dr, "Name");
                _user.Deleted               = DataReaderHelper.GetBoolean(dr, "Deleted");
                _user.Notification          = DataReaderHelper.GetBoolean(dr, "Notification");
                _user.NotificationSound     = DataReaderHelper.GetBoolean(dr, "NotificationSound");
                _user.NotificationVibration = DataReaderHelper.GetBoolean(dr, "NotificationVibration");
                _user.CreateTime            = DataReaderHelper.GetDateTime(dr, "CreateTime");
                _user.UpdateTime            = DataReaderHelper.GetDateTime(dr, "UpdateTime");
            }
            return(_user);
        }