Пример #1
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="flowAuthRoleEntity"></param>
        /// <returns></returns>
        public bool AddFlowAuthRole(FlowAuthRoleEntity flowAuthRoleEntity)
        {
            bool          flag           = false;
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append(" @JournalID");
            sqlCommandText.Append(", @ActionID");
            sqlCommandText.Append(", @RoleID");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.FlowAuthRole ({0}) VALUES ({1})", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString()));

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, flowAuthRoleEntity.JournalID);
            db.AddInParameter(cmd, "@ActionID", DbType.Int64, flowAuthRoleEntity.ActionID);
            db.AddInParameter(cmd, "@RoleID", DbType.Int64, flowAuthRoleEntity.RoleID);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return(flag);
        }
Пример #2
0
        /// <summary>
        /// 新增审稿单项
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddReviewBill(ReviewBillEntity model)
        {
            bool          flag           = false;
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append(" @JournalID");
            sqlCommandText.Append(", @Title");
            sqlCommandText.Append(", @ItemType");
            sqlCommandText.Append(", @PItemID");
            sqlCommandText.Append(", @SortID");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.ReviewBill ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString()));

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, model.JournalID);
            db.AddInParameter(cmd, "@Title", DbType.AnsiString, model.Title.TextFilter());
            db.AddInParameter(cmd, "@ItemType", DbType.Byte, model.ItemType);
            db.AddInParameter(cmd, "@PItemID", DbType.Int64, model.PItemID);
            db.AddInParameter(cmd, "@SortID", DbType.Int32, model.SortID);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return(flag);
        }
Пример #3
0
        /// <summary>
        /// 得到投稿自动分配配置
        /// </summary>
        /// <param name="autoAllotQuery"></param>
        /// <returns></returns>
        public EditorAutoAllotEntity GetEditorAutoAllot(EditorAutoAllotQuery autoAllotQuery)
        {
            EditorAutoAllotEntity editorAutoAllotEntity = null;
            StringBuilder         sqlCommandText        = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  PKID,JournalID,AllotPattern,AuthorID,OddAuthorID,AddDate FROM dbo.EditorAutoAllot WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  JournalID=@JournalID");
            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, autoAllotQuery.JournalID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                editorAutoAllotEntity = MakeEditorAutoAllot(dr);
                if (editorAutoAllotEntity != null)
                {
                    // 如果是按照学科分类设置,则取学科分类的明细
                    if (editorAutoAllotEntity.AllotPattern == 1)
                    {
                        editorAutoAllotEntity.SubjectAuthorMap = new List <SubjectAuthorMapEntity>();
                        StringBuilder sqlGetSubjectCategoryText = new StringBuilder();
                        sqlGetSubjectCategoryText.Append("SELECT SubjectCategoryID,AuthorID FROM dbo.SubjectAuthorMap WITH(NOLOCK)");
                        sqlGetSubjectCategoryText.Append(" WHERE  JournalID=@JournalID");
                        DbCommand cmdGetSubjectCategory = db.GetSqlStringCommand(sqlGetSubjectCategoryText.ToString());
                        db.AddInParameter(cmdGetSubjectCategory, "@JournalID", DbType.Int64, autoAllotQuery.JournalID);
                        using (IDataReader drSubject = db.ExecuteReader(cmdGetSubjectCategory))
                        {
                            SubjectAuthorMapEntity subjectMap = null;
                            while (drSubject.Read())
                            {
                                subjectMap = new SubjectAuthorMapEntity();
                                subjectMap.SubjectCategoryID = TypeParse.ToInt(drSubject["SubjectCategoryID"]);
                                subjectMap.AuthorID          = TypeParse.ToInt(drSubject["AuthorID"]);
                                subjectMap.JournalID         = autoAllotQuery.JournalID;
                                editorAutoAllotEntity.SubjectAuthorMap.Add(subjectMap);
                            }
                            drSubject.Close();
                        }
                    }
                }
                dr.Close();
            }
            return(editorAutoAllotEntity);
        }
