Exemple #1
0
        protected void gridHangHoa_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            string ID            = e.Keys[0].ToString();
            string MaHang        = e.NewValues["MaHang"].ToString();
            string IDNhomHang    = e.NewValues["IDNhomHang"].ToString();
            string TenHangHoa    = e.NewValues["TenHangHoa"].ToString();
            string IDDonViTinhLe = e.NewValues["IDDonViTinhLe"].ToString();
            string IDDonViTinhSi = e.NewValues["IDDonViTinhSi"].ToString();
            double GiaMua        = Double.Parse(e.NewValues["GiaMua"].ToString());
            double GiaBan        = Double.Parse(e.NewValues["GiaBan"].ToString());
            double DoDay         = Double.Parse(e.NewValues["DoDay"].ToString());
            double ChieuDai      = Double.Parse(e.NewValues["ChieuDai"].ToString());
            string GhiChu        = e.NewValues["GhiChu"] != null ? e.NewValues["GhiChu"].ToString() : "";

            data = new dataHangHoa();
            double GiaCu = data.LaySoTienCu(ID);

            if (GiaCu != GiaBan)
            {
                dtThayDoiGia.ThemLichSu(MaHang, ID, IDDonViTinhLe, GiaCu.ToString(), GiaBan.ToString(), Session["IDNhanVien"].ToString(), "Thay đổi giá");
                dtBangGia bg = new dtBangGia();
                bg.CapNhatGiaCuTrongChiTietBangGia(ID, GiaBan.ToString());
            }
            data.SuaThongTinHangHoaNew(ID, IDNhomHang, MaHang, TenHangHoa, IDDonViTinhLe, IDDonViTinhSi, GiaMua, GiaBan, GhiChu, DoDay.ToString(), ChieuDai.ToString());
            e.Cancel = true;
            gridHangHoa.CancelEdit();
            LoadGrid(cmbSoLuongXem.Value.ToString());
        }
        protected void gridHangHoa_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            data = new dtHangHoa();
            string ID          = e.Keys[0].ToString();
            string MaHangHoa   = e.NewValues["MaHangHoa"].ToString();
            string TenHangHoa  = e.NewValues["TenHangHoa"].ToString();
            string GiaBan      = e.NewValues["GiaBan"].ToString();
            string IDDonViTinh = e.NewValues["IDDonViTinh"].ToString();
            string IDNhomHang  = e.NewValues["IDNhomHang"].ToString();
            string GhiChu      = e.NewValues["GhiChu"] == null ? "" : e.NewValues["GhiChu"].ToString();
            float  GiaCu       = data.LaySoTienCu(ID);

            if (GiaCu != float.Parse(GiaBan))
            {
                dtThayDoiGia.ThemLichSu(Session["IDNhanVien"].ToString(), MaHangHoa, TenHangHoa, IDDonViTinh, GiaCu + "", GiaBan, Session["IDChiNhanh"].ToString());
                dtBangGia bg = new dtBangGia();
                bg.CapNhatGiaCuTrongChiTietBangGia(ID, GiaBan);
            }
            data.SuaHangHoa(ID, MaHangHoa, TenHangHoa, GiaBan, IDDonViTinh, IDNhomHang, GhiChu);
            e.Cancel = true;
            gridHangHoa.CancelEdit();
            LoadGrid();

            dtLichSuTruyCap.ThemLichSu(Session["IDChiNhanh"].ToString(), Session["IDNhom"].ToString(), Session["IDNhanVien"].ToString(), "Quản lý hàng hóa", "Cập nhật hàng hóa: " + ID);
        }