示例#1
0
        // returns true if month already exists
        private bool DoesMonthExistForUser(List <Month_Year> MonthsForUser, Month_Year NewMonth)
        {
            if (MonthsForUser.Any(M => M.Month == NewMonth.Month && M.Year == NewMonth.Year && M.UserId == NewMonth.UserId))
            {
                return(true);
            }

            return(false);
        }
示例#2
0
        // adds new month and returns false if month already exists
        public bool AddMonth(Month_Year NewMonth)
        {
            using (ContextDBDataContext context = new ContextDBDataContext(_connectionString))
            {
                if (DoesMonthExistForUser(context.Month_Years.Where(M => M.UserId == NewMonth.UserId).ToList(), NewMonth))
                {
                    return(true);
                }

                context.Month_Years.InsertOnSubmit(NewMonth);
                context.SubmitChanges();

                return(false);
            }
        }
示例#3
0
 partial void DeleteMonth_Year(Month_Year instance);
示例#4
0
 partial void UpdateMonth_Year(Month_Year instance);
示例#5
0
 partial void InsertMonth_Year(Month_Year instance);
示例#6
0
 private void detach_Month_Years(Month_Year entity)
 {
     this.SendPropertyChanging();
     entity.User = null;
 }
示例#7
0
 private void attach_Month_Years(Month_Year entity)
 {
     this.SendPropertyChanging();
     entity.User = this;
 }