Esempio n. 1
0
 public static XElement CreateCategoryInfo(CategoryInfo info)
 {
     return new XElement("Item", new XAttribute("ID", info.ID),
        new XAttribute("Name", info.Name == null ? "" : info.Name),
        new XAttribute("Place", info.Place),
        new XAttribute("Remark", info.Remark == null ? "" : info.Remark));
 }
Esempio n. 2
0
 public CategoryInfo[] GetAllCategory()
 {
     List<CategoryInfo> infos = new List<CategoryInfo>();
     SqlDataReader reader = null;
     try
     {
         db.GetReader(ref reader, "SP_Items_Category_All");
         while (reader.Read())
         {
             CategoryInfo info = new CategoryInfo();
             info.ID = (int)reader["ID"];
             info.Name = reader["Name"] == null ? "" : reader["Name"].ToString();
             info.Place = (int)reader["Place"];
             info.Remark = reader["Remark"] == null ? "" : reader["Remark"].ToString();
             infos.Add(info);
         }
     }
     catch (Exception e)
     {
         if (log.IsErrorEnabled)
             log.Error("Init", e);
     }
     finally
     {
         if (reader != null && !reader.IsClosed)
             reader.Close();
     }
     return infos.ToArray();
 }