void setDropDownUnit() { DXPopupMenu menu = new DXPopupMenu(); goodsunitTableAdapter1.Fill(dataSet1.GOODSUNIT); DataSet1.GOODSUNITDataTable goodsunitDataTable = goodsunitTableAdapter1.GetData(); foreach (DataRow data in goodsunitDataTable.Rows) { menu.Items.Add(new DXMenuItem(data["gdsunit_desc"] as string)); menu.Items[menu.Items.Count - 1].Click += ActionDropDownUnit; } drbtn_unit.DropDownControl = menu; }
void Modify() { try { if (b.Length * tb_name.TextLength * tb_model.TextLength * tb_qty.TextLength * tb_price.TextLength * drbtn_unit.Text.Length * drbtn_grade.Text.Length * drbtn_slvs.Text.Length * drbtn_store.Text.Length * drbtn_vendor.Text.Length == 0) { return; } if (drbtn_unit.Text.Equals("단위")) { return; } goodsTableAdapter1.Fill(dataSet1.GOODS); goodsgradeTableAdapter1.Fill(dataSet1.GOODSGRADE); goodstypeTableAdapter1.Fill(dataSet1.GOODSTYPE); goodsunitTableAdapter1.Fill(dataSet1.GOODSUNIT); DataSet1.GOODSGRADEDataTable goodsgradeDataTable = goodsgradeTableAdapter1.GetData(); DataSet1.GOODSTYPEDataTable goodstypeDataTable = goodstypeTableAdapter1.GetData(); DataSet1.GOODSUNITDataTable goodsunitDataTable = goodsunitTableAdapter1.GetData(); string gdsgrade_no; // DataRow[] gradeData = goodsgradeDataTable.Select("gdsgrade_desc = " + drbtn_grade.Text); // gdsgrade_no = gradeData[0]["gdsgrade_no"] as string; gdsgrade_no = goodsgradeTableAdapter1.GetDataByDesc(drbtn_grade.Text)[0].GDSGRADE_NO; string gdstype_no; // DataRow[] typeData = goodstypeDataTable.Select("gdstype_desc = " + drbtn_vendor.Text); // gdstype_no = typeData[0]["gdstype_no"] as string; gdstype_no = goodstypeTableAdapter1.GetDataByDesc(drbtn_vendor.Text)[0].GDSTYPE_NO; string gdsunit_id; // DataRow[] unitData = goodsunitDataTable.Select("gdsunit_desc = " + drbtn_unit.Text); // gdsunit_id = unitData[0]["gdsunit_id"] as string; gdsunit_id = goodsunitTableAdapter1.GetDataByDesc(drbtn_unit.Text)[0].GDSUNIT_ID; string slvs_no; slvs_no = shelvesTableAdapter1.GetDataByDesc(drbtn_slvs.Text)[0].SLVS_NO; DataSet1.GOODSDataTable goodsDataTable = goodsTableAdapter1.GetData(); DataSet1.GOODSRow presentRow = goodsDataTable.FindByGDS_ID(currentGoodsRow.GDS_ID); presentRow.GDS_IMG = b; presentRow.GDS_NAME = tb_name.Text; presentRow.GDSGRADE_NO = gdsgrade_no; presentRow.GDSTYPE_NO = gdstype_no; presentRow.GDSUNIT_ID = gdsunit_id; presentRow.SLVS_NO = slvs_no; presentRow.GDS_PRICE = int.Parse(tb_price.Text); presentRow.GDS_QTY = int.Parse(tb_qty.Text); presentRow.GDS_MODEL = tb_model.Text; int ret = goodsTableAdapter1.Update(presentRow); if (ret < 1) { MessageBox.Show("실패"); } buyinggoodsTableAdapter1.Fill(dataSet1.BUYINGGOODS); goodsstoreTableAdapter1.Fill(dataSet1.GOODSSTORE); DataSet1.BUYINGGOODSRow buyingRows = buyinggoodsTableAdapter1.GetData().Select("gds_id = " + currentGoodsRow.GDS_ID)[0] as DataSet1.BUYINGGOODSRow; buyingRows.STR_ID = goodsstoreTableAdapter1.GetDataByName(drbtn_store.Text)[0].STR_ID; ret = buyinggoodsTableAdapter1.Update(buyingRows); if (ret > 0) { MessageBox.Show("성공"); this.Close(); } else { MessageBox.Show("실패"); } } catch (Exception e) { MessageBox.Show(e.Message, "실패!"); } }
private void Buy() { int ret; try { if (b.Length * tb_name.TextLength * tb_model.TextLength * tb_qty.TextLength * tb_price.TextLength * drbtn_unit.Text.Length * drbtn_grade.Text.Length * drbtn_slvs.Text.Length * drbtn_store.Text.Length * drbtn_vendor.Text.Length == 0) { return; } if (drbtn_unit.Text.Equals("단위")) { return; } goodsTableAdapter1.Fill(dataSet1.GOODS); goodsgradeTableAdapter1.Fill(dataSet1.GOODSGRADE); goodstypeTableAdapter1.Fill(dataSet1.GOODSTYPE); goodsunitTableAdapter1.Fill(dataSet1.GOODSUNIT); DataSet1.GOODSGRADEDataTable goodsgradeDataTable = goodsgradeTableAdapter1.GetData(); DataSet1.GOODSTYPEDataTable goodstypeDataTable = goodstypeTableAdapter1.GetData(); DataSet1.GOODSUNITDataTable goodsunitDataTable = goodsunitTableAdapter1.GetData(); string gdsgrade_no; // DataRow[] gradeData = goodsgradeDataTable.Select("gdsgrade_desc = " + drbtn_grade.Text); // gdsgrade_no = gradeData[0]["gdsgrade_no"] as string; gdsgrade_no = goodsgradeTableAdapter1.GetDataByDesc(drbtn_grade.Text)[0].GDSGRADE_NO; string gdstype_no; // DataRow[] typeData = goodstypeDataTable.Select("gdstype_desc = " + drbtn_vendor.Text); // gdstype_no = typeData[0]["gdstype_no"] as string; gdstype_no = goodstypeTableAdapter1.GetDataByDesc(drbtn_vendor.Text)[0].GDSTYPE_NO; string gdsunit_id; // DataRow[] unitData = goodsunitDataTable.Select("gdsunit_desc = " + drbtn_unit.Text); // gdsunit_id = unitData[0]["gdsunit_id"] as string; gdsunit_id = goodsunitTableAdapter1.GetDataByDesc(drbtn_unit.Text)[0].GDSUNIT_ID; string slvs_no; slvs_no = shelvesTableAdapter1.GetDataByDesc(drbtn_slvs.Text)[0].SLVS_NO; DataSet1.GOODSDataTable goodsDataTable = goodsTableAdapter1.GetData(); DataSet1.GOODSRow goodsRow = goodsDataTable.NewGOODSRow(); goodsRow.GDS_IMG = b; goodsRow.GDS_NAME = tb_name.Text; goodsRow.GDSGRADE_NO = gdsgrade_no; goodsRow.GDSTYPE_NO = gdstype_no; goodsRow.GDSUNIT_ID = gdsunit_id; goodsRow.SLVS_NO = slvs_no; goodsRow.GDS_PRICE = int.Parse(tb_price.Text); goodsRow.GDS_QTY = int.Parse(tb_qty.Text); goodsRow.GDS_MODEL = tb_model.Text; goodsDataTable.Rows.Add(goodsRow); ret = goodsTableAdapter1.Update(goodsDataTable); if (ret < 1) { throw new Exception("상품등록 실패"); } goodsstoreTableAdapter1.Fill(dataSet1.GOODSSTORE); buyinggoodsTableAdapter1.Fill(dataSet1.BUYINGGOODS); DataSet1.GOODSSTOREDataTable goodsstoreDataTable = goodsstoreTableAdapter1.GetData(); DataSet1.BUYINGGOODSDataTable buyinggoodsDataTable = buyinggoodsTableAdapter1.GetData(); goodsDataTable = goodsTableAdapter1.GetData(); int gds_id = int.Parse(goodsRow.GDS_ID.ToString()); int str_id; //DataRow[] storeData = goodsstoreDataTable.Select("str_name = " + drbtn_store.Text); // str_id = int.Parse(storeData[0]["str_id"] as string); str_id = int.Parse(goodsstoreTableAdapter1.GetDataByName(drbtn_store.Text)[0].STR_ID.ToString()); DataSet1.BUYINGGOODSRow buyinggoodsRow = buyinggoodsDataTable.NewBUYINGGOODSRow(); buyinggoodsRow.BUYING_DATE = getDateServerTime(); buyinggoodsRow.GDS_ID = gds_id; buyinggoodsRow.STR_ID = str_id; buyinggoodsRow.MNG_ID = Form1.account; buyinggoodsDataTable.Rows.Add(buyinggoodsRow); ret = buyinggoodsTableAdapter1.Update(buyinggoodsDataTable); if (ret < 1) { throw new Exception("구매정보 등록 실패"); } MessageBox.Show("업데이트 성공"); this.Close(); } catch (Exception e) { MessageBox.Show(e.Message, "실패"); } }