【发布时间】:2015-07-22 10:39:35
【问题描述】:
我有一个 DNN 应用程序,并且我设法放置了一个自定义模块。该模块基本上是在标签中增加和减少值。还有一个名为 submit 的按钮,它只在标签中显示一个正值,这也是正在递增和递减的值。目的只是为了计算用户在应用程序中的下载量。
现在这是我的减量代码: public void doDecrement(string propertyKey, UserInfo userInformation, int portalID) { int newDownloadCount = GetProfilePropertyValueAsInt(propertyKey, userInformation); ; 整数结果 = 0; 结果 = newDownloadCount - 1; userInformation.Profile.SetProfileProperty(propertyKey, result.ToString()); UserController.UpdateUser(portalID, userInformation); }
这是我的增量代码:
public void doIncrement(string propertyKey, UserInfo userInformation, int portalID)
{
int newDownloadCount = GetProfilePropertyValueAsInt(propertyKey, userInformation);
int result = 0; //initialize to zero
result = newDownloadCount + 1; //assign new value
//set the profile property to RAM... no need to test because Get will default to zero
userInformation.Profile.SetProfileProperty(propertyKey, result.ToString());
//call update user to write the changes to disk
UserController.UpdateUser(portalID, userInformation);
}
这是我的提交代码,因此我可以更新值:
public void UpdatePropertyValue(string propertyKey, UserInfo userInformation, int portalID, string txtNewVale)
{
int newDownloadCount = 0;
int resultValue = 0;
int.TryParse(txtNewVale, out newDownloadCount);
if (String.IsNullOrEmpty(txtNewVale))
{
newDownloadCount = resultValue;
}
userInformation.Profile.SetProfileProperty(propertyKey, newDownloadCount.ToString());
UserController.UpdateUser(portalID, userInformation);
}
我现在的问题是,我遇到了路障。我想使用 postgres 将增量值保存在数据库中。我希望每当值增加、减少或更新时,它都会保存到数据库中。
我非常感谢任何可以提供帮助的人。提前谢谢你。
【问题讨论】:
标签: c# asp.net postgresql dotnetnuke monodevelop