Beispiel #1
0
        internal static Show GetShow(int showId)
        {
            Show m = new Show(showId);

            if (showId > 0)
            {
                SafeProcedure.ExecuteAndMapRecords(
                    Database.GetDatabase(D4DDefine.DBInstanceName),
                    "dbo.Show_Get",
                    delegate(IRecord record)
                {
                    m.Title     = record.GetStringOrEmpty(1);
                    m.Body      = record.GetStringOrEmpty(2);
                    m.SImage    = record.GetStringOrEmpty(3);
                    m.LImage    = record.GetStringOrEmpty(4);
                    m.BandId    = record.GetInt32OrDefault(5, 0);
                    m.ShowDate  = record.GetDateTime(6);
                    m.ShowPlace = record.GetStringOrEmpty(7);
                    m.AddUserID = record.GetInt32OrDefault(8, 0);
                    m.AddDate   = record.GetDateTime(9);
                    m.Status    = (PublishStatus)(record.GetInt32OrDefault(10, 0));
                    m.EndDate   = record.GetDateTime(11);
                },
                    showId);
            }
            return(m);
        }
Beispiel #2
0
        /// <summary>
        /// 增加开放平台帐号信息
        /// </summary>
        /// <param name="info"></param>
        internal static int Insert(AppAccountInfo info)
        {
            var db = Database.GetDatabase(DatabaseName.AppConnect);
            int id = 0;

            SafeProcedure.ExecuteNonQuery(db, "dbo.AppAccount_Insert", parameterMapper =>
            {
                parameterMapper.AddWithValue("@AppAccountId", info.AppAccountId);
                parameterMapper.AddWithValue("@TenantId", info.TenantId);
                parameterMapper.AddWithValue("@Name", info.Name);
                parameterMapper.AddWithValue("@Type", info.Type);
                parameterMapper.AddWithValue("@SourceId", info.SourceId);
                parameterMapper.AddWithValue("@AppId", info.AppId);
                parameterMapper.AddWithValue("@AppSecret", info.AppSecret);
                parameterMapper.AddWithValue("@AgentId", info.AgentId);
                parameterMapper.AddWithValue("@State", (short)info.State);
                parameterMapper.AddWithValue("@Tag", info.Tag);
                parameterMapper.AddWithValue("@UserId", info.CreateBy);
                parameterMapper.AddTypedDbNull("@Id", ParameterDirectionWrap.Output, DbType.Int32);
            }, o =>
            {
                id = (int)o.GetValue("@Id");
            });
            return(id);
        }
Beispiel #3
0
        internal static List <ShopItem> GetPagedShopItemByPublishDate(PagingContext pager, int publishStatus,
                                                                      DateTime sTime, DateTime eTime)
        {
            List <ShopItem> list = new List <ShopItem>(pager.RecordsPerPage);

            SafeProcedure.ExecuteAndMapRecords(Database.GetDatabase(JaneDefine.DBInstanceName),
                                               "dbo.Shop_items_GetPagedByPublishDate",
                                               delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@STime", sTime);
                parameters.AddWithValue("@ETime", eTime);
                parameters.AddWithValue("@PublishStatus", publishStatus);
                parameters.AddWithValue("@PageIndex", pager.CurrentPageNumber);
                parameters.AddWithValue("@PageSize", pager.RecordsPerPage);
                parameters.AddWithValue("@NumberOfCount", 0, ParameterDirectionWrap.Output);
            },
                                               delegate(IRecord record)
            {
                MapList(record, list);
            },
                                               delegate(IParameterSet outputParameters)
            {
                pager.TotalRecordCount = outputParameters.GetValue("@NumberOfCount") == DBNull.Value ? 0 : (int)outputParameters.GetValue("@NumberOfCount");
            }
                                               );

            return(list);
        }
Beispiel #4
0
 internal static void DeleteTagRelationByTagId(int tagId)
 {
     SafeProcedure.ExecuteNonQuery(
         Database.GetDatabase(D4DDefine.DBInstanceName),
         "dbo.TagRelation_DeleteByTagId",
         tagId);
 }
