【问题标题】:How to cancel uploading?如何取消上传?
【发布时间】:2020-04-03 02:21:28
【问题描述】:

我有两种方法。 1 - 是验证,2 - 如果验证是上传;如何取消上传?

1 - CheckValidationByMEAS_TYPE(lotInfo.LotDataTable, MEAS_TYPE, lotInfo);

int skipRows = 0;
foreach (DataRow item in lotTable.Rows)
{
    string filename = Convert.ToString(item["Filename"]);

    if (filename == string.Empty || filename == "NA")
    {
        continue;
    }

    String[] data = filename.Split('_');
    string measType = Convert.ToString(data[2]);
    bool rowIsNA = true;

    for (int j = 1; j <= 11; j++)        // From I to S in AVG WorkSheet
    {
        string paramValue = Convert.ToString(item[7 + j]);

        if (rowIsNA == true && paramValue != "NA")
        {
            rowIsNA = false;
        }
    }

    if (rowIsNA && (MEAS_TYPE.ToUpper() == measType.ToUpper() || MEAS_TYPE.ToUpper() == "ALL"))
    {
         skipRows++;
    }
}
string message = string.Empty;
string errMsg = string.Empty;

if (skipRows > 1)
{
    MessageBox.Show("Measure different rowbar or adjacent slider. " + skipRows + " sliders have no data in MATLAB", "AFM Host Alert", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

}

2 - public static bool SendData(LotInfo lotInfo, List&lt;string&gt; submitMessage)

string message = string.Empty;
string errMsg = string.Empty;
DataTable MQDataTable;

try
{
     //this is method 1         CheckValidationByMEAS_TYPE(lotInfo.LotDataTable, MEAS_TYPE, lotInfo);
}
catch (Exception exception)
{
    message = "Job: " + lotInfo.SubmissionID + " FAILED to convert data for MQ submission.";
    submitMessage.Add(exception.Message);
    Globals.Logger.Error(exception.Message);
    return false;
}

try
{
    foreach (DataRow row in MQDataTable.Rows)
    {
        PDBAXLib.PdbClass PDB = new PDBAXLib.PdbClass();
        PDB.init(AppConfig.GetString("MQConfiguration", "MQ_ADDRESS"), "1", AppConfig.GetString("MQConfiguration", "MQ_Connection_File"));
        while (PDB.reupload()) ;
        PDB.format("Detail");

        foreach (DataColumn col in MQDataTable.Columns)
        {
            if (!string.IsNullOrEmpty(row[col].ToString()))
                PDB.field(col.ColumnName, row[col].ToString());
            else if (row[col].ToString().Equals(" "))
                PDB.field(col.ColumnName, row[col].ToString());
        }
            PDB.formatEnd("Detail");
            PDB.transmit(null);
   }

   MessageBox.Show("Job " + lotInfo.SubmissionID + " uploaded successfully.", "AFM SA Host", MessageBoxButtons.OK, MessageBoxIcon.Information);
   message = "Job " + lotInfo.SubmissionID + " - Data uploaded successfully. " + DateTime.Now;
   submitMessage.Add(message);
}
catch (Exception exception)
{
    message = "Job " + lotInfo.SubmissionID + " FAILED to upload data.";
    submitMessage.Add(message);
    submitMessage.Add(exception.Message);
    Globals.Logger.Error(exception.Message);
}
return true;

这是我的问题, if (skiprows &gt; 1)会出现提示信息并上传数据。

我要if (skiprows &gt; 1)提示信息,不会上传。

谢谢。

【问题讨论】:

    标签: c# winforms class methods


    【解决方案1】:

    这只是一种方式

    bool CheckValidationByMEAS_TYPE(....)
    {
       . . . .
        if (skipRows > 1)
        {
            MessageBox.Show(....);
            return false;
        }
    }
    
    . . . . . .  . .
    try
    {
        if (!CheckValidationByMEAS_TYPE(lotInfo.LotDataTable, MEAS_TYPE, lotInfo)
            return;
    }
    catch (Exception exception)
    {
        . . . . . 
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-27
      • 2020-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多