Example #1
0
        private void exportDptButton_Click(object sender, EventArgs e)
        {
            var fd = new FolderBrowserDialog();

            //fd.InitialDirectory = System.Environment.CurrentDirectory;
            //fd.Title = "Please select file to import.";
            if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string exportDPTname = "DPTstatus.csv";

                string          selectedPath = fd.SelectedPath;
                bool            isSuccessful = true;
                string          msg          = "";
                dbDPTController dbDpt        = new dbDPTController();
                string          pathDpt      = selectedPath + @"\" + exportDPTname;
                //Cek apakah berhasil export mwawm
                isSuccessful &= dbDpt.exportCSVdpt(pathDpt);
                if (isSuccessful)
                {
                    msg += "Export Successful!\n";
                    msg += "File Exported to: " + selectedPath + "\n";
                    msg += "File name: " + exportDPTname;
                }

                MessageBox.Show(msg);
            }
        }
Example #2
0
        private void exportButton_Click(object sender, EventArgs e)
        {
            for (int i = 1; i <= nPasswords; i++)
            {
                BukaKunci bk = new BukaKunci(i);
                bk.ShowDialog();
                if (bk.getIsCancel())
                {
                    break;
                }
                else if (i == nPasswords && bk.getIsPasswordTrue())
                {
                    var fd = new FolderBrowserDialog();
                    //fd.InitialDirectory = System.Environment.CurrentDirectory;
                    //fd.Title = "Please select file to import.";
                    if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        string selectedPath = fd.SelectedPath;

                        string exportKMname    = "KMresults.csv";
                        string exportMWAWMname = "MWAWMresults.csv";

                        bool            isSuccessful = true;
                        string          msg          = "";
                        dbDPTController dbDpt        = new dbDPTController();
                        string          pathKM       = selectedPath + @"\" + exportKMname;
                        //Cek apakah berhasil export km
                        isSuccessful &= dbDpt.exportCSVkm(pathKM);
                        string pathMWAWM = selectedPath + @"\" + exportMWAWMname;
                        //Cek apakah berhasil export mwawm
                        isSuccessful &= dbDpt.exportCSVmwawm(pathMWAWM);
                        if (isSuccessful)
                        {
                            msg += "Export Successful!\n";
                            msg += "File Exported to: " + selectedPath + "\n";
                            msg += "File names: " + exportKMname + " and " + exportMWAWMname;
                        }

                        MessageBox.Show(msg);
                        //this.Close();
                    }
                }
            }
        }
Example #3
0
        private void okButton_Click(object sender, EventArgs e)
        {
            bool   isValid = true;
            string errMsg  = "Wrong Passwords:\n";

            if (password1TB.Text != passwords[0])
            {
                isValid = false;
                errMsg += "password 1\n";
            }
            if (password2TB.Text != passwords[1])
            {
                isValid = false;
                errMsg += "password 2\n";
            }
            if (password3TB.Text != passwords[2])
            {
                isValid = false;
                errMsg += "password 3\n";
            }
            if (password4TB.Text != passwords[3])
            {
                isValid = false;
                errMsg += "password 4\n";
            }
            if (password5TB.Text != passwords[4])
            {
                isValid = false;
                errMsg += "password 5\n";
            }

            if (isValid)
            {
                var fd = new FolderBrowserDialog();
                //fd.InitialDirectory = System.Environment.CurrentDirectory;
                //fd.Title = "Please select file to import.";
                if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string selectedPath = fd.SelectedPath;

                    bool            isSuccessful = true;
                    string          msg          = "";
                    dbDPTController dbDpt        = new dbDPTController();
                    string          pathKM       = selectedPath + @"\exportKM.csv";
                    //Cek apakah berhasil export km
                    isSuccessful &= dbDpt.exportCSVkm(pathKM);
                    string pathMWAWM = selectedPath + @"\exportMWAWM.csv";
                    //Cek apakah berhasil export mwawm
                    isSuccessful &= dbDpt.exportCSVmwawm(pathMWAWM);
                    if (isSuccessful)
                    {
                        msg += "Export Successful!\n";
                        msg += "File Exported to: " + selectedPath + "\n";
                        msg += "File names: exportKM.csv and exportMWAWM.csv";
                    }

                    MessageBox.Show(msg);
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show(errMsg);
            }
        }