Beispiel #5
0
        internal static List <SpamKeyword> GetPagedSpamKeywords(PagingContext pager)
        {
            List <SpamKeyword> list = new List <SpamKeyword>(pager.RecordsPerPage);

            SafeProcedure.ExecuteAndMapRecords(Database.GetDatabase(D4DDefine.DBInstanceName),
                                               "dbo.SpamKeywords_GetPaged",
                                               delegate(IParameterSet parameters)
            {
                //parameters.AddWithValue("@PublishStatus", publishStatus);
                parameters.AddWithValue("@PageIndex", pager.CurrentPageNumber);
                parameters.AddWithValue("@PageSize", pager.RecordsPerPage);
                parameters.AddWithValue("@NumberOfCount", 0, ParameterDirectionWrap.Output);
            },
                                               delegate(IRecord record)
            {
                MapList(record, list);
            },
                                               delegate(IParameterSet outputParameters)
            {
                pager.TotalRecordCount = outputParameters.GetValue("@NumberOfCount") == DBNull.Value ? 0 : (int)outputParameters.GetValue("@NumberOfCount");
            }
                                               );

            return(list);
        }
Beispiel #6
0
        internal static MusicTitle GetMusicTitle(int musicId)
        {
            MusicTitle m = new MusicTitle(musicId);

            if (musicId > 0)
            {
                SafeProcedure.ExecuteAndMapRecords(
                    Database.GetDatabase(D4DDefine.DBInstanceName),
                    "dbo.Music_GetMusicTitle",
                    delegate(IRecord record)
                {
                    m.Title       = record.GetStringOrEmpty(1);
                    m.Body        = record.GetStringOrEmpty(2);
                    m.SImage      = record.GetStringOrEmpty(3);
                    m.LImage      = record.GetStringOrEmpty(4);
                    m.BandId      = record.GetInt32OrDefault(5, 0);
                    m.PublishDate = record.GetDateTime(6);
                    m.PublishYear = record.GetInt32OrDefault(7, 0);
                    m.AddUserID   = record.GetInt32OrDefault(8, 0);
                    m.AddDate     = record.GetDateTime(9);
                    m.Status      = (PublishStatus)(record.GetInt32OrDefault(10, 0));
                },
                    musicId);
            }
            return(m);
        }
Beispiel #7
0
        internal static Dictionary <int, Tag> GetTags20(List <int> tagIds)
        {
            Dictionary <int, Tag> dic = new Dictionary <int, Tag>();

            if (tagIds != null && tagIds.Count > 0)
            {
                SafeProcedure.ExecuteAndMapRecords(Database.GetDatabase(D4DDefine.DBInstanceName),
                                                   "dbo.Tags_GetTags20",
                                                   delegate(IParameterSet parameters)
                {
                    int maxCount = tagIds.Count > 20 ? 20 : tagIds.Count;
                    for (int i = 0; i < maxCount; i++)
                    {
                        parameters.AddWithValue("@tid" + (i + 1).ToString(), tagIds[i]);
                    }
                },
                                                   delegate(IRecord record)
                {
                    Tag tag       = new Tag();
                    tag.TagId     = record.GetInt32OrDefault(0, 0);
                    tag.TagName   = record.GetStringOrEmpty(1);
                    tag.Hits      = record.GetInt32OrDefault(2, 0);
                    tag.AddUserID = record.GetInt32OrDefault(3, 0);
                    tag.AddDate   = record.GetDateTime(4);

                    if (!dic.ContainsKey(tag.TagId))
                    {
                        dic.Add(tag.TagId, tag);
                    }
                }
                                                   );
            }

            return(dic);
        }
