コード例 #1
0
ファイル: ControlPanel.cs プロジェクト: iraychen/ourmsg
        /// <summary>
        /// 获得分组信息
        /// </summary>
        /// <param name="group"></param>
        private void onOrgGroups(Group group)
        {

            exGroup exgroup = new exGroup();
            exgroup.GroupID = group.GroupID;
            exgroup.GroupName = group.GroupName;
            exgroup.SuperiorID = group.SuperiorID;
            exgroup.OrderID = group.OrderID;
            Groups.Add(exgroup);

            if (frmOrg != null && !frmOrg.IsDisposed)
            {
                frmOrg.Times = 0;
                frmOrg.Value = this.Groups.Count;
            }
        }
コード例 #2
0
ファイル: DBHelper.cs プロジェクト: iraychen/ourmsg
 /// <summary>
 /// 将所有数据库中分组基本信息读入内存
 /// </summary>
 /// <returns></returns>
 private static Dictionary<string, Group> GetGroups()
 {
     Dictionary<string, Group> Groups = new Dictionary<string, Group>(); 
     System.Data.SqlClient.SqlDataReader dr = DataAccess.GetReaderBySql("select * from groups");
     if (dr != null)
     {
         while (dr.Read())
         {
             Group group = new Group();
             group.GroupID = dr["GroupID"].ToString().Trim();
             group.GroupName = dr["GroupName"] is DBNull ? group.GroupID : dr["GroupName"].ToString().Trim();
             group.SuperiorID = dr["SuperiorID"] is DBNull ? "" : dr["SuperiorID"].ToString().Trim();
             group.OrderID = Convert.ToInt32(dr["OrderID"] is DBNull ? 0 : dr["OrderID"]);
            
             Groups.Add(group.GroupID, group);
         }
         dr.Close();
     }
     dr.Dispose();
     return Groups;
 }