/// <summary> /// Code to validate user details while logging in /// </summary> /// <param name="ObjEUserInfo"></param> /// <returns></returns> public EUserInfo CheckUserCredentials(EUserInfo ObjEUserInfo) { DataSet dsFeature = new DataSet(); try { using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = SQLCon.Sqlconn2(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "[P_Get_CheckUserCredentials]"; cmd.Parameters.Add("@UserName", ObjEUserInfo.UserName); cmd.Parameters.Add("@Password", ObjEUserInfo.Password); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(dsFeature); } if (dsFeature != null && dsFeature.Tables.Count > 0) { string strUserID = dsFeature.Tables[0].Rows[0][0].ToString(); int UserID = 0; if (int.TryParse(strUserID, out UserID)) { ObjEUserInfo.dtUserDetails = dsFeature.Tables[0]; if (dsFeature.Tables.Count > 1) { ObjEUserInfo.dtFeature = dsFeature.Tables[1]; if (dsFeature.Tables.Count > 2) { ObjEUserInfo.dtLVStatus = dsFeature.Tables[2]; if (dsFeature.Tables.Count > 3) { ObjEUserInfo.dtPositionKZ = dsFeature.Tables[3]; } } } } else { throw new Exception(strUserID); } } } } catch (Exception ex) { throw new Exception("Der Login konnte nicht erfolgen"); } finally { SQLCon.Close2(); } return(ObjEUserInfo); }