Exemple #1
0
        public IHttpActionResult GetReportDataByContainer(int packingListID, int template)
        {
            Library.DTO.Notification notification;
            Module.Framework.BLL     fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanPrint))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }
            BLL.PackingListMng bll = new BLL.PackingListMng();
            //int? companyID = fwBll.GetCompanyID(ControllerContext.GetAuthUserId());

            string data = "";

            if (template == 1)
            {
                data = bll.GetOrangePineReportDataByContainer(packingListID, out notification);
            }
            else
            {
                data = bll.GetReportDataByContainer(packingListID, out notification);
            }
            return(Ok(new Library.DTO.ReturnData <string>()
            {
                Data = data, Message = notification
            }));
        }
Exemple #2
0
        public IHttpActionResult PrintPackingListPDF(int id, int template)
        {
            Library.DTO.Notification notification;
            Module.Framework.BLL     fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanPrint))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }
            BLL.PackingListMng bll          = new BLL.PackingListMng();
            string             dataFileName = bll.PrintPackingListPDF(id, out notification);

            return(Ok(new Library.DTO.ReturnData <string>()
            {
                Data = dataFileName, Message = notification
            }));
        }
Exemple #3
0
        public IHttpActionResult Get(int id, int purchasingInvoiceID)
        {
            // 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.PackingListMng               bll = new BLL.PackingListMng();
            Library.DTO.Notification         notification;
            DTO.PackingListMng.DataContainer PackingList = bll.GetDataContainer(id, purchasingInvoiceID, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <DTO.PackingListMng.DataContainer>()
            {
                Data = PackingList, Message = notification
            }));
        }
Exemple #4
0
        public IHttpActionResult Delete(int id)
        {
            // authentication
            Module.Framework.BLL fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanDelete))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }

            BLL.PackingListMng       bll = new BLL.PackingListMng();
            Library.DTO.Notification notification;
            bll.DeleteData(id, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <int>()
            {
                Data = id, Message = notification
            }));
        }
Exemple #5
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.PackingListMng       bll = new BLL.PackingListMng();
            Library.DTO.Notification notification;
            int totalRows = 0;
            IEnumerable <DTO.PackingListMng.PackingListSearchResult> searchResult = bll.GetDataWithFilter(ControllerContext.GetAuthUserId(), searchInput.Filters, searchInput.PageSize, searchInput.PageIndex, searchInput.SortedBy, searchInput.SortedDirection, out totalRows, out notification);

            return(Ok(new Library.DTO.ReturnData <IEnumerable <DTO.PackingListMng.PackingListSearchResult> >()
            {
                Data = searchResult, Message = notification, TotalRows = totalRows
            }));
        }
Exemple #6
0
        public IHttpActionResult GetInitInfos(DTO.Search searchInput)
        {
            // authentication
            Module.Framework.BLL fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanCreate))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }

            BLL.PackingListMng       bll = new BLL.PackingListMng();
            Library.DTO.Notification notification;

            int totalRows = 0;
            IEnumerable <DTO.PackingListMng.InitInfo> initInfos = bll.GetInitInfos(searchInput.Filters, ControllerContext.GetAuthUserId(), out totalRows, out notification);

            return(Ok(new Library.DTO.ReturnData <IEnumerable <DTO.PackingListMng.InitInfo> >()
            {
                Data = initInfos, Message = notification, TotalRows = totalRows
            }));
        }
Exemple #7
0
        public IHttpActionResult Update(int id, DTO.PackingListMng.PackingList 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.PackingListMng.PackingList>(dtoItem, out notification))
            {
                return(Ok(new Library.DTO.ReturnData <DTO.PackingListMng.PackingList>()
                {
                    Data = dtoItem, Message = notification
                }));
            }

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


            return(Ok(new Library.DTO.ReturnData <DTO.PackingListMng.PackingList>()
            {
                Data = dtoItem, Message = notification
            }));
        }