Beispiel #8
0
        internal static int InsertComment(Comment comment)
        {
            if (comment == null)
            {
                return(-1);
            }

            SafeProcedure.ExecuteNonQuery(
                Database.GetDatabase(D4DDefine.DBInstanceName),
                "dbo.Comment_Insert",
                delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@ObjectId", comment.ObjectId);
                parameters.AddWithValue("@ObjectType", (int)(comment.ObjectType));
                parameters.AddWithValue("@UserId", comment.UserId);
                parameters.AddWithValue("@UserName", comment.UserName);
                parameters.AddWithValue("@AddDate", comment.AddDate);
                parameters.AddWithValue("@Body", comment.Body);
                parameters.AddWithValue("@Remark", comment.Remark);
                parameters.AddWithValue("@Status", (int)(comment.Status));
                parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue);
            },
                delegate(IParameterSet outputParameters)
            {
                comment.CommentId = Convert.ToInt32(outputParameters.GetValue("@RetVal"));
            });

            return(comment.CommentId);
        }
Beispiel #9
0
        internal static Dictionary <int, int> GetComments20(List <int> oIds, int objectType)
        {
            Dictionary <int, int> dic = new Dictionary <int, int>();

            if (oIds != null && oIds.Count > 0)
            {
                SafeProcedure.ExecuteAndMapRecords(Database.GetDatabase(D4DDefine.DBInstanceName),
                                                   "dbo.Comment_GetCmments20",
                                                   delegate(IParameterSet parameters)
                {
                    parameters.AddWithValue("@ObjectType", objectType);
                    int maxCount = oIds.Count > 20 ? 20 : oIds.Count;
                    for (int i = 0; i < maxCount; i++)
                    {
                        parameters.AddWithValue("@id" + (i + 1).ToString(), oIds[i]);
                    }
                },
                                                   delegate(IRecord record)
                {
                    int commentCount = record.GetInt32OrDefault(0, 0);
                    int objectId     = record.GetInt32OrDefault(1, 0);


                    if (!dic.ContainsKey(objectId))
                    {
                        dic.Add(objectId, commentCount);
                    }
                }
                                                   );
            }

            return(dic);
        }
Beispiel #10
0
        internal static List <ShopTradelist> GetPagedTradelist(PagingContext pager, int orderid)
        {
            List <ShopTradelist> list = new List <ShopTradelist>(pager.RecordsPerPage);

            SafeProcedure.ExecuteAndMapRecords(Database.GetDatabase(JaneDefine.DBInstanceName),
                                               "dbo.Shop_tradelist_GetPaged",
                                               delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@orderid", orderid);
                parameters.AddWithValue("@PageIndex", pager.CurrentPageNumber);
                parameters.AddWithValue("@PageSize", pager.RecordsPerPage);
                parameters.AddWithValue("@NumberOfCount", 0, ParameterDirectionWrap.Output);
            },
                                               delegate(IRecord record)
            {
                MapList(record, list);
            },
                                               delegate(IParameterSet outputParameters)
            {
                pager.TotalRecordCount = outputParameters.GetValue("@NumberOfCount") == DBNull.Value ? 0 : (int)outputParameters.GetValue("@NumberOfCount");
            }
                                               );

            return(list);
        }
Beispiel #11
0
        internal static int SetShopTradelist(ShopTradelist item)
        {
            if (item == null)
            {
                return(-1);
            }

            SafeProcedure.ExecuteNonQuery(
                Database.GetDatabase(JaneDefine.DBInstanceName),
                "dbo.Shop_tradelist_Set",
                delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@Id", item.Id);
                parameters.AddWithValue("@orderid", item.OrderId);
                parameters.AddWithValue("@itemid", item.ItemId);
                parameters.AddWithValue("@itemcount", item.ItemCount);
                parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue);
            },
                delegate(IParameterSet outputParameters)
            {
                item.Id = Convert.ToInt32(outputParameters.GetValue("@RetVal"));
            });

            return(item.Id);
        }
