Example #1
0
        public List <LeaveAllocationDTO> GetAllLeaveAllocation(LeaveAllocationGetDTO objLeave)
        {
            List <LeaveAllocationDTO> Leave = new List <LeaveAllocationDTO>();

            using (DbLayer dbLayer = new DbLayer())
            {
                SqlCommand SqlCmd = new SqlCommand("spSelectLeaveAllocation");
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.AddWithValue("@ActionBy", objLeave.ActionBy);
                Leave = dbLayer.GetEntityList <LeaveAllocationDTO>(SqlCmd);
            }
            return(Leave);
        }
Example #2
0
        public LeaveAllocationDTO GetLeaveAllocationById(LeaveAllocationGetDTO objLeave)
        {
            LeaveAllocationDTO accounts = new LeaveAllocationDTO();

            using (DbLayer dbLayer = new DbLayer())
            {
                SqlCommand SqlCmd = new SqlCommand("spSelectLeaveAllocation");
                SqlCmd.CommandType = CommandType.StoredProcedure;
                SqlCmd.Parameters.AddWithValue("@Id", objLeave.Id);
                SqlCmd.Parameters.AddWithValue("@ActionBy", objLeave.ActionBy);
                accounts = dbLayer.GetEntityList <LeaveAllocationDTO>(SqlCmd).FirstOrDefault();
            }
            return(accounts);
        }
        public HttpResponseMessage GetLeaveAllocationById(LeaveAllocationGetDTO objLeave)
        {
            HttpResponseMessage message;

            try
            {
                // LeaveAllocationDataAccessLayer dal = new LeaveAllocationDataAccessLayer();
                var dynObj = new { result = _leave.GetLeaveAllocationById(objLeave) };
                message = Request.CreateResponse(HttpStatusCode.OK, dynObj);
            }
            catch (Exception ex)
            {
                message = Request.CreateResponse(HttpStatusCode.BadRequest, new { msgText = "Somthing wrong, Try Again!" });
                ErrorLog.CreateErrorMessage(ex, "Leave", "LeaveAllocationById");
            }
            return(message);
        }