Exemple #1
0
        /// <summary>
        /// LoadCollectors
        /// </summary>
        private void LoadCollectors()
        {
            IList <CollectorModel> model = new List <CollectorModel>();

            collectorProvider = new CollectorService.Provider();

            var collectors = collectorProvider.RetrieveCollectors();

            foreach (var collector in collectors)
            {
                var frequency = collectorProvider.RetrieveFrequency(collector.Id);

                model.Add(new CollectorModel
                {
                    Name            = collector.Name,
                    Address         = collector.Address,
                    Mobile          = collector.Mobile,
                    Ward            = collector.Ward,
                    PickupFrequency = frequency.PickupFrequency,
                    FrequencyType   = frequency.FrequencyType,
                    SlotFrom1       = frequency.SlotFrom1,
                    SlotTo1         = frequency.SlotTo1,
                    SlotFrom2       = frequency.SlotFrom2,
                    SlotTo2         = frequency.SlotTo2,
                    SlotFrom3       = frequency.SlotFrom3,
                    SlotTo3         = frequency.SlotTo3,
                    Capacity        = frequency.Capacity,
                    LastUpdateDate  = frequency.LastUpdateDate
                });
            }

            gridControlCollectors.DataSource = model;
        }
Exemple #2
0
        /// <summary>
        /// Submit Button Save Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            int pickupFrequency = 1;

            if (comboBoxPickupFrequency.SelectedItem.ToString() == "Once in a day")
            {
                pickupFrequency = 1;
            }
            else if (comboBoxPickupFrequency.SelectedItem.ToString() == "Twice in a day")
            {
                pickupFrequency = 2;
            }
            else if (comboBoxPickupFrequency.SelectedItem.ToString() == "Thrice in a day")
            {
                pickupFrequency = 3;
            }

            provider = new CollectorService.Provider();
            provider.InsertCollector(txtName.Text, txtAddress.Text, comboBoxWard.SelectedItem.ToString().Trim(), txtMobile.Text,
                                     txtPassword.Text, pickupFrequency, Convert.ToInt32(txtFrequencyType.Text), Convert.ToInt32(txtCapacity.Text),
                                     txtSlotFrom1.Text + "|" + txtSlotFrom2.Text + "|" + txtSlotFrom3.Text,
                                     txtSlotTo1.Text + "|" + txtSlotTo2.Text + "|" + txtSlotTo3.Text, comboBoxGarbageType.SelectedItem.ToString().Trim(), dateTimeLastCollection.Value);

            this.Close();

            MessageBox.Show("Inserted successfully!");

            ClearControls();
        }
Exemple #3
0
        /// <summary>
        /// Submit Button Save Event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            int pickupFrequency = 1;

            if (comboBoxPickupFrequency.SelectedItem.ToString() == "Once in a day")
            {
                pickupFrequency = 1;
            }
            else if (comboBoxPickupFrequency.SelectedItem.ToString() == "Twice in a day")
            {
                pickupFrequency = 2;
            }
            else if (comboBoxPickupFrequency.SelectedItem.ToString() == "Thrice in a day")
            {
                pickupFrequency = 3;
            }

            provider = new CollectorService.Provider();
            provider.InsertCollector(txtName.Text, txtAddress.Text, comboBoxWard.SelectedItem.ToString().Trim(), txtMobile.Text,
                txtPassword.Text, pickupFrequency, Convert.ToInt32(txtFrequencyType.Text), Convert.ToInt32(txtCapacity.Text),
                txtSlotFrom1.Text + "|" + txtSlotFrom2.Text + "|" + txtSlotFrom3.Text,
                txtSlotTo1.Text + "|" + txtSlotTo2.Text + "|" + txtSlotTo3.Text, comboBoxGarbageType.SelectedItem.ToString().Trim(), dateTimeLastCollection.Value);

            this.Close();

            MessageBox.Show("Inserted successfully!");

            ClearControls();
        }
        public IList<string> GetCollector(string key1, string key2)
        {
            CollectorService.Provider provider = new CollectorService.Provider();
            Guid collectorId = Guid.Parse(key1);
            string mobile = key2;

            return provider.RetrieveRequest(collectorId);
        }
Exemple #5
0
        public IList <string> GetCollector(string key1, string key2)
        {
            CollectorService.Provider provider = new CollectorService.Provider();
            Guid   collectorId = Guid.Parse(key1);
            string mobile      = key2;

            return(provider.RetrieveRequest(collectorId));
        }
