Ejemplo n.º 1
0
        public IHttpActionResult Update(int id, DTO.ForwarderInvoiceMng.ForwarderInvoice 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.ForwarderInvoiceMng.ForwarderInvoice>(dtoItem, out notification))
            {
                return(Ok(new Library.DTO.ReturnData <DTO.ForwarderInvoiceMng.ForwarderInvoice>()
                {
                    Data = dtoItem, Message = notification
                }));
            }

            // continue processing
            BLL.ForwarderInvoiceMng bll = new BLL.ForwarderInvoiceMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            bll.UpdateData(id, ref dtoItem, ControllerContext.GetAuthUserId(), out notification);
            return(Ok(new Library.DTO.ReturnData <DTO.ForwarderInvoiceMng.ForwarderInvoice>()
            {
                Data = dtoItem, Message = notification
            }));
        }
Ejemplo n.º 2
0
 public IHttpActionResult GetInitData()
 {
     BLL.ForwarderInvoiceMng              bll = new BLL.ForwarderInvoiceMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
     Library.DTO.Notification             notification;
     DTO.ForwarderInvoiceMng.InitFormData data = bll.GetInitData(ControllerContext.GetAuthUserId(), out notification);
     return(Ok(new Library.DTO.ReturnData <DTO.ForwarderInvoiceMng.InitFormData>()
     {
         Data = data, Message = notification, TotalRows = 0
     }));
 }
Ejemplo n.º 3
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.ForwarderInvoiceMng              bll = new BLL.ForwarderInvoiceMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            Library.DTO.Notification             notification;
            DTO.ForwarderInvoiceMng.EditFormData data = bll.GetData(id, ControllerContext.GetAuthUserId(), out notification);
            return(Ok(new Library.DTO.ReturnData <DTO.ForwarderInvoiceMng.EditFormData>()
            {
                Data = data, Message = notification
            }));
        }
Ejemplo n.º 4
0
        public IHttpActionResult Gets(DTO.Search searchInput)
        {
            // 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.ForwarderInvoiceMng  bll = new BLL.ForwarderInvoiceMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            Library.DTO.Notification notification;
            int totalRows = 0;

            DTO.ForwarderInvoiceMng.SearchFormData data = bll.GetDataWithFilter(ControllerContext.GetAuthUserId(), searchInput.Filters, searchInput.PageSize, searchInput.PageIndex, searchInput.SortedBy, searchInput.SortedDirection, out totalRows, out notification);

            return(Ok(new Library.DTO.ReturnData <DTO.ForwarderInvoiceMng.SearchFormData>()
            {
                Data = data, Message = notification, TotalRows = totalRows
            }));
        }