Example #1
0
        //-----Get Data By Month----//--
        public List <TargetGetEmployeeByAmount> GetAllEmployeeByMonth(TargetGetMonth objTarget)
        {
            List <TargetGetEmployeeByAmount> target = new List <TargetGetEmployeeByAmount>();

            using (DbLayer dbLayer = new DbLayer())
            {
                SqlCommand SqlCmd = new SqlCommand("spSelectEmployeeMonth");
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.AddWithValue("@Month", objTarget.Month);
                SqlCmd.Parameters.AddWithValue("@Year", objTarget.year);
                SqlCmd.Parameters.AddWithValue("@ReportTo", objTarget.ReportTo);
                target = dbLayer.GetEntityList <TargetGetEmployeeByAmount>(SqlCmd);
            }
            return(target);
        }
        public HttpResponseMessage GetAllEmployeeByMonth(TargetGetMonth objTarget)
        {
            HttpResponseMessage message;

            try
            {
                // TargetDataAccessLayer dal = new TargetDataAccessLayer();
                var dynObj = new { result = _target.GetAllEmployeeByMonth(objTarget) };
                message = Request.CreateResponse(HttpStatusCode.OK, dynObj);
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = " Somthing wrong,try Again!" });
                ErrorLog.CreateErrorMessage(ex, "Target", "GetAllEmployeeByMonth");
            }
            return(message);
        }