public bool UpdateSignStateByID(MSignState objsignstate) { StringBuilder sb = new StringBuilder(); sb.Append("update tb_signState set [time]=@SignTime where signStateID=@SignID"); OleDbParameter[] param = { OleDbHelper.GetParameter("@SignTime",OleDbType.Date,"[time]",objsignstate.Time), OleDbHelper.GetParameter("@SignID",OleDbType.Integer,4,"ID",objsignstate.ID) }; bool is_succeed = OleDbHelper.ExecuteSql(sb.ToString(), param); if (is_succeed) return true; else return false; }
public bool InsertIntoSignState(MSignState objsignstate) { StringBuilder sb = new StringBuilder(); sb.Append("insert into tb_signState (signstate_describe,[time]) values(@SignState,@Time)"); OleDbParameter[] param = { OleDbHelper.GetParameter("@SignState",OleDbType.VarWChar,50,"signstate_describe",objsignstate.Signstate_describe), OleDbHelper.GetParameter("@SignTime",OleDbType.Date,"[time]",objsignstate.Time) }; bool is_succeed = OleDbHelper.ExecuteSql(sb.ToString(), param); if (is_succeed) return true; else return false; }
protected void btnSave_Click(object sender, EventArgs e) { signState signstate = new signState(); MSignState objsignstate = new MSignState(); bool blS; bool blX; DataTable dt = signstate.SelectAllSignState(); if (dt.Rows.Count > 0) { objsignstate.ID = 1; objsignstate.Time = Convert.ToDateTime(TextBox1.Text.Trim()); blS = signstate.UpdateSignStateByID(objsignstate); objsignstate.ID = 2; objsignstate.Time = Convert.ToDateTime(TextBox2.Text.Trim()); blX = signstate.UpdateSignStateByID(objsignstate); if (blS && blX) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('上下班时间设置成功!');</script>"); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('上下班时间设置失败!');</script>"); } } else { objsignstate.Signstate_describe = "上班"; objsignstate.Time = Convert.ToDateTime(TextBox1.Text.Trim()); blS = signstate.InsertIntoSignState(objsignstate); objsignstate.Signstate_describe = "下班"; objsignstate.Time = Convert.ToDateTime(TextBox2.Text.Trim()); blX = signstate.InsertIntoSignState(objsignstate); if (blS && blX) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('上下班时间设置成功!');</script>"); } else { this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('上下班时间设置失败!');</script>"); } } }
public bool UpdateSignStateByID(MSignState objsignstate) { return signstate.UpdateSignStateByID(objsignstate); }
public bool InsertIntoSignState(MSignState objsignstate) { return signstate.InsertIntoSignState(objsignstate); }