public T_PlaningDTO FindByPK(object data) { List <SqlParameter> parameterList = new List <SqlParameter>(); var obj = new T_PlaningDTO(); dataTable = null; string procName = "sp_T_Planing_FindByPK"; try { dataTable = new DataTable(); adapter = new SqlDataAdapter(); SqlConnection conn = OpenConnection(); if (data != null) { parameterList.AddRange(GetParameters(procName, data).ToArray()); } command = new SqlCommand(procName, conn); command.CommandType = CommandType.StoredProcedure; if (data != null) { command.Parameters.AddRange(parameterList.ToArray()); } using (SqlDataReader reader = command.ExecuteReader()) { obj = ConvertX.GetListFromDataReader <T_PlaningDTO>(reader).ToList()[0]; obj.SpecSDate = ConvertX.DDMMYY(obj.SpecSDate); obj.SpecEDate = ConvertX.DDMMYY(obj.SpecEDate); obj.POSDate = ConvertX.DDMMYY(obj.POSDate); obj.POEDate = ConvertX.DDMMYY(obj.POEDate); obj.ActionSDate = ConvertX.DDMMYY(obj.ActionSDate); obj.ActionEDate = ConvertX.DDMMYY(obj.ActionEDate); reader.NextResult(); obj.UploadFileList = ConvertX.GetListFromDataReader <T_Planing_File>(reader).ToList(); } } catch (Exception ex) { } finally { CloseConnection(); } return(obj); }
public HttpResponseMessage Search() { var deserializer = new JavaScriptSerializer(); bal = new T_PlaningBAL(); ResposeType response = new ResposeType(); HttpResponseMessage mapMessage = null; T_PlaningDTO dto = null; List <T_PlaningDTO> objList = null; try { var context = HttpContext.Current; dto = ConvertX.GetReqeustForm <T_PlaningDTO>(); logger.debug("Search dto :" + dto.ToString()); objList = bal.FindByObjList(dto); if (!ObjUtil.isEmpty(objList)) { foreach (T_PlaningDTO obj in objList) { obj.SpecSDate = ConvertX.DDMMYY(obj.SpecSDate); obj.SpecEDate = ConvertX.DDMMYY(obj.SpecEDate); obj.POSDate = ConvertX.DDMMYY(obj.POSDate); obj.POEDate = ConvertX.DDMMYY(obj.POEDate); obj.ActionSDate = ConvertX.DDMMYY(obj.ActionSDate); obj.ActionEDate = ConvertX.DDMMYY(obj.ActionEDate); } } response.statusCode = true; response.data = objList; } catch (Exception ex) { logger.error("Search error:" + ex.ToString()); response.statusText = ex.ToString(); } mapMessage = Request.CreateResponse(HttpStatusCode.OK, response); return(mapMessage); }