コード例 #1
0
        /// <summary>
        /// 트랙백 정보를 저장한다.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int InsertTrackback(TrackbackModel model)
        {
            object exceprt = !string.IsNullOrEmpty(model.Exceprt) ? (object)model.Exceprt : DBNull.Value;

            SqlParameter[] param =
            {
                CreateInParam("@ArticleNo", SqlDbType.Int,                  4, model.ArticleNo),
                CreateInParam("@Url",       SqlDbType.VarChar,            255, model.Url),
                CreateInParam("@Blog_Name", SqlDbType.VarChar,            255, model.Blog_Name),
                CreateInParam("@Title",     SqlDbType.VarChar,            255, model.Title),
                CreateInParam("@Exceprt",   SqlDbType.Text,    Int32.MaxValue, exceprt),
                CreateInParam("@UserIP",    SqlDbType.VarChar,             20, model.UserIP),
                CreateReturnValue()
            };

            SqlCommand cmd = GetSpCommand("UBT_InsertTrackback", param, IsolationLevel.ReadUncommitted);

            try
            {
                cmd.ExecuteNonQuery();

                int seqNo = (int)cmd.Parameters["@ReturnValue"].Value;

                ReleaseCommandWithCommit(cmd);

                return(seqNo);
            }
            catch (Exception ex)
            {
                ReleaseCommandWithRollback(cmd);
                throw new UmcDataException("UBT_InsertTrackback 프로시져 호출중 에러", ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// 아티클과 연결된 트랙백 리스트를 가져온다.
        /// </summary>
        /// <param name="articleNo"></param>
        /// <returns></returns>
        public static List <TrackbackModel> GetTrackbackList(int articleNo)
        {
            SqlParameter[] param =
            {
                CreateInParam("@ArticleNo", SqlDbType.Int, 4, articleNo)
            };

            SqlCommand            cmd       = GetSpCommand("UBT_GetTrackbackList", param);
            SqlDataReader         reader    = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            List <TrackbackModel> bindModel = new List <TrackbackModel>();

            try
            {
                while (reader.Read())
                {
                    TrackbackModel model = new TrackbackModel((int)reader["SeqNo"]);
                    fillTrackback(reader, model);

                    bindModel.Add(model);
                    model = null;
                }
                return(bindModel);
            }
            catch (Exception ex)
            {
                throw new UmcDataException("UBT_GetTrackbackList 프로시져 호출중 에러", ex);
            }
            finally
            {
                ReleaseCommand(cmd);
            }
        }
コード例 #3
0
        /// <summary>
        /// 트랙백 정보를 저장한다.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int InsertTrackback(TrackbackModel model)
        {
            object exceprt		= !string.IsNullOrEmpty(model.Exceprt) ? (object)model.Exceprt : DBNull.Value;

            SqlParameter[] param = {
                CreateInParam("@ArticleNo",			SqlDbType.Int,4,					model.ArticleNo),
                CreateInParam("@Url",				SqlDbType.VarChar,255,				model.Url),
                CreateInParam("@Blog_Name",			SqlDbType.VarChar,255,				model.Blog_Name),
                CreateInParam("@Title",				SqlDbType.VarChar,255,				model.Title),
                CreateInParam("@Exceprt",			SqlDbType.Text, Int32.MaxValue,		exceprt),
                CreateInParam("@UserIP",			SqlDbType.VarChar,20,				model.UserIP),
                CreateReturnValue()
            };

            SqlCommand cmd				= GetSpCommand("UBT_InsertTrackback", param, IsolationLevel.ReadUncommitted);

            try
            {
                cmd.ExecuteNonQuery();

                int seqNo				= (int)cmd.Parameters["@ReturnValue"].Value;

                ReleaseCommandWithCommit(cmd);

                return seqNo;
            }
            catch (Exception ex)
            {
                ReleaseCommandWithRollback(cmd);
                throw new UmcDataException("UBT_InsertTrackback 프로시져 호출중 에러", ex);
            }
        }
コード例 #4
0
        /// <summary>
        /// 아티클과 연결된 트랙백 리스트를 가져온다.
        /// </summary>
        /// <param name="articleNo"></param>
        /// <returns></returns>
        public static List<TrackbackModel> GetTrackbackList(int articleNo)
        {
            SqlParameter[] param = {
                CreateInParam("@ArticleNo",			SqlDbType.Int,4,					articleNo )
            };

            SqlCommand cmd					= GetSpCommand("UBT_GetTrackbackList", param );
            SqlDataReader reader			= cmd.ExecuteReader(CommandBehavior.CloseConnection);
            List<TrackbackModel> bindModel	= new List<TrackbackModel>();

            try
            {
                while (reader.Read())
                {
                    TrackbackModel model = new TrackbackModel((int)reader["SeqNo"]);
                    fillTrackback(reader, model);

                    bindModel.Add(model);
                    model = null;
                }
                return bindModel;
            }
            catch (Exception ex)
            {
                throw new UmcDataException("UBT_GetTrackbackList 프로시져 호출중 에러", ex);
            }
            finally
            {
                ReleaseCommand(cmd);
            }
        }
コード例 #5
0
 private static void fillTrackback(IDataRecord row, TrackbackModel model)
 {
     model.ArticleNo  = (int)row["ArticleNo"];
     model.Url        = (string)row["Url"];
     model.Blog_Name  = (string)row["Blog_Name"];
     model.Title      = (string)row["Title"];
     model.Exceprt    = row["Exceprt"] != DBNull.Value ? (string)row["Exceprt"] : string.Empty;
     model.InsertDate = row["InsertDate"];
 }
コード例 #6
0
        /// <summary>
        /// 트랙백을 받는다.
        /// </summary>
        /// <param name="articleNo"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public bool ReceiveTrackback(int articleNo, HttpContext context)
        {
            TrackbackModel model		= new TrackbackModel();
            model.ArticleNo				= articleNo;
            model.Url					= GetParamString( "url", context );
            model.Blog_Name				= GetParamString( "blog_name", context );
            model.Title					= GetParamString( "title", context );
            model.Exceprt				= GetParamString( "exceprt", context );
            model.UserIP				= context.Request.UserHostAddress;

            if (model.Url == null || model.Blog_Name == null || model.Title == null )
            {
                WriteXml("1", "REQUIRED PARAMETER IS MISSING", context);
                return false;
            }

            TrackbackManager.GetInstance().InsertTrackback( model );
            WriteXml("0", "Registed Trackback", context);

            return true;
        }
コード例 #7
0
        /// <summary>
        /// 트랙백을 받는다.
        /// </summary>
        /// <param name="articleNo"></param>
        /// <param name="context"></param>
        /// <returns></returns>
        public bool ReceiveTrackback(int articleNo, HttpContext context)
        {
            TrackbackModel model = new TrackbackModel();

            model.ArticleNo = articleNo;
            model.Url       = GetParamString("url", context);
            model.Blog_Name = GetParamString("blog_name", context);
            model.Title     = GetParamString("title", context);
            model.Exceprt   = GetParamString("exceprt", context);
            model.UserIP    = context.Request.UserHostAddress;

            if (model.Url == null || model.Blog_Name == null || model.Title == null)
            {
                WriteXml("1", "REQUIRED PARAMETER IS MISSING", context);
                return(false);
            }

            TrackbackManager.GetInstance().InsertTrackback(model);
            WriteXml("0", "Registed Trackback", context);

            return(true);
        }
コード例 #8
0
        /// <summary>
        /// utf-8 로 트랙백을 보낸다.
        /// </summary>
        /// <param name="targetUrl"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool SendTrackback(string targetUrl, TrackbackModel model)
        {
            string[] data = new string[4] {
                "url=" + model.Url,
                "blog_name=" + model.Blog_Name,
                "title=" + model.Title,
                "exceprt=" + model.Exceprt
            };

            string trackbackData = string.Join("&", data);

            try
            {
                WebClient wc = new WebClient();
                wc.Headers.Add("content-type", "application/x-www-form-urlencoded");
                byte[] response = wc.UploadData(targetUrl, "POST", Encoding.Default.GetBytes(trackbackData));

                string resultXml = Encoding.UTF8.GetString(response).Trim();

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(resultXml);

                if (doc.SelectSingleNode("response/error").InnerXml == "0")
                {
                    //TrackbackManager.GetInstance().InsertTrackback( model );
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                return(false);
            }
        }
コード例 #9
0
        /// <summary>
        /// utf-8 로 트랙백을 보낸다.
        /// </summary>
        /// <param name="targetUrl"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool SendTrackback(string targetUrl, TrackbackModel model)
        {
            string[] data = new string[4]{
                "url=" + model.Url,
                "blog_name=" + model.Blog_Name,
                "title=" + model.Title,
                "exceprt=" + model.Exceprt
            };

            string trackbackData	= string.Join("&", data );

            try
            {
                WebClient wc			= new WebClient();
                wc.Headers.Add( "content-type","application/x-www-form-urlencoded");
                byte[] response			= wc.UploadData( targetUrl, "POST", Encoding.Default.GetBytes(trackbackData));

                string resultXml		= Encoding.UTF8.GetString( response ).Trim();

                XmlDocument doc			= new XmlDocument();
                doc.LoadXml( resultXml );

                if (doc.SelectSingleNode("response/error").InnerXml == "0")
                {
                    //TrackbackManager.GetInstance().InsertTrackback( model );
                    return true;
                }
                else
                    return false;
            }
            catch
            {
                return false;
            }
        }
コード例 #10
0
 /// <summary>
 /// 트랙백 정보를 저장한다.
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int InsertTrackback(TrackbackModel model)
 {
     return TrackbackAccess.InsertTrackback( model );
 }
コード例 #11
0
    protected void lnkRegister_Click(object sender, EventArgs e)
    {
        if (txtTitle.Text.Length == 0)
        {
            Utility.JS_Alert(sender, MessageCode.GetMessageByCode("message.no.title"));
            return;
        }
        if (FCKeditor1.Value.Length == 0)
        {
            Utility.JS_Alert(sender, MessageCode.GetMessageByCode("message.no.content"));
            return;
        }
        bool tagValidate = true;
        foreach (string noTag in noTagList)
        {
            if (txtTag.Text.IndexOf(noTag) != -1)
            {
                tagValidate = false;
                break;
            }
        }
        if (!tagValidate)
        {
            Utility.JS_Alert(sender, MessageCode.GetMessageByCode("message.article.notaglist"));
            return;
        }

        HttpFileCollection fileCollection	= Request.Files;
        //CategoryNodeValue node				= CategoryNodeValue.Parse( ddlCategoryM.SelectedValue );

        ArticleModel model	= new ArticleModel();
        model.CategoryID	= int.Parse( ddlCategoryM.SelectedValue );
        model.Title			= txtTitle.Text;
        model.Content		= FCKeditor1.Value;
        model.TrackbackUrl	= txtTrackbackUrl.Text;
        model.PublicFlag	= bool.Parse( rblPublicFlag.SelectedValue );
        model.PublicRss		= bool.Parse( rblPublicRss.SelectedValue );
        model.AllowComment	= bool.Parse( rblAllowComment.SelectedValue );
        model.AllowTrackback= bool.Parse( rblAllowTrackback.SelectedValue );

        string[] tags	= txtTag.Text.Split(',');

        foreach (string tag in tags)
        {
            model.Tag.Add( new TagModel(tag) );
        }

        // 아티클 수정모드라면 다른곳으로 분기
        if (articleNo > 0)
        {
            updateArticle( model );
            return;
        }

        int seqNo = ArticleManager.GetInstance().InsertArticle( model, fileCollection );

        TrackbackModel trackbackModel	= new TrackbackModel();
        trackbackModel.ArticleNo		= seqNo;
        trackbackModel.Blog_Name		= BlogManager.GetInstance().BlogBaseModel.BlogModel.Title;
        trackbackModel.Title			= model.Title;
        trackbackModel.Exceprt			= model.Content;
        trackbackModel.Url				= Utility.MakeArticleUrl( seqNo );
        trackbackModel.UserIP			= Request.UserHostAddress;

        // 트랙백 보내는 아티클이면..
        if (txtTrackbackUrl.Text.Length > 0)
        {
            TrackbackManager.GetInstance().SendTrackback( txtTrackbackUrl.Text, trackbackModel );
        }

        string script = string.Format("alert('{0}'); location.href='{1}';",
                UmcConfiguration.Message[ArticleConst.MESSAGE_ARTICLE_REGIST],
                ListQueryString);
        Utility.JsCall( sender, script );
    }
コード例 #12
0
 private static void fillTrackback(IDataRecord row, TrackbackModel model)
 {
     model.ArticleNo					= (int)row["ArticleNo"];
     model.Url						= (string)row["Url"];
     model.Blog_Name					= (string)row["Blog_Name"];
     model.Title						= (string)row["Title"];
     model.Exceprt					= row["Exceprt"] != DBNull.Value ? (string)row["Exceprt"] : string.Empty;
     model.InsertDate				= row["InsertDate"];
 }
コード例 #13
0
 /// <summary>
 /// 트랙백 정보를 저장한다.
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int InsertTrackback(TrackbackModel model)
 {
     return(TrackbackAccess.InsertTrackback(model));
 }