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"); }
protected void Button1_Click(object sender, EventArgs e) { RewardProbelmBll rewardProblemBll = new RewardProbelmBll(); RewardProblemEntity rewardProblemEntity = new RewardProblemEntity(); if (this.txtDes.Value != null && this.txtDes.Value != "") { rewardProblemEntity.UserID = base.Session["UserID"].ToString(); rewardProblemEntity.DateUp = DateTime.Now; rewardProblemEntity.RecordState = 1; rewardProblemEntity.Des = this.txtDes.Value; } else { rewardProblemEntity.Des = ""; } if (rewardProblemBll.Add(rewardProblemEntity)) { this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('添加成功');</script>"); this.txtDes.Value = ""; base.Response.Redirect("UserRewardManager.aspx"); return; } this.Page.ClientScript.RegisterStartupScript(base.GetType(), "alert", "<script>alert('添加失败');</script>"); }
public void Asp2(DataList gv, AspNetPager pager, RewardProblemEntity mo) { DataBase db = new DataBase(); SqlParameter[] param = new SqlParameter[1]; param[0] = new SqlParameter("@UserID", SqlDbType.VarChar, 50); param[0].Value = mo.UserID; string comstr = "with RewardProblemInfo as\r\n (\r\n select RewardProblem.*,(case when RecordState=1 then '未读' when RecordState=2 then '已读,认同加分' else '已读,不认同加分' end ) as CheckState,Users.UserName as UserName,ChangDes,Row_Number() over(order by RewardProblemID) as row_number from Users,RewardProblem,UserIntegraDetail where RewardProblem.UserID=Users.UserID,Users.UserID=UserIntegraDetail.UserID"; // string comstr = "with WrongProblemInfo as\r\n (\r\n select WrongProblem.*,(case when RecordState=1 then '教师未读' when RecordState=2 then '教师已读,认同加分' else '教师已读,不认同加分' end ) as CheckState,Problems.ProblemName as ProblemName,Problems.ProblemDes as ProblemDes,Users.UserName as UserName,Row_Number() over(order by WrongProblemID) as row_number from Problems,Users,WrongProblem where WrongProblem.UserID=Users.UserID and WrongProblem.ProblemID=Problems.ProblemID"; string comstr2 = "select count(*) from Users,RewardProblem where RewardProblem.UserID=Users.UserID "; if (mo.UserID != null && mo.UserID != "") { comstr += " and RewardProblem.UserID=@UserID"; comstr2 += " and RewardProblem.UserID=@UserID"; } comstr += " )select * from RewardProblemInfo where row_number>{0} and row_number<={1}"; comstr = string.Format(comstr, (pager.CurrentPageIndex - 1) * pager.PageSize, pager.CurrentPageIndex * pager.PageSize); pager.RecordCount = Convert.ToInt32(db.ExecuteValue(comstr2, param)); gv.DataSource = db.GetDataTable(comstr, param); gv.DataBind(); }
private void BindDataList() { RewardProblemEntity rewardProblemEntity = new RewardProblemEntity(); RewardProbelmBll wrongProblemBll = new RewardProbelmBll(); rewardProblemEntity.UserID = ""; wrongProblemBll.Asp(this.DataList1, this.AspNetPager1, rewardProblemEntity); }
protected void Button2_Command(object sender, CommandEventArgs e) { RewardProblemEntity wrongProblemEntity = new RewardProblemEntity(); RewardProbelmBll wrongProblemBll = new RewardProbelmBll(); wrongProblemEntity.RewardProblemID = int.Parse(e.CommandArgument.ToString()); wrongProblemEntity.ManagerBack = "谢谢您的上报,我们不给你加分"; wrongProblemEntity.RecordState = 3; wrongProblemBll.Update_Back(wrongProblemEntity); base.ClientScript.RegisterStartupScript(base.GetType(), "msg", "<script>alert('谢谢您的上报,我们不给你加分');</script>"); }
public bool DeleteWrongProblembyID(RewardProblemEntity en) { SqlParameter[] p = new SqlParameter[] { new SqlParameter("@RewardProblemID", SqlDbType.Int, 4) }; p[0].Value = en.RewardProblemID; string sql = "delete from Reward where RewardID=@RewardID"; return(this.db.ExecuteSql(sql, p) > 0); }
public bool Update_Back(RewardProblemEntity mo) { DataBase db = new DataBase(); string sql = "update RewardProblem set ManagerBack=@ManagerBack,RecordState=@RecordState where RewardProblemID=@RewardProblemID"; SqlParameter[] param = new SqlParameter[3]; param[0] = new SqlParameter("@RewardProblemID", SqlDbType.Int); param[0].Value = mo.RewardProblemID; param[1] = new SqlParameter("@ManagerBack", SqlDbType.VarChar, 1000); param[1].Value = mo.ManagerBack; param[2] = new SqlParameter("@RecordState", SqlDbType.Int); param[2].Value = mo.RecordState; return(db.ExecuteSql(sql, param) > 0); }
public void Asp(GridView gv, AspNetPager pager, RewardProblemEntity en) { SqlParameter[] p = new SqlParameter[] { new SqlParameter("@UserID", SqlDbType.VarChar, 50) }; p[0].Value = en.UserID; string sql = "with AllUserProblem as( select RewardProblemID,Des,ManagerBack,DateUp,Row_Number() over(order by RewardProblemID) as row_number from RewardProblem where UserID=@UserID ) select * from AllUserProblem where row_number>{0} and row_number<={1}"; string sql2 = "select count (*) from WrongProblem where UserID=@UserID"; sql = string.Format(sql, (pager.CurrentPageIndex - 1) * pager.PageSize, pager.CurrentPageIndex * pager.PageSize); pager.RecordCount = Convert.ToInt32(this.db.ExecuteValue(sql2, p)); gv.DataSource = this.db.GetDataTable(sql, p); gv.DataBind(); }
public bool Add(RewardProblemEntity mo) { DataBase db = new DataBase(); string sql = "insert into RewardProblem(UserID,Des,DateUp,RecordState) values(@UserID,@Des,@DateUp,@RecordState)"; SqlParameter[] param = new SqlParameter[4]; param[0] = new SqlParameter("@UserID", SqlDbType.VarChar, 50); param[0].Value = mo.UserID; param[1] = new SqlParameter("@Des", SqlDbType.VarChar, 1000); param[1].Value = mo.Des; param[2] = new SqlParameter("@DateUp", SqlDbType.DateTime); param[2].Value = mo.DateUp; param[3] = new SqlParameter("@RecordState", SqlDbType.Int); param[3].Value = mo.RecordState; return(db.ExecuteSql(sql, param) > 0); }
private void BindView1() { RewardProblemEntity wrongProblemEntity = new RewardProblemEntity(); RewardProbelmBll wrongProblemBll = new RewardProbelmBll(); wrongProblemEntity.RecordState = 1; wrongProblemEntity.UserID = this.ViewState["id"].ToString(); wrongProblemBll.Asp(this.DataList1, this.AspNetPager1, wrongProblemEntity); 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.lblUserName.Text = byID.Rows[0]["UserName"].ToString(); this.lblIntegral.Text = byID.Rows[0]["UserIntegral"].ToString(); } }
public bool AddRewardProblem(RewardProblemEntity en) { SqlParameter[] p = new SqlParameter[3]; p[0] = new SqlParameter("@UserID", SqlDbType.VarChar, 50); p[0].Value = en.UserID; p[1] = new SqlParameter("@Des", SqlDbType.VarChar, 1000); p[1].Value = en.Des; p[2] = new SqlParameter("@ManagerBack", SqlDbType.VarChar, 1000); if (en.ManagerBack != null) { p[3].Value = en.ManagerBack; } else { p[3].Value = ""; } string sql = "insert into RewardProblem (UserID,Des,ManagerBack) values(@UserID,@Des,@ManagerBack)"; return(this.db.ExecuteSql(sql, p) > 0); }
public DataTable GetByID(RewardProblemEntity mo) { DataBase db = new DataBase(); string sql = "select RewardProblem.*,Users.UserName as UserName from Users,RewardProblem where RewardProblem.UserID=Users.UserID "; SqlParameter[] param = new SqlParameter[2]; param[0] = new SqlParameter("@RewardProblemID", SqlDbType.Int); param[0].Value = mo.RewardProblemID; param[1] = new SqlParameter("@UserID", SqlDbType.VarChar, 50); param[1].Value = mo.UserID; if (mo.RewardProblemID != 0) { sql += " and RewardProblem.RewardProblemID=@RewardProblemID"; } if (mo.UserID != null && mo.UserID != "") { sql += " and RewardProblem.UserID=@UserID"; } return(db.GetDataTable(sql, param)); }
protected void Button1_Click(object sender, EventArgs e) { if (base.Request.QueryString["type"].ToString() == "1") { UserHolidayEntity rewardProblemEntity = new UserHolidayEntity(); UserHolidayBll rewarProblemBll = new UserHolidayBll(); rewardProblemEntity.UserHolidayID = 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); UserHolidayDetailEntity UserHolidayDetailEntity = new UserHolidayDetailEntity(); UserHolidayDetailBll UserHolidayDetailBll = new UserHolidayDetailBll(); UserHolidayDetailEntity.UserID = userID; UserHolidayDetailEntity.IntegralChange = 5; UserHolidayDetailEntity.ChangeDes = "请假认同上报"; UserHolidayDetailBll.Add(UserHolidayDetailEntity); rewardProblemEntity.ManagerBack = this.txtDes.Text.Trim(); rewardProblemEntity.RecordState = 2; rewarProblemBll.Update_Back(rewardProblemEntity); base.Response.Redirect("UserHolidayManage.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(); UserHolidayDetailEntity UserHolidayDetailEntity2 = new UserHolidayDetailEntity(); UserHolidayDetailBll UserHolidayDetailBll2 = new UserHolidayDetailBll(); UserHolidayDetailEntity2.UserID = userID2; UserHolidayDetailEntity2.IntegralChange = 0; UserHolidayDetailEntity2.ChangeDes = "请假不认同上报"; UserHolidayDetailBll2.Add(UserHolidayDetailEntity2); rewardProblemEntity2.ManagerBack = this.txtDes.Text.Trim(); rewardProblemEntity2.RecordState = 3; wrongProblemBll2.Update_Back(rewardProblemEntity2); base.Response.Redirect("UserHolidayManage.aspx"); return; } base.Response.Redirect("~/login_1.aspx"); return; } }
/* public bool AddWrongProblem(RewardProblemEntity en) * { * return this.dal.AddWrongProblem(en); * } */ public bool DeleteWrongProblembyID(RewardProblemEntity en) { return(this.dal.DeleteWrongProblembyID(en)); }
public void Asp(GridView gv, AspNetPager pager, RewardProblemEntity en) { this.dal.Asp(gv, pager, en); }
public bool Add(RewardProblemEntity mo) { return(this.dal.Add(mo)); }
public bool Update_Back(RewardProblemEntity mo) { return(this.dal.Update_Back(mo)); }
public DataTable GetByID(RewardProblemEntity mo) { return(this.dal.GetByID(mo)); }
public void Asp2(DataList gv, AspNetPager pager, RewardProblemEntity mo) { this.dal.Asp2(gv, pager, mo); }