コード例 #1
0
        public static ShareTypeEntity ReaderBind(IDataReader dataReader)
        {
            var    model = new ShareTypeEntity();
            object obj;

            obj = dataReader["ID"];
            if (obj != null && obj != DBNull.Value)
            {
                model.ID = (int)obj;
            }
            model.Title = dataReader["Title"].ToString();
            obj         = dataReader["CreatedBy"];
            if (obj != null && obj != DBNull.Value)
            {
                model.CreatedBy = (int)obj;
            }
            obj = dataReader["CreatedOn"];
            if (obj != null && obj != DBNull.Value)
            {
                model.CreatedOn = (DateTime)obj;
            }
            obj = dataReader["Type"];
            if (obj != null && obj != DBNull.Value)
            {
                model.Type = (int)obj;
            }
            return(model);
        }
コード例 #2
0
        /// <summary>
        /// 初始化KnowledgeShare时,同时初始化其相关联类型.
        /// </summary>
        /// <param name="dataReader">The data reader.</param>
        /// <param name="initWithShareEntity">if set to <c>true</c> [initialize with share entity].</param>
        /// <returns></returns>
        /// Author  :  Jack Zhang (JACKZ)
        /// Date    :  5/25 20:54
        internal static ShareTypeEntity ReaderBind(IDataReader dataReader, bool initWithShareEntity)
        {
            if (!initWithShareEntity)
            {
                return(ReaderBind(dataReader));
            }
            var    model = new ShareTypeEntity();
            object obj   = dataReader["TypeID"];

            if (obj != null && obj != DBNull.Value)
            {
                model.ID = (int)obj;
            }
            model.Title = dataReader["TypeTitle"].ToString();
            obj         = dataReader["TypeCreatedBy"];
            if (obj != null && obj != DBNull.Value)
            {
                model.CreatedBy = (int)obj;
            }
            obj = dataReader["TypeCreatedOn"];
            if (obj != null && obj != DBNull.Value)
            {
                model.CreatedOn = (DateTime)obj;
            }
            obj = dataReader["TypeType"];
            if (obj != null && obj != DBNull.Value)
            {
                model.Type = (int)obj;
            }
            return(model);
        }
コード例 #3
0
ファイル: ShareEntity.cs プロジェクト: KhaledSMQ/SunNet.PM
        public static ShareEntity ReaderBind(IDataReader dataReader)
        {
            ShareEntity model = new ShareEntity();
            object      obj;

            obj = dataReader["ID"];
            if (obj != null && obj != DBNull.Value)
            {
                model.ID = (int)obj;
            }
            model.Title = dataReader["Title"].ToString();
            model.Note  = dataReader["Note"].ToString();

            obj = dataReader["CreatedBy"];
            if (obj != null && obj != DBNull.Value)
            {
                model.CreatedBy = (int)obj;
            }
            obj = dataReader["CreatedOn"];
            if (obj != null && obj != DBNull.Value)
            {
                model.CreatedOn = (DateTime)obj;
            }
            obj = dataReader["ModifiedOn"];
            if (obj != null && obj != DBNull.Value)
            {
                model.ModifiedOn = (DateTime)obj;
            }
            obj = dataReader["Type"];
            if (obj != null && obj != DBNull.Value)
            {
                model.Type = (int)obj;
            }
            obj = dataReader["TicketID"];
            if (obj != null && obj != DBNull.Value)
            {
                model.TicketID = (int)obj;
            }
            if (dataReader.Contains("TypeID"))
            {
                obj = dataReader["TypeID"];
                if (obj != null && obj != DBNull.Value)
                {
                    model.TypeEntity = ShareTypeEntity.ReaderBind(dataReader, true);
                }
            }
            obj         = dataReader["Files"];
            model.Files = new Dictionary <int, string>();
            if (obj != null && obj != DBNull.Value)
            {
                string[] files = obj.ToString().Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                foreach (var file in files)
                {
                    int fileID = 0;
                    int.TryParse(file.Substring(0, file.IndexOf("_")), out fileID);
                    var filetitle = file.Substring(file.IndexOf("_") + 1);
                    model.Files.Add(fileID, filetitle);
                }
            }
            return(model);
        }