public bool KPMRead(ref List <Dictionary <string, string> > LActionList, ref ExcelControl g_ExcelTool) { bool bResult = true; g_Util.DebugPrint("I'm reading KPM Page..."); List <Dictionary <KPMReadInfo, List <string> > > ReadList = new List <Dictionary <KPMReadInfo, List <string> > >(); Dictionary <string, string> dummyitem = null; for (int nIdx = 0; nIdx < LActionList.Count; nIdx++) { Dictionary <string, string> ActionItem = LActionList[nIdx]; if (ActionItem["Step"] == "ReadKPM" && ActionItem["Execute"] != "X") { if (CallAction(ref dummyitem, ref ActionItem, ref ReadList, null, ActionItem["InputString"]) == false) { bResult = false; break; } else { if (ActionItem["ActionType"] == "READ_DROPBOX") { g_ExcelTool.UpdateKPMReadSheet(ReadList); ReadList.Clear(); } } } } return(bResult); }
private void bStartCreation_Click(object sender, EventArgs e) { try { List <Dictionary <string, string> > LTicketItemList = new List <Dictionary <string, string> >(); List <Dictionary <string, string> > LActionList = new List <Dictionary <string, string> >(); var nStartTick = DateTime.Now; bool bExcelReadResult = true; bool bCreateResult = false; int tryCnt = 0; if (rbKPMRead.Checked == true || rbTKCancel.Checked == true) { rbB2B.Checked = true; rbIE.Checked = true; } if (rbB2C.Checked == true) { // Because of the error below, IE can't be used for B2C. (Use FF) // The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)' rbFirefox.Checked = true; } g_ExcelTool = new ExcelControl(ref g_Util); int nTicketCNT = 0; if (g_ExcelTool.ReadExcelValue(tExcelPath, rbB2B, rbB2C, rbKPMRead, rbTKCancel, ref LTicketItemList, ref LActionList, ref processes) == true) // Data read from Excel Files { if (rbIE.Checked == true) { g_WebControl_SHDOC = new WebControl_SHDoc(ref g_Util); g_WebControl_SHDOC.OpenWebSite(rbB2B, rbB2C, rbKPMRead, tB2BID, tB2BPW, ref processes); // Go to KPM site g_WebControl_SHDOC.GoToMainPage(LActionList[0]); if (rbKPMRead.Checked == true) { while (bCreateResult == false && tryCnt < 3) { bCreateResult = g_WebControl_SHDOC.KPMRead(ref LActionList, ref g_ExcelTool); // KPM Read tryCnt++; } } else if (rbTKCancel.Checked == true) { bCreateResult = g_WebControl_SHDOC.Delete(ref LTicketItemList, ref LActionList, ref g_ExcelTool); // Cancel Ticket } else { while (bCreateResult == false && tryCnt < 3) { bCreateResult = g_WebControl_SHDOC.CreateTickets(ref LTicketItemList, ref LActionList); // Start Ticket Creation tryCnt++; } } } else { g_WebControl_Selenium = new WebControl_Selenium(ref g_Util); g_WebControl_Selenium.OpenWebSite(rbB2B, rbB2C, rbKPMRead, tB2BID, tB2BPW, ref processes); // Go to KPM site g_WebControl_Selenium.GoToMainPage(ref LTicketItemList, ref LActionList, rbB2C); while (bCreateResult == false && tryCnt < 3) { bCreateResult = g_WebControl_Selenium.CreateTickets(ref LTicketItemList, ref LActionList, rbB2C, ref nTicketCNT); // Start Ticket Creation tryCnt++; } } g_ExcelTool.UpdateKPMDocument(LTicketItemList); } else { bExcelReadResult = false; } var nEndTick = DateTime.Now; long nGap = nEndTick.Ticks - nStartTick.Ticks; var nDiffSpan = new TimeSpan(nGap); string ResultReport = ""; if (bExcelReadResult == false) { ResultReport = "[Abnormal Termination!] Excel Path is Strange or ReadOnly. Please check your Excel File."; } else if (bCreateResult == false) { ResultReport = "[Abnormal Termination!] Something happen during creation. Please try it later. Try Count= " + tryCnt; } else { ResultReport = "Creation Success. " + nTicketCNT + " Tickets (" + nDiffSpan.Hours + "hr:" + nDiffSpan.Minutes + "min:" + nDiffSpan.Seconds + "sec). Try Count= " + tryCnt; } g_Util.DebugPrint(ResultReport); } catch (Exception error) { g_Util.DebugPrint(error.ToString()); CloseAll(); } }
public bool Delete(ref List <Dictionary <string, string> > TicketItemList, ref List <Dictionary <string, string> > LActionList, ref ExcelControl g_ExcelTool) { bool bResult = true; g_Util.DebugPrint("I'm Delete KPM Ticket..."); List <Dictionary <KPMReadInfo, List <string> > > dummy = null; //Access each ticket items for (int nIdx = 0; nIdx < TicketItemList.Count; nIdx++) //for (int nIdx = 0; nIdx < 1; nIdx++) { Dictionary <string, string> dTItem = TicketItemList[nIdx]; for (int nAIdx = 0; nAIdx < LActionList.Count; nAIdx++) { Dictionary <string, string> dAItem = LActionList[nAIdx]; if (dAItem["Step"] == "ReadKPM" && dAItem["Execute"] != "X") { if (CallAction(ref dTItem, ref dAItem, ref dummy, null, dAItem["InputString"]) == false) { bResult = false; break; } else { ; } } } } return(bResult); }