示例#1
0
        private void btnStartTask_Click(object sender, EventArgs e)
        {
            pgbMergeFiles.Visible = true;
            lblProgress.Visible   = true;
            btnStartTask.Enabled  = false;
            btnExit.Enabled       = false;
            int   master_id = (int)cboMasterFile.SelectedValue;
            merge task      = new merge(_dttExcelFiles, master_id);

            pgbMergeFiles.Minimum = 0;
            pgbMergeFiles.Maximum = task.Final;
            task.cambioPosic     += new merge.cambioPosHandler(DB_cambioPosic);
            if (task.mergeData(txtProjectPath.Text, txtMasterFile.Text, txtProjectPrefix.Text))
            {
                //if task runs properly then send the email if it is checked
                if (chkSendEmail.Checked)
                {
                    dbConfig mailSettings = new dbConfig();
                    mailSettings.getMailconfig();
                    emailAdmin eMail        = new emailAdmin(mailSettings.Host, mailSettings.Port, mailSettings.User, mailSettings.Password, mailSettings.Sender, mailSettings.enableSSL);
                    string     fileAttached = this.txtProjectPath.Text + '\\' + this.txtMasterFile.Text;
                    eMail.sendEmail(this.txtEmail.Text, this.txtMasterFile.Text, _MESSSAGE, fileAttached);
                }
            }
            //Show the errMsg anyway
            MessageBox.Show(task.errMsg);
            pgbMergeFiles.Visible = false;
            lblProgress.Visible   = false;
            btnStartTask.Enabled  = true;
            btnExit.Enabled       = true;
        }
示例#2
0
        private void btnOpenPath_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog flb = new FolderBrowserDialog();

            //*******************************************
            if (flb.ShowDialog() == DialogResult.OK)
            {
                string sPath      = flb.SelectedPath;
                int    index      = sPath.LastIndexOf('\\');
                string folderName = sPath.Substring(index + 1);
                txtProjectPath.Text   = sPath;
                txtProjectPrefix.Text = folderName;

                int   master_id = (int)cboMasterFile.SelectedValue;
                merge task      = new merge(folderName, master_id);
                txtMasterFile.Text = task.masterFile;
            }
        }