Beispiel #12
0
        internal static Album GetAlbum(int albumId)
        {
            Album m = new Album(albumId);

            if (albumId > 0)
            {
                SafeProcedure.ExecuteAndMapRecords(
                    Database.GetDatabase(D4DDefine.DBInstanceName),
                    "dbo.Album_Get",
                    delegate(IRecord record)
                {
                    m.Title        = record.GetStringOrEmpty(1);
                    m.BandId       = record.GetInt32OrDefault(2, 0);
                    m.PublishDate  = record.GetDateTime(3);
                    m.PublishYear  = record.GetInt32OrDefault(4, 0);
                    m.PublishMonth = record.GetInt32OrDefault(5, 0);
                    m.AddUserID    = record.GetInt32OrDefault(6, 0);
                    m.AddDate      = record.GetDateTime(7);
                    m.Status       = (PublishStatus)(record.GetInt32OrDefault(8, 0));
                    m.TotalCount   = record.GetInt32OrDefault(9, 0);
                    m.SImage       = record.GetStringOrEmpty(10);
                    m.LImage       = record.GetStringOrEmpty(11);
                },
                    albumId);
            }
            return(m);
        }
Beispiel #13
0
        internal static int SetImage(Image image)
        {
            if (image == null)
            {
                return(-1);
            }

            SafeProcedure.ExecuteNonQuery(
                Database.GetDatabase(D4DDefine.DBInstanceName),
                "dbo.Image_Set",
                delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@ImageId", image.ImageId);
                parameters.AddWithValue("@AlbumId", image.AlbumId);
                parameters.AddWithValue("@ImageName", image.ImageName);
                parameters.AddWithValue("@ImageFile", image.ImageFile);
                parameters.AddWithValue("@SImageFile", image.SImageFile);
                parameters.AddWithValue("@AddUserId", image.AddUserID);
                parameters.AddWithValue("@PublishDate", image.PublishDate);
                parameters.AddWithValue("@Status", (int)(image.Status));
                parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue);
            },
                delegate(IParameterSet outputParameters)
            {
                image.ImageId = Convert.ToInt32(outputParameters.GetValue("@RetVal"));
            });

            return(image.ImageId);
        }
Beispiel #14
0
        internal static int SetAlbum(Album album)
        {
            if (album == null)
            {
                return(-1);
            }

            SafeProcedure.ExecuteNonQuery(
                Database.GetDatabase(D4DDefine.DBInstanceName),
                "dbo.Album_Set",
                delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@AlbumId", album.AlbumId);
                parameters.AddWithValue("@Title", album.Title);
                parameters.AddWithValue("@SImage", album.SImage);
                parameters.AddWithValue("@LImage", album.LImage);
                parameters.AddWithValue("@BandId", album.BandId);
                parameters.AddWithValue("@PublishDate", album.PublishDate);
                parameters.AddWithValue("@PublishYear", album.PublishYear);
                parameters.AddWithValue("@PublishMonth", album.PublishMonth);
                parameters.AddWithValue("@AddUserId", album.AddUserID);
                parameters.AddWithValue("@Status", (int)(album.Status));
                parameters.AddWithValue("@TotalCount", album.TotalCount);
                parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue);
            },
                delegate(IParameterSet outputParameters)
            {
                album.AlbumId = Convert.ToInt32(outputParameters.GetValue("@RetVal"));
            });

            return(album.AlbumId);
        }
Beispiel #15
0
        internal static List <MusicTitle> GetPagedMusicTitlesByBandIdANDPublishYear(PagingContext pager, int bandId, int publishYear, int publishStatus)
        {
            List <MusicTitle> list = new List <MusicTitle>(pager.RecordsPerPage);

            SafeProcedure.ExecuteAndMapRecords(Database.GetDatabase(D4DDefine.DBInstanceName),
                                               "dbo.Music_GetPagedMusicTitleByBandIdANDPublishYear",
                                               delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@PublishYear", publishYear);
                parameters.AddWithValue("@BandId", bandId);
                parameters.AddWithValue("@PublishStatus", publishStatus);
                parameters.AddWithValue("@PageIndex", pager.CurrentPageNumber);
                parameters.AddWithValue("@PageSize", pager.RecordsPerPage);
                parameters.AddWithValue("@NumberOfCount", 0, ParameterDirectionWrap.Output);
            },
                                               delegate(IRecord record)
            {
                MapMusicTitleList(record, list);
            },
                                               delegate(IParameterSet outputParameters)
            {
                pager.TotalRecordCount = outputParameters.GetValue("@NumberOfCount") == DBNull.Value ? 0 : (int)outputParameters.GetValue("@NumberOfCount");
            }
                                               );

            return(list);
        }
