示例#1
0
        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);
        }
示例#2
0
        public HttpResponseMessage View()
        {
            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>();
                if (dto.Year == null || "".Equals(dto.Year))
                {
                    dto.Year = DateTime.Now.Year.ToString();
                }
                string UserID = context.Request.Form["UserID"];
                if (ObjUtil.isEmpty(UserID))
                {
                    throw new Exception("UserID is require");
                }
                dto.CreateBy = UserID;
                dto.UpdateBy = UserID;

                logger.debug("View dto :" + dto.ToString());

                objList = bal.FindByObjListV2(dto);

                response.statusCode = true;
                response.data       = objList;
            }
            catch (Exception ex)
            {
                logger.error("View error:" + ex.ToString());
                response.statusText = ex.ToString();
            }

            mapMessage = Request.CreateResponse(HttpStatusCode.OK, response);
            return(mapMessage);
        }