Exemplo n.º 1
0
        /// <summary>
        /// M77_TRHの物理削除
        /// </summary>
        /// <param name="m77trh">M77_TRH_Member</param>
        public void Delete(M77_TRH_Member M75skk)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

                //削除行を特定
                var ret = from x in context.M77_TRH
                          where (x.取引区分ID == M75skk.取引区分ID)
                          orderby x.取引区分ID
                          select x;
                var m77 = ret.FirstOrDefault();

                context.DeleteObject(m77);
                context.SaveChanges();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// M77_TRHの更新
        /// </summary>
        /// <param name="m77trh">M77_TRH_Member</param>
        public void Update(M77_TRH_Member m77trh)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

                //更新行ヲ特定
                var ret = from x in context.M77_TRH
                          where (x.取引区分ID == m77trh.取引区分ID)
                          orderby x.取引区分ID
                          select x;
                var m77 = ret.FirstOrDefault();
                m77.取引区分ID = m77trh.取引区分ID;
                m77.登録日時   = m77trh.登録日時;
                m77.更新日時   = DateTime.Now;
                m77.取引区分名  = m77trh.歩合計算名;

                m77.AcceptChanges();
                context.SaveChanges();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// M77_TRHの新規追加
        /// </summary>
        /// <param name="m77trh">M77_TRH_Member</param>
        public void Insert(M77_TRH_Member m77trh)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

                M77_TRH m77 = new M77_TRH();
                m77.取引区分ID = m77trh.取引区分ID;
                m77.登録日時   = m77trh.登録日時;
                m77.更新日時   = m77trh.更新日時;
                m77.取引区分名  = m77trh.歩合計算名;
                try
                {
                    // newノエンティティニ対シテハAcceptChangesデ新規追加トナル
                    context.M77_TRH.ApplyChanges(m77);
                    context.SaveChanges();
                }
                catch (UpdateException ex)
                {
                    // PKey違反等
                    Console.WriteLine(ex);
                }
            }
        }