private void LoadData() { SqlParameter par = new SqlParameter("@groupID", _id); DataTable dt = DB.TableFromProcedure("getGroup", new SqlParameter[1] { par }); if (dt == null || dt.Rows.Count == 0) { _id = 0; return; } DataRow row = dt.Rows[0]; _name = row["g_name"].ToString(); _creator = row["g_user_name"].ToString(); _category = new Category(); _category.ID = (int)row["_id"]; _category.Name = row["_name"].ToString(); _description = row["g_description"].ToString(); _gonggao = row["g_gonggao"].ToString(); _tags = row["g_tags"].ToString(); _uptime = (DateTime)row["g_uptime"]; if (!int.TryParse(row["g_redu"].ToString(), out _redu)) _redu = 0; }
/// <summary> /// category_b --> category /// </summary> /// <param name="id"></param> /// <returns></returns> public static Category ToCategory(int id) { int cid = 10; if (id == 101 || id == 108 || id == 115 || id == 116 || id == 117 || id == 118 || id == 119 || id == 121) cid = 12; else if (id == 102 || id == 106 || id == 123) cid = 21; else if (id == 103 || id == 110 || id == 111) cid = 15; else if (id == 104 || id == 109) cid = 18; else if (id == 105) cid = 11; else if (id == 107) cid = 21; else if (id == 112 || id == 113) cid = 16; else if (id == 114) cid = 17; else if (id == 120) cid = 13; else if (id == 122) cid = 18; else if (id == 124) cid = 10; Category cat = new Category(); cat.ID = cid; if (cid > 10) cat.Name = Category.AllCategory[cid]; else cat.Name = "�������"; return cat; }