Example #1
0
 public IHttpActionResult GetModelInfo(int modelID)
 {
     BLL.OfferMng             bll = new BLL.OfferMng();
     Library.DTO.Notification notification;
     DTO.OfferMng.Model       data = bll.GetModelInfo(modelID, ControllerContext.GetAuthUserId(), out notification);
     return(Ok(new Library.DTO.ReturnData <DTO.OfferMng.Model>()
     {
         Data = data, Message = notification
     }));
 }
Example #2
0
        public IHttpActionResult GetModelSparepart(int modelID)
        {
            BLL.OfferMng bll = new BLL.OfferMng();
            IEnumerable <DTO.Support.ModelSparepart> data = bll.GetModelSparepart(modelID);

            return(Ok(new Library.DTO.ReturnData <IEnumerable <DTO.Support.ModelSparepart> >()
            {
                Data = data
            }));
        }
Example #3
0
        public IHttpActionResult ApproveAllItem(int id)
        {
            BLL.OfferMng             bll = new BLL.OfferMng();
            Library.DTO.Notification notification;
            bool result = bll.ApproveAllItem(id, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <bool>()
            {
                Data = result, Message = notification
            }));
        }
Example #4
0
        public IHttpActionResult GetSupportData()
        {
            BLL.OfferMng                      bll = new BLL.OfferMng();
            Library.DTO.Notification          notification;
            DTO.OfferMng.SupportDataContainer result = bll.GetSupportData(out notification);

            return(Ok(new Library.DTO.ReturnData <DTO.OfferMng.SupportDataContainer>()
            {
                Data = result, Message = notification, TotalRows = 0
            }));
        }
Example #5
0
        public IHttpActionResult UploadOfferScanFile(int offerID, string newOfferScanFile, string offerScanFile)
        {
            DTO.OfferMng.Offer       dtoOffer;
            Library.DTO.Notification notification;
            BLL.OfferMng             bll = new BLL.OfferMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            bll.UploadOfferScanFile(offerID, true, newOfferScanFile, offerScanFile, out dtoOffer, out notification);

            return(Ok(new Library.DTO.ReturnData <DTO.OfferMng.Offer>()
            {
                Data = dtoOffer, Message = notification
            }));
        }
Example #6
0
 public IHttpActionResult GetOfferLineSalePriceHistory(int id, string season)
 {
     BLL.OfferMng              bll = new BLL.OfferMng();
     Library.DTO.Notification  notification;
     DTO.OfferMng.PriceHistory Data = bll.GetOfferLineSalePriceHistory(ControllerContext.GetAuthUserId(), season, id, out notification);
     if (notification.Type != Library.DTO.NotificationType.Success)
     {
         return(InternalServerError(new Exception(notification.Message)));
     }
     return(Ok(new Library.DTO.ReturnData <DTO.OfferMng.PriceHistory>()
     {
         Data = Data, Message = notification
     }));
 }
Example #7
0
        public IHttpActionResult GetPlaningPurchasingPrice2(object param) // param: DTO.OfferMng.PlanningPurchasingPriceParamDTO
        {
            BLL.OfferMng             bll = new BLL.OfferMng();
            Library.DTO.Notification notification;
            List <DTO.OfferMng.PlaningPurchasingPriceDTO> Data = bll.GetPlaningPurchasingPrice(ControllerContext.GetAuthUserId(), param, out notification);

            if (notification.Type != Library.DTO.NotificationType.Success)
            {
                return(InternalServerError(new Exception(notification.Message)));
            }
            return(Ok(new Library.DTO.ReturnData <List <DTO.OfferMng.PlaningPurchasingPriceDTO> >()
            {
                Data = Data, Message = notification
            }));
        }
Example #8
0
        public IHttpActionResult GetPrintDataOfferPP2013(int id)
        {
            // authentication
            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.OfferMng bll            = new BLL.OfferMng();
            string       reportFileName = bll.GetPrintDataOfferPP2013(id, ControllerContext.GetAuthUserId(), out Library.DTO.Notification notification);

            return(Ok(new Library.DTO.ReturnData <string>()
            {
                Data = reportFileName, Message = notification
            }));
        }
Example #9
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.OfferMng             bll = new BLL.OfferMng();
            Library.DTO.Notification notification;
            bll.DeleteData(id, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <int>()
            {
                Data = id, Message = notification
            }));
        }
Example #10
0
        public IHttpActionResult SendEmailNotificationByApproveOfferPermission(int id)
        {
            // authentication
            Module.Framework.BLL fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanApprove))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }

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

            object data = bll.SendEmailNotificationByApproveOfferPermission(id, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <object>()
            {
                Data = data, Message = notification
            }));
        }
Example #11
0
        public IHttpActionResult Revise(int id, int actionType, DTO.OfferMng.Offer dtoItem)
        {
            // authentication
            Module.Framework.BLL fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanApprove))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }

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

            bll.Revise(id, actionType, ref dtoItem, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <DTO.OfferMng.Offer>()
            {
                Data = dtoItem, Message = notification
            }));
        }
