private void btnGenerateTestData_Click(object sender, EventArgs e) { DataTable dt = this.dataGridView1.DataSource as DataTable; if (dt == null) { MessageBox.Show("加载数据不存在,请加载Excel或者Txt数据文件"); return; } ChannelSendSettings channelSetting = this.ucChannelParams1.ChannelSetting; if (rbLoadDataSend.Checked) { channelSetting.ParamsLinkidValue = dt.Columns[0].ColumnName; channelSetting.ParamsMobileValue = dt.Columns[1].ColumnName; channelSetting.ParamsMoValue = dt.Columns[2].ColumnName; channelSetting.ParamsSPCodeValue = dt.Columns[3].ColumnName; } if (sfdSendText.ShowDialog() == DialogResult.OK) { List <UrlSendTask> sendTasks = channelSetting.GenerateSendUrls(dt); using (StreamWriter sw = new StreamWriter(sfdSendText.FileName)) { foreach (UrlSendTask urlSendTask in sendTasks) { sw.WriteLine(urlSendTask.ToFileLine()); } } } }
private void btnSendData_Click(object sender, EventArgs e) { DataTable dt = this.dataGridView1.DataSource as DataTable; if (dt == null) { MessageBox.Show("加载数据存在"); return; } ChannelSendSettings channelSetting = this.ucChannelParams1.ChannelSetting; frmSendData sendData = new frmSendData(); sendData.ShowSendData(channelSetting, dt); //channelSetting.SendData(dt); }
public void ShowSendData(ChannelSendSettings channelSetting, DataTable dt) { this.ShowDialog(); }
private void cmbChannelList_SelectedIndexChanged(object sender, EventArgs e) { if (cmbChannelList.SelectedValue != null) { SPChannelWrapper channel = cmbChannelList.SelectedValue as SPChannelWrapper; if (channel != null) { ChannelSendSettings channelSetting = new ChannelSendSettings(); channelSetting.SubmitSendUrl = channel.GetInterfaceUrl("http://localhost:55662"); channelSetting.ParamsLinkidName = channel.ChannelParams[DictionaryConst.Dictionary_SPField_LinkID_Key]; channelSetting.ParamsMoName = channel.ChannelParams[DictionaryConst.Dictionary_SPField_MO_Key]; channelSetting.ParamsMobileName = channel.ChannelParams[DictionaryConst.Dictionary_SPField_Mobile_Key]; channelSetting.ParamsSPCodeName = channel.ChannelParams[DictionaryConst.Dictionary_SPField_SpNumber_Key]; channelSetting.DataOkMessage = channel.DataOkMessage; channelSetting.IsStatusReport = channel.IsStateReport; channelSetting.ParamsStatusName = channel.StateReportParamName; channelSetting.RequestType = 0; if (!channel.IsStateReport) { channelSetting.RequestType = 0; } else { if (channel.StateReportType == DictionaryConst.Dictionary_ChannelStateReportType_SendOnce_Key) { channelSetting.RequestType = 0; } else if (channel.StateReportType == DictionaryConst.Dictionary_ChannelStateReportType_SendTwice_Key) { channelSetting.RequestType = 1; } else if (channel.StateReportType == DictionaryConst.Dictionary_ChannelStateReportType_SendTwiceTypeRequest_Key) { channelSetting.RequestType = 2; } } channelSetting.ParamsStatusValue = channel.StateReportParamValue; channelSetting.ParamsRequestTypeDataValue = channel.RequestTypeParamDataReportValue; channelSetting.ParamsRequestTypeName = channel.RequestTypeParamName; channelSetting.ParamsRequestTypeReportValue = channel.RequestTypeParamStateReportValue; channelSetting.ReportOkMesage = channel.ReportOkMessage; this.ucChannelParams1.ChannelSetting = channelSetting; } } }
public void ShowSendData(ChannelSendSettings channelSetting, DataTable dt) { this.ShowDialog(); }