Beispiel #1
0
    public bool receiver_SignIn(int id)
    {
        try
        {
            BCAspenUser user = new BCAspenUser();
            user.loadData(id);

            if ((Label1.Text = CredentialControl.Login(user.UserName, user.Password)) == "")
            {
                return true;
            }
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }

        return false;
    }
Beispiel #2
0
 public virtual BCAspenUser GetLockHolder()
 {
     if (IdLockHolder == null)
     {
         return null;
     }
     else
     {
         BCAspenUser result = new BCAspenUser();
         result.Id = (int)IdLockHolder;
         result.loadData();
         return result;
     }
 }
Beispiel #3
0
    /// <summary>
    /// Obtain exclusive hold of all PAs within the given PAList. 
    /// If no PA is currently held by any other user, operation is successful and
    /// an empty list is returned. 
    /// If there are users currently holding some PAs, operation is not successful and
    /// the list of users who are holding PAs is returned.
    /// </summary>
    /// <returns></returns>
    public List<BCAspenUser> HoldPAListExclusive(long idPAList)
    {
        //Hold all PAs within this PAlist
        string whereClause =
            " WHERE intIdPAList = @idPAList ";
        List<SqlParameter> pCol = new List<SqlParameter>();
        SqlParameter param = new SqlParameter("@idPAList", SqlDbType.BigInt);
        param.Value = idPAList;
        pCol.Add(param);

        Hold(whereClause, pCol);

        //check if any PA remains held by others
        AdoNetManager db = new AdoNetManager("table");

        db.objCmd.Parameters.Clear();
        db.objCmd.Parameters.Add
            ("@idPAList", SqlDbType.BigInt).Value = idPAList;
        db.objCmd.Parameters.Add
            ("@paLockKey", SqlDbType.VarChar).Value = LockKey;

        DataTable tbl = db.queryTable(
            " SELECT DISTINCT intIdLockHolderPA FROM APAS_PaymentAdvice " +
            " WHERE strLockKeyPA IS NOT NULL " +
            " AND strLockKeyPA != '' " +
            " AND strLockKeyPA != @paLockKey  " +
            " AND intIdPAList = @idPAList "
            );

        List<BCAspenUser> result = new List<BCAspenUser>();

        if (tbl != null && tbl.Rows.Count > 0)
        {
            //has PAs held by others
            //hold unsuccessful

            //Release PAs
            pCol = new List<SqlParameter>();
            whereClause =
            " WHERE intIdPAList = @idPAList ";
            param = new SqlParameter("@idPAList", SqlDbType.BigInt);
            param.Value = idPAList;
            pCol.Add(param);
            Release(whereClause, pCol);

            foreach (DataRow row in tbl.Rows)
            {
                BCAspenUser objStaff = new BCAspenUser();
                objStaff.Id = Convert.ToInt32(row["intIdLockHolderPA"]);
                objStaff.loadData();

                result.Add(objStaff);
            }

            return result;
        }
        else
        {
            //has no PA held by others
            //hold successful

            return result;
        }
    }