private void gridControlGiaVT_Load(object sender, EventArgs e) { switch (_selectedIndex) { case 0: GiaTrungBinh gtb = new GiaTrungBinh(_tuThang, _denThang, makhoapgia); int solantinh = gtb.solantinh(); for (int i = 0; i < solantinh; i++) { Cursor.Current = Cursors.WaitCursor; gtb.TinhGia(); //gtb.ApGia(); Cursor.Current = Cursors.Default; } gridControlGiaVT.DataSource = gtb.DtVatTu; break; case 1: GiaNTXT gntxt = new GiaNTXT(_tuThang, _denThang); gntxt.MaKho = makhoapgia; Cursor.Current = Cursors.WaitCursor; gntxt.TinhGia(); Cursor.Current = Cursors.Default; gridControlGiaVT.DataSource = gntxt.DtVatTu; gridColumn6.Visible = true; gridColumn7.Visible = true; gridColumn8.Visible = true; break; default: break; } }
private void gridControlGiaVT_Load(object sender, EventArgs e) { Database dbData = Database.NewDataDatabase(); dbData.BeginMultiTrans(); ChenhLechTonKho cltk; if (_selectedIndex == 0) { if (_condition != "") { _condition += " and "; } _condition += "MaVT in (select MaVT from DMVT where TonKho = 3)"; cltk = new ChenhLechTonKho(dbData, _condition, _tkCL, _denThang); cltk.XoaButToan(); GiaTrungBinh gtb = new GiaTrungBinh(dbData, _tuThang, _denThang, makhoapgia, _condition); Cursor.Current = Cursors.WaitCursor; //int solantinh = gtb.solantinh(); //tinh nhieu lan cho truong hop co dieu chuyen kho //for (int i = 0; i < solantinh + 1; i++) //{ gtb.TinhGia(); //} Cursor.Current = Cursors.Default; gridControlGiaVT.DataSource = gtb.DtVatTu; gridColumn6.Visible = false; gridColumn7.Visible = false; } else { if (_selectedIndex == 1) { if (_condition != "") { _condition += " and "; } _condition += "MaVT in (select MaVT from DMVT where TonKho = 2)"; cltk = new ChenhLechTonKho(dbData, _condition, _tkCL, _denThang); cltk.XoaButToan(); GiaNTXT gntxt = new GiaNTXT(dbData, _tuThang, _denThang, _condition); Cursor.Current = Cursors.WaitCursor; gntxt.TinhGia(); Cursor.Current = Cursors.Default; gridControlGiaVT.DataSource = gntxt.DtVatTu; gridColumn4.FieldName = "PsCo"; gridColumn3.FieldName = "SoLuong_x"; } else { if (_condition != "") { _condition += " and "; } _condition += "MaVT in (select MaVT from DMVT where TonKho = 4)"; cltk = new ChenhLechTonKho(dbData, _condition, _tkCL, _denThang); cltk.XoaButToan(); CultureInfo ci = Application.CurrentCulture; GiaBQDD bqdd = new GiaBQDD(dbData, _tuThang, _denThang, _condition); Cursor.Current = Cursors.WaitCursor; bqdd.TinhGia(); Cursor.Current = Cursors.Default; gridControlGiaVT.DataSource = bqdd.DtVatTu; gridColumn4.FieldName = "PsCo"; gridColumn3.FieldName = "SoLuong_x"; Application.CurrentCulture = ci; } } cltk.XuLy(); if (!dbData.HasErrors) { dbData.EndMultiTrans(); } if (Config.GetValue("Language").ToString() == "1") { FormFactory.DevLocalizer.Translate(this); } }