Example #12
0
        public IHttpActionResult GetExcelFOBItemOnlyReportData(DTO.Search searchInput)
        {
            Library.DTO.Notification notification;

            // authentication
            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.OfferMng bll            = new BLL.OfferMng();
            string       reportFileName = bll.ExportExcelSearchOffer(searchInput.Filters, out notification);

            return(Ok(new Library.DTO.ReturnData <string>()
            {
                Data = reportFileName, Message = notification
            }));
        }
Example #13
0
        public IHttpActionResult SearchOfferLine(int offerID)
        {
            // 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.OfferMng             bll = new BLL.OfferMng();
            Library.DTO.Notification notification;

            int totalRows = 0;
            IEnumerable <DTO.OfferMng.OfferLine> offerLineData = bll.SearchOfferLines(offerID, ControllerContext.GetAuthUserId(), out totalRows, out notification);

            return(Ok(new Library.DTO.ReturnData <IEnumerable <DTO.OfferMng.OfferLine> >()
            {
                Data = offerLineData, Message = notification, TotalRows = totalRows
            }));
        }
Example #14
0
        public IHttpActionResult QuickSearchSampleProduct(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.OfferMng             bll = new BLL.OfferMng();
            Library.DTO.Notification notification;
            int totalRows = 0;
            IEnumerable <DTO.OfferMng.SampleProductSearchResultDTO> result = bll.QuickSearchSampleProduct(ControllerContext.GetAuthUserId(), searchInput.Filters, searchInput.PageSize, searchInput.PageIndex, searchInput.SortedBy, searchInput.SortedDirection, out totalRows, out notification);


            return(Ok(new Library.DTO.ReturnData <IEnumerable <DTO.OfferMng.SampleProductSearchResultDTO> >()
            {
                Data = result, Message = notification, TotalRows = totalRows
            }));
        }
Example #15
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.OfferMng               bll = new BLL.OfferMng();
            Library.DTO.Notification   notification;
            DTO.OfferMng.DataContainer data = bll.GetDataContainer(id, ControllerContext.GetAuthUserId(), out notification);
            //foreach (var item in data.OfferData.OfferLines)
            //{
            //    item.ProductThumbnailLocation = System.Configuration.ConfigurationManager.AppSettings["ServiceUrl"] + System.Configuration.ConfigurationManager.AppSettings["ThumbnailUrl"] + item.ProductThumbnailLocation;
            //    item.ProductFileLocation = System.Configuration.ConfigurationManager.AppSettings["ServiceUrl"] + System.Configuration.ConfigurationManager.AppSettings["FileUrl"] + item.ProductFileLocation;
            //}

            return(Ok(new Library.DTO.ReturnData <DTO.OfferMng.DataContainer>()
            {
                Data = data, Message = notification
            }));
        }
Example #16
0
        public IHttpActionResult Update(int id, int actionType, DTO.OfferMng.Offer 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.OfferMng.Offer>(dtoItem, out notification))
            {
                return(Ok(new Library.DTO.ReturnData <DTO.OfferMng.Offer>()
                {
                    Data = dtoItem, Message = notification
                }));
            }

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


            return(Ok(new Library.DTO.ReturnData <DTO.OfferMng.Offer>()
            {
                Data = dtoItem, Message = notification
            }));
        }
Example #17
0
        public IHttpActionResult GetOfferLineEdit(int offerLineID)
        {
            // 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.OfferMng               bll = new BLL.OfferMng();
            Library.DTO.Notification   notification;
            DTO.OfferMng.OfferLineEdit data = bll.GetOfferLineEdit(offerLineID, ControllerContext.GetAuthUserId(), out notification);
            data.MaterialThumbnailLocation         = System.Configuration.ConfigurationManager.AppSettings["ServiceUrl"] + System.Configuration.ConfigurationManager.AppSettings["ThumbnailUrl"] + data.MaterialThumbnailLocation;
            data.FrameMaterialThumbnailLocation    = System.Configuration.ConfigurationManager.AppSettings["ServiceUrl"] + System.Configuration.ConfigurationManager.AppSettings["ThumbnailUrl"] + data.FrameMaterialThumbnailLocation;
            data.SubMaterialColorThumbnailLocation = System.Configuration.ConfigurationManager.AppSettings["ServiceUrl"] + System.Configuration.ConfigurationManager.AppSettings["ThumbnailUrl"] + data.SubMaterialColorThumbnailLocation;
            data.CushionColorThumbnailLocation     = System.Configuration.ConfigurationManager.AppSettings["ServiceUrl"] + System.Configuration.ConfigurationManager.AppSettings["ThumbnailUrl"] + data.CushionColorThumbnailLocation;
            data.BackCushionThumbnailLocation      = System.Configuration.ConfigurationManager.AppSettings["ServiceUrl"] + System.Configuration.ConfigurationManager.AppSettings["ThumbnailUrl"] + data.BackCushionThumbnailLocation;
            data.SeatCushionThumbnailLocation      = System.Configuration.ConfigurationManager.AppSettings["ServiceUrl"] + System.Configuration.ConfigurationManager.AppSettings["ThumbnailUrl"] + data.SeatCushionThumbnailLocation;

            return(Ok(new Library.DTO.ReturnData <DTO.OfferMng.OfferLineEdit>()
            {
                Data = data, Message = notification
            }));
        }