예제 #1
0
        private int DeleteYearMonth(MS_GAKUNEN Gakunen, int Year)
        {
            #region SQL
            string SQL = @"
delete from DATE_DATA

where MS_GAKUNEN_ID = @MS_GAKUNEN_ID
and strftime('%Y-%m', JIKANWARI) >= @NENDO_START and strftime('%Y-%m', JIKANWARI) <= @NENDO_END

";
            #endregion

            int cnt = 0;
            using (MySqlCommand command = new MySqlCommand(SQL, DBConnect.GetConnection()))
            {
                var 年度 = Get年度(Year);

                command.Parameters.AddWithValue("@MS_GAKUNEN_ID", Gakunen.MS_GAKUNEN_ID);
                command.Parameters.AddWithValue("@NENDO_START", 年度.NendoStart);
                command.Parameters.AddWithValue("@NENDO_END", 年度.NendoEnd);

                cnt = command.ExecuteNonQuery();
            }
            return(cnt);
        }
예제 #2
0
        public void Save(List <DateData> dateDatas, MS_GAKUNEN Gakunen, int Year)
        {
            using (var trans = DBConnect.GetConnection().BeginTransaction())
            {
                int cnt = DeleteYearMonth(Gakunen, Year);

                foreach (var d in dateDatas)
                {
                    Insert(d);
                }
                trans.Commit();
            }
        }