Ejemplo n.º 1
0
        public void Load_cmbDonVi_TheoQuyen(VSCM.Base.Controls.ucSearchLookupEdit cmb, bool p)
        {
            cmb.Tag = 0;
            clsDM_DonVi cls = new clsDM_DonVi();
            DataTable   dt  = cls.SelectAll();

            dt = GlobalMethod.CheckQuyenDonVi(dt);
            if (dt.Rows.Count > 1)
            {
                DataRow row;
                row              = dt.NewRow();
                row["ID_DonVi"]  = "0";
                row["Ten_DonVi"] = "Tất cả";
                row["SuDung"]    = 1;
                row["TonTai"]    = 1;
                dt.Rows.Add(row);
            }

            dt.DefaultView.RowFilter = "SuDung = 1 AND TonTai = 1 AND ID_DonVi <> " + iID_DonVi;
            dt.DefaultView.Sort      = "STT_DonVi ASC";

            cmb.Properties.DataSource    = dt.DefaultView.ToTable();
            cmb.Properties.ValueMember   = "ID_DonVi";
            cmb.Properties.DisplayMember = "Ten_DonVi";
            cmb.Tag = 1;

            if (dt.DefaultView.ToTable().Rows.Count == 1)
            {
                cmb.EditValue = dt.DefaultView.ToTable().Rows[0]["ID_DonVi"];
            }
        }
Ejemplo n.º 2
0
        private void LoadcmbCapDuoi()
        {
            var cmb = cmbCapDuoi;

            cmb.Tag = 0;
            clsDM_DonVi cls = new clsDM_DonVi();
            //DataTable dt = cls.SelectAllNVCapDuoi(Convert.ToInt32(cmbCapTren.EditValue));
            DataTable dt = cls.SelectAll();

            dt.DefaultView.RowFilter = "ID_DonVi <> " + cmbCapTren.EditValue + " AND TonTai = 1 AND SuDung = 1";
            dt.DefaultView.Sort      = "STT_DonVi ASC";
            dt = dt.DefaultView.ToTable();
            cmb.Properties.DataSource    = dt;
            cmb.Properties.DisplayMember = "Ten_DonVi";
            cmb.Properties.ValueMember   = "ID_DonVi";
            cmb.Tag = 1;
        }
Ejemplo n.º 3
0
        public void LoadCombo_DSDonVi_TrucThuoc(int id_DonVi)
        {
            var cmb = cmbDonViTrucThuoc;

            cmb.Tag = 0;
            clsDM_DonVi cls = new clsDM_DonVi();
            DataTable   dt  = cls.SelectAll();

            dt.DefaultView.Sort      = "ID_DonVi ASC";
            dt.DefaultView.RowFilter = "TonTai = 1 and ID_DonVi <> " + id_DonVi + "";
            dt = dt.DefaultView.ToTable();
            cmb.Properties.DataSource    = dt;
            cmb.Properties.DisplayMember = "Ten_DonVi";
            cmb.Properties.ValueMember   = "ID_DonVi";
            if (dt.DefaultView.ToTable().Rows.Count == 1)
            {
                cmb.EditValue = dt.DefaultView.ToTable().Rows[0]["ID_DonVi"];
            }
            else
            {
                cmb.EditValue = null;
            }
            cmb.Tag = 1;
        }
Ejemplo n.º 4
0
        private void LoadcmbDonVi()
        {
            var cmb = cmbDonVi;

            cmb.Tag = 0;
            var cls = new clsDM_DonVi();
            var dt  = cls.SelectAll();

            dt.DefaultView.Sort      = "STT_DonVi ASC";
            dt.DefaultView.RowFilter = "TonTai = 1 AND SuDung = 1";
            dt = dt.DefaultView.ToTable();
            cmb.Properties.DataSource    = dt;
            cmb.Properties.DisplayMember = "Ten_DonVi";
            cmb.Properties.ValueMember   = "ID_DonVi";
            if (dt.DefaultView.ToTable().Rows.Count == 1)
            {
                cmb.EditValue = dt.DefaultView.ToTable().Rows[0]["ID_DonVi"];
            }
            else
            {
                cmb.EditValue = null;
            }
            cmb.Tag = 1;
        }