예제 #1
0
        public IHttpActionResult Update(int id, DTO.ProductMng.Product 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.ProductMng.Product>(dtoItem, out notification))
            {
                return(InternalServerError(new Exception(notification.Message)));
            }

            // continue processing
            BLL.ProductMng bll = new BLL.ProductMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            bll.UpdateData(id, ref dtoItem, ControllerContext.GetAuthUserId(), out notification);
            return(Ok(new Library.DTO.ReturnData <DTO.ProductMng.Product>()
            {
                Data = dtoItem, Message = notification
            }));
        }
예제 #2
0
 public IHttpActionResult GeneratePieceCode(int id)
 {
     Library.DTO.Notification notification;
     BLL.ProductMng           bll = new BLL.ProductMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
     bll.GeneratePieceCode(id, ControllerContext.GetAuthUserId(), out notification);
     return(Ok(new Library.DTO.ReturnData <int>()
     {
         Data = id, Message = notification
     }));
 }
예제 #3
0
 public IHttpActionResult GetSearchSupportData()
 {
     BLL.ProductMng                  bll = new BLL.ProductMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
     Library.DTO.Notification        notification;
     DTO.ProductMng.SearchFilterData data = bll.GetFilterData(out notification);
     return(Ok(new Library.DTO.ReturnData <DTO.ProductMng.SearchFilterData>()
     {
         Data = data, Message = notification, TotalRows = 0
     }));
 }
예제 #4
0
        public IHttpActionResult PrintEANCode(int productColliPieceID)
        {
            Library.DTO.Notification notification;
            BLL.ProductMng           bll = new BLL.ProductMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            string reportName            = bll.PrintEANCode(productColliPieceID, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <string>()
            {
                Data = reportName, Message = notification
            }));
        }
예제 #5
0
        public IHttpActionResult UpdateColliPiece(DTO.ProductMng.ProductColliPiece dtoItem)
        {
            Library.DTO.Notification notification;
            BLL.ProductMng           bll = new BLL.ProductMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            object item = bll.UpdateColliPiece(dtoItem, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <object>()
            {
                Data = item, Message = notification
            }));
        }
예제 #6
0
        public IHttpActionResult DeleteSetEanCode(int id)
        {
            Library.DTO.Notification notification;
            BLL.ProductMng           bll = new BLL.ProductMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            object item = bll.DeleteSetEanCode(id, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <object>()
            {
                Data = item, Message = notification
            }));
        }
예제 #7
0
        public IHttpActionResult UpdateColli(int productColliID, DTO.ProductMng.ProductColli dtoItem)
        {
            BLL.ProductMng bll = new BLL.ProductMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));

            object data = bll.UpdateColli(productColliID, dtoItem, out Library.DTO.Notification notification);

            return(Ok(new Library.DTO.ReturnData <object>()
            {
                Data = data, Message = notification
            }));
        }
예제 #8
0
        public IHttpActionResult CreateColli(int productSetEANCodeID)
        {
            Library.DTO.Notification notification;
            BLL.ProductMng           bll = new BLL.ProductMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            object item = bll.CreateColli(productSetEANCodeID, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <object>()
            {
                Data = item, Message = notification
            }));
        }
예제 #9
0
        public IHttpActionResult Get(int id, int modelID)
        {
            // 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.ProductMng              bll = new BLL.ProductMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            Library.DTO.Notification    notification;
            DTO.ProductMng.EditFormData data = bll.GetData(id, modelID, ControllerContext.GetAuthUserId(), out notification);
            return(Ok(new Library.DTO.ReturnData <DTO.ProductMng.EditFormData>()
            {
                Data = data, Message = notification, TotalRows = 0
            }));
        }
예제 #10
0
        public IHttpActionResult Delete(int id)
        {
            Library.DTO.Notification notification;

            // 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.ProductMng bll = new BLL.ProductMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            bll.DeleteData(id, ControllerContext.GetAuthUserId(), out notification);
            return(Ok(new Library.DTO.ReturnData <int>()
            {
                Data = id, Message = notification
            }));
        }
예제 #11
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.ProductMng           bll = new BLL.ProductMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            Library.DTO.Notification notification;
            int totalRows = 0;

            DTO.ProductMng.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.ProductMng.SearchFormData>()
            {
                Data = data, Message = notification, TotalRows = totalRows
            }));
        }