Example #1
0
        private static Tab_UserArticle_Reply ToModel(DataRow row)
        {
            Tab_UserArticle_Reply model = new Tab_UserArticle_Reply();

            model.Idx = row.IsNull("Idx")?null:(System.Int32?)row["Idx"];
            model.UserArticlesIdx_fx = row.IsNull("UserArticlesIdx_fx")?null:(System.Int32?)row["UserArticlesIdx_fx"];
            model.ReplyContent       = row.IsNull("ReplyContent")?null:(System.String)row["ReplyContent"];
            model.DisplayBool        = row.IsNull("DisplayBool")?null:(System.String)row["DisplayBool"];
            model.ReplyTime          = row.IsNull("ReplyTime")?null:(System.String)row["ReplyTime"];
            return(model);
        }
Example #2
0
        public int AddNew(Tab_UserArticle_Reply model)
        {
            string sql = "insert into Tab_UserArticle_Reply(UserArticlesIdx_fx,ReplyContent,DisplayBool,ReplyTime)  values(@UserArticlesIdx_fx,@ReplyContent,@DisplayBool,@ReplyTime); select @@identity ;";
            int    Idx = Convert.ToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sql
                                                                 , new SqlParameter("@UserArticlesIdx_fx", model.UserArticlesIdx_fx)
                                                                 , new SqlParameter("@ReplyContent", model.ReplyContent)
                                                                 , new SqlParameter("@DisplayBool", model.DisplayBool)
                                                                 , new SqlParameter("@ReplyTime", model.ReplyTime)
                                                                 ));

            return(Idx);
        }
Example #3
0
        public bool Update(Tab_UserArticle_Reply model)
        {
            string sql  = "update Tab_UserArticle_Reply set UserArticlesIdx_fx=@UserArticlesIdx_fx,ReplyContent=@ReplyContent,DisplayBool=@DisplayBool,ReplyTime=@ReplyTime where Idx=@Idx";
            int    rows = SqlHelper.ExecuteNonQuery(CommandType.Text, sql
                                                    , new SqlParameter("@UserArticlesIdx_fx", model.UserArticlesIdx_fx)
                                                    , new SqlParameter("@ReplyContent", model.ReplyContent)
                                                    , new SqlParameter("@DisplayBool", model.DisplayBool)
                                                    , new SqlParameter("@ReplyTime", model.ReplyTime)
                                                    , new SqlParameter("Idx", model.Idx)
                                                    );

            return(rows > 0);
        }
Example #4
0
        public Tab_UserArticle_Reply Get(string Idx)
        {
            DataTable dt = SqlHelper.ExecuteDataset(CommandType.Text, "select * from Tab_UserArticle_Reply  where Idx=@Idx",
                                                    new SqlParameter("Idx", Idx)).Tables[0];

            if (dt.Rows.Count > 1)
            {
                throw new Exception("more than 1 row was found");
            }

            if (dt.Rows.Count <= 0)
            {
                return(null);
            }

            DataRow row = dt.Rows[0];
            Tab_UserArticle_Reply model = ToModel(row);

            return(model);
        }