Exemplo n.º 1
0
        public override void Loading()
        {
            if (dataTable == null)
            {
                return;
            }
            if (gridView == null)
            {
                return;
            }

            WaitingService.BeginLoading();
            dataTable.Rows.Clear();

            if (LoadData != null)
            {
                LoadData();
            }

            string sql = String.Format("Select UserCode, UserName, UserPsw, UserRight From T_User  ");

            if (String.IsNullOrEmpty(KeyWords) == false)
            {
                sql += GetSqlWhere(KeyWords);
            }
            sql += " order by UserName ";

            gridView.BeginUpdate();
            gridView.BeginDataUpdate();

            DataTable dt  = Database.Select(sql);
            Object    obj = null;

            gridView.GridControl.DataSource = dt;
            int cnt = dt.Rows.Count;
            int no  = 0;

            for (int i = 0; i < cnt; i++)
            {
                no  = 0;
                obj = dt.Rows[i]["UserPsw"];
                if (string.IsNullOrEmpty(obj.ToString()) == false)
                {
                    dt.Rows[i]["UserPsw"] = encrypt.DecryptString(obj.ToString());
                }

                obj = dt.Rows[i]["UserRight"];
                if (string.IsNullOrEmpty(obj.ToString()) == false)
                {
                    int.TryParse(obj.ToString(), out no);
                    dt.Rows[i]["UserRight"] = User.GetUserKindName(no);
                }
            }
            gridView.EndDataUpdate();

            if (dt.Rows.Count > 0)
            {
                gridView.IndicatorWidth = 25 + (dt.Rows.Count.ToString().Length + 1) * 5;
            }

            gridView.EndUpdate();

            WaitingService.EndLoading();
        }