Пример #4
0
        /// <summary>
        /// 获取令牌
        /// </summary>
        /// <param name="tokenID"></param>
        /// <returns></returns>
        public TokenEntity GetToken(TokenQuery tokenQuery)
        {
            TokenEntity   tokenEntity    = null;
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1 TokenID,AuthorID,Token,Type,AddDate FROM dbo.Token WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  JournalID=@JournalID AND AuthorID=@AuthorID AND AddDate>=@ExpireDate");
            if (!string.IsNullOrEmpty(tokenQuery.Token))
            {
                sqlCommandText.Append(" AND Token=@Token");
            }
            if (tokenQuery.Type > 0)
            {
                sqlCommandText.Append(" AND Type=@Type");
            }

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, tokenQuery.JournalID);
            db.AddInParameter(cmd, "@AuthorID", DbType.Int64, tokenQuery.AuthorID);
            if (!string.IsNullOrEmpty(tokenQuery.Token))
            {
                db.AddInParameter(cmd, "@Token", DbType.String, tokenQuery.Token);
            }
            if (tokenQuery.Type > 0)
            {
                db.AddInParameter(cmd, "@Type", DbType.Int16, tokenQuery.Type);
            }
            db.AddInParameter(cmd, "@ExpireDate", DbType.DateTime, tokenQuery.ExpireDate);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                if (dr.Read())
                {
                    tokenEntity          = new TokenEntity();
                    tokenEntity.TokenID  = (Int64)dr["TokenID"];
                    tokenEntity.AuthorID = (Int64)dr["AuthorID"];
                    tokenEntity.Token    = (String)dr["Token"];
                    tokenEntity.Type     = (Byte)dr["Type"];
                    tokenEntity.AddDate  = (DateTime)dr["AddDate"];
                }
                dr.Close();
            }
            return(tokenEntity);
        }
Пример #5
0
        public NoticeContentEntity GetNoticeContent(string dicKey)
        {
            NoticeContentEntity dictEntity     = null;
            StringBuilder       sqlCommandText = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  DicID,DicKey,Content,AddTime,UpdateTime FROM dbo.NoticeContent WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  DicKey=@DicKey");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@DicKey", DbType.String, dicKey);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                dictEntity = MakeDict(dr);
            }
            return(dictEntity);
        }
Пример #6
0
        public IssueViewLogEntity GetIssueViewLog(Int64 viewLogID)
        {
            IssueViewLogEntity issueViewLogEntity = null;
            StringBuilder      sqlCommandText     = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  ViewLogID,JournalID,ContentID,AuthorID,Daytime,Year,Month,IP,AddDate FROM dbo.IssueViewLog WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  ViewLogID=@ViewLogID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@ViewLogID", DbType.Int64, viewLogID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                issueViewLogEntity = MakeIssueViewLog(dr);
            }
            return(issueViewLogEntity);
        }
Пример #7
0
        /// <summary>
        /// 添加审稿单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddReviewBillContent(ReviewBillContentEntity model, DbTransaction trans = null)
        {
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append(" @CID");
            sqlCommandText.Append(", @JournalID");
            sqlCommandText.Append(", @ItemID");
            sqlCommandText.Append(", @ContentValue");
            sqlCommandText.Append(", @IsChecked");
            sqlCommandText.Append(", @AddUser");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.ReviewBillContent ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString()));

            db.AddInParameter(cmd, "@ItemContentID", DbType.Int64, model.ItemContentID);
            db.AddInParameter(cmd, "@CID", DbType.Int64, model.CID);
            db.AddInParameter(cmd, "@JournalID", DbType.Int64, model.JournalID);
            db.AddInParameter(cmd, "@ItemID", DbType.AnsiString, model.ItemID);
            db.AddInParameter(cmd, "@ContentValue", DbType.AnsiString, model.ContentValue);
            db.AddInParameter(cmd, "@IsChecked", DbType.Boolean, model.IsChecked);
            db.AddInParameter(cmd, "@AddUser", DbType.Int64, model.AddUser);
            try
            {
                bool result = false;
                if (trans == null)
                {
                    result = db.ExecuteNonQuery(cmd) > 0;
                }
                else
                {
                    result = db.ExecuteNonQuery(cmd, trans) > 0;
                }
                if (!result)
                {
                    throw new Exception("新增审稿单失败!");
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #8
0
        public MessageTemplateEntity GetMessageTemplate(Int64 templateID)
        {
            MessageTemplateEntity messageTemplateEntity = null;
            StringBuilder         sqlCommandText        = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  TemplateID,JournalID,TType,Title,TContent,TCategory,EditUser,EditDate,InUser,AddDate FROM dbo.MessageTemplate WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  TemplateID=@TemplateID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@TemplateID", DbType.Int64, templateID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                messageTemplateEntity = MakeMessageTemplate(dr);
            }
            return(messageTemplateEntity);
        }
Пример #9
0
        public ContactWayEntity GetContactWay(Int64 contactID)
        {
            ContactWayEntity contactWayEntity = null;
            StringBuilder    sqlCommandText   = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  ContactID,JournalID,ChannelID,Company,LinkMan,Address,ZipCode,Tel,Fax,AddDate FROM dbo.ContactWay WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  ContactID=@ContactID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@ContactID", DbType.Int64, contactID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                contactWayEntity = MakeContactWay(dr);
            }
            return(contactWayEntity);
        }
