public CardMenuPDVsModel(string name, double lat, double lng, string endereco,
                          string btn1, EventHandler btnEventClick1, string btn2, EventHandler btnEventClick2,
                          string btn3, EventHandler btnEventClick3, ListTypePDV listTypePdv)
 {
     this.name           = name;
     this.endereco       = endereco;
     this.btn1           = btn1;
     this.btn2           = btn2;
     this.btn3           = btn3;
     this.btnEventClick1 = btnEventClick1;
     this.btnEventClick2 = btnEventClick2;
     this.btnEventClick3 = btnEventClick3;
     latitude            = lat;
     longitude           = lng;
     this.listTypePdv    = new List <ListTypePDV>();
     this.listTypePdv.Add(listTypePdv);
 }
Ejemplo n.º 2
0
        public List <CardMenuPDVsModel> PopulateList()
        {
            model.pdvs = new List <CardMenuPDVsModel>();
            var result = model.pdvs;

            foreach (TB_VISITA pdv in controller.VisitasPendentes())
            {
                string[] fullGeoPT    = pdv.ENDERECO.Split('\n');
                string   itemLoja     = fullGeoPT[0].Split('-')[1].Trim();
                string   itemEndereco = (fullGeoPT[1] + " " + fullGeoPT[2].Replace(" - CEP:", ", CEP:"));

                var index = model.pdvs.FindIndex(CardMenuPDVsModel => (CardMenuPDVsModel.name.Equals(itemLoja) &&
                                                                       CardMenuPDVsModel.endereco.Equals(itemEndereco)));

                var infoPdv = new ListTypePDV(pdv.ID);
                if (index >= 0 && result.Count > 0)
                {
                    if (result[index].listTypePdv.FindIndex(ListTypePDV => (ListTypePDV.IdVisita.Equals(infoPdv.IdVisita))) < 0)
                    {
                        result[index].listTypePdv.Add(infoPdv);
                    }
                }
                else
                {
                    var justificativaTextView = new TextView(this)
                    {
                        Text = Resources.GetString(Resource.String.justificativa_card)
                    };
                    justificativaTextView.Click += delegate { };

                    var checkIn = new TextView(this)
                    {
                        Text = Resources.GetString(Resource.String.check_in_card)
                    };
                    checkIn.Click += delegate { };
                    var itemCard = new CardMenuPDVsModel(itemLoja, pdv.LAT_PDV, pdv.LONG_PDV, itemEndereco,
                                                         Resources.GetString(Resource.String.justificar_card), HandleClickJustificativa,
                                                         Resources.GetString(Resource.String.check_in_card), HandleClickCheckIN,
                                                         Resources.GetString(Resource.String.map_card), HandleClickMap, infoPdv);
                    result.Add(itemCard);
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
        void PopulatePdvs()
        {
            feedCollection.Pdvs = new List <Pdv>();

            var onde = controllerPCL.VisitasPendentes();

            foreach (var item in controllerPCL.VisitasPendentes())
            {
                var    fullGeoPT = item.ENDERECO.Split('\n');
                string id        = item.ID;
                double lat       = item.LAT;
                double longi     = item.LONG;
                var    cell      = new Pdv
                {
                    listTypePdv = new List <ListTypePDV>(),
                    NomePDV     = fullGeoPT[0].Split('-')[1].Trim(),
                    Endereco    = (fullGeoPT[1] + " " + fullGeoPT[2].Replace(" - CEP:", ", CEP:"))
                };
                var index = feedCollection.Pdvs.FindIndex(Pdv => (Pdv.NomePDV.ToUpper().Equals(cell.NomePDV.ToUpper()) &&
                                                                  Pdv.Endereco.ToUpper().Equals(cell.Endereco.ToUpper())));

                var infoPdv = new ListTypePDV(id);
                if (index >= 0 && feedCollection.Pdvs.Count > 0)
                {
                    if (feedCollection.Pdvs[index].listTypePdv.FindIndex(ListTypePDV => (ListTypePDV.IdVisita.Equals(infoPdv.IdVisita))) < 0)
                    {
                        feedCollection.Pdvs[index].listTypePdv.Add(infoPdv);
                    }
                }
                else
                {
                    cell.listTypePdv.Add(infoPdv);
                    cell.Lat            = lat;
                    cell.Longi          = longi;
                    cell.IdVisita       = id;
                    cell.Justificativa += Justificativa();
                    cell.CheckIn       += CheckIn();
                    cell.MapsExec      += ExecMaps();
                    feedCollection.Pdvs.Add(cell);
                }
            }
            InvokeOnMainThread(() => collecFeedPdv.ReloadData());
        }