Esempio n. 1
0
        public HttpResponseMessage Add()
        {
            ResposeType         response   = new ResposeType();
            HttpResponseMessage mapMessage = null;

            try
            {
                var context = HttpContext.Current;

                T_PlaningMobileDTO planingDTO = GetRequestToObjectMobile(context);
                T_PlaningCoatingRepairMobileDTO planingCoatingRepairDTO = ConvertX.GetReqeustForm <T_PlaningCoatingRepairMobileDTO>();

                string UserID = context.Request.Form["UserID"];
                if (ObjUtil.isEmpty(UserID))
                {
                    throw new Exception("UserID is require");
                }
                planingDTO.CreateBy = UserID;
                planingDTO.UpdateBy = UserID;
                planingCoatingRepairDTO.CreateBy = UserID;
                planingCoatingRepairDTO.UpdateBy = UserID;

                T_PlaningMobileBAL mobileBal = new T_PlaningMobileBAL();

                logger.debug("PlanController Add planingDTO:" + planingDTO.ToString());
                logger.debug("PlanController Add planingCoatingRepairDTO:" + planingCoatingRepairDTO.ToString());

                string TPID = mobileBal.AddFromMobile(planingDTO, planingCoatingRepairDTO, null, null, null);

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

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