Пример #10
0
        public DBServerInfoEntity GetDBServerInfo(Int32 dBServerID)
        {
            DBServerInfoEntity dBServerInfoEntity = null;
            StringBuilder      sqlCommandText     = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  DBServerID,ServerIP,Port,Account,Pwd,Note,Status,AddDate FROM dbo.DBServerInfo WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  DBServerID=@DBServerID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@DBServerID", DbType.Int32, dBServerID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                dBServerInfoEntity = MakeDBServerInfo(dr);
            }
            return(dBServerInfoEntity);
        }
Пример #11
0
        public ApiServerInfoEntity GetApiServerInfo(Int32 apiServerID)
        {
            ApiServerInfoEntity apiServerInfoEntity = null;
            StringBuilder       sqlCommandText      = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  ApiServerID,SiteName,SiteUrl,Status,Note,AddDate FROM dbo.ApiServerInfo WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  ApiServerID=@ApiServerID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@ApiServerID", DbType.Int32, apiServerID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                apiServerInfoEntity = MakeApiServerInfo(dr);
            }
            return(apiServerInfoEntity);
        }
Пример #12
0
        public GuestbookEntity GetGuestbook(Int64 messageID)
        {
            GuestbookEntity guestbookEntity = null;
            StringBuilder   sqlCommandText  = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  MessageID,JournalID,PMessageID,UserName,Email,Tel,Title,MessageContent,IP,AddDate FROM dbo.Guestbook WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  MessageID=@MessageID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@MessageID", DbType.Int64, messageID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                guestbookEntity = MakeGuestbook(dr);
            }
            return(guestbookEntity);
        }
Пример #13
0
        public FinancePayDetailEntity GetFinancePayDetail(Int64 billID)
        {
            FinancePayDetailEntity financePayDetailEntity = null;
            StringBuilder          sqlCommandText         = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  BillID,JournalID,AuthorID,EBankType,TransactionID,TotalFee,Currency,IsInCome,PayType,PayStatus,PayDate,ProductTable,ProductID,ProductDes,UserAccount,BankID,BankNo,AddDate FROM dbo.FinancePayDetail WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  BillID=@BillID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@BillID", DbType.Int64, billID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                financePayDetailEntity = MakeFinancePayDetail(dr);
            }
            return(financePayDetailEntity);
        }
Пример #14
0
        public DictEntity GetDict(Int64 dictID)
        {
            DictEntity    dictEntity     = null;
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  DictID,JournalID,DictKey,Note,InUserID,EditUserID,EditDate,AddDate FROM dbo.Dict WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  DictID=@DictID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@DictID", DbType.Int64, dictID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                dictEntity = MakeDict(dr);
            }
            return(dictEntity);
        }
Пример #15
0
        public RoleInfoEntity GetRoleInfo(Int64 roleID)
        {
            RoleInfoEntity roleInfoEntity = null;
            StringBuilder  sqlCommandText = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  RoleID,JournalID,RoleName,Note,GroupID,AddDate FROM dbo.RoleInfo WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  RoleID=@RoleID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@RoleID", DbType.Int64, roleID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                roleInfoEntity = MakeRoleInfo(dr);
            }
            return(roleInfoEntity);
        }
Пример #16
0
        /// <summary>
        /// 新增内容块
        /// </summary>
        /// <param name="SiteResourceEntity"></param>
        /// <returns></returns>
        public bool AddSiteBlock(SiteBlockEntity model)
        {
            bool          flag           = false;
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append(" @JournalID");
            sqlCommandText.Append(", @ChannelID");
            sqlCommandText.Append(", @Title");
            sqlCommandText.Append(", @Linkurl");
            sqlCommandText.Append(", @TitlePhoto");
            sqlCommandText.Append(", @Note");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.SiteBlock ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString()));

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, model.JournalID);
            db.AddInParameter(cmd, "@ChannelID", DbType.Int64, model.ChannelID);
            db.AddInParameter(cmd, "@Title", DbType.AnsiString, model.Title);
            db.AddInParameter(cmd, "@Linkurl", DbType.AnsiString, model.Linkurl);
            db.AddInParameter(cmd, "@TitlePhoto", DbType.AnsiString, model.TitlePhoto);
            db.AddInParameter(cmd, "@Note", DbType.AnsiString, model.Note);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return(flag);
        }
