Exemple #1
0
        private void cms_Modify_Click(object sender, EventArgs e)
        {
            if (dgvSch.Rows.Count == 0)
            {
                return;
            }
            if (dgvSch.SelectedRows.Count == 0)
            {
                return;
            }
            try
            {
                int    iRowidx = dgvSch.SelectedCells[0].RowIndex;
                string Status  = dgvSch.Rows[iRowidx].Cells["Status"].Value.ToString();
                if (Status != "Disabled" && Status != "Waiting" && Status.StartsWith("Error:") == false)
                {
                    MessageBox.Show("This schedule is running now, please wait until it's finish", "Modify Schedule", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                string        name    = dgvSch.Rows[iRowidx].Cells["ScheduleName"].Value.ToString();
                string        profile = dgvSch.Rows[iRowidx].Cells["SiteProfile"].Value.ToString();
                frmSchSetting fss     = new frmSchSetting(name, profile);
                fss.ShowDialog();

                //更新返回结果
                if (fss.Cancel == "N")
                {
                    foreach (DataGridViewRow dgvr in dgvSch.Rows)
                    {
                        if (dgvr.Cells["ScheduleName"].Value.ToString() == name)
                        {
                            dgvr.Cells["StartTime"].Value   = fss.StartRunTimeRtn;
                            dgvr.Cells["LastRunTime"].Value = fss.StartRunTimeRtn;
                            dgvr.Cells["Repeat"].Value      = fss.RepeatRtn;
                            dgvr.Cells["NextRunTime"].Value = (Convert.ToDateTime(fss.StartRunTimeRtn).AddMinutes(Convert.ToInt32(fss.RepeatRtn))).ToString("yyyy-MM-dd HH:mm");
                            if (fss.StatusRtn == "Y")
                            {
                                dgvr.Cells["Status"].Value = "Waiting";
                            }
                            else
                            {
                                dgvr.Cells["Status"].Value = "Disabled";
                            }
                            dgvr.Cells["Mail"].Value           = fss.Mail;
                            dgvr.Cells["SuccessfulMail"].Value = fss.SuccessfulMail;
                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "FTP Tool", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        private void cms_AddNewSch_Click(object sender, EventArgs e)
        {
            try
            {
                frmSchSetting fss = new frmSchSetting("", "");
                fss.ShowDialog();

                //更新返回结果
                if (fss.Cancel == "N")
                {
                    dgvSch.Rows.Add(fss.SchNameRtn, fss.SiteProfileRtn, fss.StartRunTimeRtn, fss.StartRunTimeRtn, "0",
                                    (Convert.ToDateTime(fss.StartRunTimeRtn).AddMinutes(Convert.ToInt32(fss.RepeatRtn))).ToString("yyyy-MM-dd HH:mm"),
                                    fss.RepeatRtn, (fss.StatusRtn == "Y") ? "Waiting" : "Disabled");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "FTP Tool", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }