Exemple #1
0
        //显示全部信息
        private void ShowAll()
        {
            SourceData.Clear();
            List <StuInfo> stus = serverCatch.queryAllStu();

            if (stus == null || stus.Count <= 0)
            {
                return;
            }
            foreach (StuInfo stu in stus)
            {
                SourceData.Add(stu.getsno(), stu.getsname(), stu.getssex(), stu.getsclass());
            }
        }
Exemple #2
0
        //查询
        private void search()
        {
            List <StuInfo> sList = serverCatch.Search(ComboSearch.SelectedIndex, TextSearch.Text);

            if (sList == null || sList.Count <= 0)
            {
                ShowAll();
                MessageBox.Show("没有符合该信息的学生!", "查询失败!");
                return;
            }

            SourceData.Clear();

            int i = 0;

            foreach (StuInfo Info in sList)
            {
                SourceData.Add(Info.getsno(), Info.getsname(), Info.getssex(), Info.getsclass());
                StuList.Rows[i++].Cells[ComboSearch.SelectedIndex].Selected = true;
            }
            StuList.Rows[0].Cells[0].Selected = false;

            MessageBox.Show("查找完成");
        }
    private SourceData GetSourceInfo(DI_MapDataColumns mapDataColumns, DataTable sessionData, bool isMyData, string dbNid, string LanguageCode)
    {
        SourceData RetVal = null;
        DataTable SourceTable = null;
        SourceInfo sourceInfo;
        try
        {
            if (sessionData.Rows.Count > 0)
            {
                sourceInfo = new SourceInfo();
                RetVal = new SourceData();

                //get theme name IndicatorUnitSubgroup from Database
                _DBCon = Global.GetDbConnection(int.Parse(dbNid));
                //Step 2 Get IUS and Source information
                //Step 2.1. Get Source Information from Database
                List<DbParameter> DbParams = null;
                DbParameter sourceParam1 = _DBCon.CreateDBParameter();
                sourceParam1.ParameterName = "SourceNIds";
                sourceParam1.DbType = DbType.String;
                sourceParam1.Value = this.AddQuotesInCommaSeperated(this.GetCSV(sessionData, mapDataColumns.SourceNid), false);

                DbParams = new List<DbParameter>();
                DbParams.Add(sourceParam1);
                SourceTable = _DBCon.ExecuteDataTable("sp_get_sources_from_nids_" + LanguageCode, CommandType.StoredProcedure, DbParams).DefaultView.ToTable(true, mapDataColumns.SourceNid, mapDataColumns.SourceName);

                foreach (DataRow row in SourceTable.Rows)
                {
                    sourceInfo = new SourceInfo();
                    sourceInfo.SourceNId = row[mapDataColumns.SourceNid].ToString();
                    sourceInfo.SourceName = row[mapDataColumns.SourceName].ToString();
                    RetVal.Add(sourceInfo);
                }

            }
        }
        catch (Exception ex)
        {
            Global.CreateExceptionString(ex, null);

            throw;
        }

        return RetVal;
    }
 /// <summary>
 /// Добавить элемент в список
 /// </summary>
 /// <param name="item">элемент</param>
 public void AddElementToSourceData(object item)
 {
     SourceData.Add(item); this.vScrollBar.Minimum = 0; this.vScrollBar.Maximum = this.SourceData.Count - 1; /*this.vScrollBar.Value = this.vScrollBar.Maximum;*/ this.InvalidateVisual();
 }