Пример #17
0
        public FlowNodeConditionEntity GetFlowNodeCondition(Int64 flowConditionID)
        {
            FlowNodeConditionEntity flowNodeConditionEntity = null;
            StringBuilder           sqlCommandText          = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  FlowConditionID,JournalID,OperationID,ConditionType,ConditionExp,AddDate FROM dbo.FlowNodeCondition WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  FlowConditionID=@FlowConditionID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@FlowConditionID", DbType.Int64, flowConditionID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                flowNodeConditionEntity = MakeFlowNodeCondition(dr);
            }
            return(flowNodeConditionEntity);
        }
Пример #18
0
        /// <summary>
        /// 获取资源实体
        /// </summary>
        /// <param name="ResourceID"></param>
        /// <returns></returns>
        public SiteResourceEntity GetSiteResourceModel(SiteResourceQuery query)
        {
            SiteResourceEntity item   = null;
            string             strSql = string.Format("SELECT TOP 1 * FROM dbo.SiteResource with(nolock) WHERE ResourceID=@ResourceID AND JournalID=@JournalID");
            DbCommand          cmd    = db.GetSqlStringCommand(strSql);

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, query.JournalID);
            db.AddInParameter(cmd, "@ResourceID", DbType.Int64, query.ResourceID);
            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                if (dr.Read())
                {
                    item = MakeSiteResourceModel(dr);
                }
            }
            return(item);
        }
Пример #19
0
        public SiteConfigEntity GetSiteConfig(Int64 siteConfigID)
        {
            SiteConfigEntity siteConfigEntity = null;
            StringBuilder    sqlCommandText   = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1 * FROM dbo.SiteConfig WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  SiteConfigID=@SiteConfigID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@SiteConfigID", DbType.Int64, siteConfigID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                siteConfigEntity = MakeSiteConfig(dr);
            }
            return(siteConfigEntity);
        }
Пример #20
0
        public MenuEntity GetMenu(Int64 menuID)
        {
            MenuEntity    menuEntity     = null;
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  MenuID,JournalID,PMenuID,MenuName,MenuUrl,IconUrl,SortID,MenuType,GroupID,Status,IsContentMenu,AddDate FROM dbo.Menu WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  MenuID=@MenuID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@MenuID", DbType.Int64, menuID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                menuEntity = MakeMenu(dr);
            }
            return(menuEntity);
        }
Пример #21
0
        public PayNoticeEntity GetPayNotice(Int64 noticeID)
        {
            PayNoticeEntity payNoticeEntity = null;
            StringBuilder   sqlCommandText  = new StringBuilder();

            sqlCommandText.Append("SELECT top 1 a.*,b.Title as CTitle,b.CNumber FROM dbo.PayNotice a with(nolock) INNER JOIN dbo.ContributionInfo b with(nolock) ON a.JournalID=b.JournalID and a.CID=b.CID");
            sqlCommandText.Append(" WHERE  a.NoticeID=@NoticeID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@NoticeID", DbType.Int64, noticeID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                payNoticeEntity = MakePayNotice(dr);
            }
            return(payNoticeEntity);
        }
Пример #22
0
        public JournalInfoEntity GetJournalInfo(Int64 journalID)
        {
            JournalInfoEntity journalInfoEntity = null;
            StringBuilder     sqlCommandText    = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  JournalID,JournalName,SiteUrl,ServiceStartDate,ServiceEndDate,Linkman,LinkTel,Fax,Email,Mobile,Address,ZipCode,AuthorizationCode,Status,Note,AddDate FROM dbo.JournalInfo WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  JournalID=@JournalID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, journalID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                journalInfoEntity = MakeJournalInfo(dr);
            }
            return(journalInfoEntity);
        }
