protected void Button1_Command(object sender, CommandEventArgs e) { UserEntity userEntity = new UserEntity(); UserBll userBll = new UserBll(); string userID = this.ViewState["id"].ToString(); userEntity.UserID = userID; DataTable byID = userBll.GetByID(userEntity); if (byID != null && byID.Rows.Count == 1) { int num = int.Parse(byID.Rows[0]["UserIntegral"].ToString()); userEntity.UserID = userID; userEntity.UserIntegral = num + 5; userBll.Update_Integral(userEntity); UserIntegralDetailEntity userIntegralDetailEntity = new UserIntegralDetailEntity(); UserIntegralDetailBll userIntegralDetailBll = new UserIntegralDetailBll(); userIntegralDetailEntity.UserID = userID; userIntegralDetailEntity.IntegralChange = 5; userIntegralDetailEntity.ChangeDes = "上报"; userIntegralDetailBll.Add(userIntegralDetailEntity); RewardProblemEntity wrongProblemEntity = new RewardProblemEntity(); RewardProbelmBll wrongProblemBll = new RewardProbelmBll(); wrongProblemEntity.RewardProblemID = int.Parse(e.CommandArgument.ToString()); wrongProblemEntity.ManagerBack = "谢谢您的上报,我们为您加5分"; wrongProblemEntity.RecordState = 2; wrongProblemBll.Update_Back(wrongProblemEntity); base.ClientScript.RegisterStartupScript(base.GetType(), "msg", "<script>alert('谢谢您的上报,我们为您加5分');</script>"); int num2 = int.Parse(this.lblIntegral.Text); this.lblIntegral.Text = (num2 + 5).ToString(); return; } base.Response.Redirect("UserIntegral_Manage.aspx"); }
public void Asp(GridView gv, AspNetPager pager, UserIntegralDetailEntity mo) { SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@DetailID", SqlDbType.Int); param[0].Value = mo.DetailID; param[1] = new SqlParameter("@UserID", SqlDbType.VarChar, 50); param[1].Value = mo.UserID; string comstr = "with IntegralInfo as\r\n (\r\n select ui.DetailID as DetailID,ui.UserID as UserID,ui.IntegralChange as IntegralChange,ui.ChangeDes as ChangeDes,us.UserName as UserName,Row_Number() over(order by DetailID) as row_number from UserIntegralDetail ui,Users us where ui.UserID=us.UserID"; string comstr2 = "select count(*) from UserIntegralDetail ui,Users us where ui.UserID=us.UserID"; if (mo.DetailID != 0) { comstr += " and ui.DetailID=@DetailID"; comstr2 += " and ui.DetailID=@DetailID"; } if (mo.UserID != null && mo.UserID != "") { comstr += " and ui.UserID=@UserID"; comstr2 += " and ui.UserID=@UserID"; } comstr += " ) select * from IntegralInfo where row_number>{0} and row_number<{1}"; comstr = string.Format(comstr, (pager.CurrentPageIndex - 1) * pager.PageSize, pager.CurrentPageIndex * pager.PageSize); DataBase db = new DataBase(); pager.RecordCount = Convert.ToInt32(db.ExecuteValue(comstr2, param)); gv.DataSource = db.GetDataTable(comstr, param); gv.DataBind(); }
private void BindView1() { UserIntegralDetailEntity userIntegralDetailEntity = new UserIntegralDetailEntity(); UserIntegralDetailBll userIntegralDetailBll = new UserIntegralDetailBll(); userIntegralDetailEntity.UserID = this.Session["UserID"].ToString(); userIntegralDetailEntity.DetailID = 0; userIntegralDetailBll.Asp(this.GridView1, this.AspNetPager1, userIntegralDetailEntity); }
public bool Delete(UserIntegralDetailEntity mo) { DataBase db = new DataBase(); string sql = "delete from UserIntegralDetail where DetailID=@DetailID"; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@DetailID", SqlDbType.Int) }; param[0].Value = mo.DetailID; return(db.ExecuteSql(sql, param) > 0); }
public bool Add(UserIntegralDetailEntity mo) { DataBase db = new DataBase(); string sql = "insert into UserIntegralDetail(UserID,IntegralChange,ChangeDes) values(@UserID,@IntegralChange,@ChangeDes)"; SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter("@UserID", SqlDbType.VarChar, 50); param[0].Value = mo.UserID; param[1] = new SqlParameter("@IntegralChange", SqlDbType.Int); param[1].Value = mo.IntegralChange; param[2] = new SqlParameter("@ChangeDes", SqlDbType.VarChar, 1000); param[2].Value = mo.ChangeDes; return(db.ExecuteSql(sql, param) > 0); }
public bool Update(UserIntegralDetailEntity mo) { DataBase db = new DataBase(); string sql = "update UserIntegralDetail set UserID=@UserID,IntegralChange=@IntegralChange,ChangeDes=@ChangeDes where DetailID=@DetailID"; SqlParameter[] param = new SqlParameter[4]; param[0] = new SqlParameter("@UserID", SqlDbType.VarChar, 50); param[0].Value = mo.UserID; param[1] = new SqlParameter("@IntegralChange", SqlDbType.Int); param[1].Value = mo.IntegralChange; param[2] = new SqlParameter("@ChangeDes", SqlDbType.VarChar, 1000); param[2].Value = mo.ChangeDes; param[3] = new SqlParameter("@DetailID", SqlDbType.Int); param[3].Value = mo.DetailID; return(db.ExecuteSql(sql, param) > 0); }
public DataTable GetByID(UserIntegralDetailEntity mo) { DataBase db = new DataBase(); string sql = "select ui.DetailID as DetailID,ui.UserID as UserID,ui.IntegralChange as IntegralChange,ui.ChangeDes as ChangeDes,us.UserName as UserName from UserIntegralDetail ui,Users us where ui.UserID=us.UserID"; if (mo.DetailID != 0) { sql += " and ui.DetailID=@DetailID"; } if (mo.UserID != null && mo.UserID != "") { sql += " and ui.UserID=@UserID"; } SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@DetailID", SqlDbType.Int); param[0].Value = mo.DetailID; param[1] = new SqlParameter("@UserID", SqlDbType.VarChar, 50); param[1].Value = mo.UserID; return(db.GetDataTable(sql, param)); }
private void BindView2() { UserIntegralDetailEntity userIntegralDetailEntity = new UserIntegralDetailEntity(); UserIntegralDetailBll userIntegralDetailBll = new UserIntegralDetailBll(); userIntegralDetailEntity.DetailID = 0; userIntegralDetailEntity.UserID = this.ViewState["id"].ToString(); userIntegralDetailBll.Asp(this.GridView2, this.AspNetPager2, userIntegralDetailEntity); UserEntity userEntity = new UserEntity(); UserBll userBll = new UserBll(); userEntity.UserID = this.ViewState["id"].ToString(); DataTable byID = userBll.GetByID(userEntity); if (byID != null && byID.Rows.Count == 1) { this.Label1.Text = byID.Rows[0]["UserName"].ToString(); this.Label2.Text = byID.Rows[0]["UserIntegral"].ToString(); } }
protected void Button1_Click(object sender, EventArgs e) { if (base.Request.QueryString["type"].ToString() == "1") { RewardProblemEntity rewardProblemEntity = new RewardProblemEntity(); RewardProbelmBll rewarProblemBll = new RewardProbelmBll(); rewardProblemEntity.RewardProblemID = int.Parse(this.ViewState["id"].ToString()); rewardProblemEntity.UserID = ""; DataTable byID = rewarProblemBll.GetByID(rewardProblemEntity); if (byID == null || byID.Rows.Count != 1) { base.Response.Redirect("~/login_1.aspx"); return; } string userID = byID.Rows[0]["UserID"].ToString(); UserEntity userEntity = new UserEntity(); UserBll userBll = new UserBll(); userEntity.UserID = userID; DataTable byID2 = userBll.GetByID(userEntity); if (byID2 != null && byID2.Rows.Count == 1) { userEntity.UserID = userID; userEntity.UserIntegral = int.Parse(byID2.Rows[0]["UserIntegral"].ToString()) + 5; userBll.Update_Integral(userEntity); UserIntegralDetailEntity userIntegralDetailEntity = new UserIntegralDetailEntity(); UserIntegralDetailBll userIntegralDetailBll = new UserIntegralDetailBll(); userIntegralDetailEntity.UserID = userID; userIntegralDetailEntity.IntegralChange = 5; userIntegralDetailEntity.ChangeDes = "提出问题认同上报"; userIntegralDetailBll.Add(userIntegralDetailEntity); rewardProblemEntity.ManagerBack = this.txtDes.Text.Trim(); rewardProblemEntity.RecordState = 2; rewarProblemBll.Update_Back(rewardProblemEntity); base.Response.Redirect("UserRewardManager.aspx"); return; } base.Response.Redirect("~/login_1.aspx"); return; } else { RewardProblemEntity rewardProblemEntity2 = new RewardProblemEntity(); RewardProbelmBll wrongProblemBll2 = new RewardProbelmBll(); rewardProblemEntity2.RewardProblemID = int.Parse(this.ViewState["id"].ToString()); rewardProblemEntity2.UserID = ""; DataTable byID3 = wrongProblemBll2.GetByID(rewardProblemEntity2); if (byID3 != null && byID3.Rows.Count == 1) { string userID2 = byID3.Rows[0]["UserID"].ToString(); UserIntegralDetailEntity userIntegralDetailEntity2 = new UserIntegralDetailEntity(); UserIntegralDetailBll userIntegralDetailBll2 = new UserIntegralDetailBll(); userIntegralDetailEntity2.UserID = userID2; userIntegralDetailEntity2.IntegralChange = 0; userIntegralDetailEntity2.ChangeDes = "提出问题不认同上报"; userIntegralDetailBll2.Add(userIntegralDetailEntity2); rewardProblemEntity2.ManagerBack = this.txtDes.Text.Trim(); rewardProblemEntity2.RecordState = 3; wrongProblemBll2.Update_Back(rewardProblemEntity2); base.Response.Redirect("UserRewardManager.aspx"); return; } base.Response.Redirect("~/login_1.aspx"); return; } }
public void Asp(GridView gv, AspNetPager pager, UserIntegralDetailEntity mo) { this.dal.Asp(gv, pager, mo); }
public DataTable GetByID(UserIntegralDetailEntity mo) { return(this.dal.GetByID(mo)); }
public bool Delete(UserIntegralDetailEntity mo) { return(this.dal.Delete(mo)); }
public bool Update(UserIntegralDetailEntity mo) { return(this.dal.Update(mo)); }
public bool Add(UserIntegralDetailEntity mo) { return(this.dal.Add(mo)); }