/// <summary> /// 修改是否使用的状态 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void sbUse_Click(object sender, EventArgs e) { StateButton ub = (StateButton)sender; int index = ((GridViewRow)(ub.Parent.Parent)).RowIndex; int id = int.Parse(this.GridView1.DataKeys[index].Value.ToString()); // Song.Entities.Guide entity = Business.Do <IGuide>().GuideSingle(id); entity.Gu_IsShow = !entity.Gu_IsShow; Business.Do <IGuide>().GuideSave(entity); BindData(null, null); }
/// <summary> /// 新增按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAddEnter_Click(object sender, EventArgs e) { int id = 0; int.TryParse(lbID.Text, out id); Song.Entities.Guide guide = id == 0 ? new Song.Entities.Guide() : Business.Do <IGuide>().GuideSingle(id); guide.Gu_Title = tbTitle.Text; guide.Gu_IsHot = cbIsHot.Checked; //是否显示 guide.Gu_IsShow = cbIsShow.Checked; //是否置顶 guide.Gu_IsTop = cbIsTop.Checked; //是否推荐 guide.Gu_IsRec = cbIsRec.Checked; guide.Gu_Details = tbDetails.Text; // int gcolid = 0; int.TryParse(ddlTree.SelectedValue, out gcolid); guide.Gc_ID = gcolid; guide.Cou_ID = couid; guide.Org_ID = org.Org_ID; // if (string.IsNullOrWhiteSpace(guide.Gu_Uid)) { guide.Gu_Uid = getUID(); } if (id == 0) { Business.Do <IGuide>().GuideAdd(guide); } else { Business.Do <IGuide>().GuideSave(guide); } BindData(null, null); btnAddBack_Click(null, null); }
/// <summary> /// 进入编辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEdit_Click(object sender, ImageClickEventArgs e) { plEditArea.Visible = true; plListArea.Visible = false; // WeiSha.WebControl.RowEdit img = (WeiSha.WebControl.RowEdit)sender; int index = ((GridViewRow)(img.Parent.Parent)).RowIndex; int id = int.Parse(this.GridView1.DataKeys[index].Value.ToString()); //上级 ddlTree.Items.Clear(); Song.Entities.GuideColumns[] cous = Business.Do <IGuide>().GetColumnsAll(couid, null); ddlTree.DataSource = cous; this.ddlTree.DataTextField = "Gc_title"; this.ddlTree.DataValueField = "Gc_ID"; this.ddlTree.Root = 0; this.ddlTree.DataBind(); ddlTree.Items.Insert(0, new ListItem(" -- 顶级 --", "0")); // Song.Entities.Guide guide = Business.Do <IGuide>().GuideSingle(id); lbID.Text = guide.Gu_Id.ToString(); tbTitle.Text = guide.Gu_Title; cbIsHot.Checked = guide.Gu_IsHot; //是否显示 cbIsShow.Checked = guide.Gu_IsShow; //是否置顶 cbIsTop.Checked = guide.Gu_IsTop; //是否推荐 cbIsRec.Checked = guide.Gu_IsRec; tbDetails.Text = guide.Gu_Details; ListItem li = ddlTree.Items.FindByValue(guide.Gc_ID.ToString()); if (li != null) { li.Selected = true; } }
/// <summary> /// 删除,按主键ID; /// </summary> /// <param name="identify">实体的主键</param> public void GuideDelete(int identify) { Song.Entities.Guide guide = this.GuideSingle(identify); GuideDelete(guide); }