spt/qk30ic/Form1.cs

5679 lines
197 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#define TRACE
#define DEBUG
using Citizen.LayoutUtilities.Printing;
using com.citizen.sdk.LabelPrint;
using MySql.Data.MySqlClient;
using PCSC;
using PCSC.Exceptions;
using PCSC.Iso7816;
using SoM_PrnControl;
using SoM_PrnControl.YoyakuServiceReference;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Printing;
using System.Dynamic;
using System.Globalization;
using System.IO;
using System.IO.Ports;
using System.Linq;
using System.Management;
using System.Net;
using System.Net.NetworkInformation;
using System.Reflection;
using System.Runtime.InteropServices;
using System.ServiceModel;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using System.Xml;
namespace qk30ic;
public class Form1 : Form
{
public string Tag_LED = "IT0\rID0\r";
public string Tag_LED_ERR = "IT1\rID4\r";
public static string LogfileName = "";
public static string LogfilePath = "";
public const int OutLogNum = 15;
public const int OutConfNum = 34;
public const int RESTART_TIME = 60;
public static string[,] koumoku = new string[15, 8];
public static string[] str_Confile = new string[34];
public static int GIP_NUM = 12;
public static int MSG_NUM = 13;
public static string str_layoutFile = "";
public static string READGIP = "";
public static string HTTPGIP = "";
public static string CONFIG_PATH = "SOM_config.dat";
public static string TESTQR_STRING = "So-Manager TestQR";
private dynamic ifd = null;
private dynamic mif = null;
private dynamic icc = null;
public static string readerName = "Circle CIR315 CL 0";
public static string QRdata = "";
public static string QRdata2 = "";
public static byte[] vinfBuff = new byte[257];
public static byte[] vinfBuff2 = new byte[257];
public static uint QRresult = 0u;
public static uint MFresult = 10u;
public static string MFCODE = "";
public static string MFCODE_CHK = "4400";
public static int Retry_num = 5;
public static string DB_PORT_NUMBER;
public static string DB_NAME;
public static string ERRORINFO = "";
public static string DEBUG_MODE = "0";
public static string BEEP_MODE = "1";
public static string TodayLogName;
public static string ReceptionType = "";
private Form2 form2 = new Form2();
public int EndType = 0;
public const int ERROR_CODE_NONMFC = 1;
public const int ERROR_CODE_NONQRC = 3;
public const int ERROR_CODE_NONUID = 5;
public const int ERROR_CODE_PRNPM1 = 50;
public const int ERROR_CODE_PRNPM2 = 51;
public const int ERROR_CODE_PRNPM3 = 52;
public const int ERROR_CODE_PRNPM4 = 53;
public const int ERROR_CODE_CONFRD = 80;
public const int ERROR_CODE_LOGFRD = 111;
public const int ERROR_CODE_LOGFWR = 112;
public const int ERROR_CODE_DBOPEN = 100;
public const int ERROR_CODE_PAPRNG = 104;
public const int ERROR_CODE_LAYOUT = 110;
public const int ERROR_CODE_PRNINI = 200;
public const int ERROR_CODE_MFIINI = 300;
public const int ERROR_CODE_QRCINI = 301;
public const int ERROR_CODE_DBERR = 113;
public const int ERROR_CODE_PRNERR = 201;
public const int ERROR_CODE_QRCERR = 303;
public const int ERROR_CODE_MFIERR = 302;
public const int ERROR_CODE_QRTEST = 400;
public const int LETYPE_NORMAL = 0;
public const int LETYPE_START = 2;
public const int LETYPE_DBOPEN = 10;
public const int LETYPE_LAYOUT = 11;
public const int LETYPE_PRNINI = 12;
public const int LETYPE_MFIINI = 13;
public const int LETYPE_QRCINI = 14;
public const int LETYPE_DBERR = 15;
public const int LETYPE_NONMFC = 20;
public const int LETYPE_NONUID = 21;
public const int LETYPE_NONQRC = 30;
public const int LETYPE_PRNERR = 40;
public const int LETYPE_QRCERR = 50;
public const int LETYPE_MFIERR = 55;
public const int LETYPE_CONFRD = 80;
public const int LETYPE_LOGFRD = 85;
public const int LETYPE_LOGFWR = 87;
public const int LETYPE_PRNPR1 = 81;
public const int LETYPE_PRNPR2 = 82;
public const int LETYPE_PRNPR3 = 83;
public const int LETYPE_PRNPR4 = 84;
public const int LETYPE_PRNPR5 = 85;
public const int LETYPE_PRNPR6 = 86;
public const int LETYPE_PRNPR7 = 87;
public const int LETYPE_PRNPR8 = 88;
public const int LETYPE_QRTEST = 90;
public const int LETYPE_ISDQRC = 91;
public const int LETYPE_ISDMFC = 92;
public const int LETYPE_UNPMFC = 93;
public const int LETYPE_NWERR = 100;
public static string connectionParams;
public static string genmenQR = "Bf7EW8ZMNMCoqaOVA1qyR7pQD03qFRYXKDMIuzDLH3vEhjoQ25rRa0VYBC+SW+JO";
public string DBREAD_print_layout = "select print_layout from park, city where park.city_id=city.city_id and park.park_id=";
public string[] DBREAD_Prndat01 = new string[4] { "select distinct ta3.contract_id, ta3.park_id, t1.park_name, t3.ptype_subject, t4.city_name, ta1.user_seq, ta1.user_id, ta2.usertype_subject1, ta3.contract_periods, ta3.contract_periode, ta3.contract_id, ta3.contract_seal_issue, ta3.printable_date, ta3.contract_flag, ta3.contract_permission, ta3.pplace_no, CAST(ta3.tag_qr_flag AS CHAR) AS tag_qr_flag, t5.zone_name from (park t1 ,user ta1) inner join price_a t2 on t1.park_id = t2.park_id inner join ptype t3 on t2.ptype_id = t3.ptype_id inner join city t4 on t1.city_id = t4.city_id inner join regular_contract ta3 on ta1.user_seq = ta3.user_id join usertype ta2 on ta3.user_categoryid = ta2.user_categoryid and ta3.price_parkplaceid = t2.price_parkplaceid left join zone t5 on ta3.zone_id = t5.zone_id where ta3.park_id = t1.park_id and ta3.contract_flag = 1 and ta3.contract_permission = 1 ", "select distinct t1.park_name, t3.ptype_subject, t4.city_name ,ta1.user_seq, ta1.user_id, ta2.usertype_subject1, ta3.contract_periods, ta3.contract_periode, ta3.contract_id, ta3.contract_seal_issue, ta3.printable_date, ta3.contract_flag, ta3.contract_permission, ta3.pplace_no, CAST(ta3.tag_qr_flag AS CHAR) AS tag_qr_flag, ta3.park_id, t5.zone_name from (park t1, user ta1, usertype ta2) inner join price_a t2 on t1.park_id = t2.park_id inner join ptype t3 on t2.ptype_id = t3.ptype_id inner join city t4 on t1.city_id = t4.city_id inner join regular_contract ta3 on ta3.user_categoryid=ta2.user_categoryid and ta3.price_parkplaceid = t2.price_parkplaceid left join zone t5 on ta3.zone_id = t5.zone_id where ta3.park_id = t1.park_id and ta1.user_seq = ta3.user_id and ", "select distinct ta3.contract_id, ta3.park_id, t1.park_name, t3.ptype_subject, t4.city_name, ta1.user_seq, ta1.user_id, ta2.usertype_subject1, ta3.contract_periods, ta3.contract_periode, ta3.contract_id, ta3.contract_seal_issue, ta3.printable_date, ta3.contract_flag, ta3.contract_permission, ta3.pplace_no, ta3.tag_qr_flag, t5.zone_name from (park t1 ,user ta1) inner join price_a t2 on t1.park_id = t2.park_id inner join ptype t3 on t2.ptype_id = t3.ptype_id inner join city t4 on t1.city_id = t4.city_id inner join regular_contract ta3 on ta1.user_seq = ta3.user_id INNER JOIN new_contract ON new_contract.contract_id = ta3.contract_id join usertype ta2 on ta3.user_categoryid = ta2.user_categoryid and ta3.price_parkplaceid = t2.price_parkplaceid left join zone t5 on ta3.zone_id = t5.zone_id where new_contract.type = 1 and new_contract.validity = 1 ", "select distinct ta3.contract_id, ta3.park_id, t1.park_name, t3.ptype_subject, t4.city_name, ta1.user_seq, ta1.user_id, ta2.usertype_subject1, ta3.contract_periods, ta3.contract_periode, ta3.contract_id, ta3.contract_seal_issue, ta3.printable_date, ta3.contract_flag, ta3.contract_permission, ta3.pplace_no, ta3.tag_qr_flag, t5.zone_name from (park t1 ,user ta1) inner join price_a t2 on t1.park_id = t2.park_id inner join ptype t3 on t2.ptype_id = t3.ptype_id inner join city t4 on t1.city_id = t4.city_id inner join regular_contract ta3 on ta1.user_seq = ta3.user_id join usertype ta2 on ta3.user_categoryid = ta2.user_categoryid and ta3.price_parkplaceid = t2.price_parkplaceid left join zone t5 on ta3.zone_id = t5.zone_id where ta3.park_id = t1.park_id " };
public string[] DBREAD_Prndat02 = new string[4] { " and ta1.user_tag_serial = ", " ta3.contract_qr_id = ", " and ta1.user_tag_serial = ", " and ta1.user_tag_serial = " };
public string LOC_contract_id = " ";
public string LOC_park_id = " ";
public string[] str_logkm = new string[8];
public static string[] str_rctbl = new string[10];
public static string KpAlive_devid = "";
public string[] str_Prndat = new string[13];
public static int Prn_MaxNum;
public static int Prn_NowNum;
public static int Prn_Alert_num;
public static int Prn_Alert_flg;
public static string Prn_ParkName;
public static string Prn_ParkName_Contract;
public static string Tag_ParkID;
public static string vertext;
public static MySqlConnection DBconnect;
public static string[] PortList = new string[20];
public static DateTime date1 = new DateTime(2018, 1, 1, 12, 0, 0);
public static DateTime date2 = new DateTime(2018, 1, 1, 1, 0, 0);
public static string str_uid = " ";
public static string str_park_name = "";
public static int[] park_id_set = new int[500];
public static bool test_mode = false;
public static LabelPrinter printer = new LabelPrinter();
private EpsonPrinterTMM30Service epsonPrinter;
public Dictionary<string, string> PrnDataField = new Dictionary<string, string>();
private string printerPortName = "";
public string genmenUsercode = "";
public bool genmenFlg = false;
public bool genmenFlg_2 = false;
private static dynamic kessaiYoyakuArray;
private Button kessaiButton;
private Label kessaiLabel;
private static bool view_mode = false;
public bool waiting = true;
private string page_name = null;
private string[,] storeArray = new string[5, 3]
{
{ "1", "セブンイレブン", "SRJ" },
{ "3", "ファミリーマート", "SRI" },
{ "5", "デイリーヤマザキ", "SRI" },
{ "2", "ローソン", "SRI" },
{ "4", "ミニストップ", "SRI" }
};
private IContainer components = null;
private Button button1;
private SerialPort serialPort1;
private DataGridView dataGridView1;
private Label label2;
private Label label1;
private bool quitRequested = false;
public Form1()
{
InitializeComponent();
// 允许点 × 或 Alt+F4 时安全退出
// 允许 Esc / × / Alt+F4 时安全退出(不做耗时操作)
this.FormClosing += (s, e) =>
{
// 只做“发信号”,不要做耗时清理;清理放到主循环外的 EndProc()
quitRequested = true; // 让所有 while(!quitRequested) 失效
EndType = 10; // 你的循环里 EndType==10 会触发退出
genmenFlg_2 = true; // 让外层分支走到 else
QRresult = 2; // 你的代码QRresult==2 -> SO_ComCont(50, ...) -> break
MFresult = 11; // >10 也会触发错误分支并跳出
// 立刻把焦点和消息泵让出来
BeginInvoke(new Action(() => { /* 空,使关闭事件尽快返回 */ }));
};
base.TopMost = false;
}
private int CheckNewContractRenewalPeriod(int contract_id)
{
string cmdText = "\r\n SELECT rc.*, p.*\r\n FROM regular_contract rc\r\n INNER JOIN park p ON rc.park_id = p.park_id\r\n WHERE rc.contract_id = @contract_id;";
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, DBconnect);
mySqlCommand.Parameters.AddWithValue("@contract_id", contract_id);
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
if (mySqlDataReader.Read())
{
DateTime now = DateTime.Now;
DateTime dateTime = now;
int num = int.Parse((string)mySqlDataReader["update_grace_period_start_date"]);
TimeSpan timeSpan = TimeSpan.Parse((string)mySqlDataReader["update_grace_period_start_time"]);
int num2 = int.Parse((string)mySqlDataReader["update_grace_period_end_date"]);
TimeSpan timeSpan2 = TimeSpan.Parse((string)mySqlDataReader["update_grace_period_end_time"]);
DateTime dateTime2;
if (num > DateTime.DaysInMonth(dateTime.Year, dateTime.Month))
{
int day = DateTime.DaysInMonth(dateTime.Year, dateTime.Month);
dateTime2 = new DateTime(dateTime.Year, dateTime.Month, day) + timeSpan;
}
else
{
dateTime2 = new DateTime(dateTime.Year, dateTime.Month, num) + timeSpan;
}
if (dateTime2 > now)
{
dateTime = dateTime.AddMonths(-1);
if (num > DateTime.DaysInMonth(dateTime.Year, dateTime.Month))
{
int day2 = DateTime.DaysInMonth(dateTime.Year, dateTime.Month);
dateTime2 = new DateTime(dateTime.Year, dateTime.Month, day2) + timeSpan;
}
else
{
dateTime2 = new DateTime(dateTime.Year, dateTime.Month, num) + timeSpan;
}
}
if (num2 <= 19)
{
dateTime = dateTime.AddMonths(1);
}
DateTime dateTime3;
if (num2 > DateTime.DaysInMonth(dateTime.Year, dateTime.Month))
{
int day3 = DateTime.DaysInMonth(dateTime.Year, dateTime.Month);
dateTime3 = new DateTime(dateTime.Year, dateTime.Month, day3) + timeSpan2;
}
else
{
dateTime3 = new DateTime(dateTime.Year, dateTime.Month, num2) + timeSpan2;
}
mySqlDataReader.Close();
Debug.WriteLine("☆☆現在の日: " + now.ToString("yyyy-MM-dd HH:mm:ss"));
Debug.WriteLine("☆☆更新期間開始日: " + dateTime2.ToString("yyyy-MM-dd HH:mm:ss"));
Debug.WriteLine("☆☆更新期間終了日: " + dateTime3.ToString("yyyy-MM-dd HH:mm:ss"));
if (now >= dateTime2 && now <= dateTime3)
{
return 1;
}
}
mySqlDataReader.Close();
ShowContractRenewalPeriodErr();
return 0;
}
private int CheckContractRenewalPeriod(int contract_id)
{
string cmdText = "\r\n SELECT rc.*, p.*\r\n FROM regular_contract rc\r\n INNER JOIN park p ON rc.park_id = p.park_id\r\n WHERE rc.contract_id = @contract_id;";
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, DBconnect);
mySqlCommand.Parameters.AddWithValue("@contract_id", contract_id);
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
if (mySqlDataReader.Read())
{
DateTime dateTime = DateTime.Now;
int num = DateTime.DaysInMonth(dateTime.Year, dateTime.Month);
DateTime now = DateTime.Now;
int num2 = int.Parse((string)mySqlDataReader["update_grace_period_start_date"]);
TimeSpan timeSpan = TimeSpan.Parse((string)mySqlDataReader["update_grace_period_start_time"]);
int num3 = int.Parse((string)mySqlDataReader["update_grace_period_end_date"]);
TimeSpan timeSpan2 = TimeSpan.Parse((string)mySqlDataReader["update_grace_period_end_time"]);
string s = mySqlDataReader["contract_periode"].ToString();
DateTime dateTime2 = DateTime.ParseExact(s, "yyyy/MM/dd H:mm:ss", null).AddDays(1.0);
mySqlDataReader.Close();
DateTime dateTime3;
if (num2 > DateTime.DaysInMonth(dateTime.Year, dateTime.Month))
{
int day = DateTime.DaysInMonth(dateTime.Year, dateTime.Month);
dateTime3 = new DateTime(dateTime.Year, dateTime.Month, day) + timeSpan;
}
else
{
dateTime3 = new DateTime(dateTime.Year, dateTime.Month, num2) + timeSpan;
}
if (dateTime3 > now)
{
dateTime = dateTime.AddMonths(-1);
if (num2 > DateTime.DaysInMonth(dateTime.Year, dateTime.Month))
{
int day2 = DateTime.DaysInMonth(dateTime.Year, dateTime.Month);
dateTime3 = new DateTime(dateTime.Year, dateTime.Month, day2) + timeSpan;
}
else
{
dateTime3 = new DateTime(dateTime.Year, dateTime.Month, num2) + timeSpan;
}
}
if (num3 <= 19)
{
dateTime = dateTime.AddMonths(1);
}
DateTime dateTime4;
if (num3 > DateTime.DaysInMonth(dateTime.Year, dateTime.Month))
{
int day3 = DateTime.DaysInMonth(dateTime.Year, dateTime.Month);
dateTime4 = new DateTime(dateTime.Year, dateTime.Month, day3) + timeSpan;
}
else
{
dateTime4 = new DateTime(dateTime.Year, dateTime.Month, num3) + timeSpan2;
}
if (now >= dateTime3 && now <= dateTime4 && dateTime2 >= dateTime3 && dateTime2 <= dateTime4 && dateTime2 >= dateTime3 && dateTime2 <= dateTime4)
{
return 1;
}
}
mySqlDataReader.Close();
ShowContractRenewalPeriodErr();
return 0;
}
private void KessaiKikanErrButton_Click(object sender, EventArgs e)
{
waiting = false;
}
private void ShowContractRenewalPeriodErr()
{
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_kessai_err_01.png");
form2.BackgroundImage = backgroundImage;
SetHomeButton();
Button button = new Button
{
Name = "KessaiKikanErrButton",
FlatStyle = FlatStyle.Flat,
BackColor = Color.Transparent,
ForeColor = Color.Transparent,
Size = new Size(500, 100),
Location = new Point(420, 630)
};
button.FlatAppearance.BorderSize = 0;
button.FlatAppearance.MouseOverBackColor = Color.Transparent;
button.FlatAppearance.MouseDownBackColor = Color.Transparent;
button.Click += KessaiKikanErrButton_Click;
form2.Controls.Add(button);
Application.DoEvents();
DateTime now = DateTime.Now;
waiting = true;
while (waiting && (DateTime.Now - now).TotalSeconds < 5.0)
{
Application.DoEvents();
Thread.Sleep(100);
}
form2.Controls.Remove(button);
Application.DoEvents();
}
private int CheckContractRenewal(string usercode)
{
int result = 0;
genmenUsercode = usercode;
string text = "select distinct t2.user_id, t2.contract_id, t2.contract_flag, t2.contract_permission, t2.contract_renewal from (user t1, regular_contract t2) where t1.user_seq = t2.user_id and t1.user_tag_serial='" + usercode + "' and t1.user_quit_flag = 0 and t1.tag_qr_flag = 0 and t2.contract_flag = 1 and t2.contract_renewal IS NULL AND (t2.contract_cancel_flag NOT IN (1, 2) OR t2.contract_cancel_flag IS NULL) ORDER BY t2.updated_at DESC , t2.contract_id DESC LIMIT 1;";
Debug.WriteLine("\u3000〓〓更新情報取得:" + text);
MySqlCommand mySqlCommand = new MySqlCommand(text, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
while (mySqlDataReader.Read())
{
result = int.Parse(Convert.ToString(mySqlDataReader["contract_id"]));
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex.Message);
ERRORINFO = "更新用データのチェック時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
}
return result;
}
private int CheckNewContract(string MFCODE)
{
int num = -1;
int num2 = -1;
int result = -1;
int contract_id = 0;
string text = "SELECT * FROM user INNER JOIN regular_contract ON user.user_seq = regular_contract.user_id INNER JOIN new_contract ON new_contract.contract_id = regular_contract.contract_id WHERE user.user_tag_serial = '" + MFCODE + "' AND user.user_quit_flag = 0 AND user.tag_qr_flag = 0 ;";
Debug.WriteLine("\u3000〓〓new_contract情報取得:" + text);
MySqlCommand mySqlCommand = new MySqlCommand(text, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
while (mySqlDataReader.Read())
{
num = mySqlDataReader.GetByte(mySqlDataReader.GetOrdinal("validity"));
num2 = mySqlDataReader.GetByte(mySqlDataReader.GetOrdinal("type"));
contract_id = int.Parse(Convert.ToString(mySqlDataReader["contract_id"]));
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex.Message);
ERRORINFO = "更新用データのチェック時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
}
if (num == 0)
{
result = -1;
}
if (num == 1)
{
result = num2;
if (CheckNewContractRenewalPeriod(contract_id) == 0)
{
result = 3;
}
}
return result;
}
private int CheckGenmen(string usercode, int oldContractID)
{
view_mode = true;
string text = "";
string text2 = "";
string text3 = "";
string text4 = "";
string s = "";
string s2 = "";
string text5 = "";
string text6 = "SELECT rc.*, ut.usertype_subject1, ut.usertype_subject3, p.student_id_confirm_type, rec.reduction_confirm_type FROM regular_contract rc JOIN usertype ut ON rc.user_categoryid = ut.user_categoryid JOIN park p ON rc.park_id = p.park_id LEFT JOIN reduction_confirm rec ON rc.park_id = rec.park_id AND rc.user_categoryid = rec.user_categoryid WHERE rc.contract_id = '" + oldContractID + "'; ";
Debug.WriteLine("\u3000〓〓更新情報取得:" + text6);
MySqlCommand mySqlCommand = new MySqlCommand(text6, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
while (mySqlDataReader.Read())
{
s = mySqlDataReader["park_id"].ToString();
text = mySqlDataReader["contract_money"].ToString();
text2 = mySqlDataReader["usertype_subject1"].ToString();
text3 = mySqlDataReader["usertype_subject3"].ToString();
s2 = mySqlDataReader["contract_periode"].ToString();
text5 = ((int)mySqlDataReader.GetByte(mySqlDataReader.GetOrdinal("reduction_confirm_type"))).ToString();
text4 = ((int)mySqlDataReader.GetByte(mySqlDataReader.GetOrdinal("student_id_confirm_type"))).ToString();
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex.Message);
ERRORINFO = "減免のチェック時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
if (text == "0")
{
if (text3 == "該当なし")
{
if (!(text2 == "学生"))
{
return 0;
}
switch (text4)
{
case "0":
return 1;
case "1":
{
int maxMonth = GetMaxMonth(int.Parse(s));
DateTime dateTime = DateTime.Parse(s2);
DateTime dateTime2 = new DateTime(dateTime.Year, dateTime.Month, 1).AddMonths(1);
DateTime dateTime3 = dateTime2.AddMonths(maxMonth);
DateTime dateTime4 = new DateTime(dateTime3.Year, 4, 1);
if (dateTime2.Year == dateTime3.Year)
{
dateTime4 = dateTime4.AddYears(1);
}
if (dateTime3 > dateTime4)
{
if (genmenCheckStey())
{
return 1;
}
return 2;
}
return 1;
}
case "2":
if (genmenCheckStey())
{
return 1;
}
return 2;
}
}
else
{
switch (text5)
{
case "0":
return 1;
case "1":
{
int maxMonth2 = GetMaxMonth(int.Parse(s));
DateTime dateTime5 = DateTime.Parse(s2);
DateTime dateTime6 = new DateTime(dateTime5.Year, dateTime5.Month, 1).AddMonths(1);
DateTime dateTime7 = dateTime6.AddMonths(maxMonth2);
DateTime dateTime8 = new DateTime(dateTime7.Year, 4, 1);
if (dateTime6.Year == dateTime7.Year)
{
dateTime8 = dateTime8.AddYears(1);
}
if (dateTime7 > dateTime8)
{
if (genmenCheckStey())
{
return 1;
}
return 2;
}
break;
}
case "2":
if (genmenCheckStey())
{
return 1;
}
return 2;
}
}
}
else if (text3 == "該当なし")
{
if (!(text2 == "学生"))
{
return 0;
}
switch (text4)
{
case "0":
return 0;
case "1":
{
int maxMonth3 = GetMaxMonth(int.Parse(s));
DateTime dateTime9 = DateTime.Parse(s2);
DateTime dateTime10 = new DateTime(dateTime9.Year, dateTime9.Month, 1).AddMonths(1);
DateTime dateTime11 = dateTime10.AddMonths(maxMonth3);
DateTime dateTime12 = new DateTime(dateTime11.Year, 4, 1);
if (dateTime10.Year == dateTime11.Year)
{
dateTime12 = dateTime12.AddYears(1);
}
if (dateTime11 > dateTime12)
{
if (genmenCheckStey())
{
return 0;
}
return 2;
}
break;
}
case "2":
if (genmenCheckStey())
{
return 0;
}
return 2;
}
}
else
{
switch (text5)
{
case "0":
return 0;
case "1":
{
int maxMonth4 = GetMaxMonth(int.Parse(s));
DateTime dateTime13 = DateTime.Parse(s2);
DateTime dateTime14 = new DateTime(dateTime13.Year, dateTime13.Month, 1).AddMonths(1);
DateTime dateTime15 = dateTime14.AddMonths(maxMonth4);
DateTime dateTime16 = new DateTime(dateTime15.Year, 4, 1);
if (dateTime14.Year == dateTime15.Year)
{
dateTime16 = dateTime16.AddYears(1);
}
if (dateTime15 > dateTime16)
{
if (genmenCheckStey())
{
return 0;
}
return 2;
}
break;
}
case "2":
if (genmenCheckStey())
{
return 0;
}
return 2;
}
}
return 0;
}
private bool genmenCheckStey()
{
genmenFlg = true;
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\QRkakuninn.png");
form2.BackgroundImage = backgroundImage;
SetHomeButton();
for (int num = form2.Controls.Count - 1; num >= 0; num--)
{
Control control = form2.Controls[num];
if (control.Name == "homeButton")
{
control.Click -= HomeButton_Click;
control.Click += GenmenHomeButton_Click;
}
}
DateTime now = DateTime.Now;
while (genmenFlg)
{
Application.DoEvents();
if (Convert.ToString(QRresult) != "0")
{
KEEPALIVE.MyTimer_stop();
Debug.WriteLine(Convert.ToString(QRdata));
SO_QRcordInit();
SO_MfifareInit();
if (Convert.ToString(QRdata) == genmenQR)
{
genmenFlg = false;
genmenFlg_2 = true;
return true;
}
genmenFlg = false;
genmenFlg_2 = true;
return false;
}
if ((DateTime.Now - now).TotalSeconds >= 20.0)
{
genmenFlg = false;
return false;
}
}
genmenFlg = false;
return false;
}
private void GenmenHomeButton_Click(object sender, EventArgs e)
{
genmenFlg = false;
}
private int GetMaxMonth(int park_id)
{
int result = 0;
Dictionary<string, string> dictionary = new Dictionary<string, string>();
string cmdText = "SELECT * FROM park JOIN regular_type ON regular_type.city_id = park.city_id WHERE park.park_id = " + park_id + " ORDER BY park.updated_at DESC LIMIT 1;";
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
if (mySqlDataReader.Read())
{
dictionary["1"] = mySqlDataReader["regular_class_1"].ToString();
dictionary["2"] = mySqlDataReader["regular_class_2"].ToString();
dictionary["3"] = mySqlDataReader["regular_class_3"].ToString();
dictionary["6"] = mySqlDataReader["regular_class_6"].ToString();
dictionary["12"] = mySqlDataReader["regular_class_12"].ToString();
}
mySqlDataReader.Close();
}
catch (Exception ex)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex.Message);
ERRORINFO = "契約最大月取得時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
if (dictionary["12"] == "True")
{
return 12;
}
if (dictionary["6"] == "True")
{
return 6;
}
if (dictionary["3"] == "True")
{
return 3;
}
if (dictionary["2"] == "True")
{
return 2;
}
if (dictionary["1"] == "True")
{
return 1;
}
return result;
}
private void ZeroenKoushin(string usercode, int oldContractID)
{
Bitmap bitmap = null;
Console.WriteLine("☆☆ゼロ円更新");
page_name = "ZeroenKoushin";
view_mode = true;
Dictionary<string, string> dictionary = new Dictionary<string, string>();
kessaiYoyakuArray = new ExpandoObject();
kessaiYoyakuArray.usercode = usercode;
kessaiYoyakuArray.old_contract_id = Convert.ToString(oldContractID);
string text = "SELECT DISTINCT rc.user_id, rc.user_categoryid, rc.park_id, rc.price_parkplaceid, rc.user_securitynum, rc.contract_reduction, CAST(rc.psection_id AS CHAR) AS psection_id, rc.zone_id, rc.pplace_no, rc.price_parkplaceid, rc.contract_updated_at, rc.contract_periods, rc.contract_periode, rc.park_position, rc.storage_company_code, rc.share_storage_company_code, rc.pplace_allocation_flag, rc.tag_change_flag, u.user_seq, u.user_mobile, u.user_homephone, u.user_name, u.user_graduate, us.usertype_subject1 FROM regular_contract rc INNER JOIN user u ON rc.user_id = u.user_seq JOIN usertype us ON rc.user_categoryid = us.user_categoryid WHERE rc.contract_id = '" + oldContractID + "';";
Debug.WriteLine("\u3000〓〓更新情報取得:" + text);
MySqlCommand mySqlCommand = new MySqlCommand(text, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
while (mySqlDataReader.Read())
{
kessaiYoyakuArray.user_id = mySqlDataReader["user_id"];
kessaiYoyakuArray.user_categoryid = mySqlDataReader["user_categoryid"];
kessaiYoyakuArray.park_id = mySqlDataReader["park_id"];
kessaiYoyakuArray.price_parkplaceid = mySqlDataReader["price_parkplaceid"];
kessaiYoyakuArray.user_securitynum = mySqlDataReader["user_securitynum"];
kessaiYoyakuArray.contract_reduction = mySqlDataReader["contract_reduction"];
kessaiYoyakuArray.user_graduate = mySqlDataReader["park_position"].ToString();
kessaiYoyakuArray.psection_id = Convert.ToInt32(mySqlDataReader["psection_id"]);
kessaiYoyakuArray.zone_id = mySqlDataReader["zone_id"];
kessaiYoyakuArray.pplace_no = mySqlDataReader["pplace_no"];
kessaiYoyakuArray.storage_company_code = mySqlDataReader["storage_company_code"];
kessaiYoyakuArray.share_storage_company_code = mySqlDataReader["share_storage_company_code"];
kessaiYoyakuArray.pplace_allocation_flag = mySqlDataReader["pplace_allocation_flag"];
kessaiYoyakuArray.user_graduate = mySqlDataReader["user_graduate"].ToString();
kessaiYoyakuArray.userttype_subject1 = mySqlDataReader["usertype_subject1"];
kessaiYoyakuArray.user_seq = mySqlDataReader["user_seq"];
kessaiYoyakuArray.user_mobile = mySqlDataReader["user_mobile"].ToString();
kessaiYoyakuArray.user_homephone = mySqlDataReader["user_homephone"].ToString();
kessaiYoyakuArray.user_name = mySqlDataReader["user_name"].ToString();
kessaiYoyakuArray.old_contract_updated_at = mySqlDataReader["contract_updated_at"].ToString();
kessaiYoyakuArray.old_contract_periods = mySqlDataReader["contract_periods"].ToString();
kessaiYoyakuArray.old_contract_periode = mySqlDataReader["contract_periode"].ToString();
kessaiYoyakuArray.old_tag_change_flag = mySqlDataReader["tag_change_flag"];
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex.Message);
ERRORINFO = "更新用データのチェック時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
DateTime now = DateTime.Now;
string cmdText = "\r\n INSERT INTO regular_contract \r\n (old_contract_id, created_at, updated_at, user_id, user_categoryid, park_id, price_parkplaceid, \r\n user_securitynum, contract_reduction, contract_flag, update_flag, contract_permission, \r\n 800m_flag, tag_qr_flag, psection_id, zone_id, pplace_no, storage_company_code, share_storage_company_code, pplace_allocation_flag,contract_cancel_flag,tag_change_flag) \r\n VALUES \r\n (@old_contract_id, @createdAt, @updatedAt, @userId, @userCategoryId, @parkId, @priceParkplaceId, \r\n @userSecurityNum, @contractReduction, @contractFlag, @updateFlag, @contractPermission, \r\n @eightHundredMFlag, @tagQrFlag, @psectionId, @zoneId, @pplaceNo, @storageCompanyCode, @shareStorageCompanyCode, @pplaceAllocationFlag,@contractCancelFlag,@tag_change_flag);\r\n SELECT LAST_INSERT_ID();";
MySqlCommand mySqlCommand2 = new MySqlCommand(cmdText, DBconnect);
mySqlCommand2.Parameters.AddWithValue("@old_contract_id", kessaiYoyakuArray.old_contract_id);
mySqlCommand2.Parameters.AddWithValue("@createdAt", now);
mySqlCommand2.Parameters.AddWithValue("@updatedAt", now);
mySqlCommand2.Parameters.AddWithValue("@userId", kessaiYoyakuArray.user_id);
mySqlCommand2.Parameters.AddWithValue("@userCategoryId", kessaiYoyakuArray.user_categoryid);
mySqlCommand2.Parameters.AddWithValue("@parkId", kessaiYoyakuArray.park_id);
mySqlCommand2.Parameters.AddWithValue("@priceParkplaceId", kessaiYoyakuArray.price_parkplaceid);
mySqlCommand2.Parameters.AddWithValue("@userSecurityNum", kessaiYoyakuArray.user_securitynum);
mySqlCommand2.Parameters.AddWithValue("@contractReduction", kessaiYoyakuArray.contract_reduction);
mySqlCommand2.Parameters.AddWithValue("@contractFlag", 0);
mySqlCommand2.Parameters.AddWithValue("@updateFlag", 1);
mySqlCommand2.Parameters.AddWithValue("@contractPermission", 0);
mySqlCommand2.Parameters.AddWithValue("@eightHundredMFlag", 0);
mySqlCommand2.Parameters.AddWithValue("@tagQrFlag", 0);
mySqlCommand2.Parameters.AddWithValue("@psectionId", kessaiYoyakuArray.psection_id);
mySqlCommand2.Parameters.AddWithValue("@zoneId", kessaiYoyakuArray.zone_id);
mySqlCommand2.Parameters.AddWithValue("@pplaceNo", kessaiYoyakuArray.pplace_no);
mySqlCommand2.Parameters.AddWithValue("@storageCompanyCode", kessaiYoyakuArray.storage_company_code);
mySqlCommand2.Parameters.AddWithValue("@shareStorageCompanyCode", kessaiYoyakuArray.share_storage_company_code);
mySqlCommand2.Parameters.AddWithValue("@pplaceAllocationFlag", kessaiYoyakuArray.pplace_allocation_flag);
mySqlCommand2.Parameters.AddWithValue("@contractCancelFlag", 0);
mySqlCommand2.Parameters.AddWithValue("@tag_change_flag", kessaiYoyakuArray.old_tag_change_flag);
try
{
MySqlTransaction mySqlTransaction2 = DBconnect.BeginTransaction();
object obj = mySqlCommand2.ExecuteScalar();
if (obj != null && obj != DBNull.Value)
{
kessaiYoyakuArray.contract_id = Convert.ToInt32(obj);
}
mySqlTransaction2.Commit();
Console.WriteLine("新しいレコードが作成されました。 新しい契約ID: " + kessaiYoyakuArray.contract_id);
}
catch (Exception ex2)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex2.Message);
ERRORINFO = "更新用作成時時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
string text2 = "";
string text3 = "";
string s = "";
string text4 = "";
string s2 = "";
int num = 1;
string text5 = "";
text = "SELECT * FROM park JOIN regular_type ON regular_type.city_id = park.city_id JOIN regular_contract ON regular_contract.park_id = park.park_id JOIN user ON regular_contract.user_id = user.user_seq JOIN usertype ON regular_contract.user_categoryid = usertype.user_categoryid WHERE regular_contract.contract_id = '" + kessaiYoyakuArray.contract_id + "' " + "ORDER BY park.updated_at DESC " + "LIMIT 1; ";
Debug.WriteLine("\u3000〓〓料金テーブル名取得:" + text);
mySqlCommand = new MySqlCommand(text, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlDataReader mySqlDataReader2 = mySqlCommand.ExecuteReader();
if (mySqlDataReader2.Read())
{
dictionary["1"] = mySqlDataReader2["regular_class_1"].ToString();
dictionary["2"] = mySqlDataReader2["regular_class_2"].ToString();
dictionary["3"] = mySqlDataReader2["regular_class_3"].ToString();
dictionary["6"] = mySqlDataReader2["regular_class_6"].ToString();
dictionary["12"] = mySqlDataReader2["regular_class_12"].ToString();
text2 = mySqlDataReader2["park_name"].ToString();
text3 = mySqlDataReader2["update_grace_period_start_date"].ToString();
s = mySqlDataReader2["update_grace_period_start_time"].ToString();
text4 = mySqlDataReader2["price_parkplaceid"].ToString();
s2 = mySqlDataReader2["user_graduate"].ToString();
text5 = mySqlDataReader2["usertype_subject1"].ToString();
kessaiYoyakuArray.update_grace_period_start_date = text3;
kessaiYoyakuArray.contract_id = mySqlDataReader2["contract_id"].ToString();
}
mySqlDataReader2.Close();
}
catch (Exception ex3)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex3.Message);
ERRORINFO = "ゼロ円更新\u3000契約可能月取得時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
int day = int.Parse(text3);
TimeSpan timeSpan = TimeSpan.Parse(s);
DateTime now2 = DateTime.Now;
DateTime dateTime;
try
{
dateTime = new DateTime(now2.Year, now2.Month, day, timeSpan.Hours, timeSpan.Minutes, 0);
}
catch (ArgumentOutOfRangeException)
{
int day2 = DateTime.DaysInMonth(now2.Year, now2.Month);
dateTime = new DateTime(now2.Year, now2.Month, day2, timeSpan.Hours, timeSpan.Minutes, 0);
}
DateTime dateTime2 = ((!(now2 > dateTime)) ? new DateTime(now2.Year, now2.Month, 1) : new DateTime(now2.Year, now2.Month, 1).AddMonths(1));
Console.WriteLine("契約開始日: " + dateTime2.ToString("yyyy年MM月dd日"));
kessaiYoyakuArray.contract_updated_at = dateTime.ToString("yyyy-MM-dd");
kessaiYoyakuArray.contract_periods = dateTime2.ToString("yyyy-MM-dd");
foreach (KeyValuePair<string, string> item in dictionary)
{
bool flag = true;
if (text5 == "学生")
{
DateTime dateTime3 = dateTime2.AddMonths(int.Parse(Convert.ToString(item.Key))).AddDays(-1.0);
DateTime dateTime4 = DateTime.ParseExact(s2, "yyyy/MM/dd H:mm:ss", null);
if (dateTime3 > dateTime4)
{
flag = false;
}
}
if (item.Value == "True" && flag)
{
string key = item.Key;
string text6 = "0";
CreateKessaiKikanButton(text4, key, text6, num++);
string key2 = "kessaiKikan_" + key.ToString() + "_" + text6 + "_" + text4;
if (form2.Controls.Find(key2, searchAllChildren: true).FirstOrDefault() is Button button)
{
button.Click -= KessaiKikanButton_Click;
button.Click += SOMPR_120Button_Click;
}
}
}
if (num == 1)
{
bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_kessai_1_2.png");
form2.BackgroundImage = bitmap;
SetHomeButton();
}
else
{
kessaiButton = new Button();
kessaiButton.BackgroundImageLayout = ImageLayout.Stretch;
kessaiButton.FlatStyle = FlatStyle.Flat;
kessaiButton.FlatAppearance.BorderSize = 0;
kessaiButton.BackColor = Color.Transparent;
kessaiButton.BackgroundImage = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\syuuryou_btn.png");
kessaiButton.Name = "kessaiCancel";
kessaiButton.Size = new Size(450, 100);
kessaiButton.Location = new Point(50, 650);
kessaiButton.Click += KessaiCancelButton_Click;
form2.Controls.Add(kessaiButton);
}
bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_genmen_120.png");
form2.BackgroundImage = bitmap;
SetHomeButton();
Application.DoEvents();
DateTime now3 = DateTime.Now;
waiting = true;
while (waiting && (DateTime.Now - now3).TotalSeconds < 20.0)
{
Application.DoEvents();
Thread.Sleep(100);
}
if (page_name == "ZeroenKoushin")
{
KessaiEnd();
}
Application.DoEvents();
}
private void SOMPR_120(string type = "")
{
Console.WriteLine("☆☆新規契約 (減免) 決済期間選択");
page_name = "SOMPR_120";
view_mode = true;
KessaiPartsRemove();
Bitmap bitmap = null;
Dictionary<string, string> dictionary = new Dictionary<string, string>();
kessaiYoyakuArray = new ExpandoObject();
string text = "";
string text2 = "";
string s = "";
string text3 = "";
string s2 = "";
int num = 1;
string text4 = "";
string text5 = "SELECT * FROM park JOIN regular_type ON regular_type.city_id = park.city_id JOIN regular_contract ON regular_contract.park_id = park.park_id JOIN user ON regular_contract.user_id = user.user_seq JOIN usertype ON regular_contract.user_categoryid = usertype.user_categoryid INNER JOIN new_contract ON new_contract.contract_id = regular_contract.contract_id WHERE user.user_tag_serial = '" + MFCODE + "' AND new_contract.validity = 1 AND new_contract.type = 1 ORDER BY park.updated_at DESC LIMIT 1; ";
Debug.WriteLine("\u3000〓〓料金テーブル名取得:" + text5);
MySqlCommand mySqlCommand = new MySqlCommand(text5, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
if (mySqlDataReader.Read())
{
dictionary["1"] = mySqlDataReader["regular_class_1"].ToString();
dictionary["2"] = mySqlDataReader["regular_class_2"].ToString();
dictionary["3"] = mySqlDataReader["regular_class_3"].ToString();
dictionary["6"] = mySqlDataReader["regular_class_6"].ToString();
dictionary["12"] = mySqlDataReader["regular_class_12"].ToString();
text = mySqlDataReader["park_name"].ToString();
text2 = mySqlDataReader["update_grace_period_start_date"].ToString();
s = mySqlDataReader["update_grace_period_start_time"].ToString();
text3 = mySqlDataReader["price_parkplaceid"].ToString();
s2 = mySqlDataReader["user_graduate"].ToString();
text4 = mySqlDataReader["usertype_subject1"].ToString();
kessaiYoyakuArray.update_grace_period_start_date = text2;
kessaiYoyakuArray.contract_id = mySqlDataReader["contract_id"].ToString();
}
mySqlDataReader.Close();
}
catch (Exception ex)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex.Message);
ERRORINFO = "SOMPR_120\u3000契約可能月取得時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
int day = int.Parse(text2);
TimeSpan timeSpan = TimeSpan.Parse(s);
DateTime now = DateTime.Now;
DateTime dateTime;
try
{
dateTime = new DateTime(now.Year, now.Month, day, timeSpan.Hours, timeSpan.Minutes, 0);
}
catch (ArgumentOutOfRangeException)
{
int day2 = DateTime.DaysInMonth(now.Year, now.Month);
dateTime = new DateTime(now.Year, now.Month, day2, timeSpan.Hours, timeSpan.Minutes, 0);
}
DateTime dateTime2 = ((!(now > dateTime)) ? new DateTime(now.Year, now.Month, 1) : new DateTime(now.Year, now.Month, 1).AddMonths(1));
Console.WriteLine("契約開始日: " + dateTime2.ToString("yyyy年MM月dd日"));
kessaiYoyakuArray.contract_updated_at = dateTime.ToString("yyyy-MM-dd");
kessaiYoyakuArray.contract_periods = dateTime2.ToString("yyyy-MM-dd");
foreach (KeyValuePair<string, string> item in dictionary)
{
bool flag = true;
if (text4 == "学生")
{
Console.WriteLine("学生のチェック");
DateTime dateTime3 = dateTime2.AddMonths(int.Parse(Convert.ToString(item.Key))).AddDays(-1.0);
DateTime dateTime4 = DateTime.ParseExact(s2, "yyyy/MM/dd H:mm:ss", null);
if (dateTime3 > dateTime4)
{
flag = false;
}
}
if (item.Value == "True" && flag)
{
string key = item.Key;
string text6 = "0";
CreateKessaiKikanButton(text3, key, text6, num++);
string key2 = "kessaiKikan_" + key.ToString() + "_" + text6 + "_" + text3;
if (form2.Controls.Find(key2, searchAllChildren: true).FirstOrDefault() is Button button)
{
button.Click -= KessaiKikanButton_Click;
button.Click += SOMPR_120Button_Click;
}
}
}
if (num == 1)
{
bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_kessai_1_2.png");
form2.BackgroundImage = bitmap;
SetHomeButton();
}
else
{
kessaiButton = new Button();
kessaiButton.BackgroundImageLayout = ImageLayout.Stretch;
kessaiButton.FlatStyle = FlatStyle.Flat;
kessaiButton.FlatAppearance.BorderSize = 0;
kessaiButton.BackColor = Color.Transparent;
kessaiButton.BackgroundImage = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\syuuryou_btn.png");
kessaiButton.Name = "kessaiCancel";
kessaiButton.Size = new Size(450, 100);
kessaiButton.Location = new Point(50, 650);
kessaiButton.Click += KessaiCancelButton_Click;
form2.Controls.Add(kessaiButton);
}
bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_genmen_120.png");
form2.BackgroundImage = bitmap;
SetHomeButton();
Application.DoEvents();
DateTime now2 = DateTime.Now;
waiting = true;
while (waiting && (DateTime.Now - now2).TotalSeconds < 20.0)
{
Application.DoEvents();
Thread.Sleep(100);
}
if (page_name == "SOMPR_120")
{
KessaiEnd();
}
Application.DoEvents();
}
private void SOMPR_120Button_Click(object sender, EventArgs e)
{
KessaiPartsRemove();
uint num = 0u;
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic2-1.png");
form2.BackgroundImage = backgroundImage;
RemoveHomeButton();
Application.DoEvents();
Button button = (Button)sender;
if (!button.Name.StartsWith("kessaiKikan_"))
{
return;
}
string[] array = button.Name.Split('_');
kessaiYoyakuArray.enable_months = array[1];
string text = array[2].Replace(",", "").Replace("円", "");
kessaiYoyakuArray.billing_amount = text;
int months = int.Parse(kessaiYoyakuArray.enable_months);
int num2 = int.Parse(kessaiYoyakuArray.update_grace_period_start_date);
DateTime dateTime = ((DateTime)DateTime.ParseExact(kessaiYoyakuArray.contract_periods, "yyyy-MM-dd", null)).AddMonths(months).AddDays(-1.0);
int num3 = DateTime.DaysInMonth(dateTime.Year, dateTime.Month);
dateTime = dateTime.AddDays(num3 - dateTime.Day);
kessaiYoyakuArray.contract_periode = dateTime.ToString("yyyy-MM-dd");
DateTime dateTime2 = new DateTime(dateTime.Year, dateTime.Month, num2);
dateTime2 = ((num2 <= DateTime.DaysInMonth(dateTime.Year, dateTime.Month)) ? new DateTime(dateTime.Year, dateTime.Month, num2, 0, 0, 0) : new DateTime(dateTime.Year, dateTime.Month, DateTime.DaysInMonth(dateTime.Year, dateTime.Month), 0, 0, 0));
kessaiYoyakuArray.contract_updated_at = dateTime2.ToString("yyyy-MM-20");
int num4 = 0;
str_Prndat = new string[13];
PrnDataField = new Dictionary<string, string>();
PrnDataField.Add("駐車場名", "");
PrnDataField.Add("定期種別", "");
PrnDataField.Add("場所種別", "");
PrnDataField.Add("開始日", "");
PrnDataField.Add("終了月", "");
PrnDataField.Add("再発行", "");
PrnDataField.Add("定期番号", "");
PrnDataField.Add("自治体名", "");
PrnDataField.Add("利用者ID", "");
PrnDataField.Add("ゾーン、車室名", "");
PrnDataField.Add("発行枚数", "");
PrnDataField.Add("タグ", "");
PrnDataField.Add("ゾーン", "");
num4 = (((bool)(((IDictionary<string, object>)kessaiYoyakuArray).ContainsKey("old_contract_id") && !string.IsNullOrEmpty(kessaiYoyakuArray.old_contract_id?.ToString()))) ? SO_DBPrndat_01(3u) : SO_DBPrndat_01(2u));
if (num4 == 1)
{
bool flag = SO_ComCont(40, EndType);
Debug.WriteLine(" --処理a Result " + num4);
KessaiEnd();
Bitmap backgroundImage2 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic5.png");
form2.BackgroundImage = backgroundImage2;
RemoveHomeButton();
Debug.WriteLine(" --エラー\u3000 Result " + num4);
Application.DoEvents();
Thread.Sleep(3000);
Bitmap backgroundImage3 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic1.png");
form2.BackgroundImage = backgroundImage3;
RemoveHomeButton();
Application.DoEvents();
return;
}
PrnDataField["駐車場名"] = str_Prndat[0];
PrnDataField["定期種別"] = str_Prndat[1];
PrnDataField["場所種別"] = str_Prndat[2];
PrnDataField["開始日"] = str_Prndat[3];
PrnDataField["終了月"] = str_Prndat[4];
PrnDataField["再発行"] = str_Prndat[5];
PrnDataField["定期番号"] = str_Prndat[6];
PrnDataField["自治体名"] = str_Prndat[7];
PrnDataField["利用者ID"] = str_Prndat[8];
PrnDataField["ゾーン、車室名"] = str_Prndat[9];
PrnDataField["タグ"] = str_Prndat[10];
PrnDataField["ゾーン"] = str_Prndat[11];
PrnDataField["利用者連番"] = str_Prndat[12];
PrnDataField["発行枚数"] = "1";
backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic2-1.png");
form2.BackgroundImage = backgroundImage;
RemoveHomeButton();
Application.DoEvents();
num = SO_PrnOut();
Debug.WriteLine(" --処理印刷\u3000 result " + num);
if (num != 0)
{
Debug.WriteLine(" --処理a bResult " + SO_ComCont(40, EndType));
KessaiEnd();
Bitmap backgroundImage4 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic5.png");
form2.BackgroundImage = backgroundImage4;
RemoveHomeButton();
Debug.WriteLine(" --エラー\u3000 result " + num);
Application.DoEvents();
Thread.Sleep(3000);
Bitmap backgroundImage5 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic1.png");
form2.BackgroundImage = backgroundImage5;
RemoveHomeButton();
Application.DoEvents();
}
else
{
bool flag = SO_DBInsert_seal2(120u);
string text2 = "";
string value = "";
string cmdText = "SELECT web_master FROM setting LIMIT 1;";
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
if (mySqlDataReader.Read())
{
text2 = mySqlDataReader["web_master"].ToString();
}
mySqlDataReader.Close();
cmdText = "SELECT* FROM price" + text2 + " WHERE price_month = @priceMonth AND park_id = (SELECT park_id FROM price_a WHERE price_parkplaceid = @PriceParkplaceid) AND psection_id = (SELECT psection_id FROM price_a WHERE price_parkplaceid = @PriceParkplaceid) AND ptype_id = (SELECT ptype_id FROM price_a WHERE price_parkplaceid = @PriceParkplaceid) AND user_categoryid = (SELECT user_categoryid FROM price_a WHERE price_parkplaceid = @PriceParkplaceid);";
mySqlCommand = new MySqlCommand(cmdText, DBconnect);
mySqlCommand.Parameters.AddWithValue("@priceMonth", kessaiYoyakuArray.enable_months);
mySqlCommand.Parameters.AddWithValue("@PriceParkplaceid", array[3]);
mySqlDataReader = mySqlCommand.ExecuteReader();
if (mySqlDataReader.Read())
{
value = mySqlDataReader["price_parkplaceid"].ToString();
}
mySqlDataReader.Close();
}
catch (Exception ex)
{
Debug.WriteLine("\u3000〓〓_ERROR_120");
Trace.WriteLine(ex.Message);
ERRORINFO = "更新用データのチェック時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
string cmdText2 = "UPDATE regular_contract SET updated_at = NOW(), contract_created_at = NOW(), contract_updated_at = @contractUpdatedAt, contract_periods = @contractPeriods, contract_periode = @contractPeriode, enable_months = @enableMonths, printable_date = CURDATE(), billing_amount = @billingAmount, contract_payment_day = NOW(), contract_money = 0, contract_flag = 1, contract_seal_issue = COALESCE(contract_seal_issue, 0) + 1 ,contract_permission = 0, 800m_flag = 0 ,price_parkplaceid = @PriceParkplaceid WHERE contract_id = @contractId;";
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
mySqlCommand = new MySqlCommand(cmdText2, DBconnect);
try
{
mySqlCommand.CommandTimeout = 30;
mySqlCommand.Parameters.AddWithValue("@contractUpdatedAt", kessaiYoyakuArray.contract_updated_at);
mySqlCommand.Parameters.AddWithValue("@contractPeriods", kessaiYoyakuArray.contract_periods);
mySqlCommand.Parameters.AddWithValue("@contractPeriode", kessaiYoyakuArray.contract_periode);
mySqlCommand.Parameters.AddWithValue("@enableMonths", kessaiYoyakuArray.enable_months);
mySqlCommand.Parameters.AddWithValue("@billingAmount", kessaiYoyakuArray.billing_amount);
mySqlCommand.Parameters.AddWithValue("@contractId", kessaiYoyakuArray.contract_id);
mySqlCommand.Parameters.AddWithValue("@PriceParkplaceid", value);
mySqlCommand.ExecuteNonQuery();
if (((IDictionary<string, object>)kessaiYoyakuArray).ContainsKey("old_contract_id"))
{
cmdText2 = "UPDATE regular_contract SET contract_renewal = 1 WHERE contract_id = @contractId;";
mySqlCommand = new MySqlCommand(cmdText2, DBconnect);
mySqlCommand.Parameters.AddWithValue("@contractId", kessaiYoyakuArray.old_contract_id);
mySqlCommand.ExecuteNonQuery();
}
cmdText2 = "UPDATE new_contract SET validity=0 WHERE contract_id = @contractId;";
mySqlCommand = new MySqlCommand(cmdText2, DBconnect);
mySqlCommand.Parameters.AddWithValue("@contractId", kessaiYoyakuArray.contract_id);
mySqlCommand.ExecuteNonQuery();
mySqlTransaction.Commit();
}
catch (Exception ex2)
{
mySqlTransaction.Rollback();
Debug.WriteLine("\u3000〓〓_ERROR_120");
Trace.WriteLine(ex2.Message);
ERRORINFO = "更新用データのチェック時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
}
Debug.WriteLine(" --処理3");
Application.DoEvents();
Debug.WriteLine(" --処理おわり");
Debug.WriteLine(" --印刷完了表示");
Bitmap backgroundImage6 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic3.png");
form2.BackgroundImage = backgroundImage6;
RemoveHomeButton();
Application.DoEvents();
Thread.Sleep(5000);
KessaiEnd();
}
private void SOMPR_110()
{
Console.WriteLine("☆☆新規契約決済期間選択");
page_name = "SOMPR_110";
view_mode = true;
string text = "";
KessaiPartsRemove();
Console.WriteLine("☆☆決済予約開始");
view_mode = true;
kessaiYoyakuArray = new ExpandoObject();
string text2 = "SELECT DISTINCT rc.user_id, rc.contract_id, rc.user_categoryid, rc.park_id, rc.price_parkplaceid, rc.user_securitynum, rc.contract_reduction, CAST(rc.psection_id AS CHAR) AS psection_id, rc.zone_id, rc.pplace_no, rc.price_parkplaceid, rc.contract_updated_at, rc.contract_periods, rc.contract_periode, p.park_name, u.user_seq, u.user_mobile, u.user_homephone, u.user_name, u.user_graduate, us.usertype_subject1 FROM regular_contract rc INNER JOIN user u ON rc.user_id = u.user_seq JOIN usertype us ON rc.user_categoryid = us.user_categoryid INNER JOIN new_contract nc ON nc.contract_id = rc.contract_id INNER JOIN park p ON p.park_id = rc.park_id WHERE u.user_tag_serial = '" + MFCODE + "' AND nc.validity = 1 AND nc.type = 0; ";
Debug.WriteLine("\u3000〓〓更新情報取得:" + text2);
MySqlCommand mySqlCommand = new MySqlCommand(text2, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
while (mySqlDataReader.Read())
{
kessaiYoyakuArray.user_id = mySqlDataReader["user_id"];
kessaiYoyakuArray.user_categoryid = mySqlDataReader["user_categoryid"];
kessaiYoyakuArray.user_graduate = mySqlDataReader["user_graduate"].ToString();
kessaiYoyakuArray.userttype_subject1 = mySqlDataReader["usertype_subject1"];
kessaiYoyakuArray.park_id = mySqlDataReader["park_id"];
kessaiYoyakuArray.price_parkplaceid = mySqlDataReader["price_parkplaceid"];
kessaiYoyakuArray.user_securitynum = mySqlDataReader["user_securitynum"];
kessaiYoyakuArray.contract_reduction = mySqlDataReader["contract_reduction"];
kessaiYoyakuArray.psection_id = Convert.ToInt32(mySqlDataReader["psection_id"]);
kessaiYoyakuArray.zone_id = mySqlDataReader["zone_id"];
kessaiYoyakuArray.pplace_no = mySqlDataReader["pplace_no"];
kessaiYoyakuArray.user_seq = mySqlDataReader["user_seq"];
kessaiYoyakuArray.user_mobile = mySqlDataReader["user_mobile"].ToString();
kessaiYoyakuArray.user_homephone = mySqlDataReader["user_homephone"].ToString();
kessaiYoyakuArray.user_name = mySqlDataReader["user_name"].ToString();
kessaiYoyakuArray.old_contract_updated_at = mySqlDataReader["contract_updated_at"].ToString();
kessaiYoyakuArray.old_contract_periods = "";
kessaiYoyakuArray.old_contract_periode = "";
kessaiYoyakuArray.contract_id = Convert.ToInt32(mySqlDataReader["contract_id"].ToString());
kessaiYoyakuArray.old_contract_id = Convert.ToString(mySqlDataReader["contract_id"].ToString());
text = mySqlDataReader["park_name"].ToString();
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex.Message);
ERRORINFO = "更新用データのチェック時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_kessai_0.png");
form2.BackgroundImage = backgroundImage;
RemoveHomeButton();
kessaiButton = new Button();
kessaiButton.BackgroundImageLayout = ImageLayout.Stretch;
kessaiButton.FlatStyle = FlatStyle.Flat;
kessaiButton.FlatAppearance.BorderSize = 0;
kessaiButton.BackColor = Color.Transparent;
kessaiButton.ForeColor = Color.Transparent;
kessaiButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
kessaiButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
kessaiButton.Name = "kessaiSinki";
kessaiButton.Size = new Size(800, 200);
kessaiButton.Location = new Point(250, 500);
kessaiButton.Click += SOMPR_110Button_Click;
form2.Controls.Add(kessaiButton);
kessaiLabel = new Label();
kessaiLabel.Text = "こちらの駐輪場は\r\n" + text + "です。";
kessaiLabel.Font = new Font("MS PGothic", 80f, FontStyle.Bold);
kessaiLabel.TextAlign = ContentAlignment.MiddleCenter;
kessaiLabel.Size = new Size(1280, 350);
kessaiLabel.Location = new Point(0, 180);
kessaiLabel.BackColor = Color.Transparent;
kessaiLabel.Name = "kessaiSinkiLabel";
form2.Controls.Add(kessaiLabel);
Application.DoEvents();
DateTime now = DateTime.Now;
waiting = true;
while (waiting && (DateTime.Now - now).TotalSeconds < 20.0)
{
Application.DoEvents();
Thread.Sleep(100);
}
if (page_name == "SOMPR_110")
{
KessaiEnd();
}
Application.DoEvents();
}
private void SOMPR_110Button_Click(object sender, EventArgs e)
{
kessaiYoyakuArray.shinki = true;
KessaiYoyaku_1();
}
private void KessaiYoyaku(string usercode, int oldContractID, int genmenType)
{
Console.WriteLine("☆☆決済予約開始");
view_mode = true;
kessaiYoyakuArray = new ExpandoObject();
kessaiYoyakuArray.usercode = usercode;
kessaiYoyakuArray.old_contract_id = Convert.ToString(oldContractID);
kessaiYoyakuArray.genmen_type = Convert.ToString(genmenType);
string text = "SELECT DISTINCT rc.user_id, rc.user_categoryid, rc.park_id, rc.price_parkplaceid, rc.user_securitynum, rc.contract_reduction, CAST(rc.psection_id AS CHAR) AS psection_id, rc.zone_id, rc.pplace_no, rc.price_parkplaceid, rc.contract_updated_at, rc.contract_periods, rc.contract_periode, CAST(rc.800m_flag AS CHAR) AS 800m_flag, CAST(rc.tag_qr_flag AS CHAR) AS tag_qr_flag, CAST(rc.tag_change_flag AS CHAR) AS tag_change_flag, u.user_seq, u.user_mobile, u.user_homephone, u.user_name, u.user_graduate, us.usertype_subject1 FROM regular_contract rc INNER JOIN user u ON rc.user_id = u.user_seq JOIN usertype us ON rc.user_categoryid = us.user_categoryid WHERE rc.contract_id = '" + oldContractID + "';";
Debug.WriteLine("\u3000〓〓更新情報取得:" + text);
MySqlCommand mySqlCommand = new MySqlCommand(text, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
while (mySqlDataReader.Read())
{
kessaiYoyakuArray.user_id = mySqlDataReader["user_id"];
kessaiYoyakuArray.user_categoryid = mySqlDataReader["user_categoryid"];
kessaiYoyakuArray.user_graduate = mySqlDataReader["user_graduate"].ToString();
kessaiYoyakuArray.userttype_subject1 = mySqlDataReader["usertype_subject1"];
kessaiYoyakuArray.park_id = mySqlDataReader["park_id"];
kessaiYoyakuArray.price_parkplaceid = mySqlDataReader["price_parkplaceid"];
kessaiYoyakuArray.user_securitynum = mySqlDataReader["user_securitynum"];
kessaiYoyakuArray.contract_reduction = mySqlDataReader["contract_reduction"];
kessaiYoyakuArray.psection_id = Convert.ToInt32(mySqlDataReader["psection_id"]);
kessaiYoyakuArray.zone_id = mySqlDataReader["zone_id"];
kessaiYoyakuArray.pplace_no = mySqlDataReader["pplace_no"];
kessaiYoyakuArray.user_seq = mySqlDataReader["user_seq"];
kessaiYoyakuArray.user_mobile = mySqlDataReader["user_mobile"].ToString();
kessaiYoyakuArray.user_homephone = mySqlDataReader["user_homephone"].ToString();
kessaiYoyakuArray.user_name = mySqlDataReader["user_name"].ToString();
kessaiYoyakuArray.old_contract_updated_at = mySqlDataReader["contract_updated_at"].ToString();
kessaiYoyakuArray.old_contract_periods = mySqlDataReader["contract_periods"].ToString();
kessaiYoyakuArray.old_contract_periode = mySqlDataReader["contract_periode"].ToString();
kessaiYoyakuArray.old_800m_flag = mySqlDataReader["800m_flag"].ToString();
kessaiYoyakuArray.old_tag_qr_flag = mySqlDataReader["tag_qr_flag"].ToString();
kessaiYoyakuArray.old_tag_change_flag = mySqlDataReader["tag_change_flag"].ToString();
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex.Message);
ERRORINFO = "更新用データのチェック時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
string cmdText = "INSERT INTO regular_contract (old_contract_id,user_id, user_categoryid, park_id, price_parkplaceid, user_securitynum, contract_reduction, psection_id, zone_id, pplace_no, contract_created_at, created_at, updated_at,update_flag,800m_flag,tag_qr_flag,tag_change_flag,contract_cancel_flag) VALUES (@old_contract_id,@userId, @userCategoryId, @parkId, @priceParkplaceId, @userSecurityNum, @contractReduction, @psectionId, @zoneId, @pplaceNo, NOW(), NOW(), NOW(),1,@800m_flag,@tag_qr_flag,@tag_change_flag,@contract_cancel_flag);SELECT LAST_INSERT_ID();";
MySqlCommand mySqlCommand2 = new MySqlCommand(cmdText, DBconnect);
mySqlCommand2.Parameters.AddWithValue("@old_contract_id", kessaiYoyakuArray.old_contract_id);
mySqlCommand2.Parameters.AddWithValue("@userId", kessaiYoyakuArray.user_id);
mySqlCommand2.Parameters.AddWithValue("@userCategoryId", kessaiYoyakuArray.user_categoryid);
mySqlCommand2.Parameters.AddWithValue("@parkId", kessaiYoyakuArray.park_id);
mySqlCommand2.Parameters.AddWithValue("@priceParkplaceId", kessaiYoyakuArray.price_parkplaceid);
mySqlCommand2.Parameters.AddWithValue("@userSecurityNum", kessaiYoyakuArray.user_securitynum);
mySqlCommand2.Parameters.AddWithValue("@contractReduction", kessaiYoyakuArray.contract_reduction);
mySqlCommand2.Parameters.AddWithValue("@psectionId", kessaiYoyakuArray.psection_id);
mySqlCommand2.Parameters.AddWithValue("@zoneId", kessaiYoyakuArray.zone_id);
mySqlCommand2.Parameters.AddWithValue("@pplaceNo", kessaiYoyakuArray.pplace_no);
mySqlCommand2.Parameters.AddWithValue("@800m_flag", kessaiYoyakuArray.old_800m_flag);
mySqlCommand2.Parameters.AddWithValue("@tag_qr_flag", kessaiYoyakuArray.old_tag_qr_flag);
mySqlCommand2.Parameters.AddWithValue("@tag_change_flag", kessaiYoyakuArray.old_tag_change_flag);
mySqlCommand2.Parameters.AddWithValue("@contract_cancel_flag", 0);
try
{
MySqlTransaction mySqlTransaction2 = DBconnect.BeginTransaction();
object obj = mySqlCommand2.ExecuteScalar();
if (obj != null && obj != DBNull.Value)
{
kessaiYoyakuArray.contract_id = Convert.ToInt32(obj);
}
string cmdText2 = "UPDATE regular_contract SET contract_payment_number = @contractPaymentNumber WHERE contract_id = @contract_id;";
mySqlCommand2 = new MySqlCommand(cmdText2, DBconnect);
mySqlCommand2.Parameters.AddWithValue("@contractPaymentNumber", kessaiYoyakuArray.contract_id);
mySqlCommand2.Parameters.AddWithValue("@contract_id", kessaiYoyakuArray.contract_id);
mySqlCommand2.ExecuteNonQuery();
mySqlTransaction2.Commit();
Console.WriteLine("新しいレコードが作成されました。 新しい契約ID: " + kessaiYoyakuArray.contract_id);
}
catch (Exception ex2)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex2.Message);
ERRORINFO = "更新用作成時時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
KessaiYoyaku_1();
}
private void KessaiYoyaku_1()
{
Console.WriteLine("☆☆決済期間選択");
page_name = "kessai_1";
view_mode = true;
KessaiPartsRemove();
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_kessai_1.png");
form2.BackgroundImage = backgroundImage;
SetHomeButton();
string text = "";
string text2 = "";
Dictionary<string, string> dictionary = new Dictionary<string, string>();
int num = 1;
string text3 = "SELECT web_master FROM setting LIMIT 1;";
Debug.WriteLine("\u3000〓〓料金テーブル名取得:" + text3);
MySqlCommand mySqlCommand = new MySqlCommand(text3, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
if (mySqlDataReader.Read())
{
text = mySqlDataReader["web_master"].ToString();
}
mySqlDataReader.Close();
text3 = "SELECT * FROM park JOIN regular_type ON regular_type.city_id = park.city_id WHERE park.park_id = " + kessaiYoyakuArray.park_id + " ORDER BY park.updated_at DESC LIMIT 1; ";
Debug.WriteLine("\u3000〓〓料金テーブル名取得:" + text3);
mySqlCommand = new MySqlCommand(text3, DBconnect);
mySqlCommand.CommandTimeout = 1;
mySqlDataReader = mySqlCommand.ExecuteReader();
if (mySqlDataReader.Read())
{
dictionary["1"] = mySqlDataReader["regular_class_1"].ToString();
dictionary["2"] = mySqlDataReader["regular_class_2"].ToString();
dictionary["3"] = mySqlDataReader["regular_class_3"].ToString();
dictionary["6"] = mySqlDataReader["regular_class_6"].ToString();
dictionary["12"] = mySqlDataReader["regular_class_12"].ToString();
kessaiYoyakuArray.park_name = mySqlDataReader["park_name"].ToString();
kessaiYoyakuArray.update_grace_period_start_date = mySqlDataReader["update_grace_period_start_date"].ToString();
kessaiYoyakuArray.update_grace_period_start_time = mySqlDataReader["update_grace_period_start_time"].ToString();
}
mySqlDataReader.Close();
if (kessaiYoyakuArray.old_contract_periode == "")
{
int day = int.Parse(kessaiYoyakuArray.update_grace_period_start_date);
TimeSpan timeSpan = TimeSpan.Parse(kessaiYoyakuArray.update_grace_period_start_time);
DateTime now = DateTime.Now;
DateTime dateTime;
try
{
dateTime = new DateTime(now.Year, now.Month, day, timeSpan.Hours, timeSpan.Minutes, 0);
}
catch (ArgumentOutOfRangeException)
{
int day2 = DateTime.DaysInMonth(now.Year, now.Month);
dateTime = new DateTime(now.Year, now.Month, day2, timeSpan.Hours, timeSpan.Minutes, 0);
}
DateTime dateTime2 = ((!(now > dateTime)) ? new DateTime(now.Year, now.Month, 1) : new DateTime(now.Year, now.Month, 1).AddMonths(1));
Console.WriteLine("契約開始日: " + dateTime2.ToString("yyyy年MM月dd日"));
kessaiYoyakuArray.old_contract_periode = dateTime2.AddDays(-1.0).ToString("yyyy/MM/dd") + " 0:00:00";
}
text3 = "SELECT * FROM price" + text + " WHERE ptype_id = (SELECT ptype_id FROM price" + text + " WHERE price_parkplaceid = " + kessaiYoyakuArray.price_parkplaceid + " LIMIT 1);";
Debug.WriteLine("\u3000〓〓料金テーブル名取得:" + text3);
mySqlCommand = new MySqlCommand(text3, DBconnect);
mySqlDataReader = mySqlCommand.ExecuteReader();
if (mySqlDataReader.Read())
{
text2 = mySqlDataReader["ptype_id"].ToString();
Console.WriteLine("ptype_idカラムの値: " + text2);
}
mySqlDataReader.Close();
}
catch (Exception ex2)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex2.Message);
ERRORINFO = "料金テーブル名取得時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
text3 = "SELECT * FROM price" + text + " WHERE park_id = " + kessaiYoyakuArray.park_id + " and psection_id = " + kessaiYoyakuArray.psection_id + " and ptype_id = " + text2 + " and user_categoryid = " + kessaiYoyakuArray.user_categoryid + " ORDER BY price_month; ";
Debug.WriteLine("\u3000〓〓料金チェック:" + text3);
mySqlCommand = new MySqlCommand(text3, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlDataReader mySqlDataReader2 = mySqlCommand.ExecuteReader();
while (mySqlDataReader2.Read())
{
bool flag = true;
if (Convert.ToString(kessaiYoyakuArray.userttype_subject1) == "学生")
{
DateTime dateTime3 = ((DateTime)DateTime.ParseExact(kessaiYoyakuArray.old_contract_periode, "yyyy/MM/dd H:mm:ss", null)).AddDays(1.0).AddMonths(int.Parse(Convert.ToString(mySqlDataReader2["price_month"]))).AddDays(-1.0);
Console.WriteLine("user_graduateの日付: " + kessaiYoyakuArray.user_graduate);
DateTime dateTime4 = DateTime.ParseExact(kessaiYoyakuArray.user_graduate, "yyyy/MM/dd H:mm:ss", null);
Console.WriteLine("contractEndの日付: " + dateTime3.ToString());
Console.WriteLine("comparisonDateの日付: " + dateTime4.ToString());
if (dateTime3 > dateTime4)
{
flag = false;
}
}
Debug.WriteLine(mySqlDataReader2["price_month"]);
string key = Convert.ToString(mySqlDataReader2["price_month"]);
if (dictionary.ContainsKey(key) && dictionary[key] == "True" && flag)
{
string price_parkplaceid = Convert.ToString(mySqlDataReader2["price_parkplaceid"]);
string kikan = Convert.ToString(mySqlDataReader2["price_month"]);
string label = Convert.ToString(mySqlDataReader2["price"]);
CreateKessaiKikanButton(price_parkplaceid, kikan, label, num++);
}
}
mySqlDataReader2.Close();
}
catch (Exception ex3)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex3.Message);
ERRORINFO = "料金テーブル名取得時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
if (num == 1)
{
backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_kessai_1_2.png");
form2.BackgroundImage = backgroundImage;
SetHomeButton();
}
else
{
CreateKessaiCancelButton();
}
Application.DoEvents();
DateTime now2 = DateTime.Now;
waiting = true;
while (waiting && (DateTime.Now - now2).TotalSeconds < 20.0)
{
Application.DoEvents();
Thread.Sleep(100);
}
if (page_name == "kessai_1")
{
KessaiEnd();
}
Application.DoEvents();
}
private bool GetDisplaySetting(string webMasterValue, string month)
{
string cmdText = "SELECT * FROM park JOIN regular_type ON regular_type.city_id = park.city_id WHERE park.park_id = " + kessaiYoyakuArray.park_id + "ORDER BY park.updated_at DESC LIMIT 1; ";
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
if (mySqlDataReader.Read())
{
if (Convert.ToString(mySqlDataReader["display_setting"]) == "1")
{
return true;
}
return false;
}
mySqlDataReader.Close();
}
catch (Exception ex)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex.Message);
ERRORINFO = "料金テーブル名取得時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
return false;
}
private void CreateKessaiCancelButton()
{
kessaiButton = new Button();
kessaiButton.BackgroundImageLayout = ImageLayout.Stretch;
kessaiButton.FlatStyle = FlatStyle.Flat;
kessaiButton.FlatAppearance.BorderSize = 0;
kessaiButton.BackColor = Color.Transparent;
kessaiButton.BackgroundImage = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\kessaiCancelButton.png");
kessaiButton.Name = "kessaiCancel";
kessaiButton.Size = new Size(450, 100);
int num = (form2.ClientSize.Width - kessaiButton.Width) / 2;
kessaiButton.Location = new Point(420, 650);
kessaiButton.Click += KessaiCancelButton_Click;
form2.Controls.Add(kessaiButton);
}
private void KessaiCancelButton_Click(object sender, EventArgs e)
{
waiting = false;
}
private void CreateKessaiKikanButton(string price_parkplaceid, string kikan, string label, int order)
{
kessaiButton = new Button();
kessaiButton.BackgroundImageLayout = ImageLayout.Stretch;
kessaiButton.FlatStyle = FlatStyle.Flat;
kessaiButton.FlatAppearance.BorderSize = 0;
kessaiButton.BackColor = Color.Transparent;
kessaiButton.ForeColor = Color.Transparent;
kessaiButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
kessaiButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
kessaiButton.BackgroundImage = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\kessaiKikanButton_" + kikan.ToString() + ".png");
kessaiButton.Name = "kessaiKikan_" + kikan.ToString() + "_" + label + "_" + price_parkplaceid;
kessaiButton.Size = new Size(290, 290);
kessaiButton.Location = new Point(125 + 370 * (order - 1), 305);
kessaiButton.Click += KessaiKikanButton_Click;
form2.Controls.Add(kessaiButton);
string text = int.Parse(label).ToString("N0");
string text2 = text + "円";
kessaiLabel = new Label();
kessaiLabel.Text = text2;
kessaiLabel.Font = new Font("MS PGothic", 30f, FontStyle.Bold);
kessaiLabel.TextAlign = ContentAlignment.MiddleCenter;
kessaiLabel.Size = new Size(300, 50);
kessaiLabel.Location = new Point(kessaiButton.Left + kessaiButton.Width / 2 - kessaiLabel.Width / 2, kessaiButton.Bottom);
kessaiLabel.BackColor = Color.Transparent;
kessaiLabel.Name = "kessaiKikanLabel_" + kikan.ToString();
form2.Controls.Add(kessaiLabel);
}
private void KessaiKikanButton_Click(object sender, EventArgs e)
{
page_name = null;
Button button = (Button)sender;
if (!button.Name.StartsWith("kessaiKikan_"))
{
return;
}
string[] array = button.Name.Split('_');
kessaiYoyakuArray.enable_months = array[1];
string text = array[2].Replace(",", "").Replace("円", "");
kessaiYoyakuArray.billing_amount = text;
DateTime dateTime = DateTime.ParseExact(kessaiYoyakuArray.old_contract_periode, "yyyy/MM/dd H:mm:ss", null);
int months = int.Parse(kessaiYoyakuArray.enable_months);
int num = int.Parse(kessaiYoyakuArray.update_grace_period_start_date);
DateTime dateTime2 = dateTime.AddDays(1.0);
DateTime dateTime3 = dateTime2.AddMonths(months).AddDays(-1.0);
int num2 = DateTime.DaysInMonth(dateTime3.Year, dateTime3.Month);
dateTime3 = dateTime3.AddDays(num2 - dateTime3.Day);
DateTime dateTime4 = new DateTime(dateTime3.Year, dateTime3.Month, num);
dateTime4 = ((num <= DateTime.DaysInMonth(dateTime3.Year, dateTime3.Month)) ? new DateTime(dateTime3.Year, dateTime3.Month, num, 0, 0, 0) : new DateTime(dateTime3.Year, dateTime3.Month, DateTime.DaysInMonth(dateTime3.Year, dateTime3.Month), 0, 0, 0));
string cmdText = "UPDATE regular_contract SET updated_at = @UpdatedAt, contract_updated_at = @ContractUpdatedAt, contract_periods = @ContractPeriods, contract_periode = @ContractPeriode, enable_months = @EnableMonths, billing_amount = @BillingAmount WHERE contract_id = @ContractId";
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, DBconnect);
mySqlCommand.Parameters.AddWithValue("@UpdatedAt", DateTime.Now);
mySqlCommand.Parameters.AddWithValue("@ContractUpdatedAt", dateTime4.ToString("yyyy-MM-dd"));
mySqlCommand.Parameters.AddWithValue("@ContractPeriods", dateTime2.ToString("yyyy-MM-dd"));
mySqlCommand.Parameters.AddWithValue("@ContractPeriode", dateTime3.ToString("yyyy-MM-dd"));
mySqlCommand.Parameters.AddWithValue("@EnableMonths", kessaiYoyakuArray.enable_months);
mySqlCommand.Parameters.AddWithValue("@BillingAmount", kessaiYoyakuArray.billing_amount);
mySqlCommand.Parameters.AddWithValue("@ContractId", kessaiYoyakuArray.contract_id);
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
int num3 = mySqlCommand.ExecuteNonQuery();
if (num3 > 0)
{
mySqlTransaction.Commit();
Console.WriteLine("レコードが更新されました。 更新された契約ID: " + kessaiYoyakuArray.contract_id);
}
else
{
mySqlTransaction.Rollback();
Console.WriteLine("レコードの更新に失敗しました。");
}
}
catch (Exception ex)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex.Message);
ERRORINFO = "料金テーブル名取得時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
KessaiEnd();
}
KessaiYoyaku_2();
}
private void KessaiYoyaku_2()
{
Console.WriteLine("☆☆決済コンビニ選択");
page_name = "kessai_2";
view_mode = true;
KessaiPartsRemove();
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_kessai_2.png");
form2.BackgroundImage = backgroundImage;
SetHomeButton();
CreateKessaiStoreButton("0", storeArray[0, 1], 1, 1);
CreateKessaiStoreButton("1", storeArray[1, 1], 1, 2);
CreateKessaiStoreButton("2", storeArray[2, 1], 1, 3);
CreateKessaiStoreButton("3", storeArray[3, 1], 2, 1);
CreateKessaiStoreButton("4", storeArray[4, 1], 2, 2);
Application.DoEvents();
DateTime now = DateTime.Now;
waiting = true;
while (waiting && (DateTime.Now - now).TotalSeconds < 20.0)
{
Application.DoEvents();
Thread.Sleep(100);
}
if (page_name == "kessai_2")
{
KessaiEnd();
}
Application.DoEvents();
}
private void CreateKessaiStoreButton(string store, string method, int xOder, int yOder)
{
kessaiButton = new Button();
kessaiButton.BackgroundImageLayout = ImageLayout.Stretch;
kessaiButton.FlatStyle = FlatStyle.Flat;
kessaiButton.FlatAppearance.BorderSize = 0;
kessaiButton.BackColor = Color.Transparent;
kessaiButton.ForeColor = Color.Transparent;
kessaiButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
kessaiButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
kessaiButton.Name = "kessaiStore_" + store.ToString() + "_" + method.ToString();
kessaiButton.Size = new Size(565, 140);
kessaiButton.Location = new Point(65 + 585 * (xOder - 1), 300 + 155 * (yOder - 1));
kessaiButton.Click += KessaiStoreButton_Click;
form2.Controls.Add(kessaiButton);
}
private void KessaiStoreButton_Click(object sender, EventArgs e)
{
page_name = null;
Button button = (Button)sender;
if (button.Name.StartsWith("kessaiStore_"))
{
string[] array = button.Name.Split('_');
kessaiYoyakuArray.kessai_ID = storeArray[int.Parse(array[1]), 2];
kessaiYoyakuArray.store_name = storeArray[int.Parse(array[1]), 1];
kessaiYoyakuArray.payee = storeArray[int.Parse(array[1]), 0];
KessaiYoyaku_3();
}
}
private void KessaiYoyaku_3()
{
Console.WriteLine("☆☆決済期間確認");
page_name = "kessai_3";
view_mode = true;
KessaiPartsRemove();
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_kessai_3.png");
form2.BackgroundImage = backgroundImage;
SetHomeButton();
string text = int.Parse(kessaiYoyakuArray.billing_amount).ToString("N0");
string text2 = text + "円";
Label label = new Label();
label.Text = kessaiYoyakuArray.enable_months + "か月更新:" + text2;
label.Font = new Font("MS PGothic", 75f, FontStyle.Bold);
Size size = TextRenderer.MeasureText(label.Text, label.Font);
int num = (1200 - size.Width) / 2;
int num2 = (800 - size.Height) / 2;
label.Location = new Point(num, num2);
label.Size = size;
label.BackColor = Color.White;
label.Name = "kessaiLabel";
form2.Controls.Add(label);
num2 = 600;
int num3 = 600;
CreateAndConfigureButton("kessaiOK", new Point(235, num3), KessaiOKButton_Click);
CreateAndConfigureButton("kessaiChange", new Point(650, num3), KessaiChangeButton_Click);
}
private void CreateAndConfigureButton(string buttonName, Point location, EventHandler clickHandler)
{
Button button = new Button
{
Name = buttonName,
FlatStyle = FlatStyle.Flat,
BackColor = Color.Transparent,
ForeColor = Color.Transparent,
Size = new Size(390, 100),
Location = location
};
button.FlatAppearance.BorderSize = 0;
button.FlatAppearance.MouseOverBackColor = Color.Transparent;
button.FlatAppearance.MouseDownBackColor = Color.Transparent;
button.Click += clickHandler;
form2.Controls.Add(button);
}
private void KessaiOKButton_Click(object sender, EventArgs e)
{
Button button = (Button)sender;
KessaiYoyaku_4();
}
private void KessaiChangeButton_Click(object sender, EventArgs e)
{
Button button = (Button)sender;
KessaiYoyaku_1();
}
private void KessaiYoyaku_4()
{
Console.WriteLine("☆☆決済最終確認");
view_mode = true;
KessaiPartsRemove();
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_kessai_4.png");
form2.BackgroundImage = backgroundImage;
SetHomeButton();
string text = int.Parse(kessaiYoyakuArray.billing_amount).ToString("N0");
Label label = new Label();
label.Text = kessaiYoyakuArray.enable_months + "か月更新:" + text + "円";
label.Font = new Font("MS PGothic", 50f, FontStyle.Bold);
Size size = TextRenderer.MeasureText(label.Text, label.Font);
int num = (1200 - size.Width) / 2;
int num2 = (800 - size.Height) / 2 - 30;
label.Location = new Point(num, num2);
label.AutoSize = true;
label.BackColor = Color.White;
label.Name = "kessaiLabel_1";
form2.Controls.Add(label);
Label label2 = new Label();
label2.Text = "支払い場所:" + kessaiYoyakuArray.store_name;
label2.Font = new Font("MS PGothic", 50f, FontStyle.Bold);
size = TextRenderer.MeasureText(label2.Text, label2.Font);
num = (1200 - size.Width) / 2;
num2 = (800 - size.Height) / 2 + 65;
label2.Location = new Point(num, num2);
label2.AutoSize = true;
label2.BackColor = Color.White;
label2.Name = "kessaiLabel_2";
form2.Controls.Add(label2);
CreateAndConfigureButton("kessaiPrint", new Point(450, 600), KessaiPrintButton_Click);
}
private void KessaiPrintButton_Click(object sender, EventArgs e)
{
Button button = (Button)sender;
view_mode = true;
KessaiPartsRemove();
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_kessai_4-1.png");
form2.BackgroundImage = backgroundImage;
RemoveHomeButton();
Application.DoEvents();
string text = KessaiYoyakuKessai();
if (text == "0000")
{
if (KessaiPrint(text))
{
KessaiYoyaku_5();
}
}
else
{
KessaiError(text);
}
}
private string KessaiYoyakuKessai()
{
YoyakuSoapClient yoyakuSoapClient = new YoyakuSoapClient();
yoyakuSoapClient.Endpoint.Address = new EndpointAddress(str_Confile[17]);
DateTime today = DateTime.Today;
DateTime dateTime = today.AddDays(10.0).Date.AddHours(23.0).AddMinutes(59.0);
string text = str_Confile[33];
text = Regex.Replace(text.Trim().Normalize(NormalizationForm.FormKC).ToUpperInvariant(), "\\s+", "");
if (text == "TYPE-M")
{
DateTime dateTime2 = new DateTime(today.Year, today.Month, DateTime.DaysInMonth(today.Year, today.Month), 23, 59, 0);
dateTime = dateTime2;
}
string text2 = null;
if (kessaiYoyakuArray.user_mobile.Length > 0)
{
text2 = kessaiYoyakuArray.user_mobile;
}
else if (kessaiYoyakuArray.user_homephone.Length > 0)
{
text2 = kessaiYoyakuArray.user_homephone;
}
SyunoFree[] syunoFreeArray = ((!(text == "TYPE-M")) ? new SyunoFree[9]
{
new SyunoFree
{
Index = 1,
SyunoFreeStr = "So-Manager駐輪場"
},
new SyunoFree
{
Index = 2,
SyunoFreeStr = kessaiYoyakuArray.user_seq.ToString()
},
new SyunoFree
{
Index = 3,
SyunoFreeStr = kessaiYoyakuArray.store_name
},
new SyunoFree
{
Index = 19,
SyunoFreeStr = "株式会社ソーリン サポートセンター"
},
new SyunoFree
{
Index = 20,
SyunoFreeStr = "03-5856-4720"
},
new SyunoFree
{
Index = 21,
SyunoFreeStr = "12:00-22:00"
},
new SyunoFree
{
Index = 30,
SyunoFreeStr = "0"
},
new SyunoFree
{
Index = 39,
SyunoFreeStr = "1"
},
new SyunoFree
{
Index = 40,
SyunoFreeStr = "ご利用ありがとうございました"
}
} : new SyunoFree[9]
{
new SyunoFree
{
Index = 1,
SyunoFreeStr = "So-Manager駐輪場"
},
new SyunoFree
{
Index = 2,
SyunoFreeStr = kessaiYoyakuArray.user_seq.ToString()
},
new SyunoFree
{
Index = 3,
SyunoFreeStr = kessaiYoyakuArray.store_name
},
new SyunoFree
{
Index = 19,
SyunoFreeStr = "株式会社ソーリン サポートセンター"
},
new SyunoFree
{
Index = 20,
SyunoFreeStr = "03-5856-6777"
},
new SyunoFree
{
Index = 21,
SyunoFreeStr = "00:00-24:00"
},
new SyunoFree
{
Index = 30,
SyunoFreeStr = "0"
},
new SyunoFree
{
Index = 39,
SyunoFreeStr = "1"
},
new SyunoFree
{
Index = 40,
SyunoFreeStr = "ご利用ありがとうございました"
}
});
WellnetSoapHeader wellnetSoapHeader;
InParamSyunoBarCode inParamSyunoBarCode2;
if (kessaiYoyakuArray.payee == "1")
{
wellnetSoapHeader = new WellnetSoapHeader
{
UserId = str_Confile[19],
Password = str_Confile[20]
};
InParamSyunoBarCode inParamSyunoBarCode = new InParamSyunoBarCode();
inParamSyunoBarCode.DataSyubetsu = "4";
inParamSyunoBarCode.SyunoPayCode = str_Confile[21];
inParamSyunoBarCode.SyunoRecvNum = kessaiYoyakuArray.contract_id.ToString().PadLeft(3, '0');
inParamSyunoBarCode.BcJigyosyaNo = str_Confile[22];
inParamSyunoBarCode.BcAnkenNo = str_Confile[23];
inParamSyunoBarCode.BcNinsyoKey = kessaiYoyakuArray.contract_id.ToString();
inParamSyunoBarCode.SyunoOpCode = "I";
inParamSyunoBarCode.SyunoCorpCode = str_Confile[24];
inParamSyunoBarCode.SyunoTel = text2.ToString();
inParamSyunoBarCode.SyunoNameKanji = kessaiYoyakuArray.user_name.ToString();
inParamSyunoBarCode.SyunoPayLimit = dateTime.ToString("yyyyMMddHHmm");
inParamSyunoBarCode.SyunoPayAmount = kessaiYoyakuArray.billing_amount.ToString();
inParamSyunoBarCode2 = inParamSyunoBarCode;
inParamSyunoBarCode2.SyunoFreeArray = syunoFreeArray;
}
else
{
wellnetSoapHeader = new WellnetSoapHeader
{
UserId = str_Confile[25],
Password = str_Confile[26]
};
InParamSyunoBarCode inParamSyunoBarCode = new InParamSyunoBarCode();
inParamSyunoBarCode.DataSyubetsu = "4";
inParamSyunoBarCode.SyunoPayCode = str_Confile[27];
inParamSyunoBarCode.SyunoRecvNum = kessaiYoyakuArray.contract_id.ToString().PadLeft(3, '0');
inParamSyunoBarCode.BcJigyosyaNo = str_Confile[28];
inParamSyunoBarCode.BcAnkenNo = str_Confile[29];
inParamSyunoBarCode.BcNinsyoKey = kessaiYoyakuArray.contract_id.ToString();
inParamSyunoBarCode.SyunoOpCode = "I";
inParamSyunoBarCode.SyunoCorpCode = str_Confile[30];
inParamSyunoBarCode.SyunoTel = text2.ToString();
inParamSyunoBarCode.SyunoNameKanji = kessaiYoyakuArray.user_name.ToString();
inParamSyunoBarCode.SyunoPayLimit = dateTime.ToString("yyyyMMddHHmm");
inParamSyunoBarCode.SyunoPayAmount = kessaiYoyakuArray.billing_amount.ToString();
inParamSyunoBarCode2 = inParamSyunoBarCode;
inParamSyunoBarCode2.SyunoFreeArray = syunoFreeArray;
}
string cmdText = "INSERT INTO paycheck (user_id, contract_id, payee, amount, created_at, updated_at) VALUES (@userId, @contractId, @payee, @amount, @createdAt, @updatedAt);SELECT LAST_INSERT_ID();";
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, DBconnect);
mySqlCommand.Parameters.AddWithValue("@userId", kessaiYoyakuArray.user_id);
mySqlCommand.Parameters.AddWithValue("@contractId", kessaiYoyakuArray.contract_id);
mySqlCommand.Parameters.AddWithValue("@payee", kessaiYoyakuArray.payee);
mySqlCommand.Parameters.AddWithValue("@amount", kessaiYoyakuArray.billing_amount);
mySqlCommand.Parameters.AddWithValue("@createdAt", DateTime.Now);
mySqlCommand.Parameters.AddWithValue("@updatedAt", DateTime.Now);
object value = mySqlCommand.ExecuteScalar();
int num = Convert.ToInt32(value);
OutParamSyunoBarCode outParamSyunoBarCode = yoyakuSoapClient.YoyakuSyunoBarCode(wellnetSoapHeader, inParamSyunoBarCode2);
string cmdText2 = "UPDATE paycheck SET result = @result, kessai_no = @kessaiNo, pay_code = @payCode, recv_num = @recvNum, jigyou_no = @jigyouNo, anken_no = @ankenNo, ninsyo_key = @ninsyoKey, mms_no = @mmsNo, url = @url, seven_no = @sevenNo, payment_due = @paymentDue, updated_at = @updatedAt WHERE paycheck_id = @paycheckId";
MySqlCommand mySqlCommand2 = new MySqlCommand(cmdText2, DBconnect);
DateTime.TryParseExact(outParamSyunoBarCode.BcSyoriDate, "yyyyMMddHHmm", CultureInfo.InvariantCulture, DateTimeStyles.None, out var result);
mySqlCommand2.Parameters.AddWithValue("@result", outParamSyunoBarCode.Result);
mySqlCommand2.Parameters.AddWithValue("@kessaiNo", outParamSyunoBarCode.KKessaiNo);
mySqlCommand2.Parameters.AddWithValue("@payCode", outParamSyunoBarCode.SyunoPayCode);
mySqlCommand2.Parameters.AddWithValue("@recvNum", outParamSyunoBarCode.SyunoRecvNum);
mySqlCommand2.Parameters.AddWithValue("@jigyouNo", outParamSyunoBarCode.BcJigyosyaNo);
mySqlCommand2.Parameters.AddWithValue("@ankenNo", outParamSyunoBarCode.BcAnkenNo);
mySqlCommand2.Parameters.AddWithValue("@ninsyoKey", outParamSyunoBarCode.BcNinsyoKey);
mySqlCommand2.Parameters.AddWithValue("@mmsNo", outParamSyunoBarCode.SyunoMMSNo);
mySqlCommand2.Parameters.AddWithValue("@url", outParamSyunoBarCode.BcUrl);
mySqlCommand2.Parameters.AddWithValue("@updatedAt", result);
mySqlCommand2.Parameters.AddWithValue("@paycheckId", num);
kessaiYoyakuArray.kessai_no = outParamSyunoBarCode.KKessaiNo;
kessaiYoyakuArray.pay_code = outParamSyunoBarCode.SyunoPayCode.Trim();
string result2 = outParamSyunoBarCode.Result;
if (kessaiYoyakuArray.payee == "1")
{
if (result2 == "0000")
{
string[] array = outParamSyunoBarCode.BcUrl.Split(' ');
kessaiYoyakuArray.sevenNo = outParamSyunoBarCode.BcUrl.Split(' ')[0];
kessaiYoyakuArray.paymentDue = outParamSyunoBarCode.BcUrl.Split(' ')[1];
mySqlCommand2.Parameters.AddWithValue("@sevenNo", kessaiYoyakuArray.sevenNo);
mySqlCommand2.Parameters.AddWithValue("@paymentDue", kessaiYoyakuArray.paymentDue);
}
else
{
kessaiYoyakuArray.sevenNo = "";
kessaiYoyakuArray.paymentDue = dateTime.ToString("yyyy-MM-dd HH:mm");
mySqlCommand2.Parameters.AddWithValue("@sevenNo", null);
mySqlCommand2.Parameters.AddWithValue("@paymentDue", kessaiYoyakuArray.paymentDue);
}
}
else
{
kessaiYoyakuArray.sevenNo = "";
kessaiYoyakuArray.paymentDue = dateTime.ToString("yyyy-MM-dd HH:mm");
mySqlCommand2.Parameters.AddWithValue("@sevenNo", null);
mySqlCommand2.Parameters.AddWithValue("@paymentDue", kessaiYoyakuArray.paymentDue);
kessaiYoyakuArray.paymentDue = dateTime.ToString("yyyy/MM/dd");
}
int num2 = mySqlCommand2.ExecuteNonQuery();
yoyakuSoapClient.Close();
return result2;
}
private bool KessaiPrint(string result)
{
string ipAddress = str_Confile[18];
string deviceId = "local_printer";
int timeout = 30;
EpsonPrinterTMM30Service epsonPrinterTMM30Service = new EpsonPrinterTMM30Service(ipAddress, deviceId, timeout);
string soapRequest = "";
if (kessaiYoyakuArray.payee == "1")
{
soapRequest = epsonPrinterTMM30Service.GenerateSoapRequestPayee1(kessaiYoyakuArray.user_name, kessaiYoyakuArray.sevenNo, kessaiYoyakuArray.billing_amount, kessaiYoyakuArray.park_name, kessaiYoyakuArray.userttype_subject1, kessaiYoyakuArray.enable_months, kessaiYoyakuArray.paymentDue, kessaiYoyakuArray.pay_code, str_Confile[31], str_Confile[32]);
}
else if (kessaiYoyakuArray.payee == "3")
{
soapRequest = epsonPrinterTMM30Service.GenerateSoapRequestPayee2(kessaiYoyakuArray.user_name, kessaiYoyakuArray.kessai_no, kessaiYoyakuArray.billing_amount, kessaiYoyakuArray.park_name, kessaiYoyakuArray.userttype_subject1, kessaiYoyakuArray.enable_months, kessaiYoyakuArray.paymentDue, kessaiYoyakuArray.pay_code, str_Confile[31], str_Confile[32]);
}
else if (kessaiYoyakuArray.payee == "5")
{
soapRequest = epsonPrinterTMM30Service.GenerateSoapRequestPayee3(kessaiYoyakuArray.user_name, kessaiYoyakuArray.kessai_no, kessaiYoyakuArray.billing_amount, kessaiYoyakuArray.park_name, kessaiYoyakuArray.userttype_subject1, kessaiYoyakuArray.enable_months, kessaiYoyakuArray.paymentDue, kessaiYoyakuArray.pay_code, str_Confile[31], str_Confile[32]);
}
else if (kessaiYoyakuArray.payee == "2" || kessaiYoyakuArray.payee == "4")
{
soapRequest = epsonPrinterTMM30Service.GenerateSoapRequestPayee4(kessaiYoyakuArray.user_name, kessaiYoyakuArray.kessai_no, kessaiYoyakuArray.billing_amount, kessaiYoyakuArray.park_name, kessaiYoyakuArray.userttype_subject1, kessaiYoyakuArray.enable_months, kessaiYoyakuArray.paymentDue, kessaiYoyakuArray.pay_code, str_Confile[31], str_Confile[32]);
}
string text = epsonPrinterTMM30Service.PrintXml(soapRequest);
if (text != "")
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(text);
XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(xmlDocument.NameTable);
xmlNamespaceManager.AddNamespace("s", "http://schemas.xmlsoap.org/soap/envelope/");
xmlNamespaceManager.AddNamespace("epos", "http://www.epson-pos.com/schemas/2011/03/epos-print");
XmlNode xmlNode = xmlDocument.SelectSingleNode("//s:Body/epos:response", xmlNamespaceManager);
string value = xmlNode.Attributes["success"].Value;
string value2 = xmlNode.Attributes["status"].Value;
string value3 = xmlNode.Attributes["code"].Value;
int num = ((value == "true") ? 1 : 0);
string cmdText = "INSERT INTO receipt_log (contract_id, success, status, code,created_at) VALUES (@contract_id, @success, @status, @code, NOW())";
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, DBconnect);
mySqlCommand.Parameters.AddWithValue("@contract_id", kessaiYoyakuArray.contract_id);
mySqlCommand.Parameters.AddWithValue("@success", num);
mySqlCommand.Parameters.AddWithValue("@status", value2);
mySqlCommand.Parameters.AddWithValue("@code", value3);
mySqlCommand.ExecuteNonQuery();
if (!(value == "true"))
{
string text2 = epsonPrinterTMM30Service.PrinterErrorHandling(value2, kessaiYoyakuArray.park_id.ToString(), DBconnect);
if (!string.IsNullOrEmpty(text2))
{
KessaiPrinterError(text2);
return false;
}
return true;
}
epsonPrinterTMM30Service.PrinterPapperCheck(value2, kessaiYoyakuArray.park_id.ToString(), DBconnect);
return true;
}
string value4 = "102";
string value5 = "TM プリンター無応答";
string value6 = "プリンタを確認し、必要に応じて再起動してください。";
string cmdText2 = "INSERT INTO operator_que (user_id, contract_id, park_id, que_class, que_comment, que_status, created_at, updated_at, operator_id, work_instructions) VALUES (NULL, NULL, @parkId, @queClass, @queComment, 1, NOW(), NOW(), NULL, @workInstructions)";
MySqlCommand mySqlCommand2 = new MySqlCommand(cmdText2, DBconnect);
mySqlCommand2.Parameters.AddWithValue("@parkId", kessaiYoyakuArray.park_id);
mySqlCommand2.Parameters.AddWithValue("@queClass", value4);
mySqlCommand2.Parameters.AddWithValue("@queComment", value5);
mySqlCommand2.Parameters.AddWithValue("@workInstructions", value6);
mySqlCommand2.ExecuteNonQuery();
string error_bitmap = "pic_kessai_err_00.png";
KessaiPrinterError(error_bitmap);
return false;
}
private void KessaiErrButton_Click(object sender, EventArgs e)
{
waiting = false;
}
private void KessaiPrinterError(string error_bitmap)
{
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\" + error_bitmap);
form2.BackgroundImage = backgroundImage;
RemoveHomeButton();
Button button = new Button();
button.FlatStyle = FlatStyle.Flat;
button.FlatAppearance.BorderSize = 0;
button.BackColor = Color.Transparent;
button.ForeColor = Color.Transparent;
button.FlatAppearance.MouseOverBackColor = Color.Transparent;
button.FlatAppearance.MouseDownBackColor = Color.Transparent;
button.Size = new Size(450, 100);
button.Location = new Point(420, 580);
button.Click += KessaiErrButton_Click;
form2.Controls.Add(button);
Application.DoEvents();
waiting = true;
while (waiting)
{
Application.DoEvents();
Thread.Sleep(100);
}
form2.Controls.Remove(button);
KessaiEnd();
Application.DoEvents();
}
private void KessaiError(string result)
{
Console.WriteLine("☆☆決済エラー終了");
view_mode = true;
KessaiPartsRemove();
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_kessai_err_02.png");
form2.BackgroundImage = backgroundImage;
RemoveHomeButton();
Button button = new Button();
button.FlatStyle = FlatStyle.Flat;
button.FlatAppearance.BorderSize = 0;
button.BackColor = Color.Transparent;
button.ForeColor = Color.Transparent;
button.FlatAppearance.MouseOverBackColor = Color.Transparent;
button.FlatAppearance.MouseDownBackColor = Color.Transparent;
button.Size = new Size(450, 100);
button.Location = new Point(420, 580);
button.Click += KessaiErrButton_Click;
form2.Controls.Add(button);
Label label = new Label();
label.Text = "we_" + result;
label.Font = new Font("MS PGothic", 30f);
Size size = TextRenderer.MeasureText(label.Text, label.Font);
label.Location = new Point(650, 80);
label.AutoSize = true;
label.BackColor = Color.Transparent;
label.ForeColor = Color.White;
label.Name = "kessaiLabel_1";
form2.Controls.Add(label);
Application.DoEvents();
waiting = true;
while (waiting)
{
Application.DoEvents();
Thread.Sleep(100);
}
form2.Controls.Remove(button);
KessaiEnd();
Application.DoEvents();
}
private void KessaiYoyaku_5()
{
Console.WriteLine("☆☆決済完了");
page_name = "kessai_5";
view_mode = true;
KessaiPartsRemove();
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_kessai_5.png");
form2.BackgroundImage = backgroundImage;
SetHomeButton();
Button button = new Button();
button.FlatStyle = FlatStyle.Flat;
button.FlatAppearance.BorderSize = 0;
button.BackColor = Color.Transparent;
button.ForeColor = Color.Transparent;
button.FlatAppearance.MouseOverBackColor = Color.Transparent;
button.FlatAppearance.MouseDownBackColor = Color.Transparent;
button.Size = new Size(450, 100);
button.Location = new Point(420, 630);
button.Name = "kessaiComplate";
button.Click += KessaiComplateButton_Click;
form2.Controls.Add(button);
Application.DoEvents();
DateTime now = DateTime.Now;
waiting = true;
while (waiting && (DateTime.Now - now).TotalSeconds < 10.0)
{
Application.DoEvents();
Thread.Sleep(100);
}
KessaiEnd();
Application.DoEvents();
}
private void KessaiComplateButton_Click(object sender, EventArgs e)
{
waiting = false;
}
private void KessaiPartsRemove()
{
form2.SuspendLayout();
List<Control> list = new List<Control>();
foreach (Control control in form2.Controls)
{
if (control is Button button && button.Name.StartsWith("kessai"))
{
list.Add(button);
}
else if (control is Label label && label.Name.StartsWith("kessai"))
{
list.Add(label);
}
}
foreach (Control item in list)
{
form2.Controls.Remove(item);
item.Dispose();
}
form2.ResumeLayout(performLayout: true);
}
public void KessaiEnd()
{
KessaiPartsRemove();
waiting = false;
page_name = null;
MFCODE = "";
kessaiYoyakuArray = new ExpandoObject();
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic1.png");
form2.BackgroundImage = backgroundImage;
RemoveHomeButton();
view_mode = false;
}
private void Form1_Shown(object sender, EventArgs e)
{
uint num = 0u;
int num2 = 0;
uint num3 = 0u;
bool flag = true;
string text = "";
string str_prnprm = "";
num = ConRead.ReadConFile(ref str_Confile);
if (num == 1)
{
Application.Exit();
return;
}
SO_FullScreen(MSG_NUM, 0);
DateTime now = DateTime.Now;
TodayLogName = now.ToString("yyyyMMdd");
LogfilePath = str_Confile[8];
LogfileName = str_Confile[8] + str_Confile[9] + "_" + TodayLogName + ".csv";
if (str_Confile[5] == "1")
{
DEBUG_MODE = "1";
Form3 form = new Form3();
form.Show();
form.TopMost = true;
}
else
{
DEBUG_MODE = "0";
}
DB_PORT_NUMBER = str_Confile[4];
DB_NAME = str_Confile[3];
dataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing;
dataGridView1.ColumnHeadersHeight = 30;
dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders;
dataGridView1.ColumnCount = 8;
dataGridView1.Columns[0].HeaderText = "処理ログID";
dataGridView1.Columns[1].HeaderText = "駐輪場ID";
dataGridView1.Columns[2].HeaderText = "プロセス名";
dataGridView1.Columns[3].HeaderText = "ジョブ名";
dataGridView1.Columns[4].HeaderText = "ステータス";
dataGridView1.Columns[5].HeaderText = "エラーコード";
dataGridView1.Columns[6].HeaderText = "ステータスコメント";
dataGridView1.Columns[7].HeaderText = "登録日時";
dataGridView1.Columns[0].Width = 60;
dataGridView1.Columns[1].Width = 70;
dataGridView1.Columns[2].Width = 70;
dataGridView1.Columns[3].Width = 70;
dataGridView1.Columns[4].Width = 90;
dataGridView1.Columns[5].Width = 60;
dataGridView1.Columns[7].Width = 120;
dataGridView1.EnableHeadersVisualStyles = false;
dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.ForestGreen;
string text2 = Convert.ToString(DateTime.Now);
num = Logfile.ReadLogFile();
for (int i = 0; i < 15; i++)
{
dataGridView1.Rows.Add(koumoku[i, 0], koumoku[i, 1], koumoku[i, 2], koumoku[i, 3], koumoku[i, 4], koumoku[i, 5], koumoku[i, 6], koumoku[i, 7]);
}
if (num == 1)
{
SO_CommIniErr(85, 0);
SO_WriteLog(85);
EndProc();
Application.Exit();
return;
}
READGIP = GetGIP(str_Confile[GIP_NUM]);
Debug.WriteLine("★★初期化完了。QR/タグ待ち受けに移行★★\u3000\u3000" + now.ToString());
while (!quitRequested)
{
if (!SO_DBOpen())
{
SO_CommIniErr(10, 1);
KEEPALIVE.AutoClosingMessageBox.Show("ネットワークが切断されました", "N/Wエラー", 10000);
Thread.Sleep(3000);
}
if (!SO_PrnEnvRead_rty())
{
SO_CommIniErr(15, 2);
EndProc();
Application.Exit();
return;
}
if (SO_DBLayoutFile() != 0)
{
SO_CommIniErr(15, 2);
EndProc();
Application.Exit();
return;
}
if (!File.Exists(str_layoutFile))
{
Debug.WriteLine(str_layoutFile);
Trace.WriteLine("★レイアウトファイルがありません★");
MessageBox.Show("レイアウトファイルがありません。以下のファイルの存在を確認してください: " + Environment.NewLine + str_layoutFile, "レイアウトファイルエラー", MessageBoxButtons.OK, MessageBoxIcon.Hand);
SO_CommIniErr(11, 2);
EndProc();
Application.Exit();
return;
}
form2.Text = form2.Text + " デバイスID:" + KpAlive_devid + " レイアウト:" + str_layoutFile;
if (!SO_PrnInit())
{
Debug.WriteLine("☆☆プリンタ初期化エラー☆☆");
form2.label1.Text = "エラー";
form2.label1.ForeColor = Color.White;
form2.label1.BackColor = Color.Red;
Application.DoEvents();
SO_CommIniErr(12, 3);
Thread.Sleep(5000);
Debug.WriteLine("☆☆アプリケーションリブートします☆☆");
EndProc();
Debug.WriteLine("\u3000\u3000☆アプリケーションリブート");
Application.Restart();
Application.Exit();
return;
}
Trace.WriteLine("★プリンター初期化完了★");
if (!SO_MfifareInit())
{
SO_CommIniErr(13, 4);
EndProc();
Application.Exit();
return;
}
if (DEBUG_MODE == "0")
{
MFresult = SO_MfifareCheck();
}
if (!SO_QRcordInit())
{
SO_CommIniErr(14, 5);
EndProc();
Application.Exit();
return;
}
if (!SO_ComCont(2, 6))
{
break;
}
KEEPALIVE.TIM_Main();
uint num4 = SO_DBChk_print_area(int.Parse(str_Confile[6]));
string text3 = "";
int[] array = park_id_set;
for (int j = 0; j < array.Length; j++)
{
int num5 = array[j];
text3 = text3 + Convert.ToString(num5) + "/";
if (num5 == 0)
{
break;
}
Debug.WriteLine(" --許可駐輪場IDconfigまたはprint_area" + num5);
}
text3 = text3.Replace("/0/", "");
form2.Text = vertext + " " + Prn_ParkName + " " + text3 + " " + form2.Text;
Debug.WriteLine("☆☆処理待ちループ開始☆☆");
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic1.png");
form2.BackgroundImage = backgroundImage;
RemoveHomeButton();
while (!quitRequested)
{
KEEPALIVE.MyTimer_start();
while (!quitRequested)
{
Application.DoEvents();
if (EndType == 10)
{
EndProc();
Application.Exit();
return;
}
if (QRresult != 0)
{
Debug.WriteLine("☆☆QRresult" + Convert.ToString(QRresult) + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));
if (QRresult == 1)
{
if (DEBUG_MODE == "0")
{
serialPort1.Write(Tag_LED);
}
Thread.Sleep(500);
num3 = QRresult;
break;
}
if (QRresult == 2)
{
flag = SO_ComCont(50, EndType);
EndProc();
break;
}
QRresult = 0u;
}
else
{
if (DEBUG_MODE == "0")
{
MFresult = SO_MfifareCheck();
}
else if (MFresult != 0)
{
continue;
}
if (MFresult == 0)
{
num3 = MFresult;
break;
}
if (MFresult > 10 && MFresult != 3221356545u && MFresult != 3221356547u)
{
flag = SO_ComCont(55, EndType);
EndProc();
break;
}
}
}
if (!genmenFlg_2)
{
form2.RemoveMachiukeButtons();
Bitmap backgroundImage2 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic2.png");
form2.BackgroundImage = backgroundImage2;
RemoveHomeButton();
Application.DoEvents();
if ((num3 == 0 && MFresult != 0) || (num3 == 1 && QRresult == 2))
{
MFresult = 0u;
QRresult = 0u;
break;
}
KEEPALIVE.MyTimer_stop();
for (int k = 0; k < Retry_num; k++)
{
str_uid = "";
if (num3 == 1)
{
text = QRdata;
QRresult = 0u;
ReceptionType = "QR";
num = SO_DBChk_qrcheck(ref text);
Debug.WriteLine("\u3000\u3000☆1:" + num);
}
else
{
ReceptionType = "TAG";
test_mode = false;
num = SO_DBChk_tagnum();
MFresult = 10u;
}
Debug.WriteLine("\u3000\u3000str_uid:" + str_uid);
Debug.WriteLine("\u3000\u3000SO_DBChk_tagnum result:" + num);
switch (num)
{
case 0u:
num = SO_CommLabelOutput(num3);
Debug.WriteLine("\u3000\u3000☆3:" + num);
if (num != 0)
{
DBconnect.Open();
continue;
}
break;
case 1u:
DBconnect.Open();
continue;
}
break;
}
switch (num)
{
case 0u:
flag = true;
break;
case 1u:
flag = SO_ComCont(15, 6);
EndProc();
break;
case 2u:
flag = SO_ComCont(20, EndType);
if (flag)
{
continue;
}
break;
case 3u:
flag = SO_ComCont(30, EndType);
if (flag)
{
continue;
}
break;
case 4u:
flag = SO_ComCont(21, EndType);
if (flag)
{
continue;
}
break;
case 5u:
flag = SO_ComCont(90, EndType);
if (flag)
{
continue;
}
break;
case 6u:
flag = SO_ComCont(91, EndType);
if (flag)
{
continue;
}
break;
case 7u:
flag = SO_ComCont(92, EndType);
if (flag)
{
continue;
}
break;
case 8u:
flag = SO_ComCont(93, EndType);
if (flag)
{
continue;
}
break;
case 9u:
Debug.WriteLine("\u3000◆読み取ったタグは対象外駐輪場");
flag = SO_ComCont(84, EndType);
if (flag)
{
continue;
}
break;
case 10u:
Debug.WriteLine("\u3000◆読み取ったQRは対象外駐輪場");
flag = SO_ComCont(88, EndType);
if (flag)
{
continue;
}
break;
default:
flag = true;
continue;
}
if (!flag || num == 1)
{
break;
}
uint num6 = SO_DBChk_print_area(int.Parse(str_Confile[6]));
int[] array2 = park_id_set;
for (int l = 0; l < array2.Length; l++)
{
int num7 = array2[l];
Debug.WriteLine("\u3000◆取得駐輪場ID" + num7);
if (num7 == 0)
{
break;
}
}
num2 = SO_PRN_datchk(ref str_prnprm);
str_logkm[6] = str_prnprm;
Debug.WriteLine("\u3000\u3000☆SO_PRN_datchk:\u3000" + num2);
if (num2 != 0)
{
if (num3 == 1)
{
Bitmap backgroundImage3 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_err_202.png");
form2.BackgroundImage = backgroundImage3;
RemoveHomeButton();
Application.DoEvents();
Thread.Sleep(3000);
}
Bitmap backgroundImage4 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic1.png");
form2.BackgroundImage = backgroundImage4;
RemoveHomeButton();
Application.DoEvents();
if (!SO_ComCont(num2, EndType))
{
EndProc();
break;
}
continue;
}
Debug.WriteLine(" --処理0");
Bitmap backgroundImage5 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic2-1.png");
form2.BackgroundImage = backgroundImage5;
RemoveHomeButton();
Application.DoEvents();
num = SO_PrnOut();
SO_PrnInit_Epson();
Debug.WriteLine(" --処理印刷\u3000 result " + num);
if (num != 0)
{
Debug.WriteLine(" --処理a bResult " + SO_ComCont(40, EndType));
Bitmap backgroundImage6 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic5.png");
form2.BackgroundImage = backgroundImage6;
RemoveHomeButton();
Debug.WriteLine(" --エラー\u3000 result " + num);
Application.DoEvents();
Thread.Sleep(3000);
Bitmap backgroundImage7 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic1.png");
form2.BackgroundImage = backgroundImage7;
RemoveHomeButton();
Application.DoEvents();
EndProc();
break;
}
flag = SO_DBInsert_seal2(num3);
if (!test_mode)
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
string cmdText = "UPDATE new_contract SET validity=0 WHERE contract_id = @contractId;";
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, DBconnect);
mySqlCommand.Parameters.AddWithValue("@contractId", LOC_contract_id);
mySqlCommand.ExecuteNonQuery();
mySqlTransaction.Commit();
}
Debug.WriteLine(" --処理b bResult " + flag);
num = SO_DBPrnPrm();
if (num != 0)
{
flag = SO_ComCont(15, EndType);
EndProc();
break;
}
Debug.WriteLine(" --処理2");
Prn_NowNum++;
if (Prn_MaxNum - Prn_NowNum < Prn_Alert_num && Prn_Alert_flg == 1)
{
num = SO_DBOpeQue();
if (num != 0)
{
flag = SO_ComCont(15, 6);
EndProc();
break;
}
}
else
{
num = SO_DBNowPrnNum_rty();
if (num != 0)
{
flag = SO_ComCont(15, 6);
EndProc();
break;
}
}
Debug.WriteLine(" --処理3");
uint num8 = SO_DBChk_print_area(int.Parse(str_Confile[6]));
if (test_mode)
{
flag = SO_ComCont(90, EndType);
Debug.WriteLine(" --処理3a bResult " + flag);
if (!flag)
{
EndProc();
break;
}
}
else
{
str_logkm[6] = "定期契約駐輪場ID=" + str_rctbl[9] + "、駐輪場名=" + SO_DBChk_park_name(int.Parse(str_rctbl[9])) + "、" + ReceptionType;
flag = SO_ComCont(0, EndType);
Debug.WriteLine(" --処理3b bResult " + flag);
if (!flag)
{
EndProc();
break;
}
}
Application.DoEvents();
Debug.WriteLine(" --処理おわり");
Debug.WriteLine(" --印刷完了表示");
Bitmap backgroundImage8 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic3.png");
form2.BackgroundImage = backgroundImage8;
RemoveHomeButton();
Application.DoEvents();
Thread.Sleep(5000);
Debug.WriteLine(" --待ち受け表示");
Bitmap backgroundImage9 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic1.png");
form2.BackgroundImage = backgroundImage9;
RemoveHomeButton();
Application.DoEvents();
Thread.Sleep(5000);
Debug.WriteLine(" --待ち受け表示おわり");
continue;
}
MFresult = 0u;
QRresult = 0u;
genmenFlg_2 = false;
break;
}
}
EndProc();
Application.Exit();
}
/*private void SO_FullScreen(int msgn, int mode)
{
try
{
if (!string.IsNullOrWhiteSpace(str_Confile[msgn]) && str_Confile[msgn].Length > 2)
{
int num = str_Confile[msgn].Length;
string text = str_Confile[msgn];
if (num > 6)
{
num = 6;
text = str_Confile[9].Substring(0, 6);
}
int num2 = 300 - (num - 3) * 40;
int num3 = 110 + (num - 3) * 110;
if (mode == 0)
{
form2.Show();
}
form2.label1.Text = text;
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic0.png");
form2.BackgroundImage = backgroundImage;
Debug.WriteLine("ラベル表示名: " + text);
form2.Text = "駐ID: " + str_Confile[6] + " LOG:" + str_Confile[8] + " DBG:" + str_Confile[5];
form2.label1.TextAlign = ContentAlignment.MiddleCenter;
form2.TopMost = true;
form2.WindowState = FormWindowState.Maximized;
}
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_イメージリソースエラー:" + ex.Message + " --> " + ex);
MessageBox.Show("起動に必要なイメージリソースが見つかりません。正しくセットアップしてください。", "リソースエラー", MessageBoxButtons.OK, MessageBoxIcon.Hand);
Close();
Application.Exit();
Console.WriteLine("Exit");
}
}*/
private void SO_FullScreen(int msgn, int mode)
{
try
{
if (!string.IsNullOrWhiteSpace(str_Confile[msgn]) && str_Confile[msgn].Length > 2)
{
int num = str_Confile[msgn].Length;
string text = str_Confile[msgn];
if (num > 6)
{
num = 6;
text = str_Confile[9].Substring(0, 6);
}
int num2 = 300 - (num - 3) * 40;
int num3 = 110 + (num - 3) * 110;
if (mode == 0)
{
form2.Show();
}
form2.label1.Text = text;
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic1.png");
form2.BackgroundImage = backgroundImage;
Debug.WriteLine("ラベル表示名: " + text);
form2.Text = "駐ID: " + str_Confile[6] + " LOG:" + str_Confile[8] + " DBG:" + str_Confile[5];
form2.label1.TextAlign = ContentAlignment.MiddleCenter;
form2.TopMost = true;
form2.WindowState = FormWindowState.Maximized;
}
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_イメージリソースエラー:" + ex.Message + " --> " + ex);
MessageBox.Show("起動に必要なイメージリソースが見つかりません。正しくセットアップしてください。", "リソースエラー", MessageBoxButtons.OK, MessageBoxIcon.Hand);
Close();
Application.Exit();
Console.WriteLine("Exit");
}
}
public string GetGIP(string url)
{
string input = "";
try
{
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
using HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using Stream stream = httpWebResponse.GetResponseStream();
using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8);
input = streamReader.ReadToEnd();
}
catch
{
Debug.WriteLine("★★_ERROR_1");
return "N/A";
}
Regex regex = new Regex("<body>(?<body>.*?)</body>", RegexOptions.IgnoreCase | RegexOptions.Singleline);
Match match = regex.Match(input);
string value = match.Groups["body"].Value;
return (!string.IsNullOrWhiteSpace(value)) ? value.TrimStart() : "N/A";
}
private void SO_CommIniErr(int type, int n)
{
EndType = n;
SO_LogEdit(type);
if (type != 10 && type != 15)
{
SO_DBInsert_pjl(type);
}
SO_WriteLog(type);
switch (type)
{
case 12:
{
Bitmap backgroundImage3 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic5.png");
form2.BackgroundImage = backgroundImage3;
RemoveHomeButton();
break;
}
case 13:
{
Bitmap backgroundImage2 = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic6.png");
form2.BackgroundImage = backgroundImage2;
RemoveHomeButton();
break;
}
default:
{
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic7.png");
form2.BackgroundImage = backgroundImage;
RemoveHomeButton();
break;
}
}
Application.DoEvents();
Thread.Sleep(20000);
}
private bool SO_ComCont(int type, int n)
{
Debug.WriteLine(" ◎SO_ComCont.type" + type);
Debug.WriteLine(" ◎SO_ComCont.n" + n);
uint num = 0u;
EndType = n;
SO_LogEdit(type);
if (type != 15 && (!SO_DBInsert_pjl(type) || n == 15))
{
SO_LogEdit(15);
SO_WriteLog(15);
return false;
}
Debug.WriteLine(" ◎To\u3000SO_WriteLog" + type);
num = SO_WriteLog(type);
if (num == 1)
{
SO_LogEdit(87);
Debug.WriteLine(" SO_DBInsert_pjl2" + 87);
SO_DBInsert_pjl(87);
return false;
}
return true;
}
private uint SO_CommLabelOutput(uint mode)
{
uint num = 0u;
num = SO_PrnLabeEdit(mode);
if (num == 1)
{
return 1u;
}
return 0u;
}
public static void SO_LogFileDelCheck()
{
int num = 0;
bool flag = true;
string nwm = DateTime.Now.ToString("yyyyMM");
string text = "";
string text2 = "";
DirectoryInfo directoryInfo = new DirectoryInfo(LogfilePath);
if (!directoryInfo.Exists)
{
return;
}
FileInfo[] files = directoryInfo.GetFiles();
for (num = 0; num < files.Length; num++)
{
string text3 = Convert.ToString(files[num]);
if (text3.Length == 24)
{
text2 = text3.Substring(text3.Length - 12, 12);
text = text2.Substring(0, 6);
if (!LogFileChk_Mo(nwm, text))
{
File.Delete(LogfilePath + files[num]);
}
}
}
}
public static bool LogFileChk_Mo(string Nwm, string Tgm)
{
string text = Nwm.Substring(0, 4);
int num = Convert.ToInt32(Nwm.Substring(0, 4));
int num2 = Convert.ToInt32(Tgm.Substring(0, 4));
int num3 = Convert.ToInt32(Nwm.Substring(4, 2));
int num4 = Convert.ToInt32(Tgm.Substring(4, 2));
int num5 = Convert.ToInt32(str_Confile[10]);
int num6 = num3 - num4;
if (num6 < 0)
{
num6 += 12;
num--;
}
int num7 = num - num2;
if (num7 < 0)
{
return true;
}
int num8 = num7 * 12 + num6;
if (num8 > num5)
{
return false;
}
return true;
}
private int SO_PRN_datchk(ref string str_prnprm)
{
string text = DateTime.Now.ToString("yyyy/MM/dd");
if (test_mode)
{
return 0;
}
if (str_rctbl[4] != "1" || str_rctbl[5] != "1")
{
str_prnprm = $"シール発行不可 授受フラグ={str_rctbl[4]}、 シール発行許可={str_rctbl[5]}";
return 81;
}
if (text.CompareTo(str_rctbl[2]) > 0)
{
str_prnprm = $"シール発行不可 本日={text}、 有効期間E={str_rctbl[2]}";
return 82;
}
if (text.CompareTo(str_rctbl[3]) < 0)
{
str_prnprm = $"シール発行不可 本日={text}、 シール印刷可能日={str_rctbl[3]}";
return 83;
}
if (SO_Chk_print_area(int.Parse(str_rctbl[9])) == 0)
{
string text2 = "";
int[] array = park_id_set;
foreach (int num in array)
{
text2 = text2 + Convert.ToString(num) + "/";
if (num == 0)
{
break;
}
}
Debug.WriteLine(" ++定期契約駐輪場ID" + str_rctbl[9]);
Debug.WriteLine(" ++許可駐輪場群ID" + text2);
str_prnprm = string.Format("対象駐輪場範囲外 定期契約駐輪場ID={0}、 許可された駐輪場ID群={1}", str_rctbl[9], text2.Replace("/0/", ""));
return 84;
}
return 0;
}
private void button1_Click(object sender, EventArgs e)
{
EndType = 10;
}
private void SO_LogEdit(int n)
{
DateTime now = DateTime.Now;
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
Console.WriteLine(versionInfo.ProductVersion);
vertext = " Ver." + versionInfo.ProductVersion;
switch (n)
{
case 0:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "シール印刷";
str_logkm[4] = "正常印刷";
str_logkm[5] = "0";
break;
case 2:
str_logkm[0] = " ";
str_logkm[2] = " ";
str_logkm[3] = " ";
str_logkm[4] = "開始";
str_logkm[5] = "0";
str_logkm[6] = "[" + str_Confile[0] + "]自機GIP=" + READGIP + " " + Prn_ParkName + vertext;
break;
case 15:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 113.ToString();
str_logkm[6] = "DBアクセスエラー";
break;
case 10:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "初期化処理";
str_logkm[4] = "DBアタッチエラー";
str_logkm[5] = 100.ToString();
str_logkm[6] = "DB OPENに失敗";
break;
case 11:
str_logkm[2] = "定期シール発行";
str_logkm[3] = "初期化処理";
str_logkm[4] = "レイアウトファイルエラー";
str_logkm[5] = 110.ToString();
str_logkm[6] = "レイアウトファイルが見つからない " + str_layoutFile;
break;
case 12:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "初期化処理";
str_logkm[4] = "プリンタ初期化エラー";
str_logkm[5] = 200.ToString();
str_logkm[6] = "プリンタ初期化に失敗";
break;
case 13:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "初期化処理";
str_logkm[4] = "カードリーダ初期化エラー";
str_logkm[5] = 300.ToString();
str_logkm[6] = "Mifareリーダ初期化に失敗";
break;
case 14:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "初期化処理";
str_logkm[4] = "カードリーダ初期化エラー";
str_logkm[5] = 301.ToString();
str_logkm[6] = "QRコードリーダ初期化に失敗";
break;
case 20:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 1.ToString();
str_logkm[6] = "タグ利用者なし 該当Mifareコードなし CODE=(" + MFCODE + ")";
break;
case 92:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 1.ToString();
str_logkm[6] = "タグ\u3000シール発行済 CODE=(" + MFCODE + " → " + LOC_contract_id + ")";
break;
case 93:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 1.ToString();
str_logkm[6] = "タグ\u3000費用未払い CODE=(" + MFCODE + " → " + LOC_contract_id + ")";
break;
case 21:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 5.ToString();
str_logkm[6] = "タグ利用者なし 該当利用者IDなし";
break;
case 30:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 3.ToString();
str_logkm[6] = "該当QRコードなし CODE=(" + QRdata + ")";
break;
case 91:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 3.ToString();
str_logkm[6] = "該当QRシール発行済 CODE=(" + QRdata + " → " + LOC_contract_id + ")";
break;
case 40:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 201.ToString();
str_logkm[6] = "プリンタエラー";
break;
case 50:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 303.ToString();
str_logkm[6] = "QRコード読み取りエラー";
break;
case 55:
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 302.ToString();
str_logkm[6] = "Mifare読み取りエラー";
break;
case 80:
str_logkm[0] = "";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "初期化処理";
str_logkm[4] = "error";
str_logkm[5] = 80.ToString();
str_logkm[6] = "設定ファイル読み込みエラー";
break;
case 85:
str_logkm[2] = "定期シール発行";
str_logkm[3] = "初期化処理";
str_logkm[4] = "error";
str_logkm[5] = 111.ToString();
str_logkm[6] = "ログファイル読み込みエラー";
break;
case 87:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 112.ToString();
str_logkm[6] = "ログファイル書き込みエラー";
break;
case 81:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 50.ToString();
str_logkm[6] = "授受フラグまたはシール発行許可エラー";
break;
case 82:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 51.ToString();
str_logkm[6] = "「有効期間S」と「有効期間E」の間でない";
break;
case 83:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "利用者確認";
str_logkm[4] = "error";
str_logkm[5] = 52.ToString();
str_logkm[6] = "「シール印刷可能日」以降でない";
break;
case 84:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "対象駐輪場外";
str_logkm[4] = "error";
str_logkm[5] = 53.ToString();
str_logkm[6] = "対象駐輪場範囲外(TAG) 定期契約駐輪場ID=" + Tag_ParkID + " TAG=" + MFCODE;
break;
case 88:
str_logkm[0] = " ";
str_logkm[2] = "定期シール発行";
str_logkm[3] = "対象駐輪場外";
str_logkm[4] = "error";
str_logkm[5] = 53.ToString();
str_logkm[6] = "対象駐輪場範囲外(QR) 定期契約駐輪場ID=" + LOC_park_id;
break;
case 90:
str_logkm[0] = " ";
str_logkm[2] = "シール発行テスト";
str_logkm[3] = "テスト";
str_logkm[4] = "test";
str_logkm[5] = 400.ToString();
str_logkm[6] = "QRコードによるテスト印刷";
break;
}
str_logkm[1] = str_Confile[6];
str_logkm[7] = now.ToString();
}
private uint SO_WriteLog(int type)
{
uint result = 0u;
string text = "";
string text2 = Convert.ToString(DateTime.Now);
string text3 = DateTime.Now.ToString("yyyyMMdd");
if (string.Compare(text3, TodayLogName) != 0)
{
LogfilePath = str_Confile[8];
LogfileName = str_Confile[8] + str_Confile[9] + "_" + TodayLogName + ".csv";
TodayLogName = text3;
}
try
{
using StreamWriter streamWriter = new StreamWriter(LogfileName, append: true, Encoding.GetEncoding("utf-8"));
if (type != 0)
{
Debug.WriteLine(" ◎◎SO_WriteLog.type" + type);
Bitmap bitmap = null;
if (type == 30 || type == 91 || type == 20 || type == 92 || type == 93 || type == 84 || type == 88 || type == 82)
{
Application.DoEvents();
if (DEBUG_MODE == "0" && BEEP_MODE == "1")
{
Debug.WriteLine("★BEEP:" + str_logkm[5]);
for (int i = 0; i < 10; i++)
{
serialPort1.Write(Tag_LED_ERR);
Application.DoEvents();
Thread.Sleep(200);
}
}
int num = 0;
int num2 = -1;
int num3 = -1;
Debug.WriteLine("★MFresult:" + MFresult);
Debug.WriteLine("★MFCODE:" + MFCODE);
if (MFresult == 10 && MFCODE != "")
{
num3 = CheckNewContract(MFCODE);
Debug.WriteLine("★num3:" +num3);
switch (num3)
{
case 0:
Console.WriteLine("SOMPR-110に進む");
SOMPR_110();
break;
case 1:
Console.WriteLine("SOMPR-120に進む");
SOMPR_120();
break;
case 3:
Console.WriteLine("更新期間外");
break;
default:
num = CheckContractRenewal(MFCODE);
break;
}
}
if (num != 0 && num3 != 0 && num3 != 1 && num3 != 3)
{
num2 = CheckContractRenewalPeriod(num);
if (num2 > 0)
{
Console.WriteLine("減免のチェックをする");
int num4 = CheckGenmen(MFCODE, num);
switch (num4)
{
case 1:
ZeroenKoushin(MFCODE, num);
break;
case 2:
MFCODE = "";
break;
default:
Console.WriteLine("決済チェックOK。決済処理に進む");
KessaiYoyaku(MFCODE, num, num4);
while (view_mode)
{
Application.DoEvents();
}
break;
}
}
}
else if (num3 != 0 && num3 != 1 && num3 != 3)
{
if (num != 0)
{
num2 = CheckContractRenewalPeriod(num);
}
if (num2 != 0)
{
if (type == 30)
{
bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_err_202.png");
form2.BackgroundImage = bitmap;
RemoveHomeButton();
}
if (type == 91)
{
bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_err_204.png");
form2.BackgroundImage = bitmap;
RemoveHomeButton();
}
if (type == 20)
{
bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_err_201.png");
form2.BackgroundImage = bitmap;
RemoveHomeButton();
}
if (type == 92)
{
bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_err_203.png");
form2.BackgroundImage = bitmap;
RemoveHomeButton();
}
if (type == 93)
{
bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_err_205.png");
form2.BackgroundImage = bitmap;
RemoveHomeButton();
}
if (type == 84)
{
bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_err_201.png");
form2.BackgroundImage = bitmap;
RemoveHomeButton();
}
if (type == 88)
{
bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic_err_202.png");
form2.BackgroundImage = bitmap;
RemoveHomeButton();
}
Application.DoEvents();
Thread.Sleep(3000);
}
}
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic1.png");
form2.BackgroundImage = backgroundImage;
RemoveHomeButton();
Application.DoEvents();
}
text = str_logkm[0] + "," + str_uid + "," + LOC_contract_id + "," + str_logkm[1] + "," + str_logkm[2] + "," + str_logkm[3] + "," + str_logkm[4] + "," + str_logkm[5] + "," + str_logkm[6] + "," + str_logkm[7] + "," + ERRORINFO + "," + DEBUG_MODE;
Debug.WriteLine("!アラートログ書込み:" + text);
}
else
{
text = str_logkm[0] + "," + str_uid + "," + LOC_contract_id + "," + str_logkm[1] + "," + str_logkm[2] + "," + str_logkm[3] + "," + str_logkm[4] + "," + str_logkm[5] + "," + str_logkm[6] + "," + str_logkm[7] + ",," + DEBUG_MODE;
Debug.WriteLine("!ノーマルログ書込み:" + text);
}
streamWriter.WriteLine(text);
}
catch (Exception ex) when (ex is IOException)
{
Debug.WriteLine("★★_ERROR_2\u3000ログファイルオープンエラー:" + ex.Message + " --> " + ex);
MessageBox.Show("SOM_config.datのログフォルダ指定に誤りがあるか、ログファイルが別のプログラムで開かれています。閉じてください。", "ログファイルオープンエラー", MessageBoxButtons.OK, MessageBoxIcon.Hand);
Trace.WriteLine(ex.Message);
result = 1u;
}
catch (Exception ex2)
{
Debug.WriteLine("★★_ERROR_2B\u3000その他エラー:" + ex2.Message + " --> " + ex2);
Trace.WriteLine(ex2.Message);
result = 1u;
}
for (int num5 = 14; num5 > 0; num5--)
{
for (int j = 0; j < 8; j++)
{
dataGridView1[j, num5].Value = dataGridView1[j, num5 - 1].Value;
}
}
dataGridView1[0, 0].Value = str_logkm[0];
dataGridView1[1, 0].Value = str_logkm[1];
dataGridView1[2, 0].Value = str_logkm[2];
dataGridView1[3, 0].Value = str_logkm[3];
dataGridView1[4, 0].Value = str_logkm[4];
dataGridView1[5, 0].Value = str_logkm[5];
dataGridView1[6, 0].Value = str_logkm[6];
dataGridView1[7, 0].Value = str_logkm[7];
Refresh();
ERRORINFO = "";
return result;
}
private bool SO_DBOpen()
{
bool result = true;
Debug.WriteLine("★DBパラメータ:server={0};port={1};user={2};password={3};database={4};SSL Mode=None", str_Confile[0], DB_PORT_NUMBER, str_Confile[1], str_Confile[2], DB_NAME);
connectionParams = $"server={str_Confile[0]};port={DB_PORT_NUMBER};user={str_Confile[1]};password={str_Confile[2]};database={DB_NAME};SSL Mode=None";
DBconnect = new MySqlConnection(connectionParams);
try
{
DBconnect.Open();
Debug.WriteLine("DBconnect open");
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_3");
Trace.WriteLine(ex.Message);
ERRORINFO = "DBOPENエラー=" + ex.Message;
result = false;
}
return result;
}
public static uint SO_DBPrnPrm()
{
if (test_mode)
{
return 0u;
}
DateTime now = DateTime.Now;
string text = "update regular_contract set contract_seal_issue=" + Convert.ToString(Convert.ToInt32(str_rctbl[7]) + 1) + ", contract_permission=0 , updated_at = '" + now.ToString() + "' where user_id=" + str_uid + " and contract_id=" + str_rctbl[0] + ";";
Debug.WriteLine("★シール印刷後更新SQL:" + text);
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlCommand mySqlCommand = new MySqlCommand(text, DBconnect);
mySqlCommand.CommandTimeout = 1;
mySqlCommand.ExecuteNonQuery();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_4");
Trace.WriteLine(ex.Message);
ERRORINFO = "定期契約マスタ更新エラー=" + ex.Message;
DBconnect.Close();
return 1u;
}
return 0u;
}
public static int SO_DBKpAlive(string Insert_SQL)
{
try
{
if (DBconnect.State != ConnectionState.Open)
{
DBconnect.Open();
Debug.WriteLine("KeepAlive_DB再接続しました");
}
else
{
Debug.WriteLine("KeepAlive_DB接続中");
}
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlCommand mySqlCommand = new MySqlCommand(Insert_SQL, DBconnect);
mySqlCommand.CommandTimeout = 1;
mySqlCommand.ExecuteNonQuery();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_5 N/W停止:" + ex.Message);
Trace.WriteLine(ex.Message);
ERRORINFO = "デバイス管理マスタ書き込みエラー=" + ex.Message;
DBconnect.Close();
return 1;
}
return 0;
}
private uint SO_DBNowPrnNum_rty()
{
uint num = 0u;
if (test_mode)
{
return 0u;
}
for (int i = 0; i < Retry_num; i++)
{
num = SO_DBNowPrnNum();
if (num == 1)
{
Trace.WriteLine("error");
ERRORINFO = "駐輪場マスタ:印字数更新時エラー";
DBconnect.Open();
continue;
}
return 0u;
}
return 1u;
}
private uint SO_DBNowPrnNum()
{
DateTime now = DateTime.Now;
string cmdText = "update park set print_number=" + Convert.ToString(Prn_NowNum) + " where park_id=" + str_Confile[6] + ";";
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, DBconnect);
mySqlCommand.CommandTimeout = 1;
mySqlCommand.ExecuteNonQuery();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_6");
Trace.WriteLine(ex.Message);
DBconnect.Close();
return 1u;
}
return 0u;
}
private uint SO_DBOpeQue()
{
if (test_mode)
{
return 0u;
}
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
DateTime now = DateTime.Now;
string text = "INSERT INTO operator_que (park_id, que_class, que_status_comment, work_instructions, created_at, que_status) VALUES (" + str_Confile[6] + ",104,'" + str_Confile[7] + "','" + Prn_ParkName + "の用紙がもうすぐ無くなります。交換してください','" + now.ToString() + "',1);";
MySqlCommand mySqlCommand = new MySqlCommand(text, DBconnect);
mySqlCommand.CommandTimeout = 1;
Trace.WriteLine(text);
try
{
mySqlCommand.ExecuteNonQuery();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_7");
Trace.WriteLine(ex.Message);
ERRORINFO = "オペレータキューテーブルレコード追加時エラー";
return 1u;
}
return 0u;
}
private int SO_DBLayoutFile()
{
string text = "";
MySqlCommand mySqlCommand = new MySqlCommand(DBREAD_print_layout + str_Confile[6] + ";", DBconnect);
Trace.WriteLine("★ :" + DBREAD_print_layout + str_Confile[6]);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
while (mySqlDataReader.Read())
{
text = Convert.ToString(mySqlDataReader["print_layout"]);
Trace.WriteLine("★レイアウトファイル:" + text);
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_8");
Trace.WriteLine(ex.Message);
ERRORINFO = "印字レイアウトファイル名読み取り時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
return 1;
}
str_layoutFile = Directory.GetCurrentDirectory() + "\\" + text + ".CLF";
return 0;
}
private bool SO_PrnEnvRead_rty()
{
bool flag = true;
for (int i = 0; i < Retry_num; i++)
{
if (!SO_PrnEnvRead())
{
Trace.WriteLine("error");
ERRORINFO = "設定マスタ(setting),デバイス管理マスタ(device)読み取り時エラー発生";
DBconnect.Open();
continue;
}
return true;
}
return false;
}
private bool SO_PrnEnvRead()
{
string text = "select printable_alert_flag,printable_number,printable_alert_number from setting ORDER BY setting_id DESC;";
string text2 = "select park_name, print_number from park where park_id=" + str_Confile[6] + ";";
string text3 = "select device_id from device where park_id=" + str_Confile[6] + " and device_type='プリンタ' and device_work='1';";
MySqlCommand mySqlCommand = new MySqlCommand(text, DBconnect);
Debug.WriteLine("★設定取得SQL:" + text);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
while (mySqlDataReader.Read())
{
Prn_Alert_flg = Convert.ToInt32(mySqlDataReader["printable_alert_flag"]);
Prn_MaxNum = Convert.ToInt32(mySqlDataReader["printable_number"]);
Prn_Alert_num = Convert.ToInt32(mySqlDataReader["printable_alert_number"]);
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (MySqlException ex)
{
Debug.WriteLine("★★_ERROR_9");
Trace.WriteLine(ex.Message);
DBconnect.Close();
mySqlCommand.Dispose();
return false;
}
catch (Exception ex2)
{
Debug.WriteLine("★★_ERROR_10");
Trace.WriteLine(ex2.Message);
DBconnect.Close();
mySqlCommand.Dispose();
return false;
}
MySqlCommand mySqlCommand2 = new MySqlCommand(text2, DBconnect);
Debug.WriteLine("★駐車場取得取得SQL:" + text2);
mySqlCommand2.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction2 = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader2 = mySqlCommand2.ExecuteReader();
while (mySqlDataReader2.Read())
{
Prn_ParkName = Convert.ToString(mySqlDataReader2["park_name"]);
if (mySqlDataReader2.IsDBNull(1))
{
Prn_NowNum = 0;
}
else
{
Prn_NowNum = Convert.ToInt32(mySqlDataReader2["print_number"]);
}
}
mySqlDataReader2.Close();
mySqlTransaction2.Commit();
}
catch (Exception ex3)
{
Debug.WriteLine("★★_ERROR_11");
Trace.WriteLine(ex3.Message);
DBconnect.Close();
mySqlCommand2.Dispose();
return false;
}
MySqlCommand mySqlCommand3 = new MySqlCommand(text3, DBconnect);
Debug.WriteLine("★デバイスID取得SQL:" + text3);
mySqlCommand3.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction3 = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader3 = mySqlCommand3.ExecuteReader();
while (mySqlDataReader3.Read())
{
KpAlive_devid = Convert.ToString(mySqlDataReader3["device_id"]);
}
mySqlDataReader3.Close();
mySqlTransaction3.Commit();
}
catch (Exception ex4)
{
Debug.WriteLine("★★_ERROR_12");
Trace.WriteLine(ex4.Message);
DBconnect.Close();
mySqlCommand3.Dispose();
return false;
}
if (string.IsNullOrWhiteSpace(KpAlive_devid))
{
KpAlive_devid = "99";
}
return true;
}
private uint SO_DBChk_qrnum(ref string str_qrc)
{
string cmdText = "select user_id, contract_id ,park_id from regular_contract where contract_qr_id='" + str_qrc + "';";
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
if (object.Equals(str_qrc, TESTQR_STRING))
{
test_mode = true;
Debug.WriteLine("◆QRテストモード\u3000オン");
mySqlTransaction.Commit();
return 0u;
}
test_mode = false;
Debug.WriteLine("◆QRテストモード\u3000オフ");
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
while (mySqlDataReader.Read())
{
str_uid = Convert.ToString(mySqlDataReader["user_id"]);
LOC_contract_id = Convert.ToString(mySqlDataReader["contract_id"]);
LOC_park_id = Convert.ToString(mySqlDataReader["park_id"]);
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_13");
Trace.WriteLine(ex.Message);
ERRORINFO = "該当定期契約QRID検索時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
return 1u;
}
if (str_uid.Length == 0)
{
return 3u;
}
return 0u;
}
private uint SO_DBChk_qrcheck(ref string str_qrc)
{
int num = 0;
string text = "";
string text2 = "";
string text3 = "select user_id, contract_id, contract_flag, contract_permission,park_id from regular_contract where contract_qr_id='" + str_qrc + "' ORDER BY updated_at DESC limit 1;";
Debug.WriteLine("◆◆_SO_DBChk_qrcheck: " + text3);
MySqlCommand mySqlCommand = new MySqlCommand(text3, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
if (object.Equals(str_qrc, TESTQR_STRING))
{
test_mode = true;
Debug.WriteLine("◆QRテストモード\u3000オン");
mySqlTransaction.Commit();
return 0u;
}
test_mode = false;
Debug.WriteLine("◆QRテストモード\u3000オフ");
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
while (mySqlDataReader.Read())
{
num = 1;
text = Convert.ToString(mySqlDataReader["contract_permission"]);
text2 = Convert.ToString(mySqlDataReader["contract_flag"]);
str_uid = Convert.ToString(mySqlDataReader["user_id"]);
LOC_contract_id = Convert.ToString(mySqlDataReader["contract_id"]);
LOC_park_id = Convert.ToString(mySqlDataReader["park_id"]);
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("◆◆_ERROR_20");
Trace.WriteLine(ex.Message);
ERRORINFO = "該当定期契約QRIDチェックエラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
return 1u;
}
if (num == 0)
{
Debug.WriteLine("◆◆_SO_DBChk_qrcheck_エラー該当QRレコードなし: " + str_qrc);
return 3u;
}
Debug.WriteLine("◆◆_SO_DBChk_qrcheck_contract_permission: " + text);
if (text2.Equals("False"))
{
Debug.WriteLine("◆◆_SO_DBChk_qrcheck_エラーQR未決済: " + str_qrc);
return 3u;
}
if (text.Equals("False"))
{
Debug.WriteLine("◆◆_SO_DBChk_qrcheck_エラーシール発行済: " + str_qrc);
return 6u;
}
if (SO_Chk_print_area(int.Parse(LOC_park_id)) == 0)
{
Debug.WriteLine("◆◆_SO_DBChk_qrcheck_エラー対象駐輪場外: " + LOC_park_id);
return 10u;
}
Debug.WriteLine("◆◆_SO_DBChk_qrcheck_正常終了: " + str_qrc);
return 0u;
}
private uint SO_DBChk_print_area(int set_park_id)
{
Array.Clear(park_id_set, 0, 500);
string text = "select park_id from print_area where print_area_name = (select print_area_name from print_area where park_id= '" + set_park_id + "');";
Debug.WriteLine("★シール印刷範囲マスタ取得SQL:" + text);
MySqlCommand mySqlCommand = new MySqlCommand(text, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
int num = 0;
while (mySqlDataReader.Read())
{
park_id_set[num] = Convert.ToInt32(mySqlDataReader["park_id"]);
num++;
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_14");
Trace.WriteLine(ex.Message);
ERRORINFO = "シール印刷範囲マスタ検索時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
return 1u;
}
if (park_id_set[0] == 0)
{
park_id_set[0] = set_park_id;
return 0u;
}
return 0u;
}
private string SO_DBChk_park_name(int park_id)
{
string result = "";
string text = "select park_name from park where park_id =" + park_id;
Debug.WriteLine("★駐輪場名取得SQL:" + text);
MySqlCommand mySqlCommand = new MySqlCommand(text, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
int num = 0;
while (mySqlDataReader.Read())
{
result = Convert.ToString(mySqlDataReader["park_name"]);
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_15");
Trace.WriteLine(ex.Message);
ERRORINFO = "駐輪場名検索時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
return "N/A";
}
return result;
}
private int SO_Chk_print_area(int park_id)
{
Debug.WriteLine("★シール印刷範囲チェック:" + park_id);
int[] array = park_id_set;
for (int i = 0; i < array.Length; i++)
{
int num = array[i];
Debug.WriteLine(" --チェック取得駐輪場ID" + num);
if (num == park_id)
{
Debug.WriteLine(" --チェックOK");
return 1;
}
if (num == 0)
{
break;
}
}
Debug.WriteLine(" --チェックNG");
return 0;
}
private uint SO_DBChk_tagnum()
{
string text = "";
string text2 = "";
string text3 = "";
string text4 = "select distinct t2.user_id, t2.contract_id, t2.park_id, t2.contract_flag, t2.contract_permission from (user t1, regular_contract t2) where t1.user_seq = t2.user_id and t1.user_tag_serial='" + MFCODE + "' ORDER BY t2.updated_at DESC , t2.contract_id DESC LIMIT 1;";
Debug.WriteLine("\u3000〓〓タグからユーザー取得SQL:" + text4);
MySqlCommand mySqlCommand = new MySqlCommand(text4, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
while (mySqlDataReader.Read())
{
str_uid = Convert.ToString(mySqlDataReader["user_id"]);
LOC_contract_id = Convert.ToString(mySqlDataReader["contract_id"]);
text = Convert.ToString(mySqlDataReader["contract_flag"]);
text2 = Convert.ToString(mySqlDataReader["contract_permission"]);
text3 = (Tag_ParkID = Convert.ToString(mySqlDataReader["park_id"]));
}
mySqlDataReader.Close();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("\u3000〓〓_ERROR_16");
Trace.WriteLine(ex.Message);
ERRORINFO = "該当タグシリアル検索時エラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
return 1u;
}
if (str_uid.Length == 0)
{
Debug.WriteLine("\u3000〓〓_SO_DBChk_tagnum_エラー該当レコード無し: " + MFCODE);
return 2u;
}
Debug.WriteLine("\u3000\u3000〓〓_SO_DBChk_tagnums_contract_flag(授受フラグ): " + text);
Debug.WriteLine("\u3000\u3000〓〓_SO_DBChk_tagnums_contract_permission印刷許可フラグ: " + text2);
Debug.WriteLine("\u3000\u3000〓〓_SO_DBChk_tagnum最新定期契約 park_id: " + text3);
if (SO_Chk_print_area(int.Parse(text3)) == 0)
{
Debug.WriteLine("\u3000〓〓_SO_DBChk_tagnum_エラー該当駐輪場外: " + text3);
return 9u;
}
if (!text.Equals("True"))
{
Debug.WriteLine("\u3000〓〓_SO_DBChk_tagnum_エラー未授受: " + LOC_contract_id);
return 8u;
}
if (text2.Equals("False"))
{
Debug.WriteLine("\u3000〓〓_SO_DBChk_tagnum_エラーシール発行済: " + LOC_contract_id);
return 7u;
}
return 0u;
}
/*private int SO_DBPrndat_01(uint type)
{
str_rctbl = new string[11];
string text = "";
string text2 = "";
string text3 = "";
string text4 = ((type == 0 || type == 3) ? (DBREAD_Prndat01[type] + DBREAD_Prndat02[type] + "'" + MFCODE + "' ORDER BY ta3.updated_at DESC LIMIT 1;") : ((type != 2) ? (DBREAD_Prndat01[type] + DBREAD_Prndat02[type] + "'" + QRdata + "';") : (DBREAD_Prndat01[type] + DBREAD_Prndat02[type] + "'" + MFCODE + "' ORDER BY ta3.updated_at DESC LIMIT 1;")));
if (DEBUG_MODE == "1")
{
MessageBox.Show("シール印刷用SQL" + text4, "デバッグモード", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
Debug.WriteLine("★シール印刷データ取得SQL_A:" + DBREAD_Prndat01[type]);
Debug.WriteLine("★シール印刷データ取得SQL_B(park_id):" + str_Confile[6]);
Debug.WriteLine("★シール印刷データ取得SQL_C:" + DBREAD_Prndat02[type]);
Debug.WriteLine("★シール印刷データ取得SQL_D:" + MFCODE);
Debug.WriteLine("★シール印刷データ取得SQL_E:" + QRdata);
Debug.WriteLine("★シール印刷データ取得SQL_ALL:" + text4);
MySqlCommand mySqlCommand = new MySqlCommand(text4, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
int num = 0;
MySqlTransaction mySqlTransaction = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand.ExecuteReader();
while (mySqlDataReader.Read())
{
str_Prndat[0] = Convert.ToString(mySqlDataReader["park_name"]);
str_Prndat[2] = Convert.ToString(mySqlDataReader["ptype_subject"]);
str_Prndat[7] = Convert.ToString(mySqlDataReader["city_name"]);
str_Prndat[8] = Convert.ToString(mySqlDataReader["user_id"]);
str_Prndat[12] = Convert.ToString(mySqlDataReader["user_seq"]);
str_Prndat[11] = Convert.ToString(mySqlDataReader["zone_name"]);
if (string.IsNullOrEmpty(Convert.ToString(mySqlDataReader["pplace_no"])))
{
str_Prndat[9] = str_Prndat[11];
}
else
{
str_Prndat[9] = str_Prndat[11] + ":" + Convert.ToString(mySqlDataReader["pplace_no"]);
}
text = Convert.ToString(mySqlDataReader["contract_periode"]);
text2 = Convert.ToString(mySqlDataReader["contract_id"]);
text3 = Convert.ToString(mySqlDataReader["usertype_subject1"]);
str_rctbl[3] = Convert.ToString(mySqlDataReader["printable_date"]);
str_rctbl[4] = ((mySqlDataReader["contract_flag"] != DBNull.Value) ? Convert.ToString(Convert.ToInt16(mySqlDataReader["contract_flag"])) : "0");
str_rctbl[5] = ((mySqlDataReader["contract_permission"] != DBNull.Value) ? Convert.ToString(Convert.ToInt16(mySqlDataReader["contract_permission"])) : "0");
str_rctbl[7] = Convert.ToString(mySqlDataReader["contract_seal_issue"]);
str_rctbl[8] = Convert.ToString(mySqlDataReader["user_id"]);
str_rctbl[9] = Convert.ToString(mySqlDataReader["park_id"]);
str_rctbl[10] = Convert.ToString(Convert.ToInt16(mySqlDataReader["tag_qr_flag"]));
if (string.IsNullOrWhiteSpace(str_rctbl[7]))
{
str_rctbl[7] = "0";
num = 0;
}
else
{
num = Convert.ToInt32(str_rctbl[7]);
}
}
mySqlDataReader.Close();
if (text3 == "学生")
{
str_Prndat[1] = "学";
}
else
{
str_Prndat[1] = " ";
}
if (num > 0)
{
str_Prndat[5] = "再" + str_rctbl[7];
}
else
{
str_Prndat[5] = "";
}
if (str_rctbl[10] == "0" || str_rctbl[10] == "False")
{
str_Prndat[10] = "●";
}
else
{
str_Prndat[10] = "";
}
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_17");
Trace.WriteLine(ex.Message);
ERRORINFO = "シールの印字内容を読み取り時にエラー発生";
DBconnect.Close();
mySqlCommand.Dispose();
for (int i = 0; i < 8; i++)
{
str_rctbl[i] = " ";
}
return 1;
}
if (type == 2 || type == 3)
{
text = kessaiYoyakuArray.contract_periode;
str_rctbl[3] = kessaiYoyakuArray.contract_periode;
}
if (string.IsNullOrWhiteSpace(str_Prndat[0]) || string.IsNullOrWhiteSpace(str_Prndat[2]) || string.IsNullOrWhiteSpace(text) || string.IsNullOrWhiteSpace(text2) || string.IsNullOrWhiteSpace(str_rctbl[3]) || string.IsNullOrWhiteSpace(str_rctbl[5]) || string.IsNullOrWhiteSpace(str_rctbl[8]))
{
DBconnect.Close();
ERRORINFO = "シールの印字内容を読み取り時にエラー発生";
return 1;
}
Cperiods(text, ref str_Prndat[3]);
Cperiode(text, ref str_Prndat[4]);
str_Prndat[6] = text2;
str_rctbl[0] = text2;
str_rctbl[2] = text.Substring(0, 10);
str_rctbl[3] = str_rctbl[3].Substring(0, 10);
str_Prndat[0] = SO_DBChk_park_name(int.Parse(str_rctbl[9]));
Debug.WriteLine("\u3000\u3000☆定期契約 park_id:" + str_rctbl[9]);
Debug.WriteLine("\u3000\u3000☆定期契約 park_name:" + str_Prndat[0]);
return 0;
}*/
private int SO_DBPrndat_01(uint type)
{
// 清空/准备缓冲
str_rctbl = new string[11];
string periode = "";
string contractId = "";
string userType1 = "";
// 组SQL
string sql =
(type == 0 || type == 3)
? (DBREAD_Prndat01[type] + DBREAD_Prndat02[type] + "'" + MFCODE + "' ORDER BY ta3.updated_at DESC LIMIT 1;")
: (type != 2)
? (DBREAD_Prndat01[type] + DBREAD_Prndat02[type] + "'" + QRdata + "';")
: (DBREAD_Prndat01[type] + DBREAD_Prndat02[type] + "'" + MFCODE + "' ORDER BY ta3.updated_at DESC LIMIT 1;");
if (DEBUG_MODE == "1")
MessageBox.Show("シール印刷用SQL" + sql, "デバッグモード", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
Debug.WriteLine("★シール印刷データ取得SQL_A:" + DBREAD_Prndat01[type]);
Debug.WriteLine("★シール印刷データ取得SQL_B(park_id):" + str_Confile[6]);
Debug.WriteLine("★シール印刷データ取得SQL_C:" + DBREAD_Prndat02[type]);
Debug.WriteLine("★シール印刷データ取得SQL_D:" + MFCODE);
Debug.WriteLine("★シール印刷データ取得SQL_E:" + QRdata);
Debug.WriteLine("★シール印刷データ取得SQL_ALL:" + sql);
using (var cmd = new MySqlCommand(sql, DBconnect))
{
cmd.CommandTimeout = 10; // 读1行给10秒更稳
try
{
using (var r = cmd.ExecuteReader())
{
if (!r.HasRows)
{
Trace.WriteLine("[Prndat01] NO ROWS for QR=" + QRdata + ", park_id=" + str_Confile[6]);
ERRORINFO = "印字データが見つかりません";
return 1;
}
// 便捷安全取值
string S(string col) => r[col] == DBNull.Value ? "" : Convert.ToString(r[col]);
int I(string col, int def = 0) => r[col] == DBNull.Value ? def : Convert.ToInt32(r[col]);
int reissueCount = 0;
// 只要第一条完整记录
while (r.Read())
{
str_Prndat[0] = S("park_name");
str_Prndat[2] = S("ptype_subject");
str_Prndat[7] = S("city_name");
str_Prndat[8] = S("user_id");
str_Prndat[12] = S("user_seq");
str_Prndat[11] = S("zone_name");
var pplace = S("pplace_no");
str_Prndat[9] = string.IsNullOrEmpty(pplace) ? str_Prndat[11] : $"{str_Prndat[11]}:{pplace}";
periode = S("contract_periode");
contractId = S("contract_id");
userType1 = S("usertype_subject1");
str_rctbl[3] = S("printable_date");
str_rctbl[4] = I("contract_flag", 0).ToString();
str_rctbl[5] = I("contract_permission", 0).ToString();
str_rctbl[7] = S("contract_seal_issue");
str_rctbl[8] = S("user_id");
str_rctbl[9] = S("park_id");
str_rctbl[10] = I("tag_qr_flag", 0).ToString(); // ← 允许为NULL
// 再发回数
reissueCount = string.IsNullOrWhiteSpace(str_rctbl[7]) ? 0 : I("contract_seal_issue", 0);
// 学生标记/再発/タグ●
str_Prndat[1] = (userType1 == "学生") ? "学" : " ";
str_Prndat[5] = (reissueCount > 0) ? ("再" + reissueCount) : "";
str_Prndat[10] = (str_rctbl[10] == "0" || str_rctbl[10].Equals("False", StringComparison.OrdinalIgnoreCase)) ? "●" : "";
break; // 取到第一条就够了
}
}
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_17");
Trace.WriteLine("[Prndat01 EX] " + ex.GetType().Name + ": " + ex.Message);
ERRORINFO = "シールの印字内容を読み取り時にエラー発生";
try { DBconnect.Close(); } catch { }
return 1;
}
}
// 外部予約时覆盖
if (type == 2 || type == 3)
{
periode = kessaiYoyakuArray.contract_periode;
str_rctbl[3] = kessaiYoyakuArray.contract_periode;
}
// 必填校验
if (string.IsNullOrWhiteSpace(str_Prndat[0]) ||
string.IsNullOrWhiteSpace(str_Prndat[2]) ||
string.IsNullOrWhiteSpace(periode) ||
string.IsNullOrWhiteSpace(contractId) ||
string.IsNullOrWhiteSpace(str_rctbl[3]) ||
string.IsNullOrWhiteSpace(str_rctbl[5]) ||
string.IsNullOrWhiteSpace(str_rctbl[8]))
{
ERRORINFO = "印字データの必須項目が不足しています";
try { DBconnect.Close(); } catch { }
return 1;
}
// 派生字段与子串保护
Cperiods(periode, ref str_Prndat[3]);
Cperiode(periode, ref str_Prndat[4]);
str_Prndat[6] = contractId;
str_rctbl[0] = contractId;
str_rctbl[2] = (!string.IsNullOrEmpty(periode) && periode.Length >= 10) ? periode.Substring(0, 10) : "";
str_rctbl[3] = (!string.IsNullOrEmpty(str_rctbl[3]) && str_rctbl[3].Length >= 10) ? str_rctbl[3].Substring(0, 10) : "";
// 取公园名park_id 解析保护)
if (int.TryParse(str_rctbl[9], out var parkId) && parkId > 0)
str_Prndat[0] = SO_DBChk_park_name(parkId);
Debug.WriteLine(" ☆定期契約X park_id:" + str_rctbl[9]);
Debug.WriteLine(" ☆定期契約X park_name:" + str_Prndat[0]);
return 0;
}
private void Cperiods(string str_work, ref string work)
{
int length = str_work.Length;
work = str_work.Substring(0, 4);
}
private void Cperiode(string str_work, ref string work)
{
if (str_work[5] == '0')
{
work = str_work.Substring(6, 1);
}
else
{
work = str_work.Substring(5, 2);
}
}
private bool SO_DBInsert_pjl(int type)
{
string text = "";
switch (type)
{
case 0:
case 81:
case 82:
case 83:
text = "insert into print_job_log ( park_id, user_id, contract_id, process_name,job_name, status, error_code, status_comment, created_at) value (" + str_Confile[6] + "," + str_rctbl[8] + "," + str_rctbl[0] + ",'" + str_logkm[2] + "','" + str_logkm[3] + "','" + str_logkm[4] + "'," + str_logkm[5] + ",'" + str_logkm[6] + "','" + str_logkm[7] + "');";
break;
case 84:
case 88:
text = "insert into print_job_log ( park_id, contract_id, process_name,job_name, status, error_code, status_comment, created_at) value (" + str_Confile[6] + "," + LOC_contract_id + ",'" + str_logkm[2] + "','" + str_logkm[3] + "','" + str_logkm[4] + "'," + str_logkm[5] + ",'" + str_logkm[6] + "','" + str_logkm[7] + "');";
break;
case 21:
text = "insert into print_job_log ( park_id, user_id, process_name,job_name, status, error_code, status_comment, created_at) value (" + str_Confile[6] + "," + str_rctbl[8] + ",'" + str_logkm[2] + "','" + str_logkm[3] + "','" + str_logkm[4] + "'," + str_logkm[5] + ",'" + str_logkm[6] + "','" + str_logkm[7] + "');";
break;
default:
text = "insert into print_job_log ( park_id, process_name,job_name, status, error_code, status_comment, created_at) value (" + str_Confile[6] + ",'" + str_logkm[2] + "','" + str_logkm[3] + "','" + str_logkm[4] + "'," + str_logkm[5] + ",'" + str_logkm[6] + "','" + str_logkm[7] + "');";
break;
}
Debug.WriteLine("\u3000\u3000☆print_job_log\u3000SQL:" + text);
Debug.WriteLine("\u3000\u3000☆print_job_log\u3000TYPE:" + type);
MySqlCommand mySqlCommand = new MySqlCommand(text, DBconnect);
mySqlCommand.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction = (mySqlCommand.Transaction = DBconnect.BeginTransaction());
mySqlCommand.ExecuteNonQuery();
mySqlTransaction.Commit();
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_18");
Trace.WriteLine(ex.Message);
ERRORINFO = "プリンタ制御プログラムログテーブル追加時にエラー2発生";
return false;
}
string cmdText = "select job_log_id from print_job_log where created_at='" + str_logkm[7] + "';";
MySqlCommand mySqlCommand2 = new MySqlCommand(cmdText, DBconnect);
mySqlCommand2.CommandTimeout = 1;
try
{
MySqlTransaction mySqlTransaction3 = DBconnect.BeginTransaction();
MySqlDataReader mySqlDataReader = mySqlCommand2.ExecuteReader();
while (mySqlDataReader.Read())
{
str_logkm[0] = Convert.ToString(mySqlDataReader["job_log_id"]);
}
mySqlDataReader.Close();
mySqlTransaction3.Commit();
}
catch (Exception ex2)
{
Debug.WriteLine("★★_ERROR_19");
Trace.WriteLine(ex2.Message);
ERRORINFO = "処理ログID読み取り時にエラー発生";
DBconnect.Close();
return false;
}
return true;
}
private bool SO_DBInsert_seal2(uint mode)
{
string text = "";
uint num = 1u;
string text2 = mode switch
{
1u => "QR通常印刷",
120u => "Mifareゼロ円印刷",
_ => "Mifare通常印刷",
};
if (test_mode)
{
text2 = "QRテスト印刷";
str_rctbl[0] = "0";
}
string text3 = DateTime.Now.ToString("yyyy-MM-dd");
string text4 = "1";
text = "insert into seal ( park_id, contract_id, psection_id, seal_day, created_at, updated_at, contract_seal_issue, seal_reason) value (" + str_Confile[6] + "," + str_rctbl[0] + ",'" + num + "','" + text3 + "','" + str_logkm[7] + "','" + str_logkm[7] + "','" + Convert.ToString(Convert.ToInt32(str_rctbl[7]) + 1) + "','" + text2 + "');";
MySqlCommand mySqlCommand = new MySqlCommand(text, DBconnect);
mySqlCommand.CommandTimeout = 1;
Debug.WriteLine(text, "InsertSQL ");
try
{
Debug.WriteLine(" --InsertSQL1A ");
MySqlTransaction mySqlTransaction = (mySqlCommand.Transaction = DBconnect.BeginTransaction());
mySqlCommand.ExecuteNonQuery();
mySqlTransaction.Commit();
Debug.WriteLine(" --InsertSQL1B ");
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_20");
Debug.WriteLine(" --InsertSQL2 ERROR ");
Trace.WriteLine(ex.Message);
ERRORINFO = "シール発行履歴テーブル追加2時にエラー発生";
return false;
}
return true;
}
private bool SO_MfifareInit()
{
Trace.WriteLine("★リーダーの初期化開始★");
uint num = 0u;
if (DEBUG_MODE == "1")
{
return true;
}
try
{
Trace.WriteLine("★デバックモードじゃないので初期化開始★");
using (ISCardContext iSCardContext = ContextFactory.Instance.Establish(SCardScope.System))
{
string[] readers = iSCardContext.GetReaders();
if (readers == null || readers.Length == 0)
{
MessageBox.Show("スマートカードリーダが見つかりません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Hand);
return false;
}
string[] array = readers;
foreach (string text in array)
{
readerName = text;
}
}
return true;
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_21");
Bitmap backgroundImage = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "\\pic6.png");
form2.BackgroundImage = backgroundImage;
Application.DoEvents();
Thread.Sleep(10000);
Trace.WriteLine(ex.Message);
return false;
}
}
/*private bool SO_QRcordInit()
{
if (DEBUG_MODE == "1")
{
return true;
}
serialPort1.Close();
Debug.WriteLine("☆☆QRコードリーダ初期化☆☆");
serialPort1.PortName = str_Confile[16];
serialPort1.DataBits = 8;
serialPort1.Parity = Parity.None;
serialPort1.StopBits = StopBits.One;
try
{
serialPort1.Open();
return true;
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_22");
Trace.WriteLine(ex.Message);
}
return false;
}*/
private bool SO_QRcordInit()
{
if (DEBUG_MODE == "1") return true;
try
{
if (serialPort1.IsOpen) serialPort1.Close();
Debug.WriteLine("☆☆QRコードリーダ初期化☆☆");
// === 基本参数常见默认9600 8N1 ===
serialPort1.PortName = str_Confile[16]; // 例: "COM3"
serialPort1.BaudRate = 9600;
serialPort1.DataBits = 8;
serialPort1.Parity = Parity.None;
serialPort1.StopBits = StopBits.One;
serialPort1.Handshake = Handshake.None;
// 一些扫码器需要拉起 DTR/RTS 才会发数据
serialPort1.DtrEnable = true;
serialPort1.RtsEnable = true;
// 与扫码器“后缀”一致(建议把枪设为 CR/LF
serialPort1.NewLine = "\r\n";
// 读写细节
serialPort1.Encoding = Encoding.ASCII; // 或 Encoding.UTF8不要用 UTF-32
serialPort1.DiscardNull = true;
serialPort1.ReadTimeout = 800; // 可根据需要调整
serialPort1.ReceivedBytesThreshold = 1;
// 端口存在性检查(可选)
var ports = SerialPort.GetPortNames();
if (!ports.Contains(serialPort1.PortName, StringComparer.OrdinalIgnoreCase))
{
Trace.WriteLine($"[QR] 指定端口不存在: {serialPort1.PortName}. 可用端口: {string.Join(",", ports)}");
return false;
}
serialPort1.Open();
serialPort1.DiscardInBuffer();
Trace.WriteLine($"[QR] Opened {serialPort1.PortName} @ {serialPort1.BaudRate}, 8N1, CRLF");
return true;
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_22 " + ex.Message);
return false;
}
}
public uint SO_MfifareCheck()
{
uint result = 0u;
uint num = 0u;
uint num2 = 0u;
uint num3 = 0u;
uint num4 = 0u;
uint num5 = 0u;
num = 1000u;
num2 = 0u;
num3 = 0u;
num4 = 64u;
string text = "";
using (ISCardContext iSCardContext = ContextFactory.Instance.Establish(SCardScope.System))
{
try
{
using ICardReader cardReader = iSCardContext.ConnectReader(readerName, SCardShareMode.Shared, SCardProtocol.Any);
CommandApdu commandApdu = new CommandApdu(IsoCase.Case2Short, cardReader.Protocol)
{
CLA = byte.MaxValue,
Instruction = InstructionCode.GetData,
P1 = 0,
P2 = 0,
Le = 0
};
using (cardReader.Transaction(SCardReaderDisposition.Leave))
{
IntPtr pci = SCardPCI.GetPci(cardReader.Protocol);
SCardPCI receivePci = new SCardPCI();
byte[] array = new byte[256];
byte[] array2 = commandApdu.ToArray();
int length = cardReader.Transmit(pci, array2, array2.Length, receivePci, array, array.Length);
ResponseApdu responseApdu = new ResponseApdu(array, length, IsoCase.Case2Short, cardReader.Protocol);
if (responseApdu.HasData)
{
StringBuilder stringBuilder = new StringBuilder(BitConverter.ToString(responseApdu.GetData()));
text = stringBuilder.Replace("-", string.Empty).ToString();
Debug.WriteLine("========================================");
Debug.WriteLine("☆☆" + text + "☆☆");
Debug.WriteLine("========================================");
}
else
{
MessageBox.Show("このカードではIDを取得できません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
catch (RemovedCardException)
{
return 10u;
}
catch (PCSCException ex2)
{
MessageBox.Show(ex2.Message, "スマートカードエラー", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
}
date1 = DateTime.Now;
int seconds = (date1 - date2).Seconds;
uint num6 = bcmp(vinfBuff, vinfBuff2);
if (seconds < 2 && num6 == 0)
{
result = 10u;
}
vinfBuff2 = vinfBuff;
date2 = date1;
MFCODE = text;
Thread.Sleep(500);
return result;
}
public static uint bcmp(byte[] buf1, byte[] buf2)
{
for (int i = 0; i < 10; i++)
{
if (buf1[i] != buf2[i])
{
return 1u;
}
}
return 0u;
}
private uint SO_PrnOut()
{
if (DEBUG_MODE == "1")
{
string path = LogfilePath + "DEBUG_OUTPUT.txt";
string text = "";
try
{
using StreamWriter streamWriter = new StreamWriter(path, append: true, Encoding.GetEncoding("utf-8"));
text += "===<印字データ>=============================\r";
text = text + "ゾーン名、車室番号=(" + str_Prndat[9] + ")\r";
text = text + "駐車場名=(" + str_Prndat[0] + ")\r";
text = text + "定期種別=(" + str_Prndat[1] + ")\r";
text = text + "場所種別=(" + str_Prndat[2] + ")\r";
text = text + "開始日=(" + str_Prndat[3] + ")\r";
text = text + "終了月=(" + str_Prndat[4] + ")\r";
text = text + "再発行=(" + str_Prndat[5] + ")\r";
text = text + "定期番号=(" + str_Prndat[6] + ")\r";
text = text + "自治体名=(" + str_Prndat[7] + ")\r";
text = text + "利用者ID=(" + str_Prndat[8] + ")\r";
text += "発行枚数=(1)\r\r";
streamWriter.WriteLine(text);
MessageBox.Show(text, "定期シール印刷情報", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_24");
Trace.WriteLine(ex.Message);
}
Trace.WriteLine("===<印字データ>=============================");
Trace.WriteLine("ゾーン名、車室番号=(" + str_Prndat[9] + ")");
Trace.WriteLine("駐車場名=(" + str_Prndat[0] + ")");
Trace.WriteLine("定期種別=(" + str_Prndat[1] + ")");
Trace.WriteLine("場所種別=(" + str_Prndat[2] + ")");
Trace.WriteLine("開始日=(" + str_Prndat[3] + ")");
Trace.WriteLine("終了月=(" + str_Prndat[4] + ")");
Trace.WriteLine("再発行=(" + str_Prndat[5] + ")");
Trace.WriteLine("定期番号=(" + str_Prndat[6] + ")");
Trace.WriteLine("自治体名=(" + str_Prndat[7] + ")");
Trace.WriteLine("利用者ID=(" + str_Prndat[8] + ")");
Trace.WriteLine("発行枚数=(1)");
Trace.WriteLine("");
return 0u;
}
if (!SO_PrnGetStatus())
{
return 1u;
}
Debug.WriteLine("プリンタデータの取得済み");
printer.Disconnect();
if (printer.Connect(3, printerPortName) != 0)
{
Debug.WriteLine("印刷できていない");
return 0u;
}
printer.SetMeasurementUnit(1);
LabelDesign design = new LabelDesign();
DesignLabel_Pattern(design, str_Prndat);
printer.Print(design, 1);
Debug.WriteLine(" --印刷成功");
return 0u;
}
private bool SO_PrnInit_Epson()
{
if (DEBUG_MODE == "1") return true;
try
{
// 1) 目标打印机
string ipAddress = str_Confile[18]; // e.g. "192.168.0.179"
string deviceId = "local_printer"; // TM-m30III 系列默认
int timeout = 30; // 秒(与你的封装一致)
// 2) 实例化与生成“测试票据”XML沿用 KessaiPrint 的生成方法)
var svc = new EpsonPrinterTMM30Service(ipAddress, deviceId, timeout);
// --- 测试数据(随便但合法) ---
string user_name = "TEST USER";
string kessai_no = "TEST0001";
string billing_amount = "1"; // 1円
string park_name = "TEST駐輪場";
string usertype_subject1 = "TEST-TYPE";
string enable_months = "1"; // 1ヶ月
string paymentDue = "2099/12/31";
string pay_code = "000000";
string label_title = str_Confile[31]; // 票据抬头So-Manager駐輪場
string label_tel = str_Confile[32]; // 电话
// 用 Payee2 模板生成 SOAP/ePOS XML与 KessaiPrint 一致的方式)
string soapRequest =
svc.GenerateSoapRequestPayee4(
user_name, kessai_no, billing_amount,
park_name, usertype_subject1, enable_months,
paymentDue, pay_code, label_title, label_tel
);
// 3) 发送打印请求
string respXml = svc.PrintXml(soapRequest);
System.Diagnostics.Debug.WriteLine("statusXml------" + respXml);
if (string.IsNullOrWhiteSpace(respXml))
{
ERRORINFO = "プリンタから応答がありません。";
return false;
}
// 4) 解析回包(和 KessaiPrint 同样的解析路径/命名空间)
var doc = new System.Xml.XmlDocument();
doc.LoadXml(respXml);
var nsmgr = new System.Xml.XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("s", "http://schemas.xmlsoap.org/soap/envelope/");
nsmgr.AddNamespace("epos", "http://www.epson-pos.com/schemas/2011/03/epos-print");
var node = doc.SelectSingleNode("//s:Body/epos:response", nsmgr) as System.Xml.XmlElement;
if (node == null)
{
ERRORINFO = "ステータス解析失敗responseードなし";
return false;
}
string success = node.GetAttribute("success"); // "true"/"false"
string status = node.GetAttribute("status"); // "0" 正常
string code = node.GetAttribute("code"); // エラーコード
// 5) 依据 success 分支处理(与 KessaiPrint 一致)
if (!string.Equals(success, "true", StringComparison.OrdinalIgnoreCase))
{
string errText = svc.PrinterErrorHandling(status, "34", DBconnect);
if (!string.IsNullOrEmpty(errText))
{
// 这里不重启应用;把错误信息挂出去即可
ERRORINFO = "プリンタ異常: " + errText + $" (code={code})";
return false;
}
// 没有明确错误映射,则视作可继续
return true;
}
// 成功:做纸量等检查
svc.PrinterPapperCheck(status, "34", DBconnect);
return true;
}
catch (Exception ex)
{
ERRORINFO = "プリンタ初期化エラー: " + ex.Message;
return false;
}
}
private uint SO_PrnOut_EpsonNetwork()
{
try
{
// ラベルデザイン作成
LabelDesign design = new LabelDesign();
DesignLabel_Pattern(design, str_Prndat);
// 印刷用XML生成
string xmlPrint = epsonPrinter.GenerateSoapRequestPayee1(
str_Prndat[8], // 利用者ID
str_Prndat[6], // 定期番号
"1000", // 金額(必要に応じて変更)
str_Prndat[0], // 駐車場名
str_Prndat[1], // 定期種別
"1", // 枚数
str_Prndat[3], // 開始日
str_Prndat[6], // 定期番号
"ウェルネット", // 支払先
"03-1234-5678" // 電話番号
);
// 印刷実行
string response = epsonPrinter.PrintXml(xmlPrint);
if (string.IsNullOrEmpty(response))
{
Debug.WriteLine("印刷に失敗しました");
return 1u;
}
Debug.WriteLine("ネットワーク印刷成功");
return 0u;
}
catch (Exception ex)
{
Debug.WriteLine("ネットワーク印刷エラー: " + ex.Message);
return 99u;
}
}
// 最終送印
private bool SO_PrnInit()
{
if (DEBUG_MODE == "1")
{
return true;
}
try
{
int num = 0;
short num2 = 0;
for (num2 = 1; num2 <= 9; num2++)
{
printerPortName = "USB00" + Convert.ToString(num2);
Debug.WriteLine(printerPortName + "が接続されているか確認しています。");
printer.Disconnect();
num = printer.Connect(3, printerPortName);
Debug.WriteLine("返り値:" + Convert.ToString(num));
if (num == 0)
{
break;
}
}
if (num != 0)
{
return SO_PrnGetStatus();
}
Debug.WriteLine("コネクト確認までクリア");
return SO_PrnGetStatus();
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_25");
MessageBox.Show("プリンタの初期化に失敗しました。PCを起動後にプリンタの電源を入れてください。", "プリンタ初期化エラー", MessageBoxButtons.OK, MessageBoxIcon.Hand);
Trace.WriteLine(ex.Message);
return false;
}
}
private bool SO_PrnGetStatus()
{
string text = "";
int num = printer.PrinterCheck();
if (num == 0)
{
int commandInterpreterInAction = printer.GetCommandInterpreterInAction();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetCommandInterpreterInAction\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(コマンド処理中)";
return false;
}
commandInterpreterInAction = printer.GetPaperError();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetPaperError\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(ペーパーエラー)";
return false;
}
commandInterpreterInAction = printer.GetRibbonEnd();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetRibbonEnd\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(プリンターのリボンエンド状態)";
return false;
}
commandInterpreterInAction = printer.GetBatchProcessing();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetBatchProcessing\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(バッチ処理印字中)";
return false;
}
commandInterpreterInAction = printer.GetPrinting();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetPrinting\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(印字中)";
return false;
}
commandInterpreterInAction = printer.GetPause();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetPause\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(ポーズ中)";
return false;
}
commandInterpreterInAction = printer.GetWaitingForPeeling();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetWaitingForPeeling\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(剥離待ち中)";
return false;
}
commandInterpreterInAction = printer.GetPrintHeadLowTemp();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetPrintHeadLowTemp\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(プリントヘッド低温エラー)";
return false;
}
commandInterpreterInAction = printer.GetPrintHeadFailure();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetPrintHeadFailure\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(プリントヘッド切れエラー)";
return false;
}
commandInterpreterInAction = printer.GetPrintHeadOverheat();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetPrintHeadOverheat\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(プリントヘッドオーバーヒートエラー)";
return false;
}
commandInterpreterInAction = printer.GetMechanismOpen();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetMechanismOpen\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(プリントヘッドオープンエラー)";
return false;
}
commandInterpreterInAction = printer.GetAutoCutterError();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetAutoCutterError\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(オートカッター異常)";
return false;
}
commandInterpreterInAction = printer.GetFanMotorError();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetFanMotorError\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(ファンモーターエラー)";
return false;
}
commandInterpreterInAction = printer.GetMiscError();
if (commandInterpreterInAction == 1)
{
ERRORINFO = "GetMiscError\u3000戻り値=" + commandInterpreterInAction + " プリンタステータス(その他のエラー)";
return false;
}
return true;
}
ERRORINFO = "PrinterCheck Error\u3000戻り値=" + num + " プリンタステータス =(PrinterCheck Error)";
return false;
}
private uint SO_PrnLabeEdit(uint type)
{
int num = 0;
str_Prndat = new string[13];
PrnDataField = new Dictionary<string, string>();
PrnDataField.Add("駐車場名", "");
PrnDataField.Add("定期種別", "");
PrnDataField.Add("場所種別", "");
PrnDataField.Add("開始日", "");
PrnDataField.Add("終了月", "");
PrnDataField.Add("再発行", "");
PrnDataField.Add("定期番号", "");
PrnDataField.Add("自治体名", "");
PrnDataField.Add("利用者ID", "");
PrnDataField.Add("ゾーン、車室名", "");
PrnDataField.Add("発行枚数", "");
PrnDataField.Add("タグ", "");
if (test_mode)
{
PrnDataField["駐車場名"] = Convert.ToString(DateTime.Now);
PrnDataField["定期種別"] = "";
PrnDataField["場所種別"] = "";
PrnDataField["開始日"] = "**";
PrnDataField["終了月"] = "";
PrnDataField["再発行"] = "";
PrnDataField["定期番号"] = "by Sorin";
if (NetworkInterface.GetIsNetworkAvailable())
{
PrnDataField["自治体名"] = "動作確認OK";
}
else
{
PrnDataField["自治体名"] = "プリンタOK、N/W NG";
}
PrnDataField["利用者ID"] = "So-Manager";
PrnDataField["ゾーン、車室名"] = "テスト印刷";
PrnDataField["発行枚数"] = "1";
PrnDataField["ゾーン"] = "";
PrnDataField["利用者連番"] = "So-Manager";
return 0u;
}
if (SO_DBPrndat_01(type) != 0)
{
return 1u;
}
PrnDataField["駐車場名"] = str_Prndat[0];
PrnDataField["定期種別"] = str_Prndat[1];
PrnDataField["場所種別"] = str_Prndat[2];
PrnDataField["開始日"] = str_Prndat[3];
PrnDataField["終了月"] = str_Prndat[4];
PrnDataField["再発行"] = str_Prndat[5];
PrnDataField["定期番号"] = str_Prndat[6];
PrnDataField["自治体名"] = str_Prndat[7];
PrnDataField["利用者ID"] = str_Prndat[8];
PrnDataField["ゾーン、車室名"] = str_Prndat[9];
PrnDataField["タグ"] = str_Prndat[10];
PrnDataField["ゾーン"] = str_Prndat[11];
PrnDataField["利用者連番"] = str_Prndat[12];
PrnDataField["発行枚数"] = "1";
return 0u;
}
/*private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
Debug.WriteLine("データ受信");
if (!serialPort1.IsOpen)
{
QRresult = 2u;
return;
}
try
{
date1 = DateTime.Now;
QRdata = serialPort1.ReadExisting();
QRdata = QRdata.Substring(0, QRdata.Length - 1);
Encoding encoding = Encoding.GetEncoding("utf-32");
QRresult = 1u;
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_26");
QRdata = ex.Message;
QRresult = 2u;
}
date1 = DateTime.Now;
int seconds = (date1 - date2).Seconds;
bool flag = QRdata.SequenceEqual(QRdata2);
if (seconds < 2 && flag)
{
QRresult = 10u;
}
Trace.WriteLine(QRdata);
QRdata2 = QRdata;
date2 = date1;
}*/
private void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
{
Debug.WriteLine("データ受信");
if (!serialPort1.IsOpen)
{
QRresult = 2u; // ポート未オープン
return;
}
try
{
while (serialPort1.IsOpen && serialPort1.BytesToRead > 0)
{
// 1) 按行读取(直到 NewLine建议设为 "\r\n"
string line = serialPort1.ReadLine();
// 2) 清理控制字符 + 前后空白
string cleaned = CleanCtrl(line); // ↓见下方辅助函数
// 空行就跳过
if (string.IsNullOrEmpty(cleaned))
continue;
// 3) 重复判定2秒内同一内容
date1 = DateTime.Now;
bool isDup = (date1 - date2).TotalSeconds < 2 &&
string.Equals(cleaned, QRdata2, StringComparison.Ordinal);
if (isDup)
{
QRresult = 10u; // 重复
}
else
{
QRdata = cleaned;
QRresult = 1u; // 正常
QRdata2 = cleaned;
date2 = date1;
Trace.WriteLine(cleaned);
}
}
}
catch (TimeoutException)
{
// 读超时可忽略
}
catch (Exception ex)
{
Debug.WriteLine("★★_ERROR_26 " + ex.Message);
QRdata = ex.Message;
QRresult = 2u; // エラー
}
}
// 去掉所有控制字符(0x000x1F和0x7F)、再Trim
private static string CleanCtrl(string s)
{
if (string.IsNullOrEmpty(s)) return string.Empty;
var filtered = new string(s.Where(ch => ch >= ' ' && ch != '\x7F').ToArray());
return filtered.Trim();
}
private uint CreateObject_Ex_TEST()
{
mif = Activator.CreateInstance(Type.GetTypeFromProgID("Mifare.API"));
if (mif == null)
{
return 1u;
}
return 0u;
}
private uint CreateObject_Ex()
{
if (ifd != null || icc != null || mif != null)
{
}
ifd = Activator.CreateInstance(Type.GetTypeFromProgID("IFD.RW"));
if (ifd == null)
{
return 1u;
}
icc = Activator.CreateInstance(Type.GetTypeFromProgID("ICC.Card"));
if (icc == null)
{
return 1u;
}
mif = Activator.CreateInstance(Type.GetTypeFromProgID("Mifare.API"));
if (mif == null)
{
return 1u;
}
return 0u;
}
private uint ObjectSetUp_Ex()
{
uint num = 0u;
string text = "";
short num2 = 0;
for (num2 = 1; num2 <= 9; num2++)
{
text = "COM" + Convert.ToString(num2);
Debug.WriteLine(text + "が接続されているか確認しています。");
num = (uint)ifd.SetUp("PR", ref text);
if (num == 0)
{
break;
}
}
if (num != 0)
{
return 1u;
}
if ((uint)icc.SetUp("AM:MIF", ref ifd) != 0)
{
return 1u;
}
num = (uint)mif.SetUp(ref icc);
if (num != 0)
{
return 1u;
}
return num;
}
private void ReleaseAid_Ex()
{
if (mif != null)
{
Marshal.ReleaseComObject(mif);
mif = null;
}
if (icc != null)
{
Marshal.ReleaseComObject(icc);
icc = null;
}
if (ifd != null)
{
Marshal.ReleaseComObject(ifd);
ifd = null;
}
GC.Collect();
}
private uint RW_Authentication_Ex()
{
uint num = 0u;
byte[] array = new byte[257];
uint num2 = 0u;
uint num3 = 0u;
byte[] array2 = new byte[28]
{
3, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 0, 0, 0
};
uint num4 = 67665936u;
num2 = 256u;
num = (uint)ifd.SetControl(num4, ref array2, out array, num2, out num3);
if (num != 0)
{
return num;
}
Array.Clear(array2, 0, array2.Length);
num3 = 0u;
num4 = 67665923u;
array2[0] = 0;
return (uint)ifd.SetControl(ref num4, ref array2, ref array, ref num2, ref num3);
}
private uint ReleaseCard_Ex()
{
int num = 0;
return (uint)icc.EndTransaction(ref num);
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Application.DoEvents();
}
private void EndProc()
{
if (EndType == 0)
{
return;
}
DBconnect.Close();
if (EndType < 3)
{
return;
}
if (DEBUG_MODE == "0")
{
printer.Disconnect();
if (EndType == 3 || EndType == 4)
{
return;
}
serialPort1.Close();
}
if (EndType != 10 && EndType > 5)
{
EndWait();
}
}
private void EndWait()
{
SO_FullScreen(MSG_NUM + 1, 1);
for (int i = 0; i < 60; i++)
{
if (EndType == 10)
{
Environment.Exit(0);
return;
}
Application.DoEvents();
Thread.Sleep(1000);
}
SO_FullScreen(MSG_NUM, 1);
}
private void DesignLabel_Pattern(LabelDesign design, string[] str_Prndat)
{
Controller controller = new Controller();
if (controller.Open(str_layoutFile) == 0)
{
controller.BeginPrint();
int frameIndex = controller.InitFrame("Frame1");
int parts = controller.GetParts(frameIndex, "発行枚数");
controller.SetPartsData(frameIndex, parts, PrnDataField["発行枚数"]);
int parts2 = controller.GetParts(frameIndex, "駐車場名");
controller.SetPartsData(frameIndex, parts2, PrnDataField["駐車場名"]);
int parts3 = controller.GetParts(frameIndex, "場所種別");
controller.SetPartsData(frameIndex, parts3, PrnDataField["場所種別"]);
int parts4 = controller.GetParts(frameIndex, "開始日");
controller.SetPartsData(frameIndex, parts4, PrnDataField["開始日"]);
int parts5 = controller.GetParts(frameIndex, "終了月");
controller.SetPartsData(frameIndex, parts5, PrnDataField["終了月"]);
int parts6 = controller.GetParts(frameIndex, "定期番号");
controller.SetPartsData(frameIndex, parts6, PrnDataField["定期番号"]);
int parts7 = controller.GetParts(frameIndex, "自治体名");
controller.SetPartsData(frameIndex, parts7, PrnDataField["自治体名"]);
int parts8 = controller.GetParts(frameIndex, "再発行");
controller.SetPartsData(frameIndex, parts8, PrnDataField["再発行"]);
int parts9 = controller.GetParts(frameIndex, "定期種別");
controller.SetPartsData(frameIndex, parts9, PrnDataField["定期種別"]);
int parts10 = controller.GetParts(frameIndex, "利用者ID");
controller.SetPartsData(frameIndex, parts10, PrnDataField["利用者ID"]);
int parts11 = controller.GetParts(frameIndex, "ゾーン、車室名");
controller.SetPartsData(frameIndex, parts11, PrnDataField["ゾーン、車室名"]);
int parts12 = controller.GetParts(frameIndex, "タグ");
controller.SetPartsData(frameIndex, parts12, PrnDataField["タグ"]);
int parts13 = controller.GetParts(frameIndex, "ゾーン");
controller.SetPartsData(frameIndex, parts13, PrnDataField["ゾーン"]);
int parts14 = controller.GetParts(frameIndex, "有効期限年");
controller.SetPartsData(frameIndex, parts14, "有効期限" + PrnDataField["開始日"] + "年");
int parts15 = controller.GetParts(frameIndex, "利用者連番");
controller.SetPartsData(frameIndex, parts15, PrnDataField["利用者連番"]);
controller.AddFrame(frameIndex);
controller.DoPrint("Citizen CL-E331J");
controller.EndPrint();
controller.Close();
}
else
{
MessageBox.Show("レイアウトファイルがありません。以下のファイルの存在を確認してください: " + Environment.NewLine + str_layoutFile, "レイアウトファイルエラー", MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
}
private void SetHomeButton()
{
Control control = base.Controls.Find("homeButton", searchAllChildren: true).FirstOrDefault();
if (control != null)
{
base.Controls.Remove(control);
control.Dispose();
}
PictureBox pictureBox = new PictureBox();
pictureBox.Image = Image.FromFile(AppDomain.CurrentDomain.BaseDirectory + "\\homeButton.png");
pictureBox.BackColor = Color.Transparent;
pictureBox.ForeColor = Color.Transparent;
pictureBox.Size = new Size(125, 125);
int num = Screen.PrimaryScreen.WorkingArea.Height;
pictureBox.Location = new Point(1275 - pictureBox.Width, 795 - pictureBox.Height);
pictureBox.Click += HomeButton_Click;
pictureBox.Name = "homeButton";
form2.Controls.Add(pictureBox);
pictureBox.BringToFront();
}
private void RemoveHomeButton()
{
for (int num = form2.Controls.Count - 1; num >= 0; num--)
{
Control control = form2.Controls[num];
if (control.Name == "homeButton")
{
form2.Controls.Remove(control);
control.Dispose();
}
}
}
private void HomeButton_Click(object sender, EventArgs e)
{
for (int num = form2.Controls.Count - 1; num >= 0; num--)
{
Control control = form2.Controls[num];
if (control is Button || control is Label || control is PictureBox)
{
form2.Controls.Remove(control);
control.Dispose();
}
}
KessaiEnd();
}
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(qk30ic.Form1));
this.button1 = new System.Windows.Forms.Button();
this.serialPort1 = new System.IO.Ports.SerialPort(this.components);
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)this.dataGridView1).BeginInit();
base.SuspendLayout();
this.button1.Location = new System.Drawing.Point(538, 380);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(134, 29);
this.button1.TabIndex = 0;
this.button1.Text = "終了";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(button1_Click);
this.serialPort1.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(serialPort1_DataReceived);
this.dataGridView1.AllowUserToAddRows = false;
dataGridViewCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle.Font = new System.Drawing.Font("MS UI Gothic", 9f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 128);
dataGridViewCellStyle.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(24, 36);
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowHeadersVisible = false;
this.dataGridView1.RowHeadersWidth = 60;
this.dataGridView1.RowTemplate.Height = 21;
this.dataGridView1.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.dataGridView1.Size = new System.Drawing.Size(1161, 330);
this.dataGridView1.TabIndex = 1;
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("MS UI Gothic", 12f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 128);
this.label2.Location = new System.Drawing.Point(20, 9);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(126, 16);
this.label2.TabIndex = 2;
this.label2.Text = "ローカルステータス";
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(554, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(200, 12);
this.label1.TabIndex = 3;
this.label1.Text = " ";
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
base.ClientSize = new System.Drawing.Size(1210, 421);
base.Controls.Add(this.label1);
base.Controls.Add(this.label2);
base.Controls.Add(this.dataGridView1);
base.Controls.Add(this.button1);
base.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
base.Name = "Form1";
this.Text = "シール発行プログラム";
base.TopMost = true;
base.WindowState = System.Windows.Forms.FormWindowState.Minimized;
base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(Form1_FormClosing);
base.Shown += new System.EventHandler(Form1_Shown);
((System.ComponentModel.ISupportInitialize)this.dataGridView1).EndInit();
base.ResumeLayout(false);
base.PerformLayout();
}
}