Beispiel #1
0
        /// <summary>
        /// 既に登録済みか確認
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        public bool isRegisted(Brewer b)
        {
            var com = db.CreateCommand();

            com.CommandText = "select id from brewers where licencedate = @1 and name = @2 and item = @3";
            com.Parameters.AddWithValue("@1", b.getParam(Brewer.RegistInfo.licenceDate));
            com.Parameters.AddWithValue("@2", b.getParam(Brewer.RegistInfo.name));
            com.Parameters.AddWithValue("@3", b.getParam(Brewer.RegistInfo.item));
            var r = com.ExecuteReader();

            return(r.Read());
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="b"></param>
        public void regist(Brewer b)
        {
            if (isRegisted(b))
            {
                return;//登録済みなら何もしない
            }

            var com = db.CreateCommand();

            com.CommandText = "insert into brewers(prefecture,taxoffice,licencedate,registdate,name,place,classification,item,type) values(@1,@2,@3,@4,@5,@6,@7,@8,@9);";
            com.Parameters.AddWithValue("@1", b.getParam(Brewer.RegistInfo.prefecture));
            com.Parameters.AddWithValue("@2", b.getParam(Brewer.RegistInfo.taxoffice));
            com.Parameters.AddWithValue("@3", b.getParam(Brewer.RegistInfo.licenceDate));
            com.Parameters.AddWithValue("@4", b.getParam(Brewer.RegistInfo.registDate));
            com.Parameters.AddWithValue("@5", b.getParam(Brewer.RegistInfo.name));
            com.Parameters.AddWithValue("@6", b.getParam(Brewer.RegistInfo.place));
            com.Parameters.AddWithValue("@7", b.getParam(Brewer.RegistInfo.classification));
            com.Parameters.AddWithValue("@8", b.getParam(Brewer.RegistInfo.item));
            com.Parameters.AddWithValue("@9", b.getParam(Brewer.RegistInfo.type));
            com.ExecuteNonQuery();
        }