private static Tab_magazineDetail ToModel(DataRow row)
        {
            Tab_magazineDetail model = new Tab_magazineDetail();

            model.Idx                = row.IsNull("Idx")?null:(System.Int32?)row["Idx"];
            model.MagazineIdx_Fx     = row.IsNull("MagazineIdx_Fx")?null:(System.Int32?)row["MagazineIdx_Fx"];
            model.MultimediaCategory = row.IsNull("MultimediaCategory")?null:(System.String)row["MultimediaCategory"];
            model.Path               = row.IsNull("Path")?null:(System.String)row["Path"];
            model.CreatedDate        = row.IsNull("CreatedDate")?null:(System.DateTime?)row["CreatedDate"];
            return(model);
        }
        public int AddNew(Tab_magazineDetail model)
        {
            string sql = "insert into Tab_magazineDetail(MagazineIdx_Fx,MultimediaCategory,Path,CreatedDate)  values(@MagazineIdx_Fx,@MultimediaCategory,@Path,@CreatedDate); select @@identity ;";
            int    Idx = Convert.ToInt32(SqlHelper.ExecuteScalar(CommandType.Text, sql
                                                                 , new SqlParameter("@MagazineIdx_Fx", model.MagazineIdx_Fx)
                                                                 , new SqlParameter("@MultimediaCategory", model.MultimediaCategory)
                                                                 , new SqlParameter("@Path", model.Path)
                                                                 , new SqlParameter("@CreatedDate", model.CreatedDate)
                                                                 ));

            return(Idx);
        }
        public bool Update(Tab_magazineDetail model)
        {
            string sql  = "update Tab_magazineDetail set MagazineIdx_Fx=@MagazineIdx_Fx,MultimediaCategory=@MultimediaCategory,Path=@Path,CreatedDate=@CreatedDate where Idx=@Idx";
            int    rows = SqlHelper.ExecuteNonQuery(CommandType.Text, sql
                                                    , new SqlParameter("@MagazineIdx_Fx", model.MagazineIdx_Fx)
                                                    , new SqlParameter("@MultimediaCategory", model.MultimediaCategory)
                                                    , new SqlParameter("@Path", model.Path)
                                                    , new SqlParameter("@CreatedDate", model.CreatedDate)
                                                    , new SqlParameter("Idx", model.Idx)
                                                    );

            return(rows > 0);
        }
        public Tab_magazineDetail Get(string Idx)
        {
            DataTable dt = SqlHelper.ExecuteDataset(CommandType.Text, "select * from Tab_magazineDetail  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_magazineDetail model = ToModel(row);

            return(model);
        }