Exemple #6
0
        /// <summary>
        /// Load Collectors
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateCollector_Load(object sender, EventArgs e)
        {
            comboBoxPickupFrequency.SelectedIndex = 0;

            provider = new CollectorService.Provider();
            comboBoxWard.DataSource        = provider.RetrieveWards();
            comboBoxGarbageType.DataSource = provider.RetrieveGarbageTypes();
        }
Exemple #7
0
        public void StartMinuteActivity()
        {
            collectorProvider = new CollectorService.Provider();
            collectorProvider.UpdateLastCollectionTime();

            spotImageProvider = new SpotImageService.Provider();
            spotImageProvider.PostSpotImageProcess();

            recyclerProvider = new RecyclerService.Provider();
            recyclerProvider.ProcessNonComplaintUsers();
        }
        public string GetCollector(string key)
        {
            var values = key.Split('|');

            if (values.Length > 0)
            {
                CollectorService.Provider provider = new CollectorService.Provider();

                string method = values[0].ToLower();

                if (method == "authenticate")
                {
                    string mobile = values[1];
                    string password = values[2];
                    return provider.RetrieveCollector(mobile, password).ToString();
                }
                else if (method == "sp")
                {
                    string data = values[1];
                    string garbageType = values[2];
                    int quantity = Convert.ToInt32(values[3]);
                    bool donateGarbage = Convert.ToBoolean(values[4]);

                    string scheduleTime = "";
                    if (values.Length > 5 && values[5] != null)
                    {
                        scheduleTime = values[5];
                    }

                    return provider.SchedulePickup(data, garbageType, quantity, donateGarbage, scheduleTime);
                }
                else if (method == "rcd")
                {
                    string data = values[1];
                    return provider.RetrieveCollectorDates(data);
                }
                else if (method == "rct")
                {
                    string data = values[1];
                    return provider.RetrieveCollectorTimes(data);
                }
                else if (method == "rr")
                {
                    string requestNumber = values[1];
                    return provider.RetrieveRequest(requestNumber);
                }
            }

            return "Error, Not Found!";
        }
Exemple #9
0
        public string GetCollector(string key)
        {
            var values = key.Split('|');

            if (values.Length > 0)
            {
                CollectorService.Provider provider = new CollectorService.Provider();

                string method = values[0].ToLower();

                if (method == "authenticate")
                {
                    string mobile   = values[1];
                    string password = values[2];
                    return(provider.RetrieveCollector(mobile, password).ToString());
                }
                else if (method == "sp")
                {
                    string data          = values[1];
                    string garbageType   = values[2];
                    int    quantity      = Convert.ToInt32(values[3]);
                    bool   donateGarbage = Convert.ToBoolean(values[4]);

                    string scheduleTime = "";
                    if (values.Length > 5 && values[5] != null)
                    {
                        scheduleTime = values[5];
                    }

                    return(provider.SchedulePickup(data, garbageType, quantity, donateGarbage, scheduleTime));
                }
                else if (method == "rcd")
                {
                    string data = values[1];
                    return(provider.RetrieveCollectorDates(data));
                }
                else if (method == "rct")
                {
                    string data = values[1];
                    return(provider.RetrieveCollectorTimes(data));
                }
                else if (method == "rr")
                {
                    string requestNumber = values[1];
                    return(provider.RetrieveRequest(requestNumber));
                }
            }

            return("Error, Not Found!");
        }
