private void button7_Click(object sender, EventArgs e) { try { Lv1.Items[LvCount].SubItems[1].Text = listBox1.Text; Lv1.Items[LvCount].SubItems[2].Text = listBox2.Text; Lv1.Items[LvCount].SubItems[3].Text = CactusValue[Convert.ToInt32(Regex.Split(Regex.Split(Lv1.Items[LvCount].SubItems[1].Text, "{")[1], "}")[0]) - 1].ToString(); Lv1.Items[LvCount].SubItems[4].Text = (Convert.ToInt32(Lv1.Items[LvCount].SubItems[2].Text) * Convert.ToInt32(Lv1.Items[LvCount].SubItems[3].Text)).ToString(); int Sum = 0; for (int i = 0; i <= LvCount; i++) { Sum = Sum + Convert.ToInt32(Lv1.Items[i].SubItems[4].Text); } Lv1.Items[21].SubItems[1].Text = Sum.ToString(); LvCount++; listBox1.SelectedItem = null; listBox2.SelectedItem = null; ObjectTxt.Focus(); } catch (Exception es) { Lv1.Items[LvCount].SubItems[1].Text = null; Lv1.Items[LvCount].SubItems[2].Text = null; Lv1.Items[LvCount].SubItems[2].Text = null; Lv1.Items[LvCount].SubItems[3].Text = null; Lv1.Items[LvCount].SubItems[4].Text = null; MessageBox.Show(es.Message); } }
private void button5_Click(object sender, EventArgs e) { if (LvCount <= 0) { MessageBox.Show("삭제할 목록이 없습니다."); LvCount = 0; } else { try { var idxColl = Lv1.SelectedIndices; int idx = 0; for (int i = idxColl.Count - 1; i >= 0; i--) { idx = idxColl[i]; } if (idx >= LvCount) { MessageBox.Show("삭제하실 내용이 없습니다."); return; } Lv1.Items[idx].SubItems[1].Text = ""; Lv1.Items[idx].SubItems[2].Text = ""; Lv1.Items[idx].SubItems[3].Text = ""; for (int i = idx; i <= LvCount; i++) { Lv1.Items[i].SubItems[1].Text = Lv1.Items[i + 1].SubItems[1].Text; Lv1.Items[i].SubItems[2].Text = Lv1.Items[i + 1].SubItems[2].Text; Lv1.Items[i].SubItems[3].Text = Lv1.Items[i + 1].SubItems[3].Text; Lv1.Items[i].SubItems[4].Text = Lv1.Items[i + 1].SubItems[4].Text; } Lv1.Items[LvCount].SubItems[1].Text = ""; Lv1.Items[LvCount].SubItems[2].Text = ""; Lv1.Items[LvCount].SubItems[3].Text = ""; Lv1.Items[LvCount].SubItems[4].Text = ""; LvCount--; int Sum = 0; for (int i = 0; i < LvCount; i++) { Sum = Sum + Convert.ToInt32(Lv1.Items[i].SubItems[3].Text); } Lv1.Items[21].SubItems[1].Text = Sum.ToString(); ObjectTxt.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public void button6_Click(object sender, EventArgs e) { CactusListReset(); this.Invoke(new Action(delegate() { for (int i = 0; i <= LvCount; i++) { Lv1.Items[i].SubItems[1].Text = ""; Lv1.Items[i].SubItems[2].Text = ""; Lv1.Items[i].SubItems[3].Text = ""; Lv1.Items[i].SubItems[4].Text = ""; } Lv1.Items[21].SubItems[1].Text = "0"; LvCount = 0; ObjectTxt.Focus(); })); }
public void button2_Click(object sender, EventArgs e) { // D33 합계 try { if (Fun.InstrSeach(ObjectTxt.Text, "{") != 0) { Lv1.Items[LvCount].SubItems[1].Text = ObjectTxt.Text; } else { Lv1.Items[LvCount].SubItems[1].Text = CactusName[Convert.ToInt32(ObjectTxt.Text) - 1].ToString(); } //Lv1.Items[LvCount].SubItems[1].Text = CactusName[Convert.ToInt32(ObjectTxt.Text) - 1].ToString(); Lv1.Items[LvCount].SubItems[2].Text = NumberTxt.Text; Lv1.Items[LvCount].SubItems[3].Text = CactusValue[Convert.ToInt32(Regex.Split(Regex.Split(Lv1.Items[LvCount].SubItems[1].Text, "{")[1], "}")[0]) - 1].ToString(); Lv1.Items[LvCount].SubItems[4].Text = (CactusValue[Convert.ToInt32(Regex.Split(Regex.Split(Lv1.Items[LvCount].SubItems[1].Text, "{")[1], "}")[0]) - 1] * Convert.ToInt32(NumberTxt.Text)).ToString(); int Sum = 0; for (int i = 0; i <= LvCount; i++) { Sum = Sum + Convert.ToInt32(Lv1.Items[i].SubItems[4].Text); } Lv1.Items[21].SubItems[1].Text = Sum.ToString(); LvCount++; NumberTxt.Text = null; ObjectTxt.Text = null; ObjectTxt.Focus(); //CactusList[11, 2] = textBox1.Text; //StartJeju.SetDataExcel(CactusList); }catch (Exception es) { Lv1.Items[LvCount].SubItems[1].Text = null; Lv1.Items[LvCount].SubItems[2].Text = null; Lv1.Items[LvCount].SubItems[2].Text = null; Lv1.Items[LvCount].SubItems[3].Text = null; Lv1.Items[LvCount].SubItems[4].Text = null; MessageBox.Show(es.Message); } }
public void button4_Click(object sender, EventArgs e) { CactusListReset(); int NCount = 0; for (int i = 0; i < LvCount; i++) { CactusList[11 + i, 1] = Strings.Split(Lv1.Items[i].SubItems[1].Text, "{")[0]; // 품명 CactusList[11 + i, 2] = Lv1.Items[i].SubItems[2].Text; // 수량 NCount += Convert.ToInt32(Lv1.Items[i].SubItems[2].Text); CactusList[11 + i, 3] = Lv1.Items[i].SubItems[3].Text; // 단가 CactusList[11 + i, 4] = Lv1.Items[i].SubItems[4].Text; // 가격 } CactusList[33, 4] = Lv1.Items[21].SubItems[1].Text; CactusList[9, 3] = NCount; CactusList[7, 3] = DateTime.Now.ToString(); StartJeju.SetDataExcel(CactusList); StartJeju.SetPrintExcel(); ObjectTxt.Focus(); }