شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة ش.ش.و.

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » VerseTopic

Public general use code classes and xml files that we've compiled and used over the years:

Koran Reference Network Class Library support functions: data model

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:  using System.Web;
   5:  using System.ComponentModel.DataAnnotations;
   6:  using System.ComponentModel.DataAnnotations.Schema;
   7:   
   8:  namespace Ia.Islamic.Cl.Model.Data
   9:  {
  10:      ////////////////////////////////////////////////////////////////////////////
  11:   
  12:      /// <summary publish="true">
  13:      /// Koran Reference Network Class Library support functions: data model
  14:      /// </summary>
  15:      /// <value>
  16:      /// https://msdn.microsoft.com/en-us/library/z1hkazw7(v=vs.100).aspx
  17:      /// </value>
  18:      /// <remarks> 
  19:      /// Copyright © 2001-2015 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  20:      ///
  21:      /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  22:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  23:      ///
  24:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  25:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  26:      /// 
  27:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  28:      /// 
  29:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  30:      /// </remarks> 
  31:      public class VerseTopic
  32:      {
  33:          ////////////////////////////////////////////////////////////////////////////
  34:   
  35:          /// <summary>
  36:          ///
  37:          /// </summary>
  38:          public static Ia.Islamic.Cl.Model.VerseTopic Read(string id)
  39:          {
  40:              Ia.Islamic.Cl.Model.VerseTopic verseTopic;
  41:   
  42:              using (var db = new Ia.Islamic.Cl.Model.Context.Koran())
  43:              {
  44:                  verseTopic = (from vt in db.VerseTopics where vt.Id == id select vt).SingleOrDefault();
  45:              }
  46:   
  47:              return verseTopic;
  48:          }
  49:   
  50:          ////////////////////////////////////////////////////////////////////////////
  51:   
  52:          /// <summary>
  53:          ///
  54:          /// </summary>
  55:          public static List<Ia.Islamic.Cl.Model.VerseTopic> List()
  56:          {
  57:              List<Ia.Islamic.Cl.Model.VerseTopic> verseTopicList;
  58:   
  59:              using (var db = new Ia.Islamic.Cl.Model.Context.Koran())
  60:              {
  61:                  verseTopicList = (from q in db.VerseTopics select q).ToList();
  62:              }
  63:   
  64:              return verseTopicList;
  65:          }
  66:   
  67:          ////////////////////////////////////////////////////////////////////////////
  68:   
  69:          /// <summary>
  70:          ///
  71:          /// </summary>
  72:          public static bool Delete(string id, out string result)
  73:          {
  74:              bool b;
  75:   
  76:              b = false;
  77:              result = "";
  78:   
  79:              using (var db = new Ia.Islamic.Cl.Model.Context.Koran())
  80:              {
  81:                  var x = (from q in db.VerseTopics where q.Id == id select q).FirstOrDefault();
  82:   
  83:                  db.VerseTopics.Remove(x);
  84:                  db.SaveChanges();
  85:   
  86:                  b = true;
  87:              }
  88:   
  89:              return b;
  90:          }
  91:   
  92:          ////////////////////////////////////////////////////////////////////////////
  93:          ////////////////////////////////////////////////////////////////////////////
  94:      }
  95:   
  96:      ////////////////////////////////////////////////////////////////////////////
  97:      ////////////////////////////////////////////////////////////////////////////
  98:  }