private void SaveAttendanceLog(Bundle bundle, AttendanceLog attendance) { var result = bundle.Database.QueryScalar( "select count(*) from attendance_logs where id=@id", new Dictionary <string, object> { { "@id", attendance.Id } }); var count = Convert.ToInt32(result); if (count == 0) { bundle.Database.Execute( @"INSERT INTO attendance_logs(id,machine_id,enroll_number,project_id,log_date,mode,state,work_code, sync,device_name,device_type,log_status) VALUES(@id,@machine_id,@enroll_number,@project_id, @log_date,@mode,@state,@work_code,-1,@device_name,@device_type,@log_status);", new Dictionary <string, object> { { "@id", attendance.Id }, { "@machine_id", attendance.MachineId }, { "@enroll_number", attendance.UserId }, { "@project_id", attendance.ProjectId }, { "@log_date", attendance.LogDate }, { "@mode", attendance.Mode }, { "@state", attendance.State }, { "@work_code", attendance.WorkCode }, { "@device_name", attendance.DeviceName }, { "@device_type", (int)attendance.DeviceType }, { "@log_status", (int)attendance.LogStatus } }); } }
//If your fingerprint(or your card) passes the verification,this event will be triggered private void axCZKEM1_OnAttTransactionEx(string sEnrollNumber, int iIsInValid, int iAttState, int iVerifyMethod, int iYear, int iMonth, int iDay, int iHour, int iMinute, int iSecond, int iWorkCode) { //if valid, insert to database and display the picture to screen if (iIsInValid == 0) { //insert to database var attendaceLog = new AttendanceLog { EmployeeId = Convert.ToInt32(sEnrollNumber), ClockInOut = DateTime.Now, Type = (AttendanceType)Convert.ToInt16(iAttState) }; _attendanceLogRepository.Add(attendaceLog); Program._unitOfWork.Commit(); //display the picture to screen var url = Program.GetSettingValue("DISPLAY_LOGIN_URL", "http://payroll.logindisplay/api/payrollapi/"); var client = WebRequest.Create(String.Format("{0}/{1}/{2}/{3}", url, sEnrollNumber, iAttState, DateTime.Now.Serialize())); client.GetResponse(); } lbRTShow.Items.Add("RTEvent OnAttTrasactionEx Has been Triggered,Verified OK"); lbRTShow.Items.Add("...UserID:" + sEnrollNumber); lbRTShow.Items.Add("...isInvalid:" + iIsInValid.ToString()); lbRTShow.Items.Add("...attState:" + iAttState.ToString()); lbRTShow.Items.Add("...VerifyMethod:" + iVerifyMethod.ToString()); lbRTShow.Items.Add("...Workcode:" + iWorkCode.ToString());//the difference between the event OnAttTransaction and OnAttTransactionEx lbRTShow.Items.Add("...Time:" + iYear.ToString() + "-" + iMonth.ToString() + "-" + iDay.ToString() + " " + iHour.ToString() + ":" + iMinute.ToString() + ":" + iSecond.ToString()); }
public void LogAttendanceFuntion(List <IdentifiedPerson> listIdentifiedPerson, DateTime date, string imageLink) { try { List <AttendanceLog> listTimeAttendanceLog = new List <AttendanceLog>(); var logDateTo = date; TimeSpan timeSpan; foreach (var item in listIdentifiedPerson) { timeSpan = (date - TimeAttendanceStatic.StartTime.Value); modelAttendanceLog = new AttendanceLog() { AttendanceLogId = Guid.NewGuid().ToString(), EmployeeId = item.InfoEmployee != null ? item.InfoEmployee.EmployeeId : "Unknown", Date = logDateTo, ImageLink = imageLink, ClientIPAddress = modelTransactionLog.ClientIPAddress, CameraIPAdress = modelTransactionLog.CameraIPAdress, Confidence = item.Confidence, FaceCount = listIdentifiedPerson.Count(), ImageFace = item.ImageFace, Note = item.Note }; listTimeAttendanceLog.Add(modelAttendanceLog); } if (listTimeAttendanceLog.Count > 0) { db.AttendanceLog.AddRange(listTimeAttendanceLog); } db.SaveChanges(); } catch (Exception) { } }
private void EnsureCheckInOrCheckOut(AttendanceLog log, string workerId) { var attendance = _db.GetLastAttendanceLogByEnrollNumber(log.UserId); AttendanceStatus status = AttendanceStatus.Unknown; try { status = log.CalculateStatus(attendance); } catch (NotSupportedException ex) { _logger.ErrorFormat("EnsureCheckInOrCheckOut error:{exception}, attendance:{@log}, worker:{id}", ex.Message, attendance, workerId); return; } if (status == AttendanceStatus.CheckIn) { EnsureCheckIn(log, workerId); return; } if (status == AttendanceStatus.CheckOut) { EnsureCheckOut(log, workerId); return; } _logger.ErrorFormat("EnsureCheckInOrCheckOut: Unknown status, attendance:{@log}, worker:{id}", attendance, workerId); }
public void TestUploadAttendanceHandlerFailedToMessage() { var bundle = new Bundle(new SqliteConnector(), _mock.Object); var hub = new EventHub(bundle.Database); hub.Subscribe(EventType.AttTransactionEx, new UploadAttendanceHandler(bundle)); var attendance = new AttendanceLog("3", 1, 1, 2018, 1, 14, 12, 11, 30, 1, 1, "gate01", DeviceType.OnlyIn); hub.PublishAsync(new EventMessage(EventType.AttTransactionEx, attendance)).GetAwaiter().GetResult(); Thread.Sleep(15000); var result = bundle.Database.QueryScalar( "select count(*) from failed_queue;", null); var count = (long)result; Assert.IsTrue(count > 0); Thread.Sleep(1000); result = bundle.Database.QueryScalar( "select count(*) from attendance_logs where id=@id", new Dictionary <string, object> { { "@id", attendance.Id } }); count = (long)result; Assert.IsTrue(count == 0); }
public void TestGetLastAttendanceLog() { var attendance1 = new AttendanceLog("12", 15, 15, 2018, 1, 13, 14, 11, 30, 1, 1, "gate01", DeviceType.InOut); var bundle = new Bundle(new SqliteConnector(), mock.Object); SaveAttendanceLog(bundle, attendance1); var attendance2 = GetLastAttendanceLog(bundle, "12", attendance1.LogDate); Assert.IsNull(attendance2); var attendance3 = new AttendanceLog("3", 15, 15, 2018, 1, 12, 14, 11, 30, 1, 1, "gate01", DeviceType.InOut); SaveAttendanceLog(bundle, attendance3); var attendance4 = new AttendanceLog("3", 15, 15, 2018, 1, 16, 14, 11, 30, 1, 1, "gate01", DeviceType.InOut); SaveAttendanceLog(bundle, attendance4); var attendance5 = new AttendanceLog("3", 15, 15, 2018, 1, 15, 14, 11, 30, 1, 1, "gate01", DeviceType.InOut); SaveAttendanceLog(bundle, attendance5); var attendance6 = new AttendanceLog("3", 15, 15, 2018, 1, 13, 14, 11, 30, 1, 1, "gate01", DeviceType.InOut); SaveAttendanceLog(bundle, attendance6); var attendance = GetLastAttendanceLog(bundle, "3", attendance5.LogDate); Assert.IsNotNull(attendance); Assert.AreEqual(attendance.LogDate, attendance6.LogDate); }
private void CheckInOrCheckOut(AttendanceLog attendance, string workerId) { var lastAttendance = GetLastAttendanceLog(attendance.UserId, attendance.LogDate); Logger.DebugFormat("Last attendance({@attendance}).", lastAttendance); AttendanceStatus status = AttendanceStatus.Unknown; try { status = attendance.CalculateStatus(lastAttendance); Logger.DebugFormat("Attendance({id}) status: {status}.", attendance.Id, status); } catch (NotSupportedException ex) { Logger.ErrorFormat("CheckInOrCheckOut error:{exception}, attendance:{@log}, worker:{id}", ex.Message, attendance, workerId); return; } if (status == AttendanceStatus.CheckIn) { CheckIn(attendance, workerId); return; } if (status == AttendanceStatus.CheckOut) { CheckOut(attendance, workerId); return; } Logger.ErrorFormat("CheckInOrCheckOut: Unknown status, attendance:{@log}, worker:{id}", attendance, workerId); }
internal static List <AttendanceLog> GetAttendanceClockPendingSync(int batchSize, int startPoint, bool limit = true) { DataTable result = new DataTable(); string query = string.Format("SELECT * FROM eid_attendance_log Where SyncStatus=0 Limit {0}, {1}", startPoint, batchSize); MySqlDataAdapter Adapter = new MySqlDataAdapter(query, myConn); Adapter.Fill(result); List <AttendanceLog> attendanceLogs = new List <AttendanceLog>(); foreach (DataRow row in result.Rows) { AttendanceLog obj = new AttendanceLog { Id = (Int32)row["Id"], BaseDataId = Convert.ToString(row["BaseDataId"]), ClockDate = Convert.ToString(row["ClockDate"]), ClockStatus = Convert.ToInt32(row["ClockStatus"]), ClockTime = Convert.ToString(row["ClockTime"]), LastUpdated = Convert.ToString(row["LastUpdated"]), MatchingScore = Convert.ToInt32(row["MatchingScore"]), TempleteId = Convert.ToInt32(row["TempleteId"]), TerminalId = Convert.ToString(row["TerminalId"]), TransactionCode = Convert.ToString(row["TransactionCode"]), TransactionDateTime = Convert.ToString(row["TransactionDateTime"]), UserPrimaryCode = Convert.ToString(row["UserPrimaryCode"]) }; attendanceLogs.Add(obj); } return(attendanceLogs); }
private AttendanceLog GetLastAttendanceLog(string enrollNumber, DateTime logDate) { var reader = Bundle.Database.QuerySet( @"SELECT id, enroll_number, state, mode, log_date, work_code, machine_id, project_id, ifnull(device_name,''), ifnull(device_type,0), log_status FROM attendance_logs WHERE enroll_number=@enroll_number AND log_date<@cur_date ORDER BY log_date DESC LIMIT 1;", new Dictionary <string, object> { { "@enroll_number", enrollNumber }, { "@cur_date", logDate } }); AttendanceLog log = null; while (reader.Read()) { log = new AttendanceLog( reader.GetString(0), reader.GetString(1), reader.GetInt32(2), reader.GetInt32(3), reader.GetDateTime(4), reader.GetInt32(5), reader.GetInt32(6), reader.GetString(7), reader.GetString(8), (DeviceType)reader.GetInt32(9), (AttendanceStatus)reader.GetInt32(10)); break; } return(log); }
public void TestUploadAttendanceHandlerOk() { var bundle = new Bundle(new SqliteConnector(), _mock.Object); var hub = new EventHub(bundle.Database); hub.Subscribe(EventType.AttTransactionEx, new UploadAttendanceHandler(bundle)); var attendance = new AttendanceLog("2", 1, 1, 2018, 1, 13, 12, 11, 30, 1, 1, "gate01", DeviceType.OnlyIn); hub.PublishAsync(new EventMessage(EventType.AttTransactionEx, attendance)).GetAwaiter().GetResult(); Thread.Sleep(20000); var results = bundle.Database.QueryScalar( "select count(*) from queue where refer_id=@refer_id", new Dictionary <string, object> { { "@refer_id", attendance.Id } }); var count = (long)results; Assert.IsTrue(count == 0); results = bundle.Database.QueryScalar( "select sync from attendance_logs where id=@id", new Dictionary <string, object> { { "@id", attendance.Id } }); var sync = Convert.ToInt32(results); Assert.IsTrue(sync == 1); }
private List <AttendanceLog> GetLogs() { List <AttendanceLog> logs = new List <AttendanceLog>(); List <Staff> items = departmentTreeview1.SelectedStaff; foreach (Staff staff in items) { DateTime dt1 = dtStart.Value; DateTime dt2 = dtEnd.Value; while (dt1 <= dt2) { for (int i = 1; i <= 6; i++) { if ((this.Controls["chkTime" + i.ToString()] as CheckBox).Checked) { int hour = (int)((this.Controls["txtHour" + i.ToString()] as NumericUpDown).Value); int minute = (int)((this.Controls["txtMinute" + i.ToString()] as NumericUpDown).Value); AttendanceLog log = new AttendanceLog() { StaffID = staff.ID, ReadDateTime = dt1.AddHours(hour).AddMinutes(minute), StaffName = staff.Name, ReaderID = string.Empty, IsManual = true, Memo = txtMemo.Text }; logs.Add(log); } } dt1 = dt1.AddDays(1); } } return(logs); }
public ActionResult DeleteConfirmed(int id) { AttendanceLog attendanceLog = db.AttendanceLogs.Find(id); db.AttendanceLogs.Remove(attendanceLog); db.SaveChanges(); return(RedirectToAction("Index")); }
public void TestCheckInAndOut() { var prev = new AttendanceLog("6365298588900000001", "1", 15, 15, new DateTime(2018, 1, 31, 8, 58, 9), 1, 1, "592e2531b2ddc226f0df2b24", "gate02", DeviceType.InOut, AttendanceStatus.CheckIn); var next = new AttendanceLog("1", 15, 15, 2018, 1, 31, 18, 15, 16, 1, 1, "gate02", DeviceType.InOut); var status = next.CalculateStatus(prev); Assert.AreEqual(AttendanceStatus.CheckOut, status); }
private bool EnsureUniqueAttendanceLog(AttendanceLog log) { if (_db.HasSameAttandanceLog(log.Id)) { // If this attendance log has been recorded, // we didn't handle it again. return(false); } return(true); }
private void EnsureCheckOut(AttendanceLog attendanceLog, string workerId) { var ok = _web.CheckOut(attendanceLog.ProjectId, workerId, attendanceLog.LogDate) .GetAwaiter().GetResult(); if (ok) { _db.UploadAttendanceLogSuccess(attendanceLog.Id); } }
public void TestCheckInOut05() { var lastLog = new AttendanceLog("1", 15, 15, 2017, 12, 27, 18, 0, 0, 0, 1, "gate-01", DeviceType.InOut); lastLog.CheckOut(); var currLog = new AttendanceLog("1", 15, 15, 2017, 12, 28, 7, 0, 0, 0, 1, "gate-01", DeviceType.InOut); var status = currLog.CalculateStatus(lastLog); Assert.AreEqual(AttendanceStatus.CheckIn, status); }
public void Handle(EventMessage msg) { AttendanceLog attendance = null; try { attendance = msg.ConvertFromJSON <AttendanceLog>(); } catch (Exception ex) { Logger.ErrorFormat("DeserializeObject error: {@ex}, EventMessage[{@msg}] is not supported.", ex, msg); return; } if (IsPendingAttendance(attendance.Id)) { Logger.DebugFormat("The attendance({id}) is handled.", attendance.Id); return; } string workerId = null; try { workerId = Bundle.GetCurrentWorkerId(attendance.UserId, attendance.ProjectId); } catch (Exception ex) { throw new FailedHandleException(ex, FailedEventType.NotFoundWorker, HandlerKey, msg); } if (workerId == string.Empty) { throw new FailedHandleException(string.Format("Not found the worker id({0})", attendance.UserId), FailedEventType.NotFoundWorker, HandlerKey, msg); } switch (attendance.DeviceType) { case DeviceType.OnlyIn: CheckIn(attendance, workerId); break; case DeviceType.OnlyOut: CheckOut(attendance, workerId); break; case DeviceType.InOut: CheckInOrCheckOut(attendance, workerId); break; default: Logger.ErrorFormat("Not support device type:{@attendance}", attendance); break; } }
private void CheckOut(AttendanceLog attendance, string workerId) { Logger.DebugFormat("Attendance({id}) CheckOut executes.", attendance.Id); attendance.CheckOut(); Logger.Debug("SaveAttendanceLog executes."); SaveAttendanceLog(attendance); Logger.Debug("Bundle.CheckOutToCTMS executes."); Bundle.CheckOutToCTMS(attendance, workerId); }
public ActionResult Edit([Bind(Include = "Id,Date,TimeIN,TimeOut,TimeFunction,FunctionID,EmployeeID,MachineTableID,Comment")] AttendanceLog attendanceLog) { if (ModelState.IsValid) { db.Entry(attendanceLog).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MachineTableID = new SelectList(db.AttMachineTableRefrences, "Id", "Id", attendanceLog.MachineTableID); ViewBag.EmployeeID = new SelectList(db.Employees, "EmployeeId", "ReferenceNumber", attendanceLog.EmployeeID); return(View(attendanceLog)); }
private void EnsureCheckIn(AttendanceLog attendanceLog, string workerId) { attendanceLog.CheckIn(); _db.AddAttendanceLog(attendanceLog); var ok = _web.CheckIn(attendanceLog.ProjectId, workerId, attendanceLog.LogDate, attendanceLog.DeviceName).GetAwaiter().GetResult(); if (ok) { _db.UploadAttendanceLogSuccess(attendanceLog.Id); } }
public async void CheckOutToCTMS(AttendanceLog attendance, string workerId) { var ok = await WebApi.CheckOut(attendance.ProjectId, workerId, attendance.LogDate); if (ok) { UploadAttendanceLogSuccess(attendance.Id); } else { UploadAttendanceLogFailed(attendance.Id); } }
public ActionResult SaveTimeIn(EmployeesAttendancesViewModel viewModel, string EmpId) { var newAttendanceRecord = new AttendanceLog() { TimeIn = TimeSpan.Parse(viewModel.TimeInInput), EmployeeId = int.Parse(EmpId), Date = viewModel.Date }; _context.AttendanceLogs.Add(newAttendanceRecord); _context.SaveChanges(); return(RedirectToAction("Index", "AttendanceRec")); }
// GET: AttendanceLogs/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AttendanceLog attendanceLog = db.AttendanceLogs.Find(id); if (attendanceLog == null) { return(HttpNotFound()); } return(View(attendanceLog)); }
public static bool ValidateNewAttendanceLog(AttendanceLog log, attWebApiContext context) { if ( log.Id != 0 && context.AttendanceLog.Any(x => x.Id == log.Id) || !context.Users.Any(x => x.Id == log.StudentId) || !context.Courses.Any(x => x.Id == log.CourseId) || !context.AcademicTerms.Any(x => x.Id == log.AcademicTermId) || !context.AttendanceTypes.Any(x => x.Id == log.AttendanceTypeId) ) { return(false); } return(true); }
/// <summary> /// If your fingerprint(or your card) passes the verification,this event will be triggered /// </summary> /// <param name="enrollNumber">UserID of a user</param> /// <param name="isInValid">Whether a record is valid. 1: Not valid. 0: Valid.</param> /// <param name="attState"></param> /// <param name="verifyMethod"></param> /// <param name="year"></param> /// <param name="month"></param> /// <param name="day"></param> /// <param name="hour"></param> /// <param name="minute"></param> /// <param name="second"></param> /// <param name="workCode"> /// work code returned during verification. /// Return 0 when the device does not support work code. /// </param> private void OnAttTransactionEx(string enrollNumber, int isInValid, int attState, int verifyMethod, int year, int month, int day, int hour, int minute, int second, int workCode) { _watch.Restart(); var log = new AttendanceLog(enrollNumber, attState, verifyMethod, year, month, day, hour, minute, second, workCode, _device.MachineNumber, _device.DeviceName, _device.DeviceType); _queue.Enqueue(log); _watch.Stop(); Logger.InfoFormat("Time:{time}, OnAttTransactionEx:[{@AttendanceLog}], IsInValid[{IsInValid}].", _watch.ElapsedMilliseconds, log, isInValid); }
public void TestCheckOutToCTMSSuccess() { var attendance = new AttendanceLog("2", 1, 1, 2018, 1, 13, 10, 11, 30, 1, 1, "gate01", DeviceType.OnlyOut); var bundle = new Bundle(new SqliteConnector(), mock.Object); SaveAttendanceLog(bundle, attendance); bundle.CheckOutToCTMS(attendance, "2222222"); var sync = bundle.Database.QueryScalar("select sync from attendance_logs where id=@id;", new Dictionary <string, object> { { "@id", attendance.Id } }); Assert.AreEqual(1, sync); }
/// <summary> /// If your fingerprint(or your card) passes the verification,this event will be triggered /// </summary> /// <param name="enrollNumber">UserID of a user</param> /// <param name="isInValid">Whether a record is valid. 1: Not valid. 0: Valid.</param> /// <param name="attState"></param> /// <param name="verifyMethod"></param> /// <param name="year"></param> /// <param name="month"></param> /// <param name="day"></param> /// <param name="hour"></param> /// <param name="minute"></param> /// <param name="second"></param> /// <param name="workCode"> /// work code returned during verification. /// Return 0 when the device does not support work code. /// </param> private async void OnAttTransactionEx(string enrollNumber, int isInValid, int attState, int verifyMethod, int year, int month, int day, int hour, int minute, int second, int workCode) { var watch = new Stopwatch(); var log = new AttendanceLog(enrollNumber, attState, verifyMethod, year, month, day, hour, minute, second, workCode, MachineNumber, DeviceName, DeviceType); await Hub.PublishAsync(new EventMessage(EventType.AttTransactionEx, log)); watch.Stop(); Logger.InfoFormat("Time:{time}, OnAttTransactionEx:[{@AttendanceLog}], IsInValid[{IsInValid}].", watch.ElapsedMilliseconds, log, isInValid); }
// GET: AttendanceLogs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AttendanceLog attendanceLog = db.AttendanceLogs.Find(id); if (attendanceLog == null) { return(HttpNotFound()); } ViewBag.MachineTableID = new SelectList(db.AttMachineTableRefrences, "Id", "Id", attendanceLog.MachineTableID); ViewBag.EmployeeID = new SelectList(db.Employees, "EmployeeId", "ReferenceNumber", attendanceLog.EmployeeID); return(View(attendanceLog)); }
public AttendanceLog GetLastAttendanceLogByEnrollNumber(string enrollNumber) { if (_connection.State == System.Data.ConnectionState.Closed) { _connection.Open(); } AttendanceLog log = null; var command = new SQLiteCommand(_connection); command.CommandText = @"SELECT id, enroll_number, state, mode, log_date, work_code, machine_id, project_id, ifnull(device_name,''), ifnull(device_type,0), log_status FROM attendance_logs WHERE enroll_number=@enroll_number ORDER BY log_date DESC LIMIT 1;"; command.Parameters.Add(new SQLiteParameter("@enroll_number", enrollNumber)); SQLiteDataReader reader = null; try { reader = command.ExecuteReader(); while (reader.Read()) { log = new AttendanceLog( reader.GetInt64(0), reader.GetString(1), reader.GetInt32(2), reader.GetInt32(3), reader.GetDateTime(4), reader.GetInt32(5), reader.GetInt32(6), reader.GetString(7), reader.GetString(8), (DeviceType)reader.GetInt32(9), (AttendanceStatus)reader.GetInt32(10) ); break; } return(log); } finally { if (reader != null) { reader.Close(); } } }
public Result <int> Insert(List <CourseStudent> gelenStudentList, List <CourseStudent> gelmeyenStudentList, User user) { Teacher tchr = db.Teachers.FirstOrDefault(t => t.UserId == user.UserId); foreach (var item in gelenStudentList) { //(int)DateTime.Now.DayOfWeek AttendanceLog al = new AttendanceLog(); al.TeacherId = tchr.TeacherId; al.CourseStudentId = item.Id; al.Date = DateTime.Now; al.IsOnline = 1; al.IsFingerprint = 0; al.IsSchoolCard = 0; db.AttendanceLogs.Add(al); } foreach (var item in gelmeyenStudentList) { AttendanceLog al = new AttendanceLog(); al.TeacherId = tchr.TeacherId; al.CourseStudentId = item.Id; al.Date = DateTime.Now; al.IsOnline = 0; al.IsFingerprint = 0; al.IsSchoolCard = 0; db.AttendanceLogs.Add(al); CourseStudent cs = db.CourseStudents.FirstOrDefault(t => t.Id == al.CourseStudentId); cs.AttendanceSum = cs.AttendanceSum + 1; Course getCourse = db.Courses.FirstOrDefault(t => t.Id == cs.CourseId); if (cs.AttendanceSum < (getCourse.LecturePerWeek * 14 * 30 / 100) - 2) { cs.AttendanceSituation = 1; } else if ((getCourse.LecturePerWeek * 14 * 30 / 100) - 2 <= cs.AttendanceSum && cs.AttendanceSum <= (getCourse.LecturePerWeek * 14 * 30 / 100)) { cs.AttendanceSituation = 2; } else if ((getCourse.LecturePerWeek * 14 * 30 / 100) < cs.AttendanceSum) { cs.AttendanceSituation = 3; } db.CourseStudents.Update(cs); } return(result.GetResult(db)); }