ahmed salah

ahmed salah

  • 1.2k
  • 547
  • 62.8k

error function no all code path return value ?

Jun 11 2023 6:00 AM

I implement function done by cshar return dataset but it  display error and i don't know where is error 

and how to solve this error please 

function generate error 

public DataSet UnlockUser(string szLoginName, string strHost)
{
    DataSet objDS = new DataSet();
    string strEnv = "";

    try
    {
   
        objDS = _ISecurityService.GetEnv(szLoginName.Trim());

        if (objDS.Tables[0].Rows.Count > 0)
        {
            strEnv = objDS.Tables[0].Rows[0][0].ToString();
            if (strEnv.Trim() == "PY" || strEnv.Trim() == "PD")
            {
                if (_ISecurityService.ChangeFailedLoginAttempts(szLoginName, 0) > 0)
                {
                    if (_ISecurityService.AuditLoginAttempts(szLoginName, strHost, "S", objDS.Tables[0].Rows[0][0].ToString(), "Account is Unlocked", "Unlock") > 0)
                    {
                        return _ISecurityService.FillRtnDs("0", " User - " + szLoginName.Trim() + " is Unlocked Successfully");
                    }
                    else
                    {
                        return _ISecurityService.FillRtnDs("E9", "Failed to Unlock, Please try again");
                    }
                }
                
            }
            else
            {
                return _ISecurityService.FillRtnDs("-4", "Invalid User with Different Env"); //Invalid User with Different Env
            }
        }
        else
        {
            return _ISecurityService.FillRtnDs("-5", "Invalid User");     //Invalid User 
        }
    }
    catch (Exception ex)
    {
        return _ISecurityService.FillRtnDs("E9", ex.Message);
    }
}

 


Answers (2)