private void PrintSelections() { var rows = this.dataGridView1.SelectedRows; List <int> items = new List <int>(); if (rows.Count == 0) { return; } DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString); for (int i = 0; i < rows.Count; i++) { var list = from n in context.item where n.item_receipt_id == int.Parse(rows[i].Cells[0].Value.ToString().Substring(1, 4)) select n; foreach (var item in list) { items.Add(item.item_id); } } ItemsPrintDocument.PrintItems(items); context.SubmitChanges(); }
private void SellForm_KeyDown(object sender, KeyEventArgs e) { if (e.Control && e.KeyCode == Keys.Z) { var context = new DBClassDataContext(Globals.ConnectionString); if (this.privItem_id == 0) { return; } item privItem = context.item.Single(n => n.item_id == privItem_id); int? priv_canceledsellprice = privItem.item_sellprice; privItem.item_sellprice = privItemSellPrice; privItem.item_selltime = privItemSellTime; privItem.item_sell_operator = privItemSellOperatorId; context.SubmitChanges(); this.setItem(privItem); this.textBox_baika.Text = priv_canceledsellprice.ToString(); this.textBox_baika.Focus(); this.textBox_baika.SelectAll(); this.privItem_id = 0; } }
public void RefreshData() { var context = new DBClassDataContext(Globals.ConnectionString); List <item> items = (from n in context.item select n).ToList(); this.itemGroup = (from i in items group i by Globals.getSellerString(context.receipt.Single(n => n.receipt_id == i.item_receipt_id).receipt_seller, context.receipt.Single(n => n.receipt_id == i.item_receipt_id).receipt_seller_exname)) .OrderByDescending(g => (from i in g where i.item_sellprice.HasValue == false select i).Count()); this.dataGridView1.Rows.Clear(); foreach (var g in this.itemGroup) { DataGridViewRow row = this.dataGridView1.Rows[this.dataGridView1.Rows.Add()]; row.Cells["ColumnIchiran"].Value = "一覧"; //出品者取得 string receipt_seller = context.receipt.Single(n => n.receipt_id == g.First().item_receipt_id).receipt_seller; string receipt_seller_exname = context.receipt.Single(n => n.receipt_id == g.First().item_receipt_id).receipt_seller_exname; string sellerstring = Globals.getSellerString(receipt_seller, receipt_seller_exname); row.Cells["ColumnReceipt"].Value = sellerstring; row.Cells["ColumnReceipt"].Tag = Globals.getSellerSortKey(receipt_seller, receipt_seller_exname); //売上額 row.Cells["ColumnSellPrice"].Value = (from i in g where i.item_sellprice.HasValue select i.item_sellprice.Value).Sum(a => (int)a); //返品個数 row.Cells["ColumnReturn"].Value = (from i in g where i.item_sellprice.HasValue == false select i).Count(); } this.dataGridView1.VirtualMode = true; this.dataGridView1.VirtualMode = false; this.dataGridView1.Enabled = true; this.dataGridView1.Focus(); }
private void button_mibai_Click(object sender, EventArgs e) { if (curItem_id == 0) { return; } if (curItem_id < 90000) { var context = new DBClassDataContext(Globals.ConnectionString); var curItem = context.item.Single(n => n.item_id == curItem_id); curItem.item_sellprice = null; curItem.item_selltime = null; context.SubmitChanges(); this.DoKansaItem(curItem_id); this.label_error.Text = "商品を未売却にしました"; } else { var context = new DBClassDataContext(Globals.ConnectionString); var curItem = (from n in context.item where n.item_box_id == (curItem_id - 90000) select n).ToList(); foreach (var q in curItem) { q.item_sellprice = null; q.item_selltime = null; } context.SubmitChanges(); this.DoKansaItem(curItem_id); this.label_error.Text = "商品を未売却にしました"; } }
private void button_item_Click(object sender, EventArgs e) { int id; if (text_itemid.Text.Length > 0 && int.TryParse(text_itemid.Text, out id)) { var context = new DBClassDataContext(Globals.ConnectionString); var list = (from n in context.item where n.item_id == id select n).ToList(); if (list.Count == 0) { MessageBox.Show("該当する商品が存在しません"); } else { foreach (var q in list) { if (q.item_genre.HasValue && q.item_genre.Value != genreid) { if (DialogResult.No == MessageBox.Show("指定したジャンルと異なりますが追加しますか?", "確認", MessageBoxButtons.YesNo)) { return; } } dataGridView1.Rows.Add( q.item_id, q.item_name, q.item_tagprice ); } } text_itemid.SelectAll(); } }
private void button1_Click(object sender, EventArgs e) { int op; try { if (SelectOperator.ShowSelectOperatorDialog(out op) == DialogResult.OK) { this.nowOperator = op; } else { this.Close(); return; } } catch (Exception ex) { MessageBox.Show(ex.Message); this.Close(); return; } var context = new DBClassDataContext(Globals.ConnectionString); this.textBox_operator.Text = [email protected](n => n.operator_id == this.nowOperator).operator_name; this.textBox_ban_err("品番を入力してください"); }
private void RefreshData() { var context = new DBClassDataContext(Globals.ConnectionString); comboBox_bag.Items.Clear(); comboBox_genre.Items.Clear(); var boxlist = (from n in context.box where n.box_isbag == true select n).ToList(); if (boxlist.Count > 0) { foreach (var q in boxlist) { comboBox_bag.Items.Add(q.box_id); } comboBox_bag.SelectedIndex = 0; } var genrelist = (from n in context.genre select n).ToList(); if (genrelist.Count > 0) { foreach (var q in genrelist) { comboBox_genre.Items.Add(q.genre_name); } comboBox_genre.SelectedIndex = 0; } }
private void button_restore_Click(object sender, EventArgs e) { DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString); var list = from n in context.item orderby n.item_id ascending select n; foreach (var printeditem_id in pPrint) { foreach (var item in list) { if (item.item_id == printeditem_id) { item.item_tag_printed = false; } } } try { context.SubmitChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void LoadData() { var context = new DBClassDataContext(Globals.ConnectionString); if (boxid > 0) { var list = (from n in context.item where n.item_box_id == boxid select n).ToList(); foreach (var q in list) { //グリッド追加 dataGridView1.Rows.Add( q.item_id, q.item_name, q.item_tagprice, q.item_sellprice_bag ); } int price = 0; foreach (DataGridViewRow row in dataGridView1.Rows) { int i = 0; if (row.Cells["ItemSellPrice"].Value != null && int.TryParse(row.Cells["ItemSellPrice"].Value.ToString(), out i)) { price += i; } } label_Price.Text = "合計金額:" + price.ToString() + "円"; button_item.Enabled = true; button_save.Enabled = true; } }
public BoxItem() { InitializeComponent(); context = new DBClassDataContext(Globals.ConnectionString); selection = new List <int>(); Data_Load(); }
private void button_refresh_Click(object sender, EventArgs e) { DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString); var rows = itemsGridView1.SelectedRows; if (itemsGridView1.SelectedRows.Count > 0) { for (int i = 0; i < rows.Count; i++) { int id = int.Parse(rows[i].Cells[0].Value.ToString()); var list = from n in context.item where n.item_id == id select n; foreach (var item in list) { item.item_tag_printed = false; } } try { context.SubmitChanges(); MessageBox.Show("再印刷登録しました"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("登録する行を選択してください"); } }
public void ReceiptOpen(int receiptid, DBClassDataContext context) { var receipt_data = (from n in context.receipt where n.receipt_id == receiptid select n).First(); this.text_external.Text = receipt_data.receipt_seller_exname; if (receipt_data.receipt_seller == Globals.seller_EXT) { radio_external.Checked = true; } else if (receipt_data.receipt_seller == Globals.seller_DONATE) { radio_donate.Checked = true; } else if (receipt_data.receipt_seller == Globals.seller_LAGACY) { radio_legacy.Checked = true; } else { this.text_zai_ban.Text = receipt_data.receipt_seller.Substring(2, 2); this.text_zai_kumi.Text = receipt_data.receipt_seller.Substring(1, 1); this.text_zai_nen.Text = receipt_data.receipt_seller.Substring(0, 1); } textBox_num.Text = receiptid.ToString("'R'0000"); this.Text = "受付票: " + receiptid.ToString("'R'0000") + "(" + Globals.Config.bumonnname + ")"; receipt_id = receiptid; Globals.ConnectionString.Close(); itemsGridView1.Load(receiptid); itemsGridView1.Columns["Items_receipt_id"].Visible = false; itemsGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells); }
private void button_mibai_Click(object sender, EventArgs e) { if (curItem_id == 0) { return; } privItem_id = curItem_id; var context = new DBClassDataContext(Globals.ConnectionString); if (curItem_id < 90000) { item curItem = context.item.Single(n => n.item_id == curItem_id); privItemSellPrice = curItem.item_sellprice; privItemSellTime = curItem.item_selltime; privItemSellOperatorId = curItem.item_sell_operator; curItem.item_sellprice = null; curItem.item_selltime = null; } else { box curBox = context.box.Single(n => n.box_id == (curItem_id - 90000)); var curItems = (from n in context.item where n.item_box_id == curBox.box_id select n).ToList(); foreach (var q in curItems) { q.item_sellprice = null; q.item_selltime = null; } } context.SubmitChanges(); this.textBox_ban_err("次の品番を入力してね"); }
public ReceiptForm(int receiptid) { InitializeComponent(); DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString); this.itemsGridView1.Context = new DBClassDataContext(Globals.ConnectionString); ReceiptOpen(receiptid, context); }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (this.listBox1.SelectedItem == null) { return; } var context = new DBClassDataContext(Globals.ConnectionString); this.textBox1.Text = ([email protected](n => n.operator_name == (string)this.listBox1.SelectedItem)).operator_id.ToString(); }
private List <item> LoadItem() { DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString); var list = from n in context.item where n.item_tag_printed == false orderby n.item_id ascending select n; return(list.ToList()); }
private void RefreshList() { dataGridView1.Load(new DBClassDataContext(Globals.ConnectionString)); //ステータスバー更新 var context = new DBClassDataContext(Globals.ConnectionString); int count = context.item.Count(); int sellcount = context.item.Count(n => n.item_sellprice.HasValue); int sellpricecount = context.item.Sum(n => n.item_sellprice.HasValue ? n.item_sellprice.Value : 0); toolStripStatusLabel_count.Text = "商品数:" + count; toolStripStatusLabel_sellcount.Text = string.Format("売上:{0}円 ({1}商品)", sellpricecount, sellcount); }
public RePrint() { DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString); InitializeComponent(); source = from n in context.item where n.item_tag_printed == true select n; this.itemsGridView1.Context = context; itemList = source.ToList(); this.itemsGridView1.Load(itemList); }
private void Item_Load() { DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString); var list = from n in context.genre orderby n.genre_id ascending select n; listBox_genre.Items.Clear(); foreach (genre data in list) { listBox_genre.Items.Add(data.genre_name); } }
private void button_print_Click(object sender, EventArgs e) { var context = new DBClassDataContext(Globals.ConnectionString); //印刷 try { var boxlist = (from n in context.box where n.box_isbag == true select n.box_id).ToList(); BoxTagPrintDocument.PrintItems(boxlist); } catch { } }
private void setItem(item it) { this.curItem_id = it.item_id; var context = new DBClassDataContext(Globals.ConnectionString); item it_data = it; this.textBox_ban.Text = it.item_id.ToString(); this.textBox_name.BackColor = SystemColors.Control; this.textBox_name.Text = it_data.item_name; this.textBox_teika.Text = it_data.item_tagprice.ToString("#,##0"); this.textBox_nebiki.Text = it_data.item_return /*FIXME*/ ? "×" : "○"; if (it_data.item_sellprice.HasValue) { this.label_sellzumi.Visible = true; this.label_sellzumi.Text = "売却済 ¥" + it_data.item_sellprice.Value.ToString("#,##0"); this.label_sellop.Visible = true; this.label_sellop.Text = "入力者: " + (it_data.item_sell_operator != null ? [email protected](n => n.operator_id == it_data.item_sell_operator.Value).operator_name : "不明"); this.label_sellop.Text += " " + Globals.getTimeString(it_data.item_selltime); if (it_data.item_sellprice.Value == it_data.item_tagprice) { this.textBox_baika.Text = "-"; } else { this.textBox_baika.Text = it_data.item_sellprice.Value.ToString(); } this.button_mibai.Visible = true; } else if (it_data.item_sellprice_bag.HasValue) { this.label_sellzumi.Visible = true; this.label_sellzumi.Text = "福袋商品です。 箱番:" + it_data.item_box_id.Value.ToString(); } else { this.label_sellzumi.Visible = false; this.label_sellop.Visible = false; this.button_mibai.Visible = false; this.textBox_baika.Text = ""; } this.label_baikaEnter.Visible = true; this.textBox_baika.ReadOnly = false; this.textBox_baika.BackColor = SystemColors.Window; this.textBox_baika.Focus(); this.textBox_baika.SelectAll(); }
private DbConfig GetConfig(DBClassDataContext context) { DbConfig config_data = new DbConfig(); try { foreach (var n in context.config) { if (n.config_name == "bumonname") { config_data.bumonnname = n.config_value; } else if (n.config_name == "companyname") { config_data.companyname = n.config_value; } else if (n.config_name == "symbolcolor_argb") { config_data.symbolcolor = Color.FromArgb(int.Parse(n.config_value)); } else if (n.config_name == "bumontextcolor_argb") { config_data.bumontextcolor = Color.FromArgb(int.Parse(n.config_value)); } else if (n.config_name == "barcodeprefix") { config_data.barcodeplefix = int.Parse(n.config_value); } else if (n.config_name == "itemname_imeon") { config_data.itemname_iemon = bool.Parse(n.config_value); } else if (n.config_name == "entertotab") { config_data.entertotab = bool.Parse(n.config_value); } else if (n.config_name == "connection_string") { config_data.connectionstring = n.config_value; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } return(config_data); }
private void text_itemid_KeyDown(object sender, KeyEventArgs e) { DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString); if (e.KeyCode == Keys.Enter) { item list; int itemid; text_price.BackColor = Color.White; text_volume.BackColor = Color.White; text_num.BackColor = Color.White; if (int.TryParse(text_itemid.Text, out itemid)) { try { list = (from n in context.item where n.item_id == itemid select n).First(); if (list != null) { receipt_id = list.item_receipt_id; text_itemid.Text = list.item_id.ToString(); item_id = list.item_id; text_itemname.Text = list.item_name; text_price.Text = list.item_tagprice.ToString(); check_return.Checked = list.item_return; if (list.item_number > 1) { this.groupBox_volume.Enabled = true; this.text_num.Text = list.item_number.ToString(); if (text_volume.Text != "") { this.text_volume.Text = list.item_volumes.ToString(); } } else { this.groupBox_volume.Enabled = false; this.text_num.Text = ""; this.text_volume.Text = ""; } this.supplement = list.item_supplement; this.label_supplement.Visible = list.item_supplement; } } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
private void comboBox_bag_SelectedValueChanged(object sender, EventArgs e) { var context = new DBClassDataContext(Globals.ConnectionString); boxid = (int)comboBox_bag.SelectedItem; if (boxid >= 0) { var box = context.box.Single(n => n.box_id == boxid); text_name.Text = box.box_comment; comboBox_genre.SelectedItem = context.genre.Single(n => n.genre_id == box.box_genre).genre_name; } button_item.Enabled = false; button_save.Enabled = false; dataGridView1.Rows.Clear(); }
private void button_print_Click(object sender, EventArgs e) { DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString); if (listBox_genre.SelectedIndex < 0) { return; } var data = (from n in context.genre where n.genre_name == listBox_genre.SelectedItem.ToString() select n); int genreid = -1; foreach (var item in data) { genreid = item.genre_id; } if (genreid <= 0) { return; } PageSetupDialog psd = new PageSetupDialog(); psd.EnableMetric = true; //cf. KB814355 et http://dobon.net/vb/dotnet/graphics/pagesetupdialogbug.html psd.PageSettings = Globals.receipt_pageSettings; psd.PrinterSettings = Globals.receipt_printerSettings; psd.AllowMargins = false; psd.ShowDialog(); PrintDialog prid = new PrintDialog(); prid.PrinterSettings = Globals.receipt_printerSettings; prid.UseEXDialog = true; DialogResult pdres = prid.ShowDialog(); if (pdres != DialogResult.OK) { return; } System.Threading.Thread t = new System.Threading.Thread( (delegate() { prid.Document = new GenrePrintDocument(genreid, Globals.receipt_pageSettings, Globals.receipt_printerSettings); prid.Document.Print(); })); t.Start(); }
private void setItem(box bx) { this.curItem_id = 90000 + bx.box_id; var context = new DBClassDataContext(Globals.ConnectionString); box box_data = bx; List <item> item_list = (from n in context.item where n.item_box_id == box_data.box_id select n).ToList(); this.textBox_ban.Text = bx.box_id.ToString(); this.textBox_name.BackColor = SystemColors.Control; this.textBox_name.Text = box_data.box_comment; this.textBox_teika.Text = item_list.Sum(n => n.item_sellprice_bag.Value).ToString("#,##0"); this.textBox_nebiki.Text = "×"; if (item_list[0].item_sellprice.HasValue) { this.label_sellzumi.Visible = true; this.label_sellzumi.Text = "売却済 ¥" + item_list.Sum(n => n.item_sellprice.Value).ToString("#,##0"); this.label_sellop.Visible = true; this.label_sellop.Text = "入力者: " + (item_list[0].item_sell_operator != null ? [email protected](n => n.operator_id == item_list[0].item_sell_operator.Value).operator_name : "不明"); this.label_sellop.Text += " " + Globals.getTimeString(item_list[0].item_selltime); if (item_list.Sum(n => n.item_sellprice.Value) == item_list.Sum(n => n.item_sellprice_bag.Value)) { this.textBox_baika.Text = "-"; } else { this.textBox_baika.Text = item_list.Sum(n => n.item_sellprice.Value).ToString(); } this.button_mibai.Visible = true; } else { this.label_sellzumi.Visible = false; this.label_sellop.Visible = false; this.button_mibai.Visible = false; this.textBox_baika.Text = ""; } this.label_baikaEnter.Visible = true; this.textBox_baika.ReadOnly = false; this.textBox_baika.BackColor = SystemColors.Window; this.textBox_baika.Focus(); this.textBox_baika.SelectAll(); }
public ConfigForm() { InitializeComponent(); context = new DBClassDataContext(Globals.ConnectionString); var config = GetConfig(context); this.textBox_bumon.Text = config.bumonnname; this.textBox_company.Text = config.companyname; this.pictureBox1.BackColor = config.symbolcolor; this.pictureBox2.BackColor = config.bumontextcolor; this.textBox_barcode.Text = config.barcodeplefix.ToString(); this.checkBox_imeon.Checked = config.itemname_iemon; this.checkBox_entertotab.Checked = config.entertotab; this.textBox_connection.Text = config.connectionstring; }
private void LoadOperator() { dataGridView1.Rows.Clear(); DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString); var list = from n in context.@operator select n; foreach (var q in list) { this.dataGridView1.Rows.Add( q.operator_id, q.operator_name, q.operator_comment ); } }
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { string value; if (this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == null) { return; } else { value = this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); } DBClassDataContext context = new DBClassDataContext(Globals.ConnectionString); int id; @operator operator_item; if (int.TryParse((this.dataGridView1.Rows[e.RowIndex].Cells["OperatorId"].Value ?? "").ToString(), out id)) { operator_item = [email protected](n => n.operator_id == id); } else { operator_item = new @operator(); [email protected](operator_item); } switch (e.ColumnIndex) { case 1: operator_item.operator_name = value; break; case 2: operator_item.operator_comment = value; break; } try { context.SubmitChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } LoadOperator(); }
private void button3_Click(object sender, EventArgs e) { if (this.allListForm == null || this.allListForm.IsDisposed) { var context = new DBClassDataContext(Globals.ConnectionString); this.allListForm = new ItemsShow( (ItemsShow.ItemReturnDelegate) delegate() { return((from n in context.item where n.item_kansa_end == null && n.item_sellprice != null select n).ToList()); }, "監査対象"); } this.allListForm.Show(); this.allListForm.Activate(); }