/// <summary> /// 修改是否显示的状态 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void sbUse_Click(object sender, EventArgs e) { try { StateButton ub = (StateButton)sender; int index = ((GridViewRow)(ub.Parent.Parent)).RowIndex; int id = int.Parse(this.GridView1.DataKeys[index].Value.ToString()); // Song.Entities.DownloadType entity = Business.Do <IContents>().DownloadTypeSingle(id); entity.Dty_IsUse = !entity.Dty_IsUse; Business.Do <IContents>().DownloadTypeSave(entity); BindData(null, null); } catch (Exception ex) { Message.ExceptionShow(ex); } }
/// <summary> /// 修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnEnter_Click(object sender, EventArgs e) { Song.Entities.DownloadType mm = null; try { if (id != 0) { mm = Business.Do <IContents>().DownloadTypeSingle(id); } else { mm = new Song.Entities.DownloadType(); } mm.Dty_Name = tbName.Text.Trim(); mm.Dty_IsUse = cbIsUse.Checked; mm.Dty_Intro = tbIntro.Text.Trim(); mm.Dty_Details = tbDetails.Text; } catch (Exception ex) { Message.ExceptionShow(ex); } try { if (id != 0) { Business.Do <IContents>().DownloadTypeSave(mm); } else { Business.Do <IContents>().DownloadTypeAdd(mm); } Master.AlertCloseAndRefresh("操作成功!"); } catch (Exception ex) { Master.Alert(ex.Message); } }
/// <summary> /// 设置初始界面 /// </summary> private void fill() { try { Song.Entities.DownloadType mm; if (id != 0) { mm = Business.Do <IContents>().DownloadTypeSingle(id); cbIsUse.Checked = mm.Dty_IsUse; } else { mm = new Song.Entities.DownloadType(); } tbName.Text = mm.Dty_Name; tbIntro.Text = mm.Dty_Intro; tbDetails.Text = mm.Dty_Details; } catch (Exception ex) { Message.ExceptionShow(ex); } }