Пример #23
0
        /// <summary>
        /// 新增友情链接
        /// </summary>
        /// <param name="siteNoticeEntity"></param>
        /// <returns></returns>
        public bool AddFriendlyLink(FriendlyLinkEntity model)
        {
            bool          flag           = false;
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append(" @JournalID");
            sqlCommandText.Append(", @ChannelID");
            sqlCommandText.Append(", @SiteName");
            sqlCommandText.Append(", @SiteUrl");
            sqlCommandText.Append(", @LogoUrl");
            sqlCommandText.Append(", @LinkType");
            sqlCommandText.Append(", @SortID");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.FriendlyLink ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString()));

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, model.JournalID);
            db.AddInParameter(cmd, "@ChannelID", DbType.Int64, model.ChannelID);
            db.AddInParameter(cmd, "@SiteName", DbType.AnsiString, model.SiteName);
            db.AddInParameter(cmd, "@SiteUrl", DbType.AnsiString, model.SiteUrl);
            db.AddInParameter(cmd, "@LogoUrl", DbType.AnsiString, model.LogoUrl);
            db.AddInParameter(cmd, "@LinkType", DbType.Byte, model.LinkType);
            db.AddInParameter(cmd, "@SortID", DbType.Int32, model.SortID);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return(flag);
        }
Пример #24
0
        public RoleAuthorEntity GetRoleAuthor(Int64 mapID)
        {
            RoleAuthorEntity roleAuthorEntity = null;
            StringBuilder    sqlCommandText   = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  MapID,JournalID,RoleID,AuthorID,AddDate FROM dbo.RoleAuthor WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  MapID=@MapID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@MapID", DbType.Int64, mapID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                roleAuthorEntity = MakeRoleAuthor(dr);
            }
            return(roleAuthorEntity);
        }
Пример #25
0
        /// <summary>
        /// 新增资讯
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddSiteContent(SiteContentEntity model)
        {
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append(" @JournalID");
            sqlCommandText.Append(", @ChannelID");
            sqlCommandText.Append(", @Title");
            sqlCommandText.Append(", @Linkurl");
            sqlCommandText.Append(", @TitleColor");
            sqlCommandText.Append(", @IsBold");
            sqlCommandText.Append(", @IsItalic");
            sqlCommandText.Append(", @Source");
            sqlCommandText.Append(", @Author");
            sqlCommandText.Append(", @Tags");
            sqlCommandText.Append(", @Abstruct");
            sqlCommandText.Append(", @TitlePhoto");
            sqlCommandText.Append(", @FJPath");
            sqlCommandText.Append(", @SortID");
            sqlCommandText.Append(", @InAuthor");

            using (DbConnection conn = db.CreateConnection())
            {
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }
                DbTransaction trans = conn.BeginTransaction();
                try
                {
                    DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.SiteContent ({0},AddDate) VALUES ({1},getdate());select SCOPE_IDENTITY();", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString()));

                    db.AddInParameter(cmd, "@JournalID", DbType.Int64, model.JournalID);
                    db.AddInParameter(cmd, "@ChannelID", DbType.Int64, model.ChannelID);
                    db.AddInParameter(cmd, "@Title", DbType.AnsiString, model.Title);
                    db.AddInParameter(cmd, "@Linkurl", DbType.AnsiString, model.Linkurl);
                    db.AddInParameter(cmd, "@TitleColor", DbType.AnsiString, model.TitleColor);
                    db.AddInParameter(cmd, "@IsBold", DbType.Boolean, model.IsBold);
                    db.AddInParameter(cmd, "@IsItalic", DbType.Boolean, model.IsItalic);
                    db.AddInParameter(cmd, "@Source", DbType.AnsiString, model.Source);
                    db.AddInParameter(cmd, "@Author", DbType.AnsiString, model.Author);
                    db.AddInParameter(cmd, "@Tags", DbType.AnsiString, model.Tags);
                    db.AddInParameter(cmd, "@Abstruct", DbType.AnsiString, model.Abstruct);
                    db.AddInParameter(cmd, "@TitlePhoto", DbType.AnsiString, model.TitlePhoto);
                    db.AddInParameter(cmd, "@FJPath", DbType.AnsiString, model.FJPath);
                    db.AddInParameter(cmd, "@SortID", DbType.Int32, model.SortID);
                    db.AddInParameter(cmd, "@InAuthor", DbType.AnsiString, model.InAuthor);

                    Int64 ContentID = db.ExecuteScalar(cmd, trans).TryParse <Int64>();

                    if (ContentID == 0)
                    {
                        trans.Rollback();
                        return(false);
                    }

                    cmd = db.GetSqlStringCommand("INSERT INTO dbo.SiteContentAtt(ContentID,Content) VALUES(@ContentID,@Content)");
                    db.AddInParameter(cmd, "@ContentID", DbType.Int64, ContentID);
                    db.AddInParameter(cmd, "@Content", DbType.String, model.Content);
                    if (db.ExecuteNonQuery(cmd, trans) < 1)
                    {
                        trans.Rollback();
                        return(false);
                    }

                    trans.Commit();
                    conn.Close();
                    return(true);
                }
                catch (SqlException sqlEx)
                {
                    trans.Rollback();
                    throw sqlEx;
                }
            }
        }