Exemple #10
0
        /// <summary>
        /// linkDelete_LinkClicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void linkDelete_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (tabControlMain.SelectedTabPage == tabControlCollector)
            {
                int[] selectedRows = gridViewCollectors.GetSelectedRows();

                foreach (var row in selectedRows)
                {
                    var collector = gridViewCollectors.GetRow(row);
                    collectorProvider = new CollectorService.Provider();
                    collectorProvider.DeleteCollector(((CollectorModel)collector).Mobile);
                }

                LoadCollectors();
                gridControlCollectors.Refresh();
            }
            else if (tabControlMain.SelectedTabPage == tabControlRecycler)
            {
                int[] selectedRows = gridViewRecyclers.GetSelectedRows();

                foreach (var row in selectedRows)
                {
                    var recycler = gridViewRecyclers.GetRow(row);
                    recyclerProvider = new RecyclerService.Provider();
                    recyclerProvider.DeleteRecycler(((RecyclerModel)recycler).Mobile);
                }

                LoadRecyclers();
                gridControlRecyclers.Refresh();
            }
            else if (tabControlMain.SelectedTabPage == tabControlSpotImages)
            {
                int[] selectedRows = gridViewSpotImages.GetSelectedRows();

                foreach (var row in selectedRows)
                {
                    var spotImage = gridViewSpotImages.GetRow(row);
                    spotImageProvider = new SpotImageService.Provider();
                    spotImageProvider.DeleteSpotImage(((SpotImageModel)spotImage).ImagePath);
                }

                LoadSpotImages();
                gridControlSpotImages.Refresh();
            }
            else if (tabControlMain.SelectedTabPage == tabControlEvents)
            {
                int[] selectedRows = gridViewEvents.GetSelectedRows();

                foreach (var row in selectedRows)
                {
                    var ev = gridViewEvents.GetRow(row);
                    spotImageProvider = new SpotImageService.Provider();
                    spotImageProvider.DeleteEvent(((EventModel)ev).Name);
                }

                LoadEvents();
                gridControlEvents.Refresh();
            }

            MessageBox.Show("Deleted successfully!");
        }
Exemple #11
0
        /// <summary>
        /// LoadCollectors
        /// </summary>
        private void LoadCollectors()
        {
            IList<CollectorModel> model = new List<CollectorModel>();
            collectorProvider = new CollectorService.Provider();

            var collectors = collectorProvider.RetrieveCollectors();

            foreach (var collector in collectors)
            {
                var frequency = collectorProvider.RetrieveFrequency(collector.Id);

                model.Add(new CollectorModel
                {
                    Name = collector.Name,
                    Address = collector.Address,
                    Mobile = collector.Mobile,
                    Ward = collector.Ward,
                    PickupFrequency = frequency.PickupFrequency,
                    FrequencyType = frequency.FrequencyType,
                    SlotFrom1 = frequency.SlotFrom1,
                    SlotTo1 = frequency.SlotTo1,
                    SlotFrom2 = frequency.SlotFrom2,
                    SlotTo2 = frequency.SlotTo2,
                    SlotFrom3 = frequency.SlotFrom3,
                    SlotTo3 = frequency.SlotTo3,
                    Capacity = frequency.Capacity,
                    LastUpdateDate = frequency.LastUpdateDate
                });
            }

            gridControlCollectors.DataSource = model;
        }
Exemple #12
0
 /// <summary>
 /// Window_Loaded
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     provider = new CollectorService.Provider();
     dgCollectors.ItemsSource = provider.RetrieveCollectors();
 }
Exemple #13
0
        /// <summary>
        /// Load Collectors
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateCollector_Load(object sender, EventArgs e)
        {
            comboBoxPickupFrequency.SelectedIndex = 0;

            provider = new CollectorService.Provider();
            comboBoxWard.DataSource = provider.RetrieveWards();
            comboBoxGarbageType.DataSource = provider.RetrieveGarbageTypes();
        }
Exemple #14
0
        /// <summary>
        /// linkDelete_LinkClicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void linkDelete_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (tabControlMain.SelectedTabPage == tabControlCollector)
            {
                int[] selectedRows = gridViewCollectors.GetSelectedRows();

                foreach (var row in selectedRows)
                {
                    var collector = gridViewCollectors.GetRow(row);
                    collectorProvider = new CollectorService.Provider();
                    collectorProvider.DeleteCollector(((CollectorModel)collector).Mobile);
                }

                LoadCollectors();
                gridControlCollectors.Refresh();
            }
            else if (tabControlMain.SelectedTabPage == tabControlRecycler)
            {
                int[] selectedRows = gridViewRecyclers.GetSelectedRows();

                foreach (var row in selectedRows)
                {
                    var recycler = gridViewRecyclers.GetRow(row);
                    recyclerProvider = new RecyclerService.Provider();
                    recyclerProvider.DeleteRecycler(((RecyclerModel)recycler).Mobile);
                }

                LoadRecyclers();
                gridControlRecyclers.Refresh();
            }
            else if (tabControlMain.SelectedTabPage == tabControlSpotImages)
            {
                int[] selectedRows = gridViewSpotImages.GetSelectedRows();

                foreach (var row in selectedRows)
                {
                    var spotImage = gridViewSpotImages.GetRow(row);
                    spotImageProvider = new SpotImageService.Provider();
                    spotImageProvider.DeleteSpotImage(((SpotImageModel)spotImage).ImagePath);
                }

                LoadSpotImages();
                gridControlSpotImages.Refresh();
            }
            else if (tabControlMain.SelectedTabPage == tabControlEvents)
            {
                int[] selectedRows = gridViewEvents.GetSelectedRows();

                foreach (var row in selectedRows)
                {
                    var ev = gridViewEvents.GetRow(row);
                    spotImageProvider = new SpotImageService.Provider();
                    spotImageProvider.DeleteEvent(((EventModel)ev).Name);
                }

                LoadEvents();
                gridControlEvents.Refresh();
            }

            MessageBox.Show("Deleted successfully!");
        }
 /// <summary>
 /// Window_Loaded
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     provider = new CollectorService.Provider();
     dgCollectors.ItemsSource = provider.RetrieveCollectors();
 }
