本文整理汇总了C#中GK.Library.Utility.SqlDataAccess.ExecuteScalar方法的典型用法代码示例。如果您正苦于以下问题:C# SqlDataAccess.ExecuteScalar方法的具体用法?C# SqlDataAccess.ExecuteScalar怎么用?C# SqlDataAccess.ExecuteScalar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GK.Library.Utility.SqlDataAccess
的用法示例。
在下文中一共展示了SqlDataAccess.ExecuteScalar方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckOldPasswordCorrect
public static MsCrmResult CheckOldPasswordCorrect(Guid portalUserId, string oldPassword, SqlDataAccess sda)
{
MsCrmResult returnValue = new MsCrmResult();
try
{
#region | SQL QUERY |
string sqlQuery = @"SELECT
COUNT(0) AS RecCount
FROM
new_user AS u (NOLOCK)
WHERE
u.new_userId='{0}'
AND
u.new_password='{1}'";
#endregion
int recCount = (int)sda.ExecuteScalar(string.Format(sqlQuery, portalUserId, oldPassword.Trim()));
if (recCount > 0)
{
returnValue.Success = true;
returnValue.Result = "Eski şifre ile bilgiler eşleşti.";
}
else
{
returnValue.Result = "Eski şifre bilginiz yanlıştır.<br />Lütfen kontrol ediniz.";
}
}
catch (Exception ex)
{
returnValue.Result = ex.Message;
}
return returnValue;
}
示例2: GetUserLoginCount
public static int GetUserLoginCount(Guid portalId, Guid portalUserId, DateTime start, DateTime end, SqlDataAccess sda)
{
int returnValue = 0;
try
{
#region | SQL QUERY |
string sqlQuery = @"SELECT
COUNT(0)
FROM
new_loginlog AS ll (NOLOCK)
WHERE
[email protected]
AND
[email protected]
AND
ll.new_logindate BETWEEN @start AND @end
AND
ll.StateCode=0";
#endregion
SqlParameter[] parameters = {
new SqlParameter("@PortalId",portalId)
,new SqlParameter("@UserId",portalUserId)
,new SqlParameter("@start",start)
,new SqlParameter("@end",end)
};
returnValue = (int)sda.ExecuteScalar(sqlQuery, parameters);
}
catch (Exception ex)
{
}
return returnValue;
}
示例3: GetUserGraffitiCount
public static int GetUserGraffitiCount(Guid portalId, Guid portalUserId, DateTime start, DateTime end, bool hasMedia, SqlDataAccess sda)
{
int returnValue = 0;
try
{
#region | SQL QUERY |
string sqlQuery = @"SELECT
COUNT(0)
FROM
new_graffiti AS gr (NOLOCK)
WHERE
[email protected]
AND
[email protected]
AND
gr.CreatedOn BETWEEN @start AND @end
AND
gr.StateCode=0
AND
gr.statuscode=1 --Etkin
AND
gr.new_imageurl " + (hasMedia ? " IS NOT NULL" : " IS NULL");
#endregion
SqlParameter[] parameters = {
new SqlParameter("@PortalId",portalId)
,new SqlParameter("@UserId",portalUserId)
,new SqlParameter("@start",start)
,new SqlParameter("@end",end)
};
returnValue = (int)sda.ExecuteScalar(sqlQuery, parameters);
}
catch (Exception ex)
{
}
return returnValue;
}
示例4: HasUserQuestionLimit
public static MsCrmResult HasUserQuestionLimit(Guid portalUserId, Guid portalId, SqlDataAccess sda)
{
MsCrmResult returnValue = new MsCrmResult();
try
{
#region | SQL QUERY |
string query = @"
DECLARE @now DATETIME
DECLARE @startDate DATETIME
DECLARE @endDate DATETIME
DECLARE @current INT
DECLARE @limit INT
DECLARE @hasLimit BIT
SET @now=GETUTCDATE()
SELECT
@limit=sl.new_frequency
,@startDate= CASE
WHEN
sl.new_scoreperiod=100000000 --DAILY
THEN
{2}.dbo.fn_BeginOfToday(@now)
ELSE
CASE
WHEN
sl.new_scoreperiod=100000001 --WEEKLY
THEN
{2}.dbo.fn_BeginOfThisWeek(@now)
ELSE
CASE
WHEN
sl.new_scoreperiod=100000002 --MONTHLY
THEN
{2}.dbo.fn_BeginOfThisMonth(@now)
ELSE
{2}.dbo.fn_BeginOfThisYear(@now)
END
END
END
,@endDate= CASE
WHEN
sl.new_scoreperiod=100000000 --DAILY
THEN
{2}.dbo.fn_EndOfToday(@now)
ELSE
CASE
WHEN
sl.new_scoreperiod=100000001 --WEEKLY
THEN
{2}.dbo.fn_EndOfThisWeek(@now)
ELSE
CASE
WHEN
sl.new_scoreperiod=100000003 --MONTHLY
THEN
{2}.dbo.fn_EndOfThisMonth(@now)
ELSE
{2}.dbo.fn_EndOfThisYear(@now)
END
END
END
FROM
new_scorelimit AS sl (NOLOCK)
WHERE
sl.new_scoretype=100000000 --InfoCube
SELECT
@current = COUNT(0)
FROM
new_questionanswers AS ans (NOLOCK)
WHERE
ans.new_portalId='{1}'
AND
ans.new_userId='{0}'
AND
ans.statecode=0
AND
ans.statuscode=1 --Active
AND
ans.CreatedOn BETWEEN @startDate AND @endDate
SELECT
@hasLimit= CASE
WHEN
@current < @limit OR @limit IS NULL
THEN
1
ELSE
0
END
SELECT @hasLimit";
#endregion
returnValue.Success = (bool)sda.ExecuteScalar(string.Format(query, portalUserId, portalId, Globals.DatabaseName));
}
catch (Exception ex)
{
returnValue.Success = false;
//.........这里部分代码省略.........
示例5: IsUserLikedBefore
public static MsCrmResult IsUserLikedBefore(Guid entityId, string entityName, Guid portalUserId, SqlDataAccess sda)
{
MsCrmResult returnValue = new MsCrmResult();
try
{
#region | SQL QUERY |
string query = @"SELECT
COUNT(0) AS RecCount
FROM
new_likerecord AS l (NOLOCK)
WHERE
l.{1}Id='{0}'
AND
l.new_userId='{2}'
AND
l.statecode=0";
#endregion
int reCount = (int)sda.ExecuteScalar(string.Format(query, entityId, entityName, portalUserId));
if (reCount > 0)
{
returnValue.Success = true;
returnValue.Result = "M054"; //"Önceden beğeni kaydınız vardır.";
}
}
catch (Exception ex)
{
returnValue.Result = ex.Message;
}
return returnValue;
}
示例6: GetMaxFormCodeNumber
public static MsCrmResultObject GetMaxFormCodeNumber(SqlDataAccess sda)
{
MsCrmResultObject returnValue = new MsCrmResultObject();
try
{
#region | SQL QUERY |
string sqlQuery = @"SELECT
ISNULL(MAX(df.new_formcode),0) AS MaxCode
FROM
new_discoveryform AS df (NOLOCK)";
#endregion
int maxNo = (int)sda.ExecuteScalar(sqlQuery);
returnValue.Success = true;
returnValue.ReturnObject = maxNo;
}
catch (Exception ex)
{
returnValue.Result = ex.Message;
}
return returnValue;
}