private void gridView1_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Space) { if (gridView1.GetFocusedRowCellValue("Seçim").ToString() == "True") { gridView1.SetFocusedRowCellValue("Seçim", false); } else { gridView1.SetFocusedRowCellValue("Seçim", true); } } else if (e.KeyCode == Keys.Enter) { string barcode = ""; string oldBarcode, state = ""; int miktar; int LastListRef; DataRow row; gridView1.Columns[2].UnGroup(); #region Plug if (gelen == "Plug") { FrmOperation form = (FrmOperation)Application.OpenForms["FrmOperation"]; for (int i = 0; i < gridView1.RowCount; i++) { if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True") { if (form.grdGrid.RowCount - 1 > 0) { for (int a = 0; a < form.grdGrid.RowCount - 1; a++) { barcode = gridView1.GetRowCellValue(i, "Barkod").ToString(); oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString(); if (barcode == oldBarcode) { miktar = int.Parse(form.grdGrid.GetRowCellValue(a, "Miktar").ToString()); miktar++; form.grdGrid.SetRowCellValue(a, "Miktar", miktar); state = "true"; break; } else { state = "false"; } } if (state == "false") { row = form.dtBox.NewRow(); row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); row["Birim Ref"] = gridView1.GetRowCellValue(i, "Birim Ref").ToString(); row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString(); row["Miktar"] = 1; form.dtBox.Rows.Add(row); } } else { row = form.dtBox.NewRow(); row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); row["Birim Ref"] = gridView1.GetRowCellValue(i, "Birim Ref").ToString(); row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString(); row["Miktar"] = 1; form.dtBox.Rows.Add(row); } } } } #endregion #region Sell List else if (gelen == "List") { Sell.FrmSellPrices form = (Sell.FrmSellPrices)Application.OpenForms["FrmSellPrices"]; for (int i = 0; i < gridView1.RowCount; i++) { if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True") { if (form.grdGrid.RowCount - 1 > 0) { for (int a = 0; a < form.grdGrid.RowCount - 1; a++) { barcode = gridView1.GetRowCellValue(i, "Barkod").ToString(); oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString(); if (barcode == oldBarcode) { state = "true"; break; } else { state = "false"; } } if (state == "false") { row = form.dtBox.NewRow(); row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); row["Birim Ref"] = gridView1.GetRowCellValue(i, "Birim Ref").ToString(); row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString(); row["Fiyat"] = 1; form.dtBox.Rows.Add(row); } } else { row = form.dtBox.NewRow(); row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); row["Birim Ref"] = gridView1.GetRowCellValue(i, "Birim Ref").ToString(); row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString(); row["Fiyat"] = 1; form.dtBox.Rows.Add(row); } } } } #endregion #region Kampanya else if (gelen == "Campaing") { Sell.FrmCampaings form = (Sell.FrmCampaings)Application.OpenForms["FrmCampaings"]; for (int i = 0; i < gridView1.RowCount; i++) { if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True") { if (form.grdGrid.RowCount - 1 > 0) { for (int a = 0; a < form.grdGrid.RowCount - 1; a++) { barcode = gridView1.GetRowCellValue(i, "Barkod").ToString(); oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString(); if (barcode == oldBarcode) { state = "true"; break; } else { state = "false"; } } if (state == "false") { row = form.dtBox.NewRow(); row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); form.dtBox.Rows.Add(row); } } else { row = form.dtBox.NewRow(); row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); form.dtBox.Rows.Add(row); } } } } #endregion #region İndirim else if (gelen == "Discount") { Sell.FrmDiscount form = (Sell.FrmDiscount)Application.OpenForms["FrmDiscount"]; for (int i = 0; i < gridView1.RowCount; i++) { if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True") { if (form.grdGrid.RowCount - 1 > 0) { for (int a = 0; a < form.grdGrid.RowCount - 1; a++) { barcode = gridView1.GetRowCellValue(i, "Barkod").ToString(); oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString(); if (barcode == oldBarcode) { state = "true"; break; } else { state = "false"; } } if (state == "false") { row = form.dtBox.NewRow(); row["İndirim Tipi"] = 400; row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); row["Birim Ref"] = gridView1.GetRowCellValue(i, "Birim Ref").ToString(); row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString(); string paramBarcode = gridView1.GetRowCellValue(i, "Barkod").ToString(); db.AddParameterValue("@branchRef", branchRef); db.AddParameterValue("@barcode", paramBarcode); row["Eski Fiyat"] = decimal.Parse(db.GetScalarValue("select dbo.Tools_GetLastActiveSellPrice(@barcode,@branchRef)").ToString()); form.dtBox.Rows.Add(row); } } else { row = form.dtBox.NewRow(); row["İndirim Tipi"] = 400; row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); row["Birim Ref"] = gridView1.GetRowCellValue(i, "Birim Ref").ToString(); row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString(); string paramBarcode = gridView1.GetRowCellValue(i, "Barkod").ToString(); db.AddParameterValue("@branchRef", branchRef); db.AddParameterValue("@barcode", paramBarcode); row["Eski Fiyat"] = decimal.Parse(db.GetScalarValue("select dbo.Tools_GetLastActiveSellPrice(@barcode,@branchRef)").ToString()); form.dtBox.Rows.Add(row); } } } } #endregion #region Buy List else if (gelen == "Buy") { Buy.FrmBuyList form = (Buy.FrmBuyList)Application.OpenForms["FrmBuyList"]; for (int i = 0; i < gridView1.RowCount; i++) { if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True") { if (form.grdGrid.RowCount - 1 > 0) { for (int a = 0; a < form.grdGrid.RowCount - 1; a++) { barcode = gridView1.GetRowCellValue(i, "Barkod").ToString(); oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString(); if (barcode == oldBarcode) { state = "true"; break; } else { state = "false"; } } if (state == "false") { row = form.dtBox.NewRow(); row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); row["Birim Ref"] = gridView1.GetRowCellValue(i, "Birim Ref").ToString(); row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString(); row["Fiyat"] = 1; form.dtBox.Rows.Add(row); } } else { row = form.dtBox.NewRow(); row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); row["Birim Ref"] = gridView1.GetRowCellValue(i, "Birim Ref").ToString(); row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString(); row["Fiyat"] = 1; form.dtBox.Rows.Add(row); } } } } #endregion #region Buy Order if (gelen == "Buy Order") { Buy.FrmBuyOrder form = (Buy.FrmBuyOrder)Application.OpenForms["FrmBuyOrder"]; for (int i = 0; i < gridView1.RowCount; i++) { if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True") { if (form.grdGrid.RowCount - 1 > 0) { for (int a = 0; a < form.grdGrid.RowCount - 1; a++) { barcode = gridView1.GetRowCellValue(i, "Barkod").ToString(); oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString(); if (barcode == oldBarcode) { miktar = int.Parse(form.grdGrid.GetRowCellValue(a, "Miktar").ToString()); miktar++; form.grdGrid.SetRowCellValue(a, "Miktar", miktar); state = "true"; break; } else { state = "false"; } } if (state == "false") { row = form.dtBox.NewRow(); row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); row["Birim Ref"] = gridView1.GetRowCellValue(i, "Birim Ref").ToString(); row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString(); row["Miktar"] = 1; db.AddParameterValue("@barcode", gridView1.GetRowCellValue(i, "Barkod").ToString()); db.AddParameterValue("@branchRef", form.ledBranch.GetValue()); string price = db.GetScalarValue("select dbo.Tools_GetLastActiveBuyPrice(@barcode,@branchRef)").ToString(); row["Birim Fiyat"] = price; decimal total = 1 * decimal.Parse(price); row["Toplam Tutar"] = total; form.dtBox.Rows.Add(row); } } else { row = form.dtBox.NewRow(); row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); row["Birim Ref"] = gridView1.GetRowCellValue(i, "Birim Ref").ToString(); row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString(); row["Miktar"] = 1; db.AddParameterValue("@barcode", gridView1.GetRowCellValue(i, "Barkod").ToString()); db.AddParameterValue("@branchRef", form.ledBranch.GetValue()); string price = db.GetScalarValue("select dbo.Tools_GetLastActiveBuyPrice(@barcode,@branchRef)").ToString(); row["Birim Fiyat"] = price; decimal total = 1 * decimal.Parse(price); row["Toplam Tutar"] = total; form.dtBox.Rows.Add(row); } } } form.Calculate(); } #endregion #region Sell Order if (gelen == "Sell Order") { Sell.FrmSellOrder form = (Sell.FrmSellOrder)Application.OpenForms["FrmSellOrder"]; for (int i = 0; i < gridView1.RowCount; i++) { if (gridView1.GetRowCellValue(i, "Seçim").ToString() == "True") { if (form.grdGrid.RowCount - 1 > 0) { for (int a = 0; a < form.grdGrid.RowCount - 1; a++) { barcode = gridView1.GetRowCellValue(i, "Barkod").ToString(); oldBarcode = form.grdGrid.GetRowCellValue(a, "Barkod").ToString(); if (barcode == oldBarcode) { miktar = int.Parse(form.grdGrid.GetRowCellValue(a, "Miktar").ToString()); miktar++; form.grdGrid.SetRowCellValue(a, "Miktar", miktar); state = "true"; break; } else { state = "false"; } } if (state == "false") { row = form.dtBox.NewRow(); row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); row["Birim Ref"] = gridView1.GetRowCellValue(i, "Birim Ref").ToString(); row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString(); row["Miktar"] = 1; db.AddParameterValue("@barcode", gridView1.GetRowCellValue(i, "Barkod").ToString()); db.AddParameterValue("@branchRef", form.ledBranch.GetValue()); string price = db.GetScalarValue("select dbo.Tools_GetLastActiveSellPrice(@barcode,@branchRef)").ToString(); row["Birim Fiyat"] = price; decimal total = 1 * decimal.Parse(price); row["Toplam Tutar"] = total; form.dtBox.Rows.Add(row); } } else { row = form.dtBox.NewRow(); row["Kart Ref"] = int.Parse(gridView1.GetRowCellValue(i, "Ref").ToString()); row["Kart Kodu"] = gridView1.GetRowCellValue(i, "Kart Kodu").ToString(); row["Kart Adı"] = gridView1.GetRowCellValue(i, "Kart Adı").ToString(); row["Renk"] = gridView1.GetRowCellValue(i, "Renk").ToString(); row["Beden"] = gridView1.GetRowCellValue(i, "Beden").ToString(); row["Barkod"] = gridView1.GetRowCellValue(i, "Barkod").ToString(); row["Birim Ref"] = gridView1.GetRowCellValue(i, "Birim Ref").ToString(); row["Birim Kodu"] = gridView1.GetRowCellValue(i, "Birim Kodu").ToString(); row["Miktar"] = 1; db.AddParameterValue("@barcode", gridView1.GetRowCellValue(i, "Barkod").ToString()); db.AddParameterValue("@branchRef", form.ledBranch.GetValue()); string price = db.GetScalarValue("select dbo.Tools_GetLastActiveSellPrice(@barcode,@branchRef)").ToString(); row["Birim Fiyat"] = price; decimal total = 1 * decimal.Parse(price); row["Toplam Tutar"] = total; form.dtBox.Rows.Add(row); } } } form.Calculate(); } #endregion this.DialogResult = DialogResult.OK; this.Close(); } } catch (Exception ex) { helper.WriteLog(ex); } }
private void treeList1_MouseDoubleClick(object sender, MouseEventArgs e) { TreeListHitInfo hi = treeStock.CalcHitInfo(e.Location); if (hi.HitInfoType == DevExpress.XtraTreeList.HitInfoType.Cell) { // TreeList'ten marka seçildiğnide yapılacak işlemler. if (hi.Node[cololaylar].ToString() == "Marka") { Stock.FrmBrand cou = new Stock.FrmBrand(); AuthControl("Marka", cou); Viewchild(cou); } else if (hi.Node[cololaylar].ToString() == "Stok Kartı") { Stock.FrmStockList list = new Stock.FrmStockList(); AuthControl("Stok Kartı", list); Viewchild(list); } else if (hi.Node[cololaylar].ToString() == "Model") { Stock.FrmModel cou = new Stock.FrmModel(); AuthControl("Model", cou); Viewchild(cou); } else if (hi.Node[cololaylar].ToString() == "Sezon") { Stock.FrmSeason cou = new Stock.FrmSeason(); AuthControl("Sezon", cou); Viewchild(cou); } else if (hi.Node[cololaylar].ToString() == "Üretici Firma") { Stock.FrmProducer cou = new Stock.FrmProducer(); AuthControl("Üretici Firma", cou); Viewchild(cou); } else if (hi.Node[cololaylar].ToString() == "Ürün Grubu") { Stock.FrmGroup cou = new Stock.FrmGroup(); AuthControl("Ürün Grubu", cou); Viewchild(cou); } else if (hi.Node[cololaylar].ToString() == "Beden Kartelası") { Stock.FrmSize db = new Stock.FrmSize(); FormFill(@"Select Ref,code as [Kod],name as [Adı] from StStockCardSize", "Beden Kartelası", db); } else if (hi.Node[cololaylar].ToString() == "Renk Kartelası") { Stock.FrmColor db = new Stock.FrmColor(); FormFill(@"Select Ref,code as [Kod],name as [Adı] from StStockCardColor", "Renk Kartelası", db); } else if (hi.Node[cololaylar].ToString() == "Açılış Fişi") { Stock.FrmOperation db = new Stock.FrmOperation(); db._FormNo = "10.02.101"; FormFill(@"SELECT StPlug.Ref, plugSerial as [Fiş Seri], plugNo as [Fiş No], plugDate as [Fiş Tarihi], sysBranch.name as [Şube], sysWhouse.name as [Depo],plugDesc as [Açıklama] FROM StPlug LEFT OUTER JOIN AtlasSys.dbo.sysBranch ON StPlug.branchRef = sysBranch.Ref LEFT OUTER JOIN AtlasSys.dbo.sysWhouse ON StPlug.WhouseRef = sysWhouse.Ref where plugType = 100", "Açılış Fişi", db); } else if (hi.Node[cololaylar].ToString() == "Sayım Fişi") { Stock.FrmOperation db = new Stock.FrmOperation(); db._FormNo = "10.02.102"; FormFill(@"SELECT StPlug.Ref, plugSerial as [Fiş Seri], plugNo as [Fiş No], plugDate as [Fiş Tarihi], sysBranch.name as [Şube], sysWhouse.name as [Depo],plugDesc as [Açıklama] FROM StPlug LEFT OUTER JOIN AtlasSys.dbo.sysBranch ON StPlug.branchRef = sysBranch.Ref LEFT OUTER JOIN AtlasSys.dbo.sysWhouse ON StPlug.WhouseRef = sysWhouse.Ref where plugType = 101", "Sayım Fişi", db); } else if (hi.Node[cololaylar].ToString() == "Barkod Yazdırma") { Stock.FrmPrintBarcode barcode = new Stock.FrmPrintBarcode(); AuthControl("Barkod Yazdır", barcode); Viewchild(barcode); } else if (hi.Node[cololaylar].ToString() == "Toplu Stok Aktarma") { Stock.FrmImportStock stock = new Stock.FrmImportStock(); AuthControl("Toplu Stok Aktarma", stock); Viewchild(stock); } } }