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

                //削除行を特定
                var ret = from x in context.M79_ZKB
                          where (x.税区分ID == M75skk.出勤区分ID)
                          orderby x.税区分ID
                          select x;
                var m79 = ret.FirstOrDefault();

                context.DeleteObject(m79);
                context.SaveChanges();
            }
        }
Beispiel #2
0
        /// <summary>
        /// M79_ZKBの更新
        /// </summary>
        /// <param name="m79zkb">M79_ZKB_Member</param>
        public void Update(M79_ZKB_Member m79zkb)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

                //更新行ヲ特定
                var ret = from x in context.M79_ZKB
                          where (x.税区分ID == m79zkb.出勤区分ID)
                          orderby x.税区分ID
                          select x;
                var m79 = ret.FirstOrDefault();
                m79.税区分ID = m79zkb.出勤区分ID;
                m79.登録日時  = m79zkb.登録日時;
                m79.更新日時  = DateTime.Now;
                m79.税区分名  = m79zkb.税区分;

                m79.AcceptChanges();
                context.SaveChanges();
            }
        }
Beispiel #3
0
        /// <summary>
        /// M79_ZKBの新規追加
        /// </summary>
        /// <param name="m79zkb">M79_ZKB_Member</param>
        public void Insert(M79_ZKB_Member m79zkb)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

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