public PlanList(string user)
 {
     _user = user;
     InitializeComponent();
     countServices  = new CountServices();
     BindingContext = new CountViewModel(null, user);
 }
 public CountDetailViewModel(int idPlan, string product, string user, string description, string barCodeProduct, string nameProduct)
 {
     countServices = new CountServices();
     LoadDetails(idPlan, product, user);
     PlanDescription = description;
     BarCodeProduct  = barCodeProduct;
     NameProduct     = nameProduct;
     User            = user;
     PlanId          = idPlan;
     ProductCode     = product;
 }
 public CountDetailViewModel(List <ViewCountPlanDetailItem> items, string user, string description, string barCodeProduct,
                             string nameProduct)
 {
     countServices   = new CountServices();
     PlanDescription = description;
     BarCodeProduct  = barCodeProduct;
     NameProduct     = nameProduct;
     User            = user;
     PlanId          = items.FirstOrDefault().CountPlanId; // idPlan;
     ProductCode     = items.FirstOrDefault().ProductCode; // product;
     LoadDetails(items, user);
 }
        public CountViewModel(int?id)
        {
            Items.Clear();
            Details.Clear();
            DetailList.Clear();

            countServices = new CountServices();
            syncServices  = new SyncServices();

            //if (id == null)
            //    LoadItems();
            //else
            //    LoadDetailsPlan((int)id);

            User = "******";
        }
        public CountViewModel(int?id)
        {
            countServices = new CountServices();
            syncServices  = new SyncServices();

            if (id == null)
            {
                LoadItems();
            }
            else
            {
                LoadDetailsPlan((int)id);
            }

            User = "******";
        }
        public async void LoadData()
        {
            CountServices services = new CountServices();
            var           result   = await services.GetAll();

            List <Test> list = new List <Test>();

            list.Add(new Test()
            {
                Id     = 1,
                Value1 = "uno",
                Value2 = "Dos"
            });

            list.Add(new Test()
            {
                Id     = 2,
                Value1 = "tres",
                Value2 = "cuatro"
            });
        }
        public CountViewModel(int?id, string user)
        {
            Items.Clear();
            Details.Clear();
            DetailList.Clear();

            countServices = new CountServices();
            syncServices  = new SyncServices();



            if (id == null)
            {
                AsyncLoadItems(); //LoadItems();
            }
            else
            {
                IdPlan = (int)id;
                AsyncLoadDetailsPlan();
            }
            //LoadDetailsPlan((int)id);

            User = user;
        }
        public CountResumeViewModel(List <ViewCountPlanDetailExtend> plan, string planName, string user)
        {
            User          = user;
            countServices = new CountServices();
            //int total = 0, _quantity = 0, _totalProduct = 0;
            var list = new List <ViewCountPlanDetailExtend>();


            Porcentaje = 3; //int.Parse(Resources.PorcentajeConteo); //Obtiene valor porcentaje


            //TODO hablar con ERIK sobre porcentaje
            ////CALCULA PORCENTAJE
            //foreach (var row in plan)
            //{
            //    _quantity += row.Quantity;
            //    _totalProduct += row.TotalProduct;
            //}

            //total = (((_totalProduct * 100) / _quantity) - 100) * -1;
            ////FIN CALCULA PORCENTAJE

            ////ASIGNA COLOR E IMAGEN SEGUN PORCENTAJE
            //if (total == 0)
            //{
            //    EstatusPlanConteo = (int)EnumTShirt.CountEstatus.SINDIFERENCIA;
            //    ImageStatusPlan = "@drawable/yes.png";
            //    ColorText = Color.Green;
            //}
            //else if (total < Porcentaje)
            //{
            //    EstatusPlanConteo = (int)EnumTShirt.CountEstatus.DIFERENCIAMEDIA;
            //    ImageStatusPlan = "@drawable/warning.png";
            //    ColorText = Color.Navy;
            //}
            //else
            //{
            //    EstatusPlanConteo = (int)EnumTShirt.CountEstatus.DIFERENCIAMAYOR;
            //    ImageStatusPlan = "@drawable/no.png";
            //    ColorText = Color.Red;
            //}

            //
            EstatusPlanConteo = (int)EnumTShirt.CountEstatus.DIFERENCIAMEDIA;
            ImageStatusPlan   = "@drawable/warning.png";
            ColorText         = Color.Navy;



            ItemsCount = plan.Count();
            NumberPage = 1;
            if (ItemsCount > 10)
            {
                decimal valueItemscount    = Convert.ToDecimal(list.Count());
                decimal valueItemsperpages = Convert.ToDecimal(ITEM_PER_PAGE);
                decimal valueResult        = Math.Ceiling(valueItemscount / valueItemsperpages);

                TotalPage = Convert.ToInt32(valueResult);

                MsgPage = Convert.ToString(NumberPage) + " / " + Convert.ToString(TotalPage);
                IsPage  = true;
            }


            foreach (var item in plan)
            {
                list.Add(
                    new ViewCountPlanDetailExtend()
                {
                    Id                 = item.Id,
                    IdCountPlan        = item.IdCountPlan,
                    Name               = item.Name,
                    Description        = item.Description,
                    ProductCode        = item.ProductCode,
                    Quantity           = item.Quantity,
                    TotalCounted       = item.TotalCounted,
                    BarCode            = item.BarCode,
                    ProductDescription = item.ProductDescription.Trim(),
                    TotalProduct       = item.TotalProduct,
                    HasDetails         = item.HasDetails,
                    ProductOk          = item.ProductOk,
                    //RColor = (item.Quantity <= item.TotalProduct) ? COLORDEFAULT : ColorText
                });
            }

            DetailList = new ObservableCollection <ViewCountPlanDetailExtend>(list.Take(ITEM_PER_PAGE));
            Details    = new ObservableCollection <ViewCountPlanDetailExtend>(list);
            PlanName   = planName;
        }
        public CountResumeViewModel(List <ViewCountPlanDetailExtend> plan, string planName)
        {
            countServices = new CountServices();
            int total = 0, _quantity = 0, _totalProduct = 0;
            var list = new List <ViewCountPlanDetailExtend>();


            Porcentaje = int.Parse(Properties.Resources.PorcentajeConteo); //Obtiene valor porcentaje

            //CALCULA PORCENTAJE
            foreach (var row in plan)
            {
                _quantity     += row.Quantity;
                _totalProduct += row.TotalProduct;
            }

            total = (((_totalProduct * 100) / _quantity) - 100) * -1;
            //FIN CALCULA PORCENTAJE

            //ASIGNA COLOR E IMAGEN SEGUN PORCENTAJE
            if (total == 0)
            {
                EstatusPlanConteo = (int)EnumTShirt.CountEstatus.SINDIFERENCIA;
                ImageStatusPlan   = "Images/yes.png";
                ColorText         = Color.Green;
            }
            else if (total < Porcentaje)
            {
                EstatusPlanConteo = (int)EnumTShirt.CountEstatus.DIFERENCIAMEDIA;
                ImageStatusPlan   = "Images/warning.png";
                ColorText         = Color.Navy;
            }
            else
            {
                EstatusPlanConteo = (int)EnumTShirt.CountEstatus.DIFERENCIAMAYOR;
                ImageStatusPlan   = "Images/no.png";
                ColorText         = Color.Red;
            }

            foreach (var item in plan)
            {
                list.Add(
                    new ViewCountPlanDetailExtend()
                {
                    Id                 = item.Id,
                    IdCountPlan        = item.IdCountPlan,
                    Name               = item.Name,
                    Description        = item.Description,
                    ProductCode        = item.ProductCode,
                    Quantity           = item.Quantity,
                    TotalCounted       = item.TotalCounted,
                    BarCode            = item.BarCode,
                    ProductDescription = item.ProductDescription,
                    TotalProduct       = item.TotalProduct,
                    HasDetails         = item.HasDetails,
                    ProductOk          = item.ProductOk,
                    RColor             = (item.Quantity <= item.TotalProduct) ? COLORDEFAULT : ColorText
                });
            }

            Details = new ObservableCollection <ViewCountPlanDetailExtend>(list);

            PlanName = planName;
        }
Пример #10
0
 public PlantList()
 {
     InitializeComponent();
     countServices  = new CountServices();
     BindingContext = new CountViewModel(null);
 }
Пример #11
0
 public CountHub(CountServices countServices)
 {
     _countServices = countServices;
 }