Example #1
0
        /// <summary>
        /// M76_DBUの物理削除
        /// </summary>
        /// <param name="m76dbu">M76_DBU_Member</param>
        public void Delete(M76_DBU_Member M75skk)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

                //削除行を特定
                var ret = from x in context.M76_DBU
                          where (x.歩合計算区分ID == M75skk.歩合計算区分ID)
                          orderby x.歩合計算区分ID
                          select x;
                var m76 = ret.FirstOrDefault();

                context.DeleteObject(m76);
                context.SaveChanges();
            }
        }
Example #2
0
        /// <summary>
        /// M76_DBUの更新
        /// </summary>
        /// <param name="m76dbu">M76_DBU_Member</param>
        public void Update(M76_DBU_Member m76dbu)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

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

                m76.AcceptChanges();
                context.SaveChanges();
            }
        }
Example #3
0
        /// <summary>
        /// M76_DBUの新規追加
        /// </summary>
        /// <param name="m76dbu">M76_DBU_Member</param>
        public void Insert(M76_DBU_Member m76dbu)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

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