private async void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            MetroDialogSettings yx = new MetroDialogSettings();
            MessageDialogResult xy = new MessageDialogResult();

            x = "";
            yx.AffirmativeButtonText = "Show Records";
begin:
            x = await this.ShowInputAsync("Enter Farmer Number", "Please enter the Farmer Number of the Farmer you wish to see reports for", yx);

            x = checkNumber(x);
            if (x == "")
            {
                xy = await this.ShowMessageAsync("Entry Error", "You have entered nothing or an Invalid entry, Press Ok to enter correct Farmer Number or Cancel to Quit ", MessageDialogStyle.AffirmativeAndNegative, null);

                if (xy.ToString() != "Negative")
                {
                    goto begin;
                }
                else
                {
                    this.Close();
                }
            }

            deliveryGrid.ItemsSource = LoadCollectionData();
        }
Exemple #2
0
        // various use of the Metro popup
        private async void Message_ClickAsync(object sender, RoutedEventArgs e)
        {
            MessageDialogResult res = await this.ShowMessageAsync("Hey, Listen!", "These are just some controls to take up space :)",
                                                                  MessageDialogStyle.AffirmativeAndNegative);

            if (res == MessageDialogResult.Affirmative)
            {
                await this.ShowMessageAsync("You clicked OK! ", res.ToString());
            }
        }
Exemple #3
0
        public async void NewButton()
        {
            MetroWindow         appWindow = (System.Windows.Application.Current.MainWindow as MetroWindow);
            MessageDialogResult result    = await appWindow.ShowMessageAsync("Confirm", "Are you sure you want to create a new file?", MessageDialogStyle.AffirmativeAndNegative);

            if (result.ToString() == "Affirmative")
            {
                _eventAggregator.BeginPublishOnUIThread(new EventAggregators.SendMessage("newFile", null));
            }
        }
Exemple #4
0
        private async void AddDelivery_Click(object sender, RoutedEventArgs e)
        {
            Connection cn         = new Connection();
            String     DeliveryID = IdGen();
            float      Loaded     = float.Parse(loadedmilk.Text);
            float      UnLoaded   = 0;
            float      Deficit    = Loaded - UnLoaded;
            String     Supplier   = suppliercombo.SelectedItem.ToString();
            String     DelVehicle = Vehicle.Text;
            String     DOD        = DateTime.Now.ToShortDateString();
            String     driver     = Driver.Text;
            String     conductor  = Conductor.Text;
            String     StaffName  = staffcombo.SelectedItem.ToString();
            Utilities  f          = new Utilities();

            try
            {
                //MessageBox.Show(cn.connectionString);
                cn.connect();
                cn.cmd.Connection = cn.cnn;
                cn.cmd.Connection.Open();
                cn.cmd.CommandText = "INSERT INTO MilkCreameryDelivery(DeliveryID,Date,timeofday,Litres_loaded,Litres_Unloaded,Deficit,Loader,Driver,Conductor,Vehicle,Supplier,Delivered) VALUES('" + DeliveryID + "','" + DOD + "','" + f.TimeOfDay() + "','" + Loaded + "','" + UnLoaded + "','" + Deficit + "','" + StaffName + "','" + driver + "','" + conductor + "','" + DelVehicle + "','" + Supplier + "','0')";

                cn.cmd.ExecuteNonQuery();
                MessageDialogResult x = new MessageDialogResult();
                MetroDialogSettings y = new MetroDialogSettings();
                y.AffirmativeButtonText = "Go to Delivery Tab";
                y.NegativeButtonText    = "Close";

                x = await this.ShowMessageAsync("Delivery Added", "You have Added the Delivery Successfuly. Upon return, the Transporter(" + Supplier + ") Must enter milk unloaded at the creamery in the next Tab", MessageDialogStyle.AffirmativeAndNegative, y);

                if (x.ToString() == "Negative")
                {
                    this.Close();
                }
                else
                {
                    loadEdatCoop.IsEnabled = false;
                    fillTodayDelivery();
                    tabC.SelectedIndex = 1;
                }
                //farmerDatagrid.ItemsSource = LoadCollectionData();
                //ViewFarmersTab.BringIntoView();
                // clearRegFields();
            }
            catch (Exception ex)
            {
                displayMetroError(ex);
            }
        }
Exemple #5
0
        private async void displayNoTask()
        {
            MessageDialogResult ex = new MessageDialogResult();
            MetroDialogSettings yx = new MetroDialogSettings();

            yx.AffirmativeButtonText = "Quit";


            await this.ShowMessageAsync("All Tasks Done", "All Milk has Been Loaded and Delivered. No other Milk Delivery transactions are available at this moment.", MessageDialogStyle.Affirmative, yx);

            if (ex.ToString() == "Negative")
            {
                this.Close();
            }
        }
