public static Request MapRequestDTOToRequest(this RequestDTO requestDTO) { var request = new Request(); request.EGN = requestDTO.EGN; request.RequestIp = requestDTO.RequestIp; return(request); }
//------------------------------------------------------------------------------------------------------------------------------------------ public List <DTO.RequestDTO> SelectAllAuthorByDataReader() { List <DTO.RequestDTO> list = new List <DTO.RequestDTO>(); string strCmd = "select_all_request"; SqlDataReader rd = _DataProvicer.ExecuteQueryWithDataReader(strCmd, CommandType.StoredProcedure); if (rd.HasRows) { while (rd.Read()) { DTO.RequestDTO dto = new DTO.RequestDTO { ReqID = rd.GetString(0), UserID = rd.GetString(1), BookTitleID = rd.GetString(2), ReqDate = rd.GetDateTime(3), ReqStatus = rd.GetInt32(4) }; list.Add(dto); } } return(list); }
//------------------------------------------------------------------------------------------------------------------------------------------ public DTO.RequestDTO SearchRequestByRequestID(string id) { string strCmd = "e_select_request_by_req_id"; SqlParameter ID = new SqlParameter("@ReqID", id); SqlDataReader rd = _DataProvicer.ExecuteQueryWithDataReader(strCmd, CommandType.StoredProcedure, ID); if (rd.HasRows) { if (rd.Read()) { DTO.RequestDTO dto = new DTO.RequestDTO { ReqID = rd.GetString(0), UserID = rd.GetString(1), BookTitleID = rd.GetString(2), ReqDate = rd.GetDateTime(3), ReqStatus = rd.GetInt32(4) }; return(dto); } } return(null); }
public bool UpdateRequest(string id, int status) { DTO.RequestDTO dto = this.SearchRequestByRequestID(id); dto.ReqStatus = status; return(dao.UpdateRequest(dto)); }