public CGeneralUser Login(string UserName, string PassWord) { CGeneralUser oResult = new CGeneralUser(); try { string ePassword = _sqlService.GetEncryptString(PassWord); DataSet dsLogin = _sqlService.GetDataSet("TLogin", "uspLogin '" + UserName + "', '" + ePassword + "'"); using (DataTable dtLogin = dsLogin.Tables["TLogin"]) { if (dtLogin != null && dtLogin.Rows.Count > 0) { if (Convert.ToBoolean(dtLogin.Rows[0]["Success"])) { // TRUE FOR ORGANIZATION oResult.DisplayName = dtLogin.Rows[0]["DisplayName"].ToString(); oResult.UserID = Convert.ToInt32(dtLogin.Rows[0]["UserID"]); oResult.LoginTypeCode = Convert.ToInt32(dtLogin.Rows[0]["LoginTypeCode"]); oResult.LastLogged = Convert.ToDateTime(dtLogin.Rows[0]["LastLogged"]); oResult.Success = Convert.ToBoolean(dtLogin.Rows[0]["Success"]); oResult.WasSuccessful = Convert.ToInt32(dtLogin.Rows[0]["Success"]); oResult.Exception = dtLogin.Rows[0]["ErrorSuccessMsg"].ToString(); } // FAILED TO LOGIN else { oResult.Success = Convert.ToBoolean(dtLogin.Rows[0]["Success"]); oResult.WasSuccessful = Convert.ToInt32(dtLogin.Rows[0]["Success"]); oResult.Exception = dtLogin.Rows[0]["ErrorSuccessMsg"].ToString(); } } } } catch (Exception ex) { oResult.Success = false; oResult.WasSuccessful = 0; oResult.Exception = ex.Message; } return(oResult); }