public int Delete(LawFileInfo entityToInsert) { using (Conn) { return(Conn.Delete(entityToInsert)); } }
public int Update(LawFileInfo entityToInsert) { using (Conn) { return(Conn.Update(entityToInsert)); } }
public int Insert(LawFileInfo entityToInsert) { using (Conn) { return(Conn.Insert <int>(entityToInsert)); } }
public LawFileInfoAddAndEditForm(string operType, LawFileInfo lawFileInfo) { InitializeComponent(); this.operType = operType; if (operType.Equals("Edit")) { this.lawFileInfo = lawFileInfo; labelX_Name.Text = "编辑法律法规"; textBoxX_Path.Text = lawFileInfo.LawFilePath; textBoxX_Name.Text = lawFileInfo.LawFileName; dateTimeInput_Time.Value = lawFileInfo.IssueTime; textBoxX_LawFileType.Text = lawFileInfo.LawFileType; textBoxX_IssueOrganization.Text = lawFileInfo.IssueOrganization; textBoxX_IssueVersion.Text = lawFileInfo.IssueVersion; textBoxX_Description.Text = lawFileInfo.Description; } else { labelX_Name.Text = "新增法律法规"; } }
private void buttonX_Save_Click(object sender, EventArgs e) { LawFileInfoRepository repo = new LawFileInfoRepository(); try { if (operType.Equals("Add")) { LawFileInfo newLawFileInfo = new LawFileInfo(); newLawFileInfo.LawFilePath = textBoxX_Path.Text; newLawFileInfo.LawFileName = textBoxX_Name.Text; newLawFileInfo.IssueTime = dateTimeInput_Time.Value; newLawFileInfo.LawFileType = textBoxX_LawFileType.Text; newLawFileInfo.IssueOrganization = textBoxX_IssueOrganization.Text; newLawFileInfo.IssueVersion = textBoxX_IssueVersion.Text; newLawFileInfo.Description = textBoxX_Description.Text; repo.Insert(newLawFileInfo); } else { lawFileInfo.LawFilePath = textBoxX_Path.Text; lawFileInfo.LawFileName = textBoxX_Name.Text; lawFileInfo.IssueTime = dateTimeInput_Time.Value; lawFileInfo.LawFileType = textBoxX_LawFileType.Text; lawFileInfo.IssueOrganization = textBoxX_IssueOrganization.Text; lawFileInfo.IssueVersion = textBoxX_IssueVersion.Text; lawFileInfo.Description = textBoxX_Description.Text; repo.Update(lawFileInfo); } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }