public void CtNhapNl_InsertNl() { //DataGridView datanhapnl = new DataGridView(); //datanhapnl.DataSource= ctnhapnl_bus.CtNhapNl_InHd(); //for(int i= 0; i< datanhapnl.Rows.Count -1; i++) for (int i = 0; i < datanlnhap.Rows.Count - 1; i++) { CtNguyenLieuDTO ctnl = new CtNguyenLieuDTO(); ctnl.MaNl = datanlnhap.Rows[i].Cells[0].Value.ToString(); ctnl.DVt = datanlnhap.Rows[i].Cells[2].Value.ToString(); ctnl.HSd = datanlnhap.Rows[i].Cells[3].Value.ToString(); ctnl.TonKho = datanlnhap.Rows[i].Cells[4].Value.ToString(); ctnhapnl_bus.CtNhapNl_InsertNl(ctnl); } }
public void CtHuyNl_DeleteNl() { //DataGridView datanhapnl = new DataGridView(); //datanhapnl.DataSource= ctnhapnl_bus.CtNhapNl_InHd(); //for(int i= 0; i< datanhapnl.Rows.Count -1; i++) for (int i = 0; i < datanguyenlieuhuy.Rows.Count - 1; i++) { CtNguyenLieuDTO ctnl = new CtNguyenLieuDTO(); ctnl.MaNl = datanguyenlieuhuy.Rows[i].Cells[0].Value.ToString(); ctnl.DVt = datanguyenlieuhuy.Rows[i].Cells[1].Value.ToString(); ctnl.HSd = datanguyenlieuhuy.Rows[i].Cells[3].Value.ToString(); ctnl.TonKho = datanguyenlieuhuy.Rows[i].Cells[2].Value.ToString(); bool t = cthuynl_bus.CtHuyNl_DeleteNl(ctnl); } }
public bool CtNhapNl_InsertNl(CtNguyenLieuDTO ctnl) { try { openConnect(); SqlCommand cmd = new SqlCommand("CTNHAPNL_INSERTNL", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@MANL", ctnl.MaNl)); cmd.Parameters.Add(new SqlParameter("@SOLUONG", Convert.ToDouble(ctnl.TonKho))); ///////////////////////////////// DateTime hsd = DateTime.ParseExact(ctnl.HSd, "dd/MM/yyyy", CultureInfo.InvariantCulture); ///////////////////////////////// cmd.Parameters.Add(new SqlParameter("@HSD", Convert.ToDateTime(hsd))); cmd.Parameters.Add(new SqlParameter("@DVT", ctnl.DVt)); cmd.ExecuteNonQuery(); closeConnect(); return(true); } catch { return(false); } }
public bool CtNhapNl_InsertNl(CtNguyenLieuDTO ctnl) { return(ctnhapnl_dal.CtNhapNl_InsertNl(ctnl)); }
public bool CtHuyNl_DeleteNl(CtNguyenLieuDTO ctnl) { return(cthuynl_dal.CtHuyNl_DeleteNl(ctnl)); }