自然框架之数据访问

复制//发回复 Reply.bodyUBB = Request.Form["Editor"]; Reply.topicID = int.Parse(this.DataID); #region 验证信息 if (Reply.bodyUBB.Length <10) { Functions.PageRegisterAlert(Page,自然之数 "请填写内容,或者内容太短!框架至少也得写10个字,据访对吧。自然之数"); return; } #endregion #region 内部字段 int userID = int.Parse(UserInfo.UserID); string ip = Request.UserHostAddress; DateTime dateTime = DateTime.Now; string bodyHTML; #endregion #region 处理UBB bodyHTML = bodyUBB.Replace("\r",框架 "<BR>"); //其他略 #endregion //开启事务 Dal.ManagerTran.TranBegin(); ManagerParameter parm = Dal.ManagerParameter; #region 设置参数 parm.ClearParameter(); parm.AddNewInParameter("TopicID", Reply.topicID); // parm.AddNewInParameter("回复内容", bodyUBB); parm.AddNewInParameter("内容HTML", bodyHTML); parm.AddNewInParameter("回复人ID", userID); parm.AddNewInParameter("回复人IP", ip, 15); parm.AddNewInParameter("回复时间", dateTime); #endregion #region 保存回复,表名:BBS_Reply Dal.ModifyData.InsertData("BBS_Reply"); if (Dal.ErrorMessage.Length > 0) { //出现异常 Functions.PageRegisterAlert(Page,据访 "保存您发的回复的时候出现意外情况!"); return; } #endregion string sql; #region 更新回复人的自然之数回复数量,香港云服务器回复时间,框架以及各种积分。据访 sql = @"update BBS_Topic set 回复次数 = 回复次数 + 1 ,自然之数***回复时间 = GetDate(), ***回复人ID = , where TopicID ={1}"; Dal.ExecuteNonQuery(string.Format(sql, userID,topicID)); if (Dal.ErrorMessage.Length > 0) { //出现异常 Functions.PageRegisterAlert(Page, "更新回复数量的时候出现意外情况!"); return; } #endregion #region 更新回复人的框架参与讨论的帖子 sql = "select top 1 UserInTopicID from BBS_UserInTopic where UserID = and TopicID={1} "; string userInTopicID = Dal.ExecuteString(string.Format(sql, userID, topicID)); sql = "select top 1 回复次数 from BBS_Topic where TopicID= "; string reCount = Dal.ExecuteString(string.Format(sql, topicID)) ?? "0"; int intintReCount = int.Parse(reCount); if (userInTopicID == null) { #region 没有参与过,添加记录 parm.ClearParameter(); parm.AddNewInParameter("UserID",据访 userID); parm.AddNewInParameter("TopicID", topicID); parm.AddNewInParameter("***查看时间", dateTime); parm.AddNewInParameter("***查看回复数", intReCount); Dal.ModifyData.InsertData("BBS_UserInTopic"); if (Dal.ErrorMessage.Length > 0) { //出现异常 Functions.PageRegisterAlert(Page, "增加您参与讨论的帖子的b2b信息网时候出现意外情况!"); return; } #endregion } else { #region 参与过,自然之数修改记录 parm.ClearParameter(); parm.AddNewInParameter("***查看时间",框架 dateTime); parm.AddNewInParameter("***查看回复数", intReCount); Dal.ModifyData.UpdateData("BBS_UserInTopic", "UserInTopicID=" + userInTopicID); if (Dal.ErrorMessage.Length > 0) { //出现异常 Functions.PageRegisterAlert(Page, "更新参与讨论的帖子的时候出现意外情况!"); return; } #endregion } #endregion //提交事务 Dal.ManagerTran.TranCommit(); //正常 lblMsg.Text = "发表回复成功!据访感谢您的参与!1秒后重新加载帖子。源码库"; Functions.PageRegisterJavascript(Page, "reload()"); 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.24.25.26.27.28.29.30.31.32.33.34.35.36.37.38.39.40.41.42.43.44.45.46.47.48.49.50.51.52.53.54.55.56.57.58.59.60.61.62.63.64.65.66.67.68.69.70.71.72.73.74.75.76.77.78.79.80.81.82.83.84.85.86.87.88.89.90.91.92.93.94.95.96.97.98.99.