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

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

                context.DeleteObject(m78);
                context.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// M78_SYKの更新
        /// </summary>
        /// <param name="m78syk">M78_SYK_Member</param>
        public void Update(M78_SYK_Member m78syk)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

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

                m78.AcceptChanges();
                context.SaveChanges();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// M78_SYKの新規追加
        /// </summary>
        /// <param name="m78syk">M78_SYK_Member</param>
        public void Insert(M78_SYK_Member m78syk)
        {
            using (TRAC3Entities context = new TRAC3Entities(CommonData.TRAC3_GetConnectionString()))
            {
                context.Connection.Open();

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