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

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

            return(Idx);
        }
        public bool Update(Tab_Y_ProIndvalValue model)
        {
            string sql  = "update Tab_Y_ProIndvalValue set ArticleIdx=@ArticleIdx,IndvalItemNameValueJson=@IndvalItemNameValueJson where Idx=@Idx";
            int    rows = SqlHelper.ExecuteNonQuery(CommandType.Text, sql
                                                    , new SqlParameter("@ArticleIdx", model.ArticleIdx)
                                                    , new SqlParameter("@IndvalItemNameValueJson", model.IndvalItemNameValueJson)
                                                    , new SqlParameter("Idx", model.Idx)
                                                    );

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

            return(model);
        }