Exemple #6
0
        public async void LoadButton()
        {
            MetroWindow         appWindow = (System.Windows.Application.Current.MainWindow as MetroWindow);
            MessageDialogResult result    = await appWindow.ShowMessageAsync("Confirm", "You may have changes which have not been saved.\r\nAre you sure you want to load a new file?", MessageDialogStyle.AffirmativeAndNegative);

            if (result.ToString() == "Affirmative")
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = "XML Files (*.xml)|*.xml";
                if (ofd.ShowDialog() == true)
                {
                    _eventAggregator.BeginPublishOnUIThread(new EventAggregators.SendMessage("loadFile", ofd.FileName));
                }
            }
        }
Exemple #7
0
        private async void UpdateDb_Click(object sender, RoutedEventArgs e)
        {
            //MessageBox.Show(Unloaded.Value.ToString());
            if (Unloaded.Value != 0)
            {
                Double loaded   = double.Parse(loadedmilk1.Text);
                Double unloaded = double.Parse(Unloaded.Value.ToString());
                Double Deficit  = loaded - unloaded;

                if (Deficit < 3.0)
                {
                    Deficit = 0;
                }
                Connection cn = new Connection();
                try{
                    cn.connect();
                    cn.cmd.Connection = cn.cnn;
                    cn.cmd.Connection.Open();
                    cn.cmd.CommandText = "update MilkCreameryDelivery Set Litres_Unloaded='" + unloaded + "', Deficit='" + Deficit + "',Delivered='True' WHERE DATE='" + DateTime.Now.ToShortDateString() + "'";

                    cn.cmd.ExecuteScalar();
                    MessageDialogResult x = new MessageDialogResult();
                    MetroDialogSettings y = new MetroDialogSettings();
                    y.AffirmativeButtonText = "Quit";

                    await this.ShowMessageAsync("Delivery Confirmed", "You have updated the Delivery Successfuly.", MessageDialogStyle.Affirmative, y);

                    if (x.ToString() == "Negative")
                    {
                        this.Close();
                    }
                    //farmerDatagrid.ItemsSource = LoadCollectionData();
                    //ViewFarmersTab.BringIntoView();
                    // clearRegFields();
                }
                catch (Exception ex)
                {
                    displayMetroError(ex);
                    //ShowOverlay();
                    //MessageBox.Show("Registration has Failed! The following Message was generated to explain why \n \n"+ex.Message+"\n \n"+ex.InnerException,"Registration Failure",MessageBoxButton.OK,MessageBoxImage.Error);
                    //HideOverlay();
                }
            }
            else
            {
                Unloaded.Focus();
            }
        }
        private async void share(UserFileModel file)
        {
            bool result = await Utils.NetUtils.shareFile(file.id);

            if (result)
            {
                MessageDialogResult msg = await((MetroWindow)System.Windows.Application.Current.MainWindow)
                                          .ShowMessageAsync("Success!", "已分享,链接为" + App.URL + "/shared/" + file.id + " 点击确认复制链接", MessageDialogStyle.AffirmativeAndNegative);

                if ("Affirmative".Equals(msg.ToString()))
                {
                    System.Windows.Forms.Clipboard.SetDataObject(App.URL + "/shared/" + file.id);
                }
            }
            else
            {
                showAlertDialog("分享失败!");
            }
        }
