public ConsortiaEventInfo[] GetConsortiaEventPage(int page, int size, ref int total, int order, int consortiaID) { List<ConsortiaEventInfo> infos = new List<ConsortiaEventInfo>(); try { string sWhere = " IsExist=1 "; if (consortiaID != -1) { sWhere += " and ConsortiaID =" + consortiaID + " "; } //string sOrder = "ID"; //switch (order) //{ // case 1: // sOrder = "Remark"; // break; // case 2: // sOrder = "Date"; // break; //} string sOrder = "Date desc,ID "; DataTable dt = GetPage("Consortia_Event", sWhere, page, size, "*", sOrder, "ID", ref total); foreach (DataRow dr in dt.Rows) { ConsortiaEventInfo info = new ConsortiaEventInfo(); info.ID = (int)dr["ID"]; info.ConsortiaID = (int)dr["ConsortiaID"]; info.Date = (DateTime)dr["Date"]; info.IsExist = (bool)dr["IsExist"]; info.Remark = dr["Remark"].ToString(); info.Type = (int)dr["Type"]; infos.Add(info); } } catch (Exception e) { if (log.IsErrorEnabled) log.Error("Init", e); } finally { } return infos.ToArray(); }
public static XElement CreateConsortiaEventInfo(ConsortiaEventInfo info) { return new XElement("Item", new XAttribute("ID", info.ID), new XAttribute("ConsortiaID", info.ConsortiaID), new XAttribute("Date", info.Date.ToString("yyyy-MM-dd HH:mm:ss")), new XAttribute("Type", info.Type), new XAttribute("Remark", info.Remark == null ? "" : info.Date.ToString("yy-MM-dd") + " " + info.Remark)); }