protected void Page_Load(object sender, EventArgs e) { if (Request.Form["pid"] != null) { string pid = Request.Form["pid"].ToString(); string getSql = "select * from H_Order where course_id=" + pid; int count = DbHelperSQL.Query(getSql).Tables[0].Rows.Count; if (count > 0) { Response.Write(Tool.CreateJson("此课程在订单下有相关业务,不能被删除掉!", "2")); Response.End(); return; } else { if (H_Detail_CourseClass.Delete(pid)) { Response.Write(Tool.CreateJson("操作成功", "1")); } else { Response.Write(Tool.CreateJson("操作失败", "2")); } } } else { Response.Write(Tool.CreateJson("缺少参数", "3")); } Response.End(); }
private void InitData() { HttpCookie cookie = Request.Cookies["qx"]; if (cookie != null) { qx = cookie.Values["qxid"].ToString(); } if (qx != "1") { Response.Redirect("Error.aspx"); } int PageIndex = 1; if (Request.QueryString["page"] != null) { int.TryParse(Request.QueryString["page"].ToString(), out PageIndex); } int PageSize = 10; int TotalCount = 0; string strWhere = " 1=1 "; if (Request.QueryString["pid"] != null) { subordinate_course_id = Request.QueryString["pid"]; strWhere += " and subordinate_course_id=" + subordinate_course_id; } DataTable dt = H_Detail_CourseClass.GetList(PageSize, PageIndex, strWhere, out TotalCount); this.Repeater1.DataSource = dt; this.Repeater1.DataBind(); this.LiteralPage.Text = PageClass.BuildPage(PageIndex, TotalCount, PageSize); }
private void InitData() { if (Request.QueryString["pid"] != null) { string pid = Request.QueryString["pid"].ToString(); Model.H_Detail_Course detail_course = H_Detail_CourseClass.GetModel(pid); this.TextDetailCourse.Value = detail_course.course_name; this.TextPur_Price.Value = detail_course.course_pur_price.ToString(); this.TextSel_Price.Value = detail_course.course_sel_price.ToString(); this.TextStudent_Share.Value = detail_course.student_share.ToString(); this.TextClerk_Share.Value = detail_course.clerk_share.ToString(); this.TextService_Share.Value = detail_course.service_share.ToString(); } }
protected void Button1_Click(object sender, EventArgs e) { Model.H_Detail_Course detail_course = new Model.H_Detail_Course(); detail_course.subordinate_course_id = int.Parse(pid); detail_course.course_name = this.TextDetailCourse.Value.Trim(); detail_course.course_sel_price = double.Parse(this.TextSel_Price.Value.Trim()); detail_course.course_pur_price = double.Parse(this.TextPur_Price.Value.Trim()); detail_course.clerk_share = double.Parse(this.TextClerk_Share.Value.Trim()); detail_course.student_share = double.Parse(this.TextStudent_Share.Value.Trim()); detail_course.service_share = double.Parse(this.TextService_Share.Value.Trim()); if (H_Detail_CourseClass.Add(detail_course)) { JScript.AlertAndRedirect("操作成功", "DetailCourseList.aspx?pid=" + pid + "", this); } else { JScript.Alert("操作失败", "a2", this); } }