private void btnOK_Click(object sender, EventArgs e) { try { DateTime now = DateTime.Now; string path = this.fileControl1.get_TextBoxFile().Text.Trim(); PriceType priceType = (PriceType)Enum.Parse(typeof(PriceType), this.comboBoxJESM.SelectedValue.ToString()); InvType common = InvType.Common; if (this.radioBtnPTFP.Checked) { common = InvType.Common; } else if (this.radioBtnZYFP.Checked) { common = InvType.Special; } else if (this.radioBtnHYFP.Checked) { common = InvType.transportation; } else if (this.radioBtnJDCFP.Checked) { common = InvType.vehiclesales; } if (!File.Exists(this.fileControl1.get_TextBoxFile().Text.Trim())) { MessageManager.ShowMsgBox("INP-271101"); } else { PropValue.TxtPath = path; PropValue.TxtAmountType = this.comboBoxJESM.SelectedValue.ToString(); if (this.radioBtnPTFP.Checked) { PropValue.TxtInvType = "Common"; } else if (this.radioBtnZYFP.Checked) { PropValue.TxtInvType = "Special"; } else if (this.radioBtnHYFP.Checked) { PropValue.TxtInvType = "transportation"; } else if (this.radioBtnJDCFP.Checked) { PropValue.TxtInvType = "vehiclesales"; } ErrorResolver errorResolver = new FatchSaleBill().ImportSaleBillTxt(path, priceType, common); double totalSeconds = DateTime.Now.Subtract(now).TotalSeconds; new ResultForm(errorResolver).ShowDialog(); } } catch (CustomException) { MessageManager.ShowMsgBox("INP-271102"); } catch (Exception exception) { if (exception.ToString().Contains("文本文件与票种不匹配")) { MessageManager.ShowMsgBox("INP-271103"); } else { HandleException.HandleError(exception); } } finally { base.Close(); } }
private void btnCR_Click(object sender, EventArgs e) { try { if (!File.Exists(this.fileControl1.get_TextBoxFile().Text.Trim())) { MessageManager.ShowMsgBox("INP-271201"); } else { string text = this.fileControl1.get_TextBoxFile().Text; string str2 = this.fileControl2.get_TextBoxFile().Text; PriceType priceType = (PriceType)Enum.Parse(typeof(PriceType), this.comboBoxJESM.SelectedValue.ToString()); InvType common = InvType.Common; if (this.radioBtnPTFP.Checked) { common = InvType.Common; IniRead.type = "c"; } else if (this.radioBtnZYFP.Checked) { common = InvType.Special; IniRead.type = "s"; } else if (this.radioBtnHYFP.Checked) { common = InvType.transportation; IniRead.type = "f"; } else if (this.radioBtnJDCFP.Checked) { common = InvType.vehiclesales; IniRead.type = "v"; } if ((PropValue.SingleDoubleTable == "2") && !File.Exists(this.fileControl2.get_TextBoxFile().Text.Trim())) { MessageManager.ShowMsgBox("INP-271202"); } else { PropValue.ExcelFile1Path = text; PropValue.ExcelFile2Path = str2; PropValue.ExcelAmountType = this.comboBoxJESM.SelectedValue.ToString(); if (this.radioBtnPTFP.Checked) { PropValue.ExcelInvType = "Common"; } else if (this.radioBtnZYFP.Checked) { PropValue.ExcelInvType = "Special"; } else if (this.radioBtnHYFP.Checked) { PropValue.ExcelInvType = "transportation"; } else if (this.radioBtnJDCFP.Checked) { PropValue.ExcelInvType = "vehiclesales"; } FatchSaleBill bill = new FatchSaleBill(); new ResultForm(bill.ImportSaleBillExcel(text, str2, priceType, common)).ShowDialog(); } } } catch (CustomException exception) { MessageManager.ShowMsgBox(exception.Message); } catch (Exception exception2) { HandleException.HandleError(exception2); } finally { base.Close(); } }