Beispiel #1
0
    /// <summary>
    /// checks if we are logged in and logs in if we are not
    /// </summary>
    /// <param name="data"></param>
    /// <param name="lMDWSUserID"></param>
    /// <returns></returns>
    public REVAMP.TIU.CStatus MDWSLogin(REVAMP.TIU.CData data,
                                        BaseMaster BaseMstr,
                                        string strConnectionString,
                                        bool bAudit,
                                        out long lMDWSUserID)
    {
        REVAMP.TIU.CStatus status = new REVAMP.TIU.CStatus();

        //if the user is logged in and not times out then
        //no reason to login again.
        lMDWSUserID = 0;
        REVAMP.TIU.CAppUser appUser = new REVAMP.TIU.CAppUser(data);
        status = appUser.CheckMDWSConnection(out lMDWSUserID);
        if (!status.Status)
        {
            status = appUser.MDWSLogin(strConnectionString,
                                       bAudit,
                                       BaseMstr.FXUserID,
                                       BaseMstr.Key,
                                       BaseMstr.Session,
                                       out lMDWSUserID);
        }

        return(status);
    }
Beispiel #2
0
    /// <summary>
    /// update the mdws account
    /// </summary>
    /// <param name="lRegionID"></param>
    /// <param name="lSiteID"></param>
    /// <param name="strUserName"></param>
    /// <param name="strPWD"></param>
    /// <param name="master"></param>
    /// <returns></returns>
    public bool UpdateMDWSAccount(long lRegionID,
                                  long lSiteID,
                                  string strUserName,
                                  string strPWD,
                                  BaseMaster master)
    {
        //status
        REVAMP.TIU.CStatus status = new REVAMP.TIU.CStatus();

        //get data object and connection info
        string strConnectionString = String.Empty;

        REVAMP.TIU.CData data      = null;
        bool             bAudit    = false;
        CMDWSUtils       mdwsUtils = new CMDWSUtils();

        mdwsUtils.GetDataInfo(master,
                              master.Session,
                              out data,
                              out strConnectionString,
                              out bAudit);

        //user data
        REVAMP.TIU.CUserData userData = new REVAMP.TIU.CUserData(data);

        //try a test login to get the MDWS user id
        long lMDWSUserID = 0;

        REVAMP.TIU.CAppUser appuser = new REVAMP.TIU.CAppUser(data);
        status = appuser.MDWSLogin(strConnectionString,
                                   bAudit,
                                   master.FXUserID,
                                   master.Key,
                                   strUserName,
                                   strPWD,
                                   lRegionID,
                                   lSiteID,
                                   out lMDWSUserID);
        if (!status.Status)
        {
            master.StatusCode    = 1;
            master.StatusComment = status.StatusComment;
            if (status.StatusComment.ToUpper() == "FAILED TO LOGIN!")
            {
                master.StatusComment = "Invalid MDWS Credentials, Please check your data entry!";
            }

            return(false);
        }

        //update the account
        status = userData.UpdateMDWSAccount(strConnectionString,
                                            bAudit,
                                            master.FXUserID,
                                            master.FXUserID,
                                            master.Key,
                                            strUserName,
                                            strPWD,
                                            lRegionID,
                                            lSiteID,
                                            lMDWSUserID);
        if (!status.Status)
        {
            //error so update status
            master.StatusCode    = 1;
            master.StatusComment = "An error occured while saving MDWS credentials, Please contact your System Administrator!";
            return(false);
        }

        master.StatusCode    = 0;
        master.StatusComment = "";

        return(status.Status);
    }