/// <summary> /// Añadir /// </summary> /// <param name="attlog"></param> /// <returns></returns> public int Add(AttLogModel attlog) { string sql = string.Format(@" insert into AttLog( PIN,AttTime,Status,Verify,WorkCode,Reserved1,Reserved2,MaskFlag,Temperature,DeviceID ) values ( @PIN,@AttTime,@Status,@Verify,@WorkCode,@Reserved1,@Reserved2,@MaskFlag,@Temperature,@DeviceID );"); SQLiteParameter[] parameters = { new SQLiteParameter("@PIN", attlog.PIN), new SQLiteParameter("@AttTime", attlog.AttTime), new SQLiteParameter("@Status", attlog.Status), new SQLiteParameter("@Verify", attlog.Verify), new SQLiteParameter("@WorkCode", attlog.WorkCode), new SQLiteParameter("@Reserved1", attlog.Reserved1), new SQLiteParameter("@Reserved2", attlog.Reserved2), new SQLiteParameter("@MaskFlag", attlog.MaskFlag), new SQLiteParameter("@Temperature", attlog.Temperature), new SQLiteParameter("@DeviceID", attlog.DeviceID) }; return(SqliteHelper.ExecuteNonQuery(sql, parameters)); }
/// <summary> /// Añadir /// </summary> /// <param name="attlog"></param> /// <returns></returns> public int Add(AttLogModel attlog) { if (_dal.IsExist(attlog.PIN, attlog.AttTime)) { return(0); } return(_dal.Add(attlog)); }
/// <summary> /// 新增数据 /// </summary> /// <param name="attLogModel">考勤记录数据</param> public void AddNewRow(AttLogModel attLogModel) { if (attLogModel.AttTime >= this.dtpStartTime.Value && attLogModel.AttTime <= this.dtpEndTime.Value) { DataRow dr = _dt.NewRow(); dr["PIN"] = attLogModel.PIN; dr["AttTime"] = attLogModel.AttTime; dr["Status"] = attLogModel.Status; dr["Verify"] = attLogModel.Verify; dr["WorkCode"] = attLogModel.WorkCode; dr["DeviceID"] = attLogModel.DeviceID; dr["MaskFlag"] = attLogModel.MaskFlag; dr["Temperature"] = attLogModel.Temperature; dr["WorkName"] = string.IsNullOrEmpty(attLogModel.WorkCode)?"":_workCodeBll.GetByWorkCode(attLogModel.WorkCode).WorkName; _dt.Rows.InsertAt(dr, 0); } }
//AttLog copy to Database private void listenClient_OnNewAttLog(AttLogModel attlog) { if (AttLogBll.Add(attlog) > 0) { if (_currentPageId == (int)PageIdEnum.Attendance && m_lastfrm != null) { ((UCAttendance)m_lastfrm).AddNewRow(attlog); } else { if (_currentPageId == (int)PageIdEnum.Device && m_lastfrm != null) { UCDevice uCDevice = (UCDevice)m_lastfrm; uCDevice.UpdateDeviceMask(attlog.DeviceID, attlog.MaskFlag); uCDevice.UpdateDeviceTemp(attlog.DeviceID, attlog.Temperature); } } } }