Beispiel #16
0
        internal static Comment GetComment(int commentId)
        {
            Comment c = new Comment();

            if (commentId > 0)
            {
                SafeProcedure.ExecuteAndMapRecords(
                    Database.GetDatabase(D4DDefine.DBInstanceName),
                    "dbo.Comment_Get",
                    delegate(IRecord record)
                {
                    c.CommentId  = record.GetInt32OrDefault(0, 0);
                    c.ObjectId   = record.GetInt32OrDefault(1, 0);
                    c.ObjectType = (ObjectTypeDefine)(record.GetInt32OrDefault(2, 0));
                    c.UserId     = record.GetInt32OrDefault(3, 0);
                    c.UserName   = record.GetStringOrEmpty(4);
                    c.AddDate    = record.GetDateTime(5);
                    c.Body       = record.GetStringOrEmpty(6);
                    c.Remark     = record.GetStringOrEmpty(7);
                    c.Status     = (PublishStatus)(record.GetInt32OrDefault(8, 0));
                },
                    commentId);
            }
            return(c);
        }
Beispiel #17
0
        internal static int SetMusicSongList(MusicSongList m)
        {
            if (m == null)
            {
                return(-1);
            }

            SafeProcedure.ExecuteNonQuery(
                Database.GetDatabase(D4DDefine.DBInstanceName),
                "dbo.Music_SetMusicSongList",
                delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@ListId", m.ListId);
                parameters.AddWithValue("@MusicId", m.MusicId);
                parameters.AddWithValue("@SongName", m.SongName);
                parameters.AddWithValue("@SongFile", m.SongFile);
                parameters.AddWithValue("@SongTime", m.SongTime);
                parameters.AddWithValue("@AddUserId", m.AddUserID);
                parameters.AddWithValue("@Status", (int)(m.Status));
                parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue);
            },
                delegate(IParameterSet outputParameters)
            {
                m.ListId = Convert.ToInt32(outputParameters.GetValue("@RetVal"));
            });

            return(m.ListId);
        }
Beispiel #18
0
 internal static void DeleteAddInfo(int objectId, int objectType)
 {
     SafeProcedure.ExecuteNonQuery(
         Database.GetDatabase(D4DDefine.DBInstanceName),
         "dbo.Add_infos_Delete",
         objectType, objectId);
 }
Beispiel #19
0
        internal static List <Tag> GetPagedTags(PagingContext pager)
        {
            List <Tag> list = new List <Tag>(pager.RecordsPerPage);

            SafeProcedure.ExecuteAndMapRecords(Database.GetDatabase(D4DDefine.DBInstanceName),
                                               "dbo.GetPagedTags",
                                               delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@PageIndex", pager.CurrentPageNumber);
                parameters.AddWithValue("@PageSize", pager.RecordsPerPage);
                parameters.AddWithValue("@NumberOfCount", 0, ParameterDirectionWrap.Output);
            },
                                               delegate(IRecord record)
            {
                Tag tag       = new Tag();
                tag.TagId     = record.GetInt32OrDefault(0, 0);
                tag.TagName   = record.GetStringOrEmpty(1);
                tag.Hits      = record.GetInt32OrDefault(2, 0);
                tag.AddUserID = record.GetInt32OrDefault(3, 0);
                tag.AddDate   = record.GetDateTime(4);

                list.Add(tag);
            },
                                               delegate(IParameterSet outputParameters)
            {
                pager.TotalRecordCount = outputParameters.GetValue("@NumberOfCount") == DBNull.Value ? 0 : (int)outputParameters.GetValue("@NumberOfCount");
            }
                                               );

            return(list);
        }
