public bool modifyTime(Model.Time time, out string msg) { if (t.Update_time(time)) { msg = "提交成功"; return(true); } else { msg = "提交失败"; return(false); } }
private void button1_Click(object sender, EventArgs e) { Model.Time time = new Model.Time(); time.D1 = d1.Value; time.D2 = d2.Value; time.D3 = d3.Value; time.D4 = d4.Value; BLL.Time b_time = new BLL.Time(); string msg = ""; if (b_time.modifyTime(time, out msg)) { //MessageBox.Show(msg); } MessageBox.Show(msg); }
public bool Update_time(Model.Time time) { string sql = "update commit_time set start_write = @c1,stop_write = @c2 , start_admission = @c3 , stop_admission = @c4 where id = 1"; SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@c1", time.D1), new SqlParameter("@c2", time.D2), new SqlParameter("@c3", time.D3), new SqlParameter("@c4", time.D4) }; int i = SqlDbHelper.ExecuteNonQuery(sql.ToString(), CommandType.Text, paras); if (i == 1) { return(true); } else { return(false); } }