private void Loadfg() { fg.Tag = 0; fg.BeginUpdate(); clsDM_Kho cls = new clsDM_Kho(); DataTable dt = cls.SelectAll(); dt.DefaultView.RowFilter = "TonTai = 1"; int iSTT = 1; int i = fg.Rows.Fixed; fg.Rows.Count = fg.Rows.Fixed; foreach (DataRow dr in dt.DefaultView.ToTable().Rows) { fg.Rows.Add(); fg[i, "STT"] = iSTT; iSTT++; fg[i, "ID_Kho"] = dr["ID_Kho"]; fg[i, "Ten_Kho"] = dr["Ten_Kho"]; fg[i, "SuDung"] = dr["SuDung"]; fg[i, "TonTai"] = dr["TonTai"]; i++; } fg.Row = -1; fg.AutoSizeRows(); fg.EndUpdate(); fg.Tag = 1; }
private void LoadKho() { clsDM_Kho cls = new clsDM_Kho(); DataTable dt = cls.SelectAll(); dt.DefaultView.RowFilter = "TonTai = 1"; dt.DefaultView.Sort = "ID_Kho ASC"; cboKho.Properties.DataSource = dt; cboKho.Properties.DisplayMember = "Ten_Kho"; cboKho.Properties.ValueMember = "ID_Kho"; }
private void Loadfg() { fg.Tag = 0; fg.BeginUpdate(); clsQD_NhapVatTu_ChiTiet cls = new clsQD_NhapVatTu_ChiTiet(); Byte loai = 0; //dang xem if (!btnCapNhat.Visible) { loai = 1; //dang cap nhat } if (m_byTrangthai == 1 || m_byTrangthai == 5) { loai = 0; } int iSTT = 1; fg.Rows.Count = fg.Rows.Fixed; DataTable dt = cls.Select_DS_VatTu(m_iID_QuyetDinh, m_iID_NhaCungCap, loai); foreach (DataRow dr in dt.DefaultView.ToTable().Rows) { Row fgRow = fg.Rows.Add(); fgRow["STT"] = iSTT; iSTT++; fgRow["ID_QuyetDinh"] = dr["ID_QuyetDinh"]; fgRow["Chon"] = dr["Chon"]; fgRow["ID_VatTu"] = dr["ID_VatTu"]; fgRow["Ten_VatTu"] = dr["Ten_VatTu"]; fgRow["ID_Kho"] = dr["ID_Kho"]; fgRow["SoLuong"] = dr["SoLuong"]; } clsDM_Kho clsKho = new clsDM_Kho(); DataTable dtKho = clsKho.SelectAll(); dtKho.DefaultView.RowFilter = "TonTai = 1"; ListDictionary datamap = new ListDictionary(); for (int i = 0; i <= dtKho.DefaultView.ToTable().Rows.Count - 1; i++) { datamap.Add(dtKho.Rows[i][0], dtKho.Rows[i][1]); } fg.Cols["ID_Kho"].DataMap = datamap; fg.Row = -1; fg.AutoSizeRows(); fg.AutoSizeCols(); fg.EndUpdate(); fg.Tag = 1; }
private void LoadKho() { var cmb = cboKhoXuat; cmb.Tag = 0; clsDM_Kho cls = new clsDM_Kho(); DataTable dt = cls.SelectAll(); dt.DefaultView.RowFilter = "TonTai = 1"; dt.DefaultView.Sort = "ID_Kho ASC"; dt = dt.DefaultView.ToTable(); cmb.Properties.DataSource = dt; cmb.Properties.DisplayMember = "Ten_Kho"; cmb.Properties.ValueMember = "ID_Kho"; cmb.EditValue = 0; cmb.Tag = 1; }
private void Load_cmbKho() { var cmb = cmbKho; cmb.Tag = 0; clsDM_Kho cls = new clsDM_Kho(); DataTable dt = cls.SelectAll(); if (dt.Rows.Count > 0) { dt.Rows.Add(0, "Tất cả", 1, 1); } dt.DefaultView.RowFilter = "TonTai = 1"; dt.DefaultView.Sort = "ID_Kho ASC"; cmb.Properties.DataSource = dt; cmb.Properties.DisplayMember = "Ten_Kho"; cmb.Properties.ValueMember = "ID_Kho"; cmb.EditValue = 0; cmb.Tag = 1; }
private void btnXuatKho_Click(object sender, EventArgs e) { if (int.Parse(cmbKho.EditValue.ToString()) == 0) { BaseMessages.ShowWarningMessage("Chọn kho để xuất kho"); return; } m_bFlag = false; LockEdit(false); LockEditXuatKho(false); //Loadfg fg.BeginUpdate(); for (int i = fg.Rows.Fixed; i < fg.Rows.Count; i++) { fg.Rows[i]["Chon"] = false; } clsDM_Kho clsKho = new clsDM_Kho(); DataTable dtKho = clsKho.SelectAll(); dtKho.DefaultView.RowFilter = "ID_Kho <> " + cmbKho.EditValue.ToString() + " AND TonTai = 1"; dtKho = dtKho.DefaultView.ToTable(); ListDictionary datamap = new ListDictionary(); for (int i = 0; i <= dtKho.Rows.Count - 1; i++) { datamap.Add(dtKho.Rows[i][0], dtKho.Rows[i][1]); } fg.Cols["ID_KhoXuat"].DataMap = datamap; fg.Row = -1; fg.AutoSizeRows(); fg.EndUpdate(); }