private void ShowInfo(int FavoriteID) { BLL.Tao.Favorite bll = new BLL.Tao.Favorite(); Model.Tao.Favorite model = bll.GetModel(FavoriteID); this.lblFavoriteID.Text = model.FavoriteID.ToString(); this.lblCourseID.Text = model.CourseID.ToString(); this.lblModuleID.Text = model.ModuleID.ToString(); this.lblUserID.Text = model.UserID.ToString(); this.lblTags.Text = model.Tags; this.lblRemark.Text = model.Remark; }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtCourseID.Text)) { strErr += "课程格式错误!\\n"; } if (!PageValidate.IsNumber(txtModuleID.Text)) { strErr += "节次格式错误!\\n"; } if (!PageValidate.IsNumber(txtUserID.Text)) { strErr += "用户格式错误!\\n"; } if (this.txtTags.Text.Trim().Length == 0) { strErr += "关键字不能为空!\\n"; } if (this.txtRemark.Text.Trim().Length == 0) { strErr += "备注不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int CourseID = int.Parse(this.txtCourseID.Text); int ModuleID = int.Parse(this.txtModuleID.Text); int UserID = int.Parse(this.txtUserID.Text); string Tags = this.txtTags.Text; string Remark = this.txtRemark.Text; Model.Tao.Favorite model = new Model.Tao.Favorite(); model.CourseID = CourseID; model.ModuleID = ModuleID; model.UserID = UserID; model.Tags = Tags; model.Remark = Remark; BLL.Tao.Favorite bll = new BLL.Tao.Favorite(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
private void CancleFav(HttpRequest Request, HttpResponse Response) { BLL.Tao.Favorite favBll = new BLL.Tao.Favorite(); if (!string.IsNullOrEmpty(Request.Form["id"])) { int _ids = int.Parse(Request.Form["id"].ToString()); if (favBll.Delete(_ids)) { Response.Write("Succ"); Response.End(); } else { Response.Write("Faile"); Response.End(); } } }
/// <summary> /// 获取已关注该课程的人数 /// </summary> /// <param name="context"></param> private void GetFavCount(HttpContext context) { JsonObject json = new JsonObject(); BLL.Tao.Favorite favoriteBLL = new BLL.Tao.Favorite(); string strCid = context.Request.Params["cid"]; if (!string.IsNullOrEmpty(strCid)) { int counts = favoriteBLL.GetFavCourseCount(int.Parse(strCid)); json.Put(TAO_KEY_STATUS, TAO_STATUS_SUCCESS); json.Put("NUM", counts); } else { json.Put(TAO_KEY_STATUS, TAO_STATUS_FAILED); } context.Response.Write(json.ToString()); }
protected void Repeater_Fav_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandArgument.Equals("Fav")) { Label labcid = e.Item.FindControl("labCid") as Label; if (labcid == null && labcid.Text == "") { return; } int ids = int.Parse(labcid.Text); BLL.Tao.Favorite favBll = new BLL.Tao.Favorite(); if (favBll.Delete(ids)) { this.DataBind(); } else { this.DataBind(); } } }