Пример #1
0
 public IHttpActionResult GetAttendance(Attendance_Query query)
 {
     try
     {
         string    export = String.Empty;
         DataTable dt     = oAC.ExecuteStoredProcedure(@"Get_Attendance", new string[] { "From", "To", "Status", "CardNumber", "EmployeeID", "Workplace" }, new object[] { query.From, query.To, query.Status, query.CardNumber, query.EmployeeID, query.Workplace }).Tables[0];
         //foreach (DataRow rows in dt.Rows)
         //{
         //    export += rows["Device"] + ";" + rows["CardNo"] + ";" + Convert.ToDateTime(rows["TimeSwipe"]).ToString("yyyyMMddHHmmss") + ";" + rows["Status"] == "OUT" ? "2" : "1";
         //}
         return(Ok(_helper.ConvertJson(dt)));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message + " " + ex.InnerException));
     }
 }
Пример #2
0
 public IHttpActionResult GetAttendanceToExportMitaPro(Attendance_Query query)
 {
     try
     {
         JsonObject json   = new JsonObject();
         string     export = String.Empty;
         DataTable  dt     = oAC.ExecuteStoredProcedure(@"Get_Attendance", new string[] { "From", "To", "Status", "CardNumber", "EmployeeID", "Workplace" }, new object[] { query.From, query.To, query.Status, query.CardNumber, query.EmployeeID, query.Workplace }).Tables[0];
         foreach (DataRow rows in dt.Rows)
         {
             string status = rows["Status"].ToString() == "OUT" ? "2" : "1";
             export += rows["Device"].ToString().PadLeft(3, '0') + rows["CardNo"] + Convert.ToDateTime(rows["TimeSwipe"]).ToString("yyyyMMddHHmm") + Environment.NewLine;
         }
         json["Data"] = export;
         return(Ok(json));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message + " " + ex.InnerException));
     }
 }