private void toolStripMenuItem3_Click(object sender, EventArgs e) { frmSpareTime fs = new frmSpareTime(); fs.Show(); }
private void buttonItem3_Click(object sender, EventArgs e) { frmSpareTime fs = new frmSpareTime(); fs.Show(); }
private void buttonX6_Click(object sender, EventArgs e) { System.Diagnostics.Debug.WriteLine(DateTime.Now); if (chkBatchAdd.Checked) { if (tBStart.Text == "" || tBStart.Text == "00" || tBStart.Text == "0" || tBEnd.Text == "" || tBEnd.Text == "00" || tBEnd.Text == "0") { MessageBox.Show("周次不能为空或0!!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } } else { if (tBWeek.Text == "" || tBWeek.Text == "00" || tBWeek.Text == "0") { MessageBox.Show("周次不能为空或0!!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } } foreach (ListViewItem LVI in listView3.Items) { LVI.Checked = true; } string[] strWeek = new string[7]; foreach (object obj in A1) { string S1 = obj.ToString(); switch (S1[0]) { case '1': strWeek[0] += S1.Substring(S1.IndexOf("第") + 1, 2); break; case '2': strWeek[1] += S1.Substring(S1.IndexOf("第") + 1, 2); break; case '3': strWeek[2] += S1.Substring(S1.IndexOf("第") + 1, 2); break; case '4': strWeek[3] += S1.Substring(S1.IndexOf("第") + 1, 2); break; case '5': strWeek[4] += S1.Substring(S1.IndexOf("第") + 1, 2); break; case '6': strWeek[5] += S1.Substring(S1.IndexOf("第") + 1, 2); break; case '7': strWeek[6] += S1.Substring(S1.IndexOf("第") + 1, 2); break; } } ArrayList[] ALWeek = new ArrayList[7]; for (int i = 0; i < 7; i++) { ALWeek[i] = new ArrayList(); if (strWeek[i] != null) { ALWeek[i] = ConvertToBClass(strWeek[i]); } } help.Oledbcommand("delete from SpareTime_Data where Supervisor_ID='" + DDID + "' and Spare_Week=" + tBWeek.Text + ";"); System.Diagnostics.Debug.WriteLine(DateTime.Now); if (chkBatchAdd.Checked == false) { System.Diagnostics.Debug.WriteLine(DateTime.Now); for (int i = 0; i < 7; i++) { if (ALWeek[i].Count > 0) { for (int j = 0; j < ALWeek[i].Count; j++) { if (tBWeek.Text.Count() == 1) { strID = DDID + "0" + tBWeek.Text + (i + 1).ToString() + ALWeek[i][j]; } else { strID = DDID + tBWeek.Text + (i + 1).ToString() + ALWeek[i][j]; } InsertArray.Add("insert into SpareTime_Data(Spare_ID,Supervisor_ID,Supervisor,Spare_Week,Spare_Day,Spare_Number) values('" + strID + "','" + DDID + "','" + DDName + "','" + tBWeek.Text + "','" + (i + 1).ToString() + "','" + ALWeek[i][j] + "')"); } } } help.insertToStockDataByBatch(InsertArray, progressBar1); InsertArray.Clear(); // Insert(); iyanzheng = 1; MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); progressBar1.Value = 0; //new frmSpareTime().Show(); } else { if (int.Parse(tBEnd.Text) <= int.Parse(tBStart.Text)) { MessageBox.Show("终止周必须大于起始周!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Stop); tBEnd.Select(); return; } System.Diagnostics.Debug.WriteLine(DateTime.Now); for (int i1 = int.Parse(tBStart.Text); i1 <= int.Parse(tBEnd.Text); i1++) { for (int i = 0; i < 7; i++) { if (ALWeek[i].Count > 0) { for (int j = 0; j < ALWeek[i].Count; j++) { if (i1.ToString().Count() == 1) { strID = DDID + "0" + i1.ToString() + (i + 1).ToString() + ALWeek[i][j]; } else { strID = DDID + i1.ToString() + (i + 1).ToString() + ALWeek[i][j]; } InsertArray.Add("insert into SpareTime_Data(Spare_ID,Supervisor_ID,Supervisor,Spare_Week,Spare_Day,Spare_Number) values('" + strID + "','" + DDID + "','" + DDName + "','" + i1.ToString() + "','" + (i + 1).ToString() + "','" + ALWeek[i][j] + "')"); } } } } help.insertToStockDataByBatch(InsertArray, progressBar1); InsertArray.Clear(); // Insert(); iyanzheng = 1; MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); frmSpareTime frs = new frmSpareTime(); frs.Show(); form.Close(); //progressBar1.Value = 0; //new frmSpareTime().Show(); } }