コード例 #1
0
        public void ThanhToanNhap()
        {
            NhapNguyenLieuDTO nhapnl = new NhapNguyenLieuDTO();

            nhapnl.MaNcc    = MaNhaCc;
            nhapnl.TenDn    = TenDn ?? "admin";
            nhapnl.NgayNhap = dtpngaynhap.Value.ToString();
            nhapnl.TongTien = txttongtien.Text;
            bool t = nhapnl_bus.NhapNl_Insert(nhapnl);

            for (int i = 0; i < datanlnhap.Rows.Count - 1; i++)
            {
                CtNhapNguyenLieuDTO ctnhapnl = new CtNhapNguyenLieuDTO();
                ctnhapnl.MaNl      = datanlnhap.Rows[i].Cells[0].Value.ToString();
                ctnhapnl.SoLuong   = datanlnhap.Rows[i].Cells[4].Value.ToString();
                ctnhapnl.DonViTinh = datanlnhap.Rows[i].Cells[2].Value.ToString();
                ctnhapnl.HSd       = datanlnhap.Rows[i].Cells[3].Value.ToString();
                ctnhapnl.DonGia    = datanlnhap.Rows[i].Cells[5].Value.ToString();
                ctnhapnl_bus.CtNhapNl_Insert(ctnhapnl);

                //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);
            }

            CtNhapNl_InsertNl();

            HoaDonNhap  hdn  = new HoaDonNhap(TenDn, Quyen);
            HoaDonNhapp hdnp = new HoaDonNhapp();

            hdn.crvhoadonnhap.ReportSource = hdnp;
            this.Hide();
            hdn.ShowDialog();
        }
コード例 #2
0
 public bool CtNhapNl_Insert(CtNhapNguyenLieuDTO ctnhapnl)
 {
     try
     {
         openConnect();
         SqlCommand cmd = new SqlCommand("CTNHAPNL_INSERT", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add(new SqlParameter("MANGUYENLIEU", ctnhapnl.MaNl));
         cmd.Parameters.Add(new SqlParameter("@SOLUONG", Convert.ToDouble(ctnhapnl.SoLuong)));
         /////////////////////////////////
         DateTime hsd = DateTime.ParseExact(ctnhapnl.HSd, "dd/MM/yyyy", CultureInfo.InvariantCulture);
         /////////////////////////////////
         cmd.Parameters.Add(new SqlParameter("@HANSUDUNG", Convert.ToDateTime(hsd)));
         cmd.Parameters.Add(new SqlParameter("@DVT", ctnhapnl.DonViTinh));
         cmd.Parameters.Add(new SqlParameter("@DONGIA", Convert.ToInt32(ctnhapnl.DonGia)));
         cmd.ExecuteNonQuery();
         closeConnect();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
コード例 #3
0
 public bool CtNhapNl_Insert(CtNhapNguyenLieuDTO ctnhapnl)
 {
     return(ctnhapnl_dal.CtNhapNl_Insert(ctnhapnl));
 }