public void InsertIntoSign(MSign objsign) { StringBuilder sb = new StringBuilder(); sb.Append("INSERT INTO tb_sign (datetime, employeeName, late, quit) values (@Datetime,@EmployeeName,@Late,@Quit)"); SqlParameter[] param = { SQLDbHelper.GetParameter("@Datetime",SqlDbType.DateTime,"datetime",objsign.Datetime), SQLDbHelper.GetParameter("@EmployeeName",SqlDbType.VarChar,20,"employeeName",objsign.EmployeeName), SQLDbHelper.GetParameter("@Late",SqlDbType.Bit,"late",objsign.Late), SQLDbHelper.GetParameter("@Quit",SqlDbType.Bit,"quit",objsign.Quit) }; SQLDbHelper.ExecuteSql(sb.ToString(), param); }
protected void Button2_Click(object sender, EventArgs e) { sign signs = new sign(); MSign objsign = new MSign(); //下班进行考勤设置 if (DateTime.Compare(Convert.ToDateTime(DateTime.Now.ToString("hh:mm:ss")), Convert.ToDateTime(down)) >= 0) { objsign.Datetime = DateTime.Now; objsign.EmployeeName = Session["loginName"].ToString(); objsign.Late = false; objsign.Quit = false; signs.InsertIntoSign(objsign); } else { objsign.Datetime = DateTime.Now; objsign.EmployeeName = Session["loginName"].ToString(); objsign.Late = false; objsign.Quit = true; signs.InsertIntoSign(objsign); } this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('签退成功!');</script>"); }
public void InsertIntoSign(MSign objsign) { signs.InsertIntoSign(objsign); }