private void SetSaveItemsList() { string text = this.comboBoxRepeat.Text; DateTime time = this.dateTimePickerStop.Value; DateTime time2 = this.dateTimePickerStart.Value; this.lsSaveItems.Clear(); while (time2 <= time) { ScheduleFileItem item = new ScheduleFileItem { SendStatus = string.Empty, Address = this.comboBoxGroups.Text, TextMessage = this.textBoxNewMessage.Text, SendDate = time2.ToString() }; this.lsSaveItems.Add(item); if (text == "Monthly") { time2 = time2.AddMonths(1); } else { if (text == "Weekly") { time2 = time2.AddDays(7.0); continue; } time2 = time2.AddDays(1.0); } } this.labelRepeatCount.Text = "Repeat Settings Will Create " + this.lsSaveItems.Count.ToString() + " Jobs."; }
private void SetSaveItemsList() { string text = this.comboBoxRepeat.Text; DateTime value = this.dateTimePickerStop.Value; DateTime t = this.dateTimePickerStart.Value; this.lsSaveItems.Clear(); while (t <= value) { ScheduleFileItem scheduleFileItem = new ScheduleFileItem(); scheduleFileItem.SendStatus = string.Empty; scheduleFileItem.Address = this.comboBoxGroups.Text; scheduleFileItem.TextMessage = this.textBoxNewMessage.Text; scheduleFileItem.SendDate = t.ToString(); this.lsSaveItems.Add(scheduleFileItem); if (text == "Monthly") { t = t.AddMonths(1); } else if (text == "Weekly") { t = t.AddDays(7.0); } else { t = t.AddDays(1.0); } } this.labelRepeatCount.Text = "Repeat Settings Will Create " + this.lsSaveItems.Count.ToString() + " Jobs."; }
private void buttonSave_Click(object sender, EventArgs e) { if (this.appManager.m_bGroupScheduleProcessing) { MessageBox.Show("Group Schedule Send is currently processing, please wait a moment and try again...", this.appManager.m_strApplicationName, MessageBoxButtons.OK); } else if (this.ValidateForm()) { if (this.checkBoxRepeat.Checked) { this.SetSaveItemsList(); } else { this.lsSaveItems.Clear(); ScheduleFileItem item = new ScheduleFileItem { Address = this.comboBoxGroups.Text, SendDate = this.dateTimePickerStart.Value.ToString(), TextMessage = this.textBoxNewMessage.Text, SendStatus = string.Empty }; this.lsSaveItems.Add(item); } foreach (ScheduleFileItem item2 in this.lsSaveItems) { string str = string.Empty; str = this.appManager.GroupSchedulFileAddItem(item2); if (str.Length > 0) { this.strError = this.strError + str; } } if (this.strError.Length > 0) { this.appManager.ShowBalloon("There was error saving the group schedule: " + this.strError, 5); } else { this.appManager.ShowBalloon("Your group schedule has been saved.", 5); base.Close(); this.appManager.ShowGroupSchedule(); } } }
private bool dataGridViewGroupScheduleFile_Save() { bool flag = true; try { List <ScheduleFileItem> csvRecords = new List <ScheduleFileItem>(); foreach (DataGridViewRow row in (IEnumerable)this.dataGridViewGroupScheduleFile.Rows) { if (row.Cells[0].Value == null) { break; } string str = row.Cells[0].Value.ToString(); string str2 = row.Cells[1].Value.ToString(); string str3 = row.Cells[2].Value.ToString(); string str4 = ""; if (row.Cells[3].Value != null) { str4 = row.Cells[3].Value.ToString(); } ScheduleFileItem validateItem = new ScheduleFileItem { Address = str, SendDate = str2, TextMessage = str3, SendStatus = str4 }; validateItem = this.appManager.GroupScheduleFileValidateItem(validateItem); csvRecords.Add(validateItem); } this.appManager.GroupSchedulFileSave(csvRecords); this.dataGridViewGroupScheduleFile_Load(); } catch (Exception exception) { this.strError = "dataGridViewGroupScheduleFile_Save error: " + exception.Message; flag = false; } return(flag); }
private bool dataGridViewGroupScheduleFile_Save() { bool result = true; try { List <ScheduleFileItem> list = new List <ScheduleFileItem>(); foreach (DataGridViewRow dataGridViewRow in ((IEnumerable)this.dataGridViewGroupScheduleFile.Rows)) { if (dataGridViewRow.Cells[0].Value == null) { break; } string address = dataGridViewRow.Cells[0].Value.ToString(); string sendDate = dataGridViewRow.Cells[1].Value.ToString(); string textMessage = dataGridViewRow.Cells[2].Value.ToString(); string sendStatus = ""; if (dataGridViewRow.Cells[3].Value != null) { sendStatus = dataGridViewRow.Cells[3].Value.ToString(); } ScheduleFileItem scheduleFileItem = new ScheduleFileItem(); scheduleFileItem.Address = address; scheduleFileItem.SendDate = sendDate; scheduleFileItem.TextMessage = textMessage; scheduleFileItem.SendStatus = sendStatus; scheduleFileItem = this.appManager.GroupScheduleFileValidateItem(scheduleFileItem); list.Add(scheduleFileItem); } this.appManager.GroupSchedulFileSave(list); this.dataGridViewGroupScheduleFile_Load(); } catch (Exception ex) { this.strError = "dataGridViewGroupScheduleFile_Save error: " + ex.Message; result = false; } return(result); }