public IHttpActionResult GetLoadingPlan2(int saleOrderID)
        {
            BLL.SaleOrderMng                     bll = new BLL.SaleOrderMng();
            Library.DTO.Notification             notification;
            List <DTO.SaleOrderMng.LoadingPlan2> data = bll.GetLoadingPlan2(saleOrderID, out notification).ToList();

            return(Ok(new Library.DTO.ReturnData <List <DTO.SaleOrderMng.LoadingPlan2> >()
            {
                Data = data, Message = notification
            }));
        }
        public IHttpActionResult CreateReturnData(List <DTO.SaleOrderMng.LoadingPlan2> dtoReturns)
        {
            BLL.SaleOrderMng         bll = new BLL.SaleOrderMng();
            Library.DTO.Notification notification;
            bool data = bll.CreateReturnData2(dtoReturns, out notification);

            return(Ok(new Library.DTO.ReturnData <bool>()
            {
                Data = data, Message = notification
            }));
        }
        public IHttpActionResult GetOfferTrackingStatus(int?offerID)
        {
            BLL.SaleOrderMng         bll = new BLL.SaleOrderMng();
            Library.DTO.Notification notification;
            int?data = bll.GetOfferTrackingStatus(offerID, out notification);

            return(Ok(new Library.DTO.ReturnData <int?>()
            {
                Data = data, Message = notification
            }));
        }
        public IHttpActionResult CreateReturnData(DTO.SaleOrderMng.SaleOrder dtoItem)
        {
            BLL.SaleOrderMng         bll = new BLL.SaleOrderMng();
            Library.DTO.Notification notification;
            bool data = bll.CreateReturnData(dtoItem, out notification);

            return(Ok(new Library.DTO.ReturnData <bool>()
            {
                Data = data, Message = notification
            }));
        }
        public IHttpActionResult UploadLCFile(int saleOrderID, string newFile, string oldPointer)
        {
            DTO.SaleOrderMng.SaleOrder dtoSaleOrder;
            Library.DTO.Notification   notification;
            BLL.SaleOrderMng           bll = new BLL.SaleOrderMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            bll.UploadLCFile(saleOrderID, newFile, oldPointer, out dtoSaleOrder, out notification);

            return(Ok(new Library.DTO.ReturnData <DTO.SaleOrderMng.SaleOrder>()
            {
                Data = dtoSaleOrder, Message = notification
            }));
        }
示例#6
0
        public IHttpActionResult GetLoadingPlan2(int saleOrderID)
        {
            BLL.SaleOrderMng             bll = new BLL.SaleOrderMng();
            Library.DTO.Notification     notification;
            System.Collections.Hashtable input = new System.Collections.Hashtable();
            input["ID"] = saleOrderID;
            object data = executor.CustomFunction(ControllerContext.GetAuthUserId(), "getloadingplan2", input, out notification);

            return(Ok(new Library.DTO.ReturnData <object>()
            {
                Data = data, Message = notification
            }));
        }