Пример #26
0
        public MessageRecodeEntity GetMessageRecode(MessageRecodeQuery query)
        {
            MessageRecodeEntity messageRecodeEntity = null;
            StringBuilder       sqlCommandText      = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  * FROM dbo.MessageRecode WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  RecodeID=@RecodeID AND JournalID=@JournalID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@RecodeID", DbType.Int64, query.RecodeID);
            db.AddInParameter(cmd, "@JournalID", DbType.Int64, query.JournalID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                messageRecodeEntity = MakeMessageRecode(dr);
            }
            return(messageRecodeEntity);
        }
Пример #27
0
        public JournalSetInfoEntity GetJournalSetInfo(Int32 setID)
        {
            JournalSetInfoEntity journalSetInfoEntity = null;
            StringBuilder        sqlCommandText       = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  SetID,JournalID,ApiSiteID,DBServerID,AddDate FROM dbo.JournalSetInfo WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  SetID=@SetID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@SetID", DbType.Int32, setID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                journalSetInfoEntity = MakeJournalSetInfo(dr);
            }
            return(journalSetInfoEntity);
        }
Пример #28
0
        public SiteNoticeEntity GetSiteNotice(Int64 noticeID)
        {
            SiteNoticeEntity siteNoticeEntity = null;
            StringBuilder    sqlCommandText   = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  DesID,JournalID,ChannelID,Title,Keywords,Description,Content,FjPath,AddDate FROM dbo.SiteDescribe WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  DesID=@DesID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@DesID", DbType.Int64, noticeID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                siteNoticeEntity = MakeSiteNotice(dr);
            }
            return(siteNoticeEntity);
        }
Пример #29
0
        public SysAccountInfoEntity GetSysAccountInfo(Int32 adminID)
        {
            SysAccountInfoEntity sysAccountInfoEntity = null;
            StringBuilder        sqlCommandText       = new StringBuilder();

            sqlCommandText.Append("SELECT TOP 1  AdminID,UserName,LoginName,Pwd,Gender,Email,Mobile,Status,LastIP,LoginDate,LogOnTimes,AddDate FROM dbo.SysAccountInfo WITH(NOLOCK)");
            sqlCommandText.Append(" WHERE  AdminID=@AdminID");

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            db.AddInParameter(cmd, "@AdminID", DbType.Int32, adminID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                sysAccountInfoEntity = MakeSysAccountInfo(dr);
            }
            return(sysAccountInfoEntity);
        }
Пример #30
0
        public bool AddSiteChannel(SiteChannelEntity siteChannelEntity)
        {
            bool          flag           = false;
            StringBuilder sqlCommandText = new StringBuilder();

            sqlCommandText.Append(" @JournalID");
            sqlCommandText.Append(", @PChannelID");
            sqlCommandText.Append(", @ContentType");
            sqlCommandText.Append(", @IsNav");
            sqlCommandText.Append(", @Keywords");
            sqlCommandText.Append(", @Description");
            sqlCommandText.Append(", @ChannelUrl");
            sqlCommandText.Append(", @SortID");
            sqlCommandText.Append(", @Status");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.SiteChannel ({0}) VALUES ({1})", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString()));

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, siteChannelEntity.JournalID);
            db.AddInParameter(cmd, "@PChannelID", DbType.Int64, siteChannelEntity.PChannelID);
            db.AddInParameter(cmd, "@ContentType", DbType.Byte, siteChannelEntity.ContentType);
            db.AddInParameter(cmd, "@IsNav", DbType.Byte, siteChannelEntity.IsNav);
            db.AddInParameter(cmd, "@Keywords", DbType.AnsiString, siteChannelEntity.Keywords);
            db.AddInParameter(cmd, "@Description", DbType.AnsiString, siteChannelEntity.Description);
            db.AddInParameter(cmd, "@ChannelUrl", DbType.AnsiString, siteChannelEntity.ChannelUrl);
            db.AddInParameter(cmd, "@SortID", DbType.Int32, siteChannelEntity.SortID);
            db.AddInParameter(cmd, "@Status", DbType.Byte, siteChannelEntity.Status);
            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return(flag);
        }