コード例 #1
0
        public HttpResponseMessage DensityLog(TimeAttendanceLogSearchCondition SearchCondition)
        {
            try
            {
                #region [xu ly thoi gian]

                //string ngayFrom = "";
                //string ngayTo = "";
                //if (SearchCondition.Week==1)
                //{
                //    ngayFrom = "01";
                //    ngayTo = "07";
                //}
                //else if (SearchCondition.Week==2)
                //{
                //    ngayFrom = "08";
                //    ngayTo = "14";
                //}
                //else if (SearchCondition.Week==3)
                //{
                //    ngayFrom = "15";
                //    ngayTo = "21";
                //}
                //else
                //{
                //    ngayFrom = "22";
                //    ngayTo = DateTime.DaysInMonth(SearchCondition.Year.Value, SearchCondition.Month.Value) + "";
                //}
                //string thang = SearchCondition.Month < 10 ? "0" + SearchCondition.Month : SearchCondition.Month.ToString();
                //SearchCondition.DateFrom = DateTime.ParseExact(thang + "/" + ngayFrom + "/" + SearchCondition.Year + " 00:00:01", "MM/dd/yyyy HH:mm:ss", null);
                //SearchCondition.DateTo = DateTime.ParseExact(thang + "/" + ngayTo + "/" + SearchCondition.Year + " 23:59:59", "MM/dd/yyyy HH:mm:ss", null);
                SearchCondition.DateFrom = SearchCondition.DateFrom;
                SearchCondition.DateTo   = SearchCondition.DateFrom.Value.AddDays(6);
                #endregion
                var result = _userBusiness.DensityLog(SearchCondition);

                return(Request.CreateResponse(HttpStatusCode.OK, result));
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message, ex.InnerException);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }