public ReturnForm(DataSet1.RENTRow rentRow, DataSet1.CUSTOMERSRow customersRow) { InitializeComponent(); oracleConnection1.Open(); this.rentRow = rentRow; this.customersRow = customersRow; setForm(); setDropDownGrade(); }
private void ActionRent(object sender, EventArgs e) { if (tb_required.TextLength < 1) { return; } try { int gds_id = Convert.ToInt16(goodsRow.GDS_ID); int c_id = Convert.ToInt16(customersRow.C_ID); DateTime rnt_date = getDateServerTime(); DateTime rnt_returndate = dt_end.Value; int rnt_qty = int.Parse(tb_required.Text); string stf_id = Form1.account; string rntstate_no = "0"; rentTableAdapter1.Fill(dataSet11.RENT); DataSet1.RENTDataTable rntTable = rentTableAdapter1.GetData(); DataSet1.RENTRow newRow = rntTable.NewRENTRow(); newRow.GDS_ID = gds_id; newRow.C_ID = c_id; newRow.RNT_DATE = rnt_date; newRow.RNT_QTY = rnt_qty; newRow.STF_ID = stf_id; newRow.RNTSTATE_NO = rntstate_no; newRow.RNT_RETURNDATE = rnt_returndate; rntTable.Rows.Add(newRow); int ret = rentTableAdapter1.Update(rntTable); if (ret < 1) { MessageBox.Show("실패"); throw new Exception(); } goodsRow.GDS_QTY = goodsRow.GDS_QTY - rnt_qty; ret = goodsTableAdapter1.Update(goodsRow); if (ret > 0) { MessageBox.Show("성공"); this.Close(); } else { throw new Exception(); } } catch (Exception exc) { MessageBox.Show(exc.Message, "실패"); } }
private void ActionRentReturn(object sender, DataGridViewCellMouseEventArgs e) { DataRowView view = rENTBindingSource.Current as DataRowView; DataSet1.RENTRow rentRow = view.Row as DataSet1.RENTRow; if (rentRow.RNTSTATE_NO != "1") { DataRowView customersView = cUSTOMERSBindingSource.Current as DataRowView; DataSet1.CUSTOMERSRow customersRow = customersView.Row as DataSet1.CUSTOMERSRow; if (MessageBox.Show("반납을 진행합니다.", "알림", MessageBoxButtons.YesNo) == DialogResult.Yes) { new ReturnForm(rentRow, customersRow).ShowDialog(); rENTBindingSource.DataSource = rENTTableAdapter.GetDataByCid(customersRow.C_ID); rENTBindingSource.ResetBindings(true); resetState(rENTBindingSource.DataSource as DataSet1.RENTDataTable); } } else { MessageBox.Show("반납된 상품입니다."); } }