Beispiel #20
0
        internal static int SetShopRegion(ShopRegion item)
        {
            if (item == null)
            {
                return(-1);
            }

            SafeProcedure.ExecuteNonQuery(
                Database.GetDatabase(JaneDefine.DBInstanceName),
                "dbo.Shop_region_Set",
                delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@id", item.Id);
                parameters.AddWithValue("@Name", item.Name);
                parameters.AddWithValue("@ParentId", item.ParentId);
                parameters.AddWithValue("@TransferPrice", item.TransferPrice);
                parameters.AddWithValue("@TransferPrice1", item.TransferPrice1);
                parameters.AddWithValue("@TransferPrice2", item.TransferPrice2);
                parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue);
            },
                delegate(IParameterSet outputParameters)
            {
                item.Id = Convert.ToInt32(outputParameters.GetValue("@RetVal"));
            });

            return(item.Id);
        }
Beispiel #21
0
 internal static void DeleteTagRelationByObject(int objectId, int objectType)
 {
     SafeProcedure.ExecuteNonQuery(
         Database.GetDatabase(D4DDefine.DBInstanceName),
         "dbo.TagRelation_DeleteByObject",
         objectId, objectType);
 }
Beispiel #22
0
        internal static int SetBandInfo(BandInfo info)
        {
            if (info == null)
            {
                return(-1);
            }

            SafeProcedure.ExecuteNonQuery(
                Database.GetDatabase(D4DDefine.DBInstanceName),
                "dbo.BandInfo_Set",
                delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@BandId", info.BandId);
                parameters.AddWithValue("@BandName", info.BandName);
                parameters.AddWithValue("@Info1", info.Info1);
                parameters.AddWithValue("@Info2", info.Info2);
                parameters.AddWithValue("@Info3", info.Info3);
                parameters.AddWithValue("@Remark", info.Remark);
                parameters.AddWithValue("@DeleteFlag", info.DeleteFlag);
                parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue);
            },
                delegate(IParameterSet outputParameters)
            {
                info.BandId = Convert.ToInt32(outputParameters.GetValue("@RetVal"));
            });

            return(info.BandId);
        }