示例#7
0
        public IHttpActionResult CreateReturnData(object dtoReturns)
        {
            BLL.SaleOrderMng             bll = new BLL.SaleOrderMng();
            Library.DTO.Notification     notification;
            System.Collections.Hashtable input = new System.Collections.Hashtable();
            input["dtoReturns"] = dtoReturns;
            object data = executor.CustomFunction(ControllerContext.GetAuthUserId(), "returngoods", input, out notification);

            return(Ok(new Library.DTO.ReturnData <object>()
            {
                Data = data, Message = notification
            }));
        }
        public IHttpActionResult BizBloqsImportData(List <DTO.SaleOrderMng.BizBloqsInvoice> bizBloqsInvoice)
        {
            // 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.SaleOrderMng         bll = new BLL.SaleOrderMng();
            Library.DTO.Notification notification;
            List <DTO.SaleOrderMng.BizBloqsInvoice> data = bll.BizBloqsImportData(bizBloqsInvoice, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <List <DTO.SaleOrderMng.BizBloqsInvoice> >()
            {
                Data = data, Message = notification
            }));
        }
        public IHttpActionResult Revise(int id, DTO.SaleOrderMng.SaleOrder dtoItem)
        {
            // authentication
            Module.Framework.BLL fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanReset))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }

            BLL.SaleOrderMng         bll = new BLL.SaleOrderMng();
            Library.DTO.Notification notification;
            bll.Revise(id, ref dtoItem, ControllerContext.GetAuthUserId(), out notification);
            return(Ok(new Library.DTO.ReturnData <DTO.SaleOrderMng.SaleOrder>()
            {
                Data = dtoItem, Message = notification
            }));
        }
        public IHttpActionResult Update(int id, DTO.SaleOrderMng.SaleOrder 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.SaleOrderMng.SaleOrder>(dtoItem, out notification))
            {
                return(Ok(new Library.DTO.ReturnData <DTO.SaleOrderMng.SaleOrder>()
                {
                    Data = dtoItem, Message = notification
                }));
            }

            // continue processing
            BLL.SaleOrderMng bll = new BLL.SaleOrderMng();

            //validate quantity in stock
            if (!bll.ValidateStockQuantity(id, dtoItem, ControllerContext.GetAuthUserId(), out notification))
            {
                return(Ok(new Library.DTO.ReturnData <DTO.SaleOrderMng.SaleOrder>()
                {
                    Data = dtoItem, Message = notification
                }));
            }

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

            return(Ok(new Library.DTO.ReturnData <DTO.SaleOrderMng.SaleOrder>()
            {
                Data = dtoItem, Message = notification
            }));
        }
        public IHttpActionResult SaveLDSClient(int saleOrderID, string ldsDate, string remark)
        {
            // authentication
            Module.Framework.BLL fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanUpdate))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }

            BLL.SaleOrderMng         bll = new BLL.SaleOrderMng();
            Library.DTO.Notification notification;
            bll.SaveLDSClient(saleOrderID, ldsDate, remark, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <int>()
            {
                Data = saleOrderID, Message = notification
            }));
        }
        public IHttpActionResult GetOfferLineSample(int offerId, string orderType, string searchSample)
        {
            // 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.SaleOrderMng         bll = new BLL.SaleOrderMng();
            Library.DTO.Notification notification;
            List <DTO.SaleOrderMng.SaleOrderDetailSample> data = bll.GetOfferLineSample(offerId, orderType, searchSample, out notification);

            return(Ok(new Library.DTO.ReturnData <List <DTO.SaleOrderMng.SaleOrderDetailSample> >()
            {
                Data = data, Message = notification
            }));
        }
        public IHttpActionResult GetViewData(int id, int offerID)
        {
            // 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.SaleOrderMng         bll = new BLL.SaleOrderMng();
            Library.DTO.Notification notification;
            DTO.SaleOrderMng.DataContainerOverview SaleOrder = bll.GetViewData(id, offerID, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <DTO.SaleOrderMng.DataContainerOverview>()
            {
                Data = SaleOrder, Message = notification
            }));
        }
        public IHttpActionResult MultiDelete(List <int> ids)
        {
            // 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.SaleOrderMng         bll = new BLL.SaleOrderMng();
            Library.DTO.Notification notification;
            IEnumerable <int>        saleOrderIDSuccess = bll.MultiDelete(ids, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <IEnumerable <int> >()
            {
                Data = saleOrderIDSuccess, Message = notification
            }));
        }
        public IHttpActionResult GetReportOrderOverview(string season, string orderType)
        {
            Library.DTO.Notification notification;

            // 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.SaleOrderMng bll            = new BLL.SaleOrderMng();
            string           reportFileName = bll.GetReportOrderOverview(season, orderType, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <string>()
            {
                Data = reportFileName, Message = notification
            }));
        }
        public IHttpActionResult SearchSaleOrderDetails(int saleOrderID)
        {
            // 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.SaleOrderMng         bll = new BLL.SaleOrderMng();
            Library.DTO.Notification notification;

            int totalRows = 0;
            IEnumerable <DTO.SaleOrderMng.SaleOrderDetailSearch> saleOrderDetails = bll.SearchSaleOrderDetails(saleOrderID, ControllerContext.GetAuthUserId(), out totalRows, out notification);

            return(Ok(new Library.DTO.ReturnData <IEnumerable <DTO.SaleOrderMng.SaleOrderDetailSearch> >()
            {
                Data = saleOrderDetails, Message = notification, TotalRows = totalRows
            }));
        }
        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.SaleOrderMng         bll = new BLL.SaleOrderMng();
            Library.DTO.Notification notification;
            int totalRows = 0;

            DTO.SaleOrderMng.DataSearchContainer searchData = bll.SearchDataContainer(ControllerContext.GetAuthUserId(), searchInput.Filters, searchInput.PageSize, searchInput.PageIndex, searchInput.SortedBy, searchInput.SortedDirection, out totalRows, out notification);

            return(Ok(new Library.DTO.ReturnData <DTO.SaleOrderMng.DataSearchContainer>()
            {
                Data = searchData, Message = notification, TotalRows = totalRows
            }));
        }
