コード例 #1
0
        protected void gridDanhSach_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            string MaNguyenLieu  = e.NewValues["MaNguyenLieu"].ToString();
            string TenNguyenLieu = e.NewValues["TenNguyenLieu"].ToString();
            string GiaMua        = "0";
            string NhaCungCap    = "";
            string GhiChu        = e.NewValues["GhiChu"] == null ? "" : e.NewValues["GhiChu"].ToString();
            string IDDonViTinh   = e.NewValues["IDDonViTinh"].ToString();
            string TrangThai     = "1";
            string GiaBan        = e.NewValues["GiaBan"].ToString();

            data = new dtNguyenLieu();

            object ID = data.Them(MaNguyenLieu, TenNguyenLieu, NhaCungCap, GhiChu, IDDonViTinh, GiaMua, TrangThai, GiaBan);

            if (ID != null)
            {
                data = new dtNguyenLieu();
                DataTable dt = data.DanhSachChiNhanh();
                foreach (DataRow dr in dt.Rows)
                {
                    string IDChiNhanh = dr["ID"].ToString();
                    data = new dtNguyenLieu();
                    data.ThemNguyenLieuTonKho(ID.ToString(), IDChiNhanh, MaNguyenLieu);
                }
            }
            e.Cancel = true;
            gridDanhSach.CancelEdit();
            LoadGrid();

            dtLichSuTruyCap.ThemLichSu(Session["IDChiNhanh"].ToString(), Session["IDNhom"].ToString(), Session["IDNhanVien"].ToString(), "Quản lý nguyên liệu", "Thêm nguyên liệu: " + TenNguyenLieu);
        }
コード例 #2
0
        protected void gridDanhSach_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            string MaNguyenLieu  = e.NewValues["MaNguyenLieu"].ToString();
            string TenNguyenLieu = e.NewValues["TenNguyenLieu"].ToString();
            string GiaMua        = e.NewValues["GiaMua"].ToString();
            string NhaCungCap    = e.NewValues["NhaCungCap"] == null ? "" : e.NewValues["NhaCungCap"].ToString();
            string GhiChu        = e.NewValues["GhiChu"] == null ? "" : e.NewValues["GhiChu"].ToString();
            string IDDonViTinh   = e.NewValues["IDDonViTinh"].ToString();

            data = new dtNguyenLieu();

            object ID = data.Them(MaNguyenLieu, TenNguyenLieu, NhaCungCap, GhiChu, IDDonViTinh, GiaMua);

            if (ID != null)
            {
                data = new dtNguyenLieu();
                DataTable dt = data.DanhSachChiNhanh();
                foreach (DataRow dr in dt.Rows)
                {
                    string IDChiNhanh = dr["ID"].ToString();
                    data = new dtNguyenLieu();
                    data.ThemNguyenLieuTonKho(ID.ToString(), IDChiNhanh, MaNguyenLieu);
                }
            }
            e.Cancel = true;
            gridDanhSach.CancelEdit();
            LoadGrid();
        }