예제 #1
0
        public IHttpActionResult UpdateDetailTracking(int id, int idIssue, DTO.ModelMng.ModelIssueTrack dtoItem)
        {
            Library.DTO.Notification notification;
            Module.Framework.BLL     fwBll = new Module.Framework.BLL();

            if (id > 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanUpdate))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }
            else if (id == 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanCreate))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }

            if (!Helper.CommonHelper.ValidateDTO <DTO.ModelMng.ModelIssueTrack>(dtoItem, out notification))
            {
                return(Ok(new Library.DTO.ReturnData <DTO.ModelMng.ModelIssueTrack>()
                {
                    Data = dtoItem, Message = notification
                }));
            }

            BLL.ModelMng bll = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            bll.UpdateDetailTracking(id, idIssue, ref dtoItem, ControllerContext.GetAuthUserId(), out notification);

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

            // continue processing
            BLL.ModelMng bll = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            bll.UpdateData(id, ref dtoItem, ControllerContext.GetAuthUserId(), out notification);
            return(Ok(new Library.DTO.ReturnData <DTO.ModelMng.Model>()
            {
                Data = dtoItem, Message = notification
            }));
        }
예제 #3
0
        public IHttpActionResult GetClientData(string season, string clientID, int modelID)
        {
            //authencation
            Module.Framework.BLL fwBll = new Module.Framework.BLL();
            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, ModuleAction.CanUpdate))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }
            BLL.ModelMng             bll = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            Library.DTO.Notification notification;

            int id = 0;

            if (season == "null")
            {
                season = "";
            }
            if (clientID != "null")
            {
                id = Convert.ToInt32(clientID);
            }

            List <DTO.ModelMng.ClientSaleData> data = bll.GetClientSaleData(season, id, modelID, out notification);

            return(Ok(new Library.DTO.ReturnData <List <DTO.ModelMng.ClientSaleData> >()
            {
                Data = data, Message = notification
            }));
        }
예제 #4
0
 public IHttpActionResult GetSearchSupportData()
 {
     BLL.ModelMng                  bll = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
     Library.DTO.Notification      notification;
     DTO.ModelMng.SearchFilterData data = bll.GetFilterData(out notification);
     return(Ok(new Library.DTO.ReturnData <DTO.ModelMng.SearchFilterData>()
     {
         Data = data, Message = notification, TotalRows = 0
     }));
 }
예제 #5
0
        public IHttpActionResult QuyeryCheckList(string param)
        {
            Hashtable input = new Hashtable();

            input["query"] = param;
            BLL.ModelMng             bll               = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            Library.DTO.Notification notification      = new Library.DTO.Notification();
            List <DTO.ModelMng.CheckListGroupDTO> data = bll.QuyeryCheckList(ControllerContext.GetAuthUserId(), "query-check", input, out notification);

            return(Ok(data));
        }
예제 #6
0
        public IHttpActionResult ExportExcelModel(DTO.Search searchInput)
        {
            Library.DTO.Notification notification;
            BLL.ModelMng             bll = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            string dataFileName          = bll.ExportExcelModel(searchInput.Filters, out notification);

            //string dataFileName = string.Empty;
            return(Ok(new Library.DTO.ReturnData <string>()
            {
                Data = dataFileName, Message = notification
            }));
        }
예제 #7
0
        public IHttpActionResult GetDataCreateModel(int id, int sampleProductID)
        {
            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.ModelMng bll  = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            object       data = bll.GetDataCreateModel(ControllerContext.GetAuthUserId(), id, sampleProductID, out Library.DTO.Notification notification);

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

            Library.DTO.Notification notification = new Library.DTO.Notification();
            BLL.ModelMng             bll          = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            object data = bll.GetModelNoFactory(ControllerContext.GetAuthUserId(), out notification);

            return(Ok(new Library.DTO.ReturnData <object>()
            {
                Data = data, Message = notification
            }));
        }
예제 #10
0
        public IHttpActionResult GetModelDefaultoptionByPreviousSeason(int id, string season)
        {
            //authencation
            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.ModelMng             bll = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            Library.DTO.Notification notification;

            List <DTO.ModelMng.ModelDefaultOptionDTO> data = bll.GetDefaultOptionByPreviousSeason(ControllerContext.GetAuthUserId(), id, season, out notification);

            return(Ok(new Library.DTO.ReturnData <List <DTO.ModelMng.ModelDefaultOptionDTO> >()
            {
                Data = data, Message = notification
            }));
        }
예제 #11
0
        public IHttpActionResult SelfCalculationPrice(int id, string season, List <DTO.ModelMng.ModelPurchasingPriceConfigurationDetailDTO> dtoItem)
        {
            Module.Framework.BLL fwBll = new Module.Framework.BLL();

            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, ModuleAction.CanUpdate))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }
            BLL.ModelMng bll = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));

            Notification notification;

            object data = bll.SelfCalculationPrice(ControllerContext.GetAuthUserId(), id, season, ref dtoItem, out notification);

            return(Ok(new ReturnData <object>()
            {
                Data = dtoItem, Message = notification
            }));
        }
예제 #12
0
        public IHttpActionResult ResetData(int id, object dtoItem)
        {
            Module.Framework.BLL fwBll = new Module.Framework.BLL();

            if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, ModuleAction.CanReset))
            {
                return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED)));
            }
            BLL.ModelMng bll = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));

            Notification notification;

            object data = bll.ResetData(ControllerContext.GetAuthUserId(), id, ref dtoItem, out notification);

            return(Ok(new ReturnData <object>()
            {
                Data = dtoItem, Message = notification
            }));
        }
예제 #13
0
        public IHttpActionResult GetModelDefaultFactoryDetail(int modelID, int factoryID)
        {
            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.ModelMng             bll = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            Library.DTO.Notification notification;

            List <DTO.ModelMng.ModelDefaultFactoryDetail> data = bll.GetModelDefaultFactoryDetail(modelID, factoryID, out notification);

            return(Ok(new Library.DTO.ReturnData <List <DTO.ModelMng.ModelDefaultFactoryDetail> >()
            {
                Data = data, Message = notification
            }));
        }
예제 #14
0
        public IHttpActionResult DeleteDetailTracking(int id)
        {
            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.ModelMng             bll = new BLL.ModelMng(Helper.AuthHelper.GetCurrentUserFolder(ControllerContext));
            Library.DTO.Notification notification;

            bll.DeleteDetailTracking(id, ControllerContext.GetAuthUserId(), out notification);

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

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