예제 #1
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.ClientMng               bll = new BLL.ClientMng();
            Library.DTO.Notification    notification;
            DTO.ClientMng.DataContainer data = bll.GetEditData(id, ControllerContext.GetAuthUserId(), out notification);

            //foreach (var item in data.Client.ClientContracts)
            //{
            //    if (!string.IsNullOrEmpty(item.ContractFileURL))
            //    {
            //        item.ContractFileURL = System.Configuration.ConfigurationManager.AppSettings["ServiceUrl"] + System.Configuration.ConfigurationManager.AppSettings["FileUrl"] + item.ContractFileURL;
            //    }
            //}
            return(Ok(new Library.DTO.ReturnData <DTO.ClientMng.DataContainer>()
            {
                Data = data, Message = notification
            }));
        }
예제 #2
0
 public IHttpActionResult GetDataClientAdditionalCondition()
 {
     BLL.ClientMng               bll = new BLL.ClientMng();
     Library.DTO.Notification    notification;
     DTO.ClientMng.DataContainer dataResult = bll.GetDataClientAdditionalCondition(ControllerContext.GetAuthUserId(), out notification);
     return(Ok(new Library.DTO.ReturnData <DTO.ClientMng.DataContainer>()
     {
         Data = dataResult, Message = notification
     }));
 }
예제 #3
0
 public IHttpActionResult GetBreakdownSearchFilterData()
 {
     BLL.ClientMng            bll = new BLL.ClientMng();
     Library.DTO.Notification notification;
     DTO.ClientMng.Overview.Breakdown.SupportDataDTO dataResult = bll.BreakdownGetSearchFilter(ControllerContext.GetAuthUserId(), out notification);
     return(Ok(new Library.DTO.ReturnData <DTO.ClientMng.Overview.Breakdown.SupportDataDTO>()
     {
         Data = dataResult, Message = notification
     }));
 }
예제 #4
0
        public IHttpActionResult Delta3ExportExcel(int clientId, string season)
        {
            Library.DTO.Notification notification;
            BLL.ClientMng            bll = new BLL.ClientMng();
            string dataFileName          = bll.Detal3ExportExcel(clientId, season, out notification);

            return(Ok(new Library.DTO.ReturnData <string>()
            {
                Data = dataFileName, Message = notification
            }));
        }
예제 #5
0
        public IHttpActionResult ExportExcelClient(DTO.Search searchInput)
        {
            Library.DTO.Notification notification;
            BLL.ClientMng            bll = new BLL.ClientMng();
            string dataFileName          = bll.ExportExcelClient(ControllerContext.GetAuthUserId(), searchInput.Filters, out notification);

            return(Ok(new Library.DTO.ReturnData <string>()
            {
                Data = dataFileName, Message = notification
            }));
        }
예제 #6
0
 public IHttpActionResult GetSearchFilter()
 {
     BLL.ClientMng                  bll = new BLL.ClientMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
     Library.DTO.Notification       notification;
     DTO.ClientMng.SearchFilterData data = bll.GetSearchFilter(out notification);
     if (notification.Type == Library.DTO.NotificationType.Error)
     {
         return(InternalServerError(new Exception(notification.Message)));
     }
     return(Ok(new Library.DTO.ReturnData <DTO.ClientMng.SearchFilterData>()
     {
         Data = data, Message = notification, TotalRows = 0
     }));
 }
예제 #7
0
        public IHttpActionResult GetPlaningPurchasingPrice(int id)
        {
            BLL.ClientMng            bll = new BLL.ClientMng();
            Library.DTO.Notification notification;
            List <DTO.ClientMng.PlaningPurchasingPriceDTO> Data = bll.GetPlaningPurchasingPrice(ControllerContext.GetAuthUserId(), id, out notification);

            if (notification.Type != Library.DTO.NotificationType.Success)
            {
                return(InternalServerError(new Exception(notification.Message)));
            }
            return(Ok(new Library.DTO.ReturnData <List <DTO.ClientMng.PlaningPurchasingPriceDTO> >()
            {
                Data = Data, Message = notification
            }));
        }
예제 #8
0
        public IHttpActionResult GetClientEstimatedAdditionalCost(int id)
        {
            Library.DTO.Notification notification;
            BLL.ClientMng            bll   = new BLL.ClientMng();
            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)));
            }
            object data = bll.GetClientEstimatedAdditionalCost(id, out notification);

            return(Ok(new Library.DTO.ReturnData <object>()
            {
                Data = data, Message = notification
            }));
        }
