Esempio n. 1
0
        /// <summary>
        /// M82_SEIの物理削除
        /// </summary>
        /// <param name="m82sei">M82_SEI_Member</param>
        public void Delete(M82_SEI_Member m82sei)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

                //削除行を特定
                var ret = from x in context.M82_SEI
                          where (x.請求書区分ID == m82sei.請求書区分ID)
                          orderby x.請求書区分ID
                          select x;
                var m82 = ret.FirstOrDefault();

                context.DeleteObject(m82);
                context.SaveChanges();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// M82_SEIの更新
        /// </summary>
        /// <param name="m82sei">M82_SEI_Member</param>
        public void Update(M82_SEI_Member m82sei)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

                //更新行ヲ特定
                var ret = from x in context.M82_SEI
                          where (x.請求書区分ID == m82sei.請求書区分ID)
                          orderby x.請求書区分ID
                          select x;
                var m82 = ret.FirstOrDefault();
                m82.請求書区分ID = m82sei.請求書区分ID;
                m82.登録日時    = m82sei.登録日時;
                m82.更新日時    = DateTime.Now;
                m82.請求書名    = m82sei.請求書名;

                m82.AcceptChanges();
                context.SaveChanges();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// M82_SEIの新規追加
        /// </summary>
        /// <param name="m82sei">M82_SEI_Member</param>
        public void Insert(M82_SEI_Member m82sei)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

                M82_SEI m82 = new M82_SEI();
                m82.請求書区分ID = m82sei.請求書区分ID;
                m82.登録日時    = m82sei.登録日時;
                m82.更新日時    = m82sei.更新日時;
                m82.請求書名    = m82sei.請求書名;
                try
                {
                    // newノエンティティニ対シテハAcceptChangesデ新規追加トナル
                    context.M82_SEI.ApplyChanges(m82);
                    context.SaveChanges();
                }
                catch (UpdateException ex)
                {
                    // PKey違反等
                    Console.WriteLine(ex);
                }
            }
        }