Exemple #16
0
		private User getRecentUser()
		{
            string userData = File.ReadAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "/UserData.txt");
            CollectorService.Provider provider;

            if (userData != string.Empty)
            {
                provider = new CollectorService.Provider();
                string credentials = provider.RetrieveCredentials(userData.Trim());

                if (!string.IsNullOrEmpty(credentials))
                {
                    return new User()
                                 {
                                     UserName = credentials.Split(',')[0],
                                     Password = credentials.Split(',')[1],
                                     MobileNumber = userData.Trim(),
                                     ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png")
                                 };
                }
                else
                {
                    return new User()
                    {
                        UserName = "******",
                        Password = "******",
                        MobileNumber = userData.Trim(),
                        ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png")
                    };
                }
            }
            else
            {
                ConfigurationWindow configuration = new ConfigurationWindow();
                configuration.ShowDialog();

                if (configuration.Mobile != "")
                {
                    File.WriteAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "/UserData.txt", configuration.Mobile);

                    provider = new CollectorService.Provider();
                    string credentials = provider.RetrieveCredentials(configuration.Mobile.Trim());

                    if (!string.IsNullOrEmpty(credentials))
                    {
                        return new User()
                        {
                            UserName = credentials.Split(',')[0],
                            Password = credentials.Split(',')[1],
                            MobileNumber = configuration.Mobile.Trim(),
                            ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png")
                        };
                    }
                    else
                    {
                        return new User()
                        {
                            UserName = "******",
                            Password = "******",
                            MobileNumber = userData.Trim(),
                            ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png")
                        };

                    }
                }
            }

            return null;
		}
Exemple #17
0
        private User getRecentUser()
        {
            string userData = File.ReadAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "/UserData.txt");

            CollectorService.Provider provider;

            if (userData != string.Empty)
            {
                provider = new CollectorService.Provider();
                string credentials = provider.RetrieveCredentials(userData.Trim());

                if (!string.IsNullOrEmpty(credentials))
                {
                    return(new User()
                    {
                        UserName = credentials.Split(',')[0],
                        Password = credentials.Split(',')[1],
                        MobileNumber = userData.Trim(),
                        ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png")
                    });
                }
                else
                {
                    return(new User()
                    {
                        UserName = "******",
                        Password = "******",
                        MobileNumber = userData.Trim(),
                        ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png")
                    });
                }
            }
            else
            {
                ConfigurationWindow configuration = new ConfigurationWindow();
                configuration.ShowDialog();

                if (configuration.Mobile != "")
                {
                    File.WriteAllText(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "/UserData.txt", configuration.Mobile);

                    provider = new CollectorService.Provider();
                    string credentials = provider.RetrieveCredentials(configuration.Mobile.Trim());

                    if (!string.IsNullOrEmpty(credentials))
                    {
                        return(new User()
                        {
                            UserName = credentials.Split(',')[0],
                            Password = credentials.Split(',')[1],
                            MobileNumber = configuration.Mobile.Trim(),
                            ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png")
                        });
                    }
                    else
                    {
                        return(new User()
                        {
                            UserName = "******",
                            Password = "******",
                            MobileNumber = userData.Trim(),
                            ImageSourcePath = Path.Combine(userImagesPath, "DemoUser.png")
                        });
                    }
                }
            }

            return(null);
        }