示例#18
0
        public IHttpActionResult Get(int id, int offerID, string orderType = null)
        {
            // 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.SaleOrderMng             bll = new BLL.SaleOrderMng();
            Library.DTO.Notification     notification;
            System.Collections.Hashtable input = new System.Collections.Hashtable();
            input["ID"]        = id;
            input["offerID"]   = offerID;
            input["orderType"] = orderType;
            object SaleOrder = executor.CustomFunction(ControllerContext.GetAuthUserId(), "getsaleorder", input, out notification);

            return(Ok(new Library.DTO.ReturnData <object>()
            {
                Data = SaleOrder, Message = notification
            }));
        }
        public IHttpActionResult PrintPI(int id, string reportName)
        {
            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)));
            }

            //GET DATA
            BLL.SaleOrderMng bll = new BLL.SaleOrderMng();
            DTO.SaleOrderMng.PIContainerPrintout dtoPrintout = bll.GetPrintoutData(id, ControllerContext.GetAuthUserId(), out notification);

            //CREATE PRINTOUT
            if (reportName == null)
            {
                reportName = dtoPrintout.ReportName;
            }

            //int? companyID = fwBll.GetCompanyID(ControllerContext.GetAuthUserId());
            //switch (companyID)
            //{
            //    case 13:
            //        reportName = reportName + "_OrangePine.rdlc";
            //        break;
            //    default:
            //        reportName = reportName + ".rdlc";
            //        break;
            //}
            reportName = reportName + ".rdlc";
            Microsoft.Reporting.WebForms.LocalReport lr = new Microsoft.Reporting.WebForms.LocalReport();
            lr.ReportPath = FrameworkSetting.Setting.AbsoluteReportFolder + reportName;

            Microsoft.Reporting.WebForms.ReportDataSource rsInvoice = new Microsoft.Reporting.WebForms.ReportDataSource();
            rsInvoice.Name  = "Order";
            rsInvoice.Value = dtoPrintout.PIPrintouts;
            lr.DataSources.Add(rsInvoice);

            Microsoft.Reporting.WebForms.ReportDataSource rsInvoiceDetail = new Microsoft.Reporting.WebForms.ReportDataSource();
            rsInvoiceDetail.Name  = "OrderDetail";
            rsInvoiceDetail.Value = dtoPrintout.PIDetailPrintouts;
            lr.DataSources.Add(rsInvoiceDetail);

            string printoutFileName = PrintoutHelper.BuildPrintoutFile(lr, "PDF");

            //
            // author: TheMy
            // description: add disclaimer (using iTextSharp)
            //
            string   finalFile = System.Guid.NewGuid().ToString().Replace("-", "") + ".pdf";
            FileInfo fInfo     = new FileInfo(FrameworkSetting.Setting.AbsoluteReportFolder + reportName);

            if (File.Exists(FrameworkSetting.Setting.AbsoluteReportFolder + fInfo.Name.Replace(fInfo.Extension, "") + "_bottom.pdf"))
            {
                try
                {
                    Document document = new Document();
                    PdfCopy  writer   = new PdfCopy(document, new FileStream(FrameworkSetting.Setting.AbsoluteReportTmpFolder + finalFile, FileMode.Create));
                    if (writer == null)
                    {
                        throw new Exception("Can not create Pdf object");
                    }
                    document.Open();
                    writer.AddDocument(new PdfReader(FrameworkSetting.Setting.AbsoluteReportTmpFolder + printoutFileName));
                    writer.AddDocument(new PdfReader(FrameworkSetting.Setting.AbsoluteReportFolder + fInfo.Name.Replace(fInfo.Extension, "") + "_bottom.pdf"));
                    writer.Close();
                    document.Close();
                }
                catch (Exception ex)
                {
                    notification.Type    = Library.DTO.NotificationType.Error;
                    notification.Message = "Adding general condition failed: " + ex.Message;
                    finalFile            = printoutFileName;
                }
            }
            else
            {
                finalFile = printoutFileName;
            }
            //
            //
            //

            return(Ok(new Library.DTO.ReturnData <string>()
            {
                Data = finalFile, Message = notification
            }));
        }