/// <summary> /// 新增 /// </summary> /// <param name="templetShow"></param> /// <returns></returns> public bool InsertTempletShow(TempletShow templetShow) { string sSql = $@"Insert into TempletShow(ShowContent) values('{templetShow.ShowContent}')"; return(server.ExecuteNonQuery(sSql) > 0); }
private void btnModify_Click(object sender, EventArgs e) { if (dgvTemShow.CurrentRow != null) { TempletShow templetShow = new TempletShow(); templetShow.ID = Convert.ToInt32(dgvTemShow.CurrentRow.Cells["ID"].Value); templetShow.ShowContent = dgvTemShow.CurrentRow.Cells["ShowContent"].Value.ToString(); FrmTempletLED frmTempletLED = new FrmTempletLED(templetShow); frmTempletLED.ShowDialog(); btnSearch_Click(null, null); } }
private void btnSava_Click(object sender, EventArgs e) { try { TempletShow templetShow = new TempletShow(); templetShow.ShowContent = txtContent.Text.Trim(); if (!string.IsNullOrEmpty(txtContent.Text)) { if (templetId == -1) { if (bllTempletShow.InsertTempletShow(templetShow)) { MessageBox.Show("添加模板成功!"); txtContent.Clear(); } } else { templetShow.ID = templetId; if (bllTempletShow.ModifyTempletShow(templetShow)) { MessageBox.Show("修改模板成功!"); this.Close(); } } } else { MessageBox.Show("请完善信息!"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public bool InsertTempletShow(TempletShow templetShow) { return(dalTempletShow.InsertTempletShow(templetShow)); }
public bool ModifyTempletShow(TempletShow templetShow) { return(dalTempletShow.ModifyTempletShow(templetShow)); }
/// <summary> /// 修改 /// </summary> /// <param name="templetShow"></param> /// <returns></returns> public bool ModifyTempletShow(TempletShow templetShow) { string sSql = $@"Update TempletShow set ShowContent='{templetShow.ShowContent}' where ID='{templetShow.ID}'"; return(server.ExecuteNonQuery(sSql) > 0); }
public FrmTempletLED(TempletShow templetShow) { InitializeComponent(); templetId = templetShow.ID; txtContent.Text = templetShow.ShowContent; }