private void Btn삭제_Click(object sender, EventArgs e) { 공급자재리스트 공급자재리스트 = DB.공급자재리스트.Search공급자재리스트(dgv자재.CurrentRow.Cells[0].Value.ToString() ).FirstOrDefault(); DB.공급자재리스트.Delete(공급자재리스트); 자재 orderList = DB.자재.Get자재(dgv자재.CurrentRow.Cells[0].Value.ToString()).First(); DB.자재.Delete(orderList); MessageBox.Show("삭제"); 조회(); txb자재번호.Text = null; txb자재이름.Text = null; txb품목군.Text = null; txb안전재고량.Text = null; txb재고량.Text = null; txb리드타임.Text = null; cbb검사여부.Text = null; txb단위.Text = null; txb관리단위.Text = null; txb구매단가.Text = null; txb공급업체.Text = null; }
private void Btn변경_Click(object sender, EventArgs e) { string 공급업체번호 = DB.일반거래처.Get공급업체번호From이름(txb공급업체.Text).Select(x => x.거래처코드번호).First(); if (DB.공급자재리스트.Search공급자재리스트(dgv자재.CurrentRow.Cells[0].Value.ToString()).Count == 0) { 공급자재리스트 공급자재리스트 = new 공급자재리스트(); 공급자재리스트.자재번호 = txb자재번호.Text; 공급자재리스트.공급업체번호 = DB.일반거래처.Get공급업체번호From이름(txb공급업체.Text).Select(x => x.거래처코드번호).First(); DB.공급자재리스트.Update(공급자재리스트); } 자재 productInfo = new 자재(); productInfo.자재번호 = txb자재번호.Text; productInfo.자재명 = txb자재이름.Text; productInfo.품목군 = txb품목군.Text; if (cbb검사여부.Text == "1.예") { productInfo.검사여부 = true; } else { productInfo.검사여부 = false; } productInfo.리드타임 = int.Parse(txb리드타임.Text); productInfo.재고량 = int.Parse(txb재고량.Text); productInfo.안전재고량 = int.Parse(txb안전재고량.Text); productInfo.단위 = txb단위.Text; productInfo.관리단위 = txb관리단위.Text; productInfo.구매단가 = int.Parse(txb구매단가.Text); productInfo.품목군 = txb품목군.Text; DB.자재.Update(productInfo); MessageBox.Show("변경"); 조회(); }
private void Btn등록_Click(object sender, EventArgs e) { if (DB.일반거래처.Get공급업체번호From이름(txb공급업체.Text).Count == 0) { MessageBox.Show($"{txb공급업체.Text}라는 공급업체가 등록되지 않았습니다"); return; } 자재 productInfo = new 자재(); 공급자재리스트 공급자재리스트 = new 공급자재리스트(); productInfo.자재번호 = txb자재번호.Text; productInfo.자재명 = txb자재이름.Text; productInfo.품목군 = txb품목군.Text; if (cbb검사여부.Text == "1.예") { productInfo.검사여부 = true; } else { productInfo.검사여부 = false; } productInfo.리드타임 = int.Parse(txb리드타임.Text); productInfo.재고량 = int.Parse(txb재고량.Text); productInfo.안전재고량 = int.Parse(txb안전재고량.Text); productInfo.단위 = txb단위.Text; productInfo.관리단위 = txb관리단위.Text; productInfo.구매단가 = int.Parse(txb구매단가.Text); productInfo.품목군 = txb품목군.Text; DB.자재.Insert(productInfo); MessageBox.Show("등록"); 공급자재리스트.자재번호 = txb자재번호.Text; 공급자재리스트.공급업체번호 = DB.일반거래처.Get공급업체번호From이름(txb공급업체.Text).Select(x => x.거래처코드번호).First(); DB.공급자재리스트.Insert(공급자재리스트); }