예제 #1
0
        public App(string displayText)
        {
            _displayText = displayText;
            InitializeComponent();
            CountPlanRepo = new CountPlanRepository(displayText);
            ProviderRepo  = new ProviderRepository(displayText);
            OrderRepo     = new OrderRepository(displayText);

            MainPage = new MainPage();
        }
        public async Task <bool> SaveDetail(List <CountPlanDetailItem> item)
        {
            CountPlanRepository _repository = App.CountPlanRepo;
            bool result = false;

            try
            {
                bool flag = await _repository.Save(item);

                result = flag;
            }
            catch (Exception ex)
            {
                result = false;
                Debug.WriteLine("\t\t\t\tERROR {0}", ex.Message);
            }
            return(result);
        }
        public async Task <List <ViewCountPlanDetailItem> > GetByPlanAndProduct(int id, string product)
        {
            CountPlanRepository            _repository = App.CountPlanRepo;
            List <ViewCountPlanDetailItem> plan        = new List <ViewCountPlanDetailItem>();

            try
            {
                List <ViewCountPlanDetailItem> countPlanDetailItemList = await _repository.GetByPlanAndProduct(id, product);

                plan = countPlanDetailItemList;
                countPlanDetailItemList = (List <ViewCountPlanDetailItem>)null;
            }
            catch (Exception ex)
            {
                plan = (List <ViewCountPlanDetailItem>)null;
                Debug.WriteLine("\t\t\t\tERROR {0}", ex.Message);
            }
            return(plan);
        }
        public async Task <List <ListItems> > GetCountByIdPage(int id)
        {
            CountPlanRepository _repository = App.CountPlanRepo;
            List <ListItems>    plan        = new List <ListItems>();

            try
            {
                List <ListItems> listItemsList = await _repository.GetByIdPage(id);

                plan          = listItemsList;
                listItemsList = (List <ListItems>)null;
            }
            catch (Exception ex)
            {
                plan = (List <ListItems>)null;
                Debug.WriteLine("\t\t\t\tERROR {0}", ex.Message);
            }
            return(plan);
        }
        public async Task <List <CountPlan> > GetAll()
        {
            CountPlanRepository _repository = App.CountPlanRepo;

            Items = new List <CountPlan>();
            try
            {
                List <CountPlan> countPlanList = await _repository.GetAllAsync();

                this.Items    = countPlanList;
                countPlanList = (List <CountPlan>)null;
            }
            catch (Exception ex)
            {
                this.Items = (List <CountPlan>)null;
                Debug.WriteLine("\t\t\t\tERROR {0}", ex.Message);
            }
            return(this.Items);
        }
        public async Task <bool> SaveCountPlan(CountPlan item)
        {
            bool result = false;

            try
            {
                CountPlanRepository _repository = App.CountPlanRepo;
                bool flag = await _repository.UpdatePlan(item);

                result      = flag;
                _repository = (CountPlanRepository)null;
            }
            catch (Exception ex1)
            {
                Exception ex = ex1;
                result = false;
                throw;
            }
            return(result);
        }