Beispiel #23
0
        internal static int SetSpamKeyword(SpamKeyword keyword)
        {
            if (keyword == null)
            {
                return(-1);
            }

            SafeProcedure.ExecuteNonQuery(
                Database.GetDatabase(D4DDefine.DBInstanceName),
                "dbo.SpamKeywords_Set",
                delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@Id", keyword.Id);
                parameters.AddWithValue("@Keyword", keyword.Keyword);
                parameters.AddWithValue("@Status", keyword.Status);
                parameters.AddWithValue("@AddUserId", keyword.AddUserID);
                parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue);
            },
                delegate(IParameterSet outputParameters)
            {
                keyword.Id = Convert.ToInt32(outputParameters.GetValue("@RetVal"));
            });

            return(keyword.Id);
        }
        private static List <AppUserAccountInfo> GetAppUserAccountInSql()
        {
            List <AppUserAccountInfo> appUserAccountInfos = new List <AppUserAccountInfo>();
            Database database = Database.GetDatabase("BeisenUserSecurity");

            SafeProcedure.ExecuteAndGetInstanceList(database, "[dbo].[AppUserAccount_GetAll]",
                                                    delegate(IRecord record, int entity)
            {
                AppUserAccountInfo appUserAccountInfo = new AppUserAccountInfo();
                appUserAccountInfo.Id              = record.GetOrDefault <int>("Id", 0);
                appUserAccountInfo.AppId           = record.GetOrDefault <string>("AppId", "");
                appUserAccountInfo.OpenId          = record.GetOrDefault <string>("OpenId", "");
                appUserAccountInfo.TenantId        = record.GetOrDefault <int>("TenantId", 0);
                appUserAccountInfo.UserId          = record.GetOrDefault <int>("UserId", 0);
                appUserAccountInfo.BeisenAccount   = record.GetOrDefault <string>("BeisenAccount", "");
                appUserAccountInfo.TypeNotEnum     = record.GetOrDefault <Int16>("Type", 0);
                appUserAccountInfo.StateNotEnum    = record.GetOrDefault <Int16>("State", 0);
                appUserAccountInfo.ActivateTime    = record.GetOrDefault <DateTime>("ActivateTime", DateTime.Now);
                appUserAccountInfo.CreateTime      = record.GetOrDefault <DateTime>("CreateTime", DateTime.Now);
                appUserAccountInfo.UnbindTime      = record.GetOrDefault <DateTime>("UnbindTime", DateTime.Now);
                appUserAccountInfo.MasterAccountId = record.GetOrDefault <int>("MasterAccountId", 0);
                appUserAccountInfos.Add(appUserAccountInfo);
            });
            return(appUserAccountInfos);
        }
        /// <summary>
        /// 根据Code获取二维码登录
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public static QrCodeLoginInfo GetByCode(string code)
        {
            var info = new QrCodeLoginInfo {
                Code = code
            };

            info = AppConnectEntityProcedure.GetEntityInstanceFromCacheByExtendedId(info);

            if (info == null || info.IsEmpty)
            {
                var db = Database.GetDatabase(DatabaseName.AppConnect);
                info = SafeProcedure.ExecuteAndGetInstance <QrCodeLoginInfo>(db, "dbo.QrCodeLogin_GetByCode", parameterMapper =>
                {
                    parameterMapper.AddWithValue("@Code", new Guid(code));
                },
                                                                             BuildInfo);

                if (info != null)
                {
                    info.IsEmpty = false;
                    AppConnectEntityProcedure.SaveEntityInstanceToCache(info);
                }
            }
            return(info);
        }
Beispiel #26
0
        /// <summary>
        /// 获取调用凭证
        /// </summary>
        /// <param name="appId"></param>
        /// <returns></returns>
        public static TokenInfo Get(string appId)
        {
            var token = new TokenInfo {
                AppId = appId
            };

            token = AppConnectEntityProcedure.GetEntityInstanceFromCacheByExtendedId(token);

            if (token == null || token.IsEmpty)
            {
                var db = Database.GetDatabase(DatabaseName.AppConnect);
                token = SafeProcedure.ExecuteAndGetInstance <TokenInfo>(db, "dbo.Token_Get", parameterMapper =>
                {
                    parameterMapper.AddWithValue("@AppId", appId);
                },
                                                                        BuildInfo);

                if (token != null)
                {
                    token.IsEmpty = false;
                    AppConnectEntityProcedure.SaveEntityInstanceToCache(token);
                }
            }

            return(token);
        }
Beispiel #27
0
        internal static int SetShopItem(ShopItem item)
        {
            if (item == null)
            {
                return(-1);
            }

            SafeProcedure.ExecuteNonQuery(
                Database.GetDatabase(JaneDefine.DBInstanceName),
                "dbo.Shop_items_Set",
                delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@Id", item.Id);
                parameters.AddWithValue("@name", item.Name);
                parameters.AddWithValue("@description", item.Description);
                parameters.AddWithValue("@body", item.Body);
                parameters.AddWithValue("@price", item.Price);
                parameters.AddWithValue("@SImage", item.SImage);
                parameters.AddWithValue("@LImage", item.LImage);
                parameters.AddWithValue("@PublishDate", item.PublishDate);
                parameters.AddWithValue("@AddUserId", item.AddUserID);
                parameters.AddWithValue("@Status", (int)(item.Status));
                parameters.AddWithValue("@Hits", (int)(item.Hits));
                parameters.AddWithValue("@BaseCountEachdeliver", (int)(item.BaseCountEachdeliver));
                parameters.AddWithValue("@Weight", item.Weight);
                parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue);
            },
                delegate(IParameterSet outputParameters)
            {
                item.Id = Convert.ToInt32(outputParameters.GetValue("@RetVal"));
            });

            return(item.Id);
        }
