Beispiel #1
0
        public IHttpActionResult Update(int id, DTO.FactoryPaymentMng.FactoryPayment 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.FactoryPaymentMng.FactoryPayment>(dtoItem, out notification))
            {
                return(Ok(new Library.DTO.ReturnData <DTO.FactoryPaymentMng.FactoryPayment>()
                {
                    Data = dtoItem, Message = notification
                }));
            }

            // continue processing
            BLL.FactoryPaymentMng bll = new BLL.FactoryPaymentMng();
            bll.UpdateData(id, ref dtoItem, ControllerContext.GetAuthUserId(), out notification);
            return(Ok(new Library.DTO.ReturnData <DTO.FactoryPaymentMng.FactoryPayment>()
            {
                Data = dtoItem, Message = notification
            }));
        }
Beispiel #2
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.FactoryPaymentMng    bll = new BLL.FactoryPaymentMng();
            Library.DTO.Notification notification;
            bll.DeleteData(id, ControllerContext.GetAuthUserId(), out notification);
            return(Ok(new Library.DTO.ReturnData <int>()
            {
                Data = id, Message = notification
            }));
        }
Beispiel #3
0
        public IHttpActionResult GetReportOutStanding(string season, int supplierID)
        {
            // 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.FactoryPaymentMng    bll = new BLL.FactoryPaymentMng();
            Library.DTO.Notification notification;
            string reportname = bll.GetReportOutStanding(season, supplierID, out notification);

            return(Ok(new Library.DTO.ReturnData <string>()
            {
                Data = reportname, Message = notification
            }));
        }
Beispiel #4
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.FactoryPaymentMng    bll = new BLL.FactoryPaymentMng();
            Library.DTO.Notification notification;
            int totalRows = 0;

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