예제 #1
0
 public void DTO2DB_DocumentMonitoring(DTO.DocumentMonitoringMng.DocumentMonitoring dtoItem, ref DocumentMonitoring dbItem)
 {
     AutoMapper.Mapper.Map <DTO.DocumentMonitoringMng.DocumentMonitoring, DocumentMonitoring>(dtoItem, dbItem);
     if (dtoItem.DocumentMonitoringID > 0)
     {
         dbItem.UpdatedDate = DateTime.Now;
         dbItem.UpdatedBy   = dtoItem.UpdatedBy;
     }
     else
     {
         dbItem.CreatedDate = DateTime.Now;
         dbItem.CreatedBy   = dtoItem.UpdatedBy;
     }
     dbItem.VNReceivedDate = dtoItem.VNReceivedDate.ConvertStringToDateTime();
     dbItem.SendToEUDate   = dtoItem.SendToEUDate.ConvertStringToDateTime();
 }
예제 #2
0
        public IHttpActionResult Get(int id)
        {
            // authentication
            Module.Framework.BLL fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanRead))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }

            BLL.DocumentMonitoringMng bll = new BLL.DocumentMonitoringMng();
            Library.DTO.Notification  notification;
            DTO.DocumentMonitoringMng.DocumentMonitoring data = bll.GetData(id, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <DTO.DocumentMonitoringMng.DocumentMonitoring>()
            {
                Data = data, Message = notification
            }));
        }
예제 #3
0
        public IHttpActionResult Update(int id, DTO.DocumentMonitoringMng.DocumentMonitoring dtoItem)
        {
            Library.DTO.Notification notification;

            // authentication
            Module.Framework.BLL fwBll = new Module.Framework.BLL();
            if (id > 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanUpdate))
            {
                // edit case
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }
            else if (id == 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanCreate))
            {
                // create new case
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }

            // validation
            if (!Helper.CommonHelper.ValidateDTO <DTO.DocumentMonitoringMng.DocumentMonitoring>(dtoItem, out notification))
            {
                return(Ok(new Library.DTO.ReturnData <DTO.DocumentMonitoringMng.DocumentMonitoring>()
                {
                    Data = dtoItem, Message = notification
                }));
            }

            // continue processing
            BLL.DocumentMonitoringMng bll = new BLL.DocumentMonitoringMng();
            bll.UpdateData(id, ref dtoItem, ControllerContext.GetAuthUserId(), out notification);


            return(Ok(new Library.DTO.ReturnData <DTO.DocumentMonitoringMng.DocumentMonitoring>()
            {
                Data = dtoItem, Message = notification
            }));
        }
예제 #4
0
 public DTO.DocumentMonitoringMng.DocumentMonitoring DB2DTO_DocumentMonitoring(DocumentMonitoringMng_DocumentMonitoring_View dbItem)
 {
     DTO.DocumentMonitoringMng.DocumentMonitoring dtoItem = AutoMapper.Mapper.Map <DocumentMonitoringMng_DocumentMonitoring_View, DTO.DocumentMonitoringMng.DocumentMonitoring>(dbItem);
     return(dtoItem);
 }