Beispiel #28
0
        internal static int SetMusicTitle(MusicTitle m)
        {
            if (m == null)
            {
                return(-1);
            }

            SafeProcedure.ExecuteNonQuery(
                Database.GetDatabase(D4DDefine.DBInstanceName),
                "dbo.Music_SetMusicTitle",
                delegate(IParameterSet parameters)
            {
                parameters.AddWithValue("@MusicId", m.MusicId);
                parameters.AddWithValue("@Title", m.Title);
                parameters.AddWithValue("@Body", m.Body);
                parameters.AddWithValue("@SImage", m.SImage);
                parameters.AddWithValue("@LImage", m.LImage);
                parameters.AddWithValue("@BandId", m.BandId);
                parameters.AddWithValue("@PublishDate", m.PublishDate);
                parameters.AddWithValue("@PublishYear", m.PublishYear);
                parameters.AddWithValue("@AddUserId", m.AddUserID);
                parameters.AddWithValue("@Status", (int)(m.Status));
                parameters.AddWithValue("@RetVal", DBNull.Value, ParameterDirectionWrap.ReturnValue);
            },
                delegate(IParameterSet outputParameters)
            {
                m.MusicId = Convert.ToInt32(outputParameters.GetValue("@RetVal"));
            });

            return(m.MusicId);
        }
Beispiel #29
0
        internal static ShopItem GetShopItem(int id, int hits)
        {
            ShopItem m = new ShopItem(id);

            if (id > 0)
            {
                SafeProcedure.ExecuteAndMapRecords(
                    Database.GetDatabase(JaneDefine.DBInstanceName),
                    "dbo.Shop_items_Get",
                    delegate(IRecord record)
                {
                    m.Id                   = record.GetInt32OrDefault(0, 0);
                    m.Name                 = record.GetStringOrEmpty(1);
                    m.Description          = record.GetStringOrEmpty(2);
                    m.Price                = record.GetDouble(3);
                    m.SImage               = record.GetStringOrEmpty(4);
                    m.LImage               = record.GetStringOrEmpty(5);
                    m.PublishDate          = record.GetDateTimeOrEmpty(6);
                    m.AddUserID            = record.GetInt32OrDefault(7, 0);
                    m.AddDate              = record.GetDateTime(8);
                    m.Status               = (PublishStatus)(record.GetInt32OrDefault(9, 0));
                    m.Body                 = record.GetStringOrEmpty(10);
                    m.Hits                 = record.GetInt32OrDefault(11, 0);
                    m.BaseCountEachdeliver = record.GetInt32OrDefault(12, 5);
                    m.Weight               = record.GetDouble(13);
                },
                    id, hits);
            }
            return(m);
        }
Beispiel #30
0
        internal static News GetNews(int newsId, int hits)
        {
            News m = new News(newsId);

            if (newsId > 0)
            {
                SafeProcedure.ExecuteAndMapRecords(
                    Database.GetDatabase(D4DDefine.DBInstanceName),
                    "dbo.News_Get",
                    delegate(IRecord record)
                {
                    m.Title       = record.GetStringOrEmpty(1);
                    m.Body        = record.GetStringOrEmpty(2);
                    m.Preview     = record.GetStringOrEmpty(3);
                    m.SImage      = record.GetStringOrEmpty(4);
                    m.LImage      = record.GetStringOrEmpty(5);
                    m.NewsType    = record.GetInt32OrDefault(6, 0);
                    m.Hits        = record.GetInt32OrDefault(7, 0);
                    m.PublishDate = record.GetDateTime(8);
                    m.AddUserID   = record.GetInt32OrDefault(9, 0);
                    m.AddDate     = record.GetDateTime(10);
                    m.Status      = (PublishStatus)(record.GetInt32OrDefault(11, 0));
                    m.Remark      = record.GetStringOrEmpty(12);
                },
                    newsId, hits);
            }
            return(m);
        }