Ejemplo n.º 1
0
        /// <summary>
        /// M75_SKKの新規追加
        /// </summary>
        /// <param name="M75skk">M75_SKK_Member</param>
        public void Insert(M75_SKK_Member m75skk)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

                M75_SKK m75 = new M75_SKK();
                m75.表示順ID  = m75skk.表示順ID;
                m75.登録日時   = m75skk.登録日時;
                m75.更新日時   = m75skk.更新日時;
                m75.経費項目ID = m75skk.経費項目ID;
                m75.支払先ID  = m75skk.支払先ID;
                try
                {
                    // newノエンティティニ対シテハAcceptChangesデ新規追加トナル
                    context.M75_SKK.ApplyChanges(m75);
                    context.SaveChanges();
                }
                catch (UpdateException ex)
                {
                    // PKey違反等
                    Console.WriteLine(ex);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// M75_SKKの物理削除
        /// </summary>
        /// <param name="M75skk">M75_SKK_Member</param>
        public void Delete(M75_SKK_Member M75skk)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

                //削除行を特定
                var ret = from x in context.M75_SKK
                          where (x.表示順ID == M75skk.表示順ID)
                          orderby x.表示順ID
                          select x;
                var m75 = ret.FirstOrDefault();

                context.DeleteObject(m75);
                context.SaveChanges();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// M75_SKKの更新
        /// </summary>
        /// <param name="M75skk">M75_SKK_Member</param>
        public void Update(M75_SKK_Member m75skk)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

                //更新行ヲ特定
                var ret = from x in context.M75_SKK
                          where (x.表示順ID == m75skk.表示順ID)
                          orderby x.表示順ID
                          select x;
                var m75 = ret.FirstOrDefault();
                m75.表示順ID  = m75skk.表示順ID;
                m75.登録日時   = m75skk.登録日時;
                m75.更新日時   = DateTime.Now;
                m75.経費項目ID = m75skk.経費項目ID;
                m75.支払先ID  = m75skk.支払先ID;

                m75.AcceptChanges();
                context.SaveChanges();
            }
        }