예제 #9
0
        public IHttpActionResult QuickSearchPIByLoadingPlan(int id, string season, int lpid)
        {
            Library.DTO.Notification notification;
            BLL.ClientMng            bll   = new BLL.ClientMng();
            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)));
            }
            object data = bll.QuickSearchPI_ByLoadingPlan(lpid, id, season, out notification);

            return(Ok(new Library.DTO.ReturnData <object>()
            {
                Data = data, Message = notification
            }));
        }
예제 #10
0
        public IHttpActionResult SaveGIC(int id, List <DTO.ClientMng.ClientContactHistory> dtoItem)
        {
            // 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.ClientMng            bll = new BLL.ClientMng();
            Library.DTO.Notification notification;
            bll.SaveGIC(id, dtoItem, ControllerContext.GetAuthUserId(), out notification);
            return(Ok(new Library.DTO.ReturnData <List <DTO.ClientMng.ClientContactHistory> >()
            {
                Data = dtoItem, Message = notification
            }));
        }
예제 #11
0
        public IHttpActionResult GetClientOverview(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.ClientMng                bll = new BLL.ClientMng();
            Library.DTO.Notification     notification;
            DTO.ClientMng.ClientOverview data = bll.GetClientOverview(id, ControllerContext.GetAuthUserId(), out notification);
            return(Ok(new Library.DTO.ReturnData <DTO.ClientMng.ClientOverview>()
            {
                Data = data, Message = notification
            }));
        }
예제 #12
0
        public IHttpActionResult getOfferMarginDetail(int id, string season, int status, int clientID)
        {
            // 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.ClientMng            bll = new BLL.ClientMng();
            Library.DTO.Notification notification;
            List <DTO.ClientMng.Overview.Offer.OfferMarginDetailDTO> data = bll.GetOfferMarginDetail(id, season, status, clientID, ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <List <DTO.ClientMng.Overview.Offer.OfferMarginDetailDTO> >()
            {
                Data = data, Message = notification
            }));
        }
예제 #13
0
        public IHttpActionResult GetBreakdownWithFilter(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.ClientMng            bll = new BLL.ClientMng();
            Library.DTO.Notification notification;
            int totalRows = 0;

            DTO.ClientMng.Overview.Breakdown.SearchFormDTO searchResult = bll.BreakdownGetDataWithFilter(ControllerContext.GetAuthUserId(), searchInput.Filters, searchInput.PageSize, searchInput.PageIndex, searchInput.SortedBy, searchInput.SortedDirection, out totalRows, out notification);
            return(Ok(new Library.DTO.ReturnData <DTO.ClientMng.Overview.Breakdown.SearchFormDTO>()
            {
                Data = searchResult, Message = notification, TotalRows = totalRows
            }));
        }
예제 #14
0
        public IHttpActionResult UpdateOfferPotentialStatus(List <DTO.ClientMng.Overview.Offer.OfferMarginDTO> dtoItems)
        {
            Library.DTO.Notification notification;

            // authentication
            Module.Framework.BLL fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), "OfferMng", Library.DTO.ModuleAction.CanUpdate))
            {
                // edit case
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }

            // continue processing
            BLL.ClientMng bll    = new BLL.ClientMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            bool          result = bll.UpdateOfferPotentialStatus(ControllerContext.GetAuthUserId(), dtoItems, out notification);

            return(Ok(new Library.DTO.ReturnData <bool>()
            {
                Data = result, Message = notification
            }));
        }
예제 #15
0
        public IHttpActionResult SetActiveStatus(int id, int st)
        {
            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)));
            }

            // continue processing
            BLL.ClientMng bll    = new BLL.ClientMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            bool          result = bll.SetActivateStatus(ControllerContext.GetAuthUserId(), id, st == 1 ? true : false, out notification);

            return(Ok(new Library.DTO.ReturnData <bool>()
            {
                Data = result, Message = notification
            }));
        }
예제 #16
0
        public IHttpActionResult Update(int id, DTO.ClientMng.Client 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.ClientMng.Client>(dtoItem, out notification))
            {
                return(Ok(new Library.DTO.ReturnData <DTO.ClientMng.Client>()
                {
                    Data = dtoItem, Message = notification
                }));
            }

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


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