Exemple #9
0
        private async void BtDelete_Click(object sender, RoutedEventArgs e)
        {
            var mySettings = new MetroDialogSettings()
            {
                AffirmativeButtonText    = "Ano",
                NegativeButtonText       = "Ne",
                FirstAuxiliaryButtonText = "Cancel",
            };
            MessageDialogResult result = await this.ShowMessageAsync("Smazat?", "Opravdu smazat formulář o poruše?! ",
                                                                     MessageDialogStyle.AffirmativeAndNegative, mySettings);

            if (result.ToString() == "Negative")
            {
                return;
            }
            else
            {
                cleanForm();
            }
        }
        private async void delete()
        {
            MessageDialogResult msg = await((MetroWindow)System.Windows.Application.Current.MainWindow)
                                      .ShowMessageAsync("Delete the folder?", "You are trying to delete " + ChoosenFile.file_name, MessageDialogStyle.AffirmativeAndNegative);

            if ("Affirmative".Equals(msg.ToString()))
            {
                bool result = await Utils.NetUtils.deleteFolder(_choosenFile.id);

                if (result)
                {
                    IsDetailedInfoOpen = false;
                    refresh();
                }
                else
                {
                    await((MetroWindow)System.Windows.Application.Current.MainWindow).ShowMessageAsync("ERROR", "An error occurred");
                }
            }
        }
        private async void displayNoTask()
        {
            MessageDialogResult ex=new MessageDialogResult();
            MetroDialogSettings yx = new MetroDialogSettings();
            yx.AffirmativeButtonText = "Quit";


            await this.ShowMessageAsync("All Tasks Done","All Milk has Been Loaded and Delivered. No other Milk Delivery transactions are available at this moment.",MessageDialogStyle.Affirmative,yx);
            
            if (ex.ToString() == "Negative")
            { 
                this.Close();
            }
        }
        private async void UpdateDb_Click(object sender, RoutedEventArgs e)
        {
            //MessageBox.Show(Unloaded.Value.ToString());
            if (Unloaded.Value != 0)
            {
       
            Double loaded=double.Parse(loadedmilk1.Text);
            Double unloaded = double.Parse(Unloaded.Value.ToString());
            Double Deficit = loaded - unloaded;
            
            if (Deficit<3.0)
            {
                Deficit=0;
            }
             Connection cn = new Connection();
             try{
                 cn.connect();
                cn.cmd.Connection = cn.cnn;
                cn.cmd.Connection.Open();
                cn.cmd.CommandText = "update MilkCreameryDelivery Set Litres_Unloaded='"+unloaded+"', Deficit='"+Deficit+"',Delivered='True' WHERE DATE='"+DateTime.Now.ToShortDateString()+"'";

                cn.cmd.ExecuteScalar();
                MessageDialogResult x = new MessageDialogResult();
                MetroDialogSettings y = new MetroDialogSettings();
                y.AffirmativeButtonText = "Quit";
              
                 await this.ShowMessageAsync("Delivery Confirmed", "You have updated the Delivery Successfuly.", MessageDialogStyle.Affirmative, y);
               if (x.ToString() == "Negative")
                {
                    this.Close();

                }
                //farmerDatagrid.ItemsSource = LoadCollectionData();
                //ViewFarmersTab.BringIntoView();
               // clearRegFields();
            }
            catch (Exception ex)
            {
                displayMetroError(ex);
                //ShowOverlay();
                //MessageBox.Show("Registration has Failed! The following Message was generated to explain why \n \n"+ex.Message+"\n \n"+ex.InnerException,"Registration Failure",MessageBoxButton.OK,MessageBoxImage.Error);
                //HideOverlay();
            }
            }
            else
            {
                Unloaded.Focus();
            }
        }
        private async void AddDelivery_Click(object sender, RoutedEventArgs e)
        {
             Connection cn = new Connection();
            String DeliveryID = IdGen();
            float Loaded=float.Parse(loadedmilk.Text);
            float UnLoaded = 0;
            float Deficit=Loaded-UnLoaded;
             String Supplier =suppliercombo.SelectedItem.ToString();
             String DelVehicle = Vehicle.Text;
            String DOD=DateTime.Now.ToShortDateString();
            String driver=Driver.Text;
            String conductor = Conductor.Text;
            String StaffName=staffcombo.SelectedItem.ToString();
            Utilities f = new Utilities();
          try
            {
                //MessageBox.Show(cn.connectionString);
                cn.connect();
                cn.cmd.Connection = cn.cnn;
                cn.cmd.Connection.Open();
                cn.cmd.CommandText = "INSERT INTO MilkCreameryDelivery(DeliveryID,Date,timeofday,Litres_loaded,Litres_Unloaded,Deficit,Loader,Driver,Conductor,Vehicle,Supplier,Delivered) VALUES('" + DeliveryID + "','" + DOD + "','"+f.TimeOfDay()+"','" + Loaded + "','" + UnLoaded + "','" + Deficit + "','" + StaffName + "','" + driver + "','" + conductor + "','" + DelVehicle + "','" + Supplier + "','0')";
                
                cn.cmd.ExecuteNonQuery();
                MessageDialogResult x = new MessageDialogResult();
                MetroDialogSettings y = new MetroDialogSettings();
                y.AffirmativeButtonText = "Go to Delivery Tab";
                y.NegativeButtonText = "Close";

               x= await this.ShowMessageAsync("Delivery Added", "You have Added the Delivery Successfuly. Upon return, the Transporter("+Supplier+") Must enter milk unloaded at the creamery in the next Tab", MessageDialogStyle.AffirmativeAndNegative, y);
               if (x.ToString() == "Negative")
               {
                   this.Close();

               }
               else
               {
                   
                   loadEdatCoop.IsEnabled = false;
                   fillTodayDelivery();
                   tabC.SelectedIndex = 1;
               }
                //farmerDatagrid.ItemsSource = LoadCollectionData();
                //ViewFarmersTab.BringIntoView();
               // clearRegFields();
            }
          catch (Exception ex)
            {
                displayMetroError(ex);
            }
        }
        private async void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {

            MetroDialogSettings yx = new MetroDialogSettings();
            MessageDialogResult xy = new MessageDialogResult();
          x = "";
            yx.AffirmativeButtonText = "Show Records";
        begin:
            x = await this.ShowInputAsync("Enter Farmer Number", "Please enter the Farmer Number of the Farmer you wish to see reports for", yx);
            x = checkNumber(x);
            if (x == "")
            {
                xy = await this.ShowMessageAsync("Entry Error", "You have entered nothing or an Invalid entry, Press Ok to enter correct Farmer Number or Cancel to Quit ", MessageDialogStyle.AffirmativeAndNegative, null);
                if (xy.ToString() != "Negative")
                    goto begin;
                else
                    this.Close();
            }
          
            deliveryGrid.ItemsSource = LoadCollectionData();
        }
 public static string GetMessageButtonText(MessageDialogResult button, IDictionary<MessageDialogResult, string> buttonTextMap)
 {
     string str;
     if ((buttonTextMap != null) && buttonTextMap.TryGetValue(button, out str))
     {
         return str;
     }
     return Resources.ResourceManager.GetString("sMessageButton" + button.ToString());
 }