コード例 #1
0
        private void BT_SaveEvent_Click(object sender, EventArgs e)
        {
            int count = FLP_Events.Controls.Count;

            if (count > 0)
            {
                DailyLog dailyLog;
                dailyLog = db.GetDailyLog(DateTime.Now.ToShortDateString());

                if (dailyLog == null)
                {
                    dailyLog            = new DailyLog();
                    dailyLog.Id         = DailyLogId;
                    dailyLog.CreateTime = DateTime.Now;
                    db.AddDailyLog(dailyLog);
                }
                foreach (EventControl item in FLP_Events.Controls)
                {
                    switch (item.Status)
                    {
                    case EventControl.StatusType.Create:
                        CreateEvent(item, dailyLog.Id);
                        break;

                    case EventControl.StatusType.Delete:
                        DeleteEvent(item);
                        break;

                    case EventControl.StatusType.Keep:
                        break;

                    case EventControl.StatusType.Update:
                        UpdateEvent(item);
                        break;
                    }
                }

                MessageBox.Show("已保存");
            }
            else
            {
                // if nothing delete
                return;
            }
        }