예제 #1
0
        public IHttpActionResult PostLastMonth(LastMonth lastMonth)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.LastMonth.Add(lastMonth);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (LastMonthExists(lastMonth.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = lastMonth.Id }, lastMonth));
        }
예제 #2
0
        public IHttpActionResult PutLastMonth(int id, LastMonth lastMonth)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != lastMonth.Id)
            {
                return(BadRequest());
            }

            db.Entry(lastMonth).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LastMonthExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        public IHttpActionResult GetLastMonth(int id)
        {
            LastMonth lastMonth = db.LastMonth.Find(id);

            if (lastMonth == null)
            {
                return(NotFound());
            }

            return(Ok(lastMonth));
        }
예제 #4
0
        public IHttpActionResult DeleteLastMonth(int id)
        {
            LastMonth lastMonth = db.LastMonth.Find(id);

            if (lastMonth == null)
            {
                return(NotFound());
            }

            db.LastMonth.Remove(lastMonth);
            db.SaveChanges();

            return(Ok(lastMonth));
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TesterViewModel"/> class.
        /// </summary>
        public TesterViewModel()
        {
            _selectedExportType = ExportType.BooksToCsv;
            _outputFile         = string.Empty;
            SetupExportTypesByTitle();
            LastMonth     = DateTime.Now;
            SelectedMonth = LastMonth.AddDays(-2);
            FirstMonth    = SelectedMonth.AddDays(-2);

            _selectedImportType = ImportType.BooksFromCsv;
            _inputFile          = string.Empty;
            SetupImportTypesByTitle();
            ImportDataTable = new DataTable();

            _countryCodesReadFromDatabase
                = new ObservableCollection <CountryCodeIso3166>();
        }
예제 #6
0
 protected void PageInit()
 {
     //昨日
     Yestoday.DataSource = Query(o => o.date.Date == DateTime.Now.AddDays(-1).Date&& o.paid == true && o.price1 >= 1, out yestodyDaySales, out yestodyTotal);
     Yestoday.DataBind();
     //七天前
     ServerDays.DataSource = Query(o => o.date.Date >= DateTime.Now.AddDays(-7).Date&& o.paid == true && o.price1 >= 1, out serverDaySales, out serverTotal);
     ServerDays.DataBind();
     //上月
     LastMonth.DataSource = Query(o => o.date.Year == DateTime.Now.AddMonths(-1).Year&& o.date.Month == DateTime.Now.AddMonths(-1).Month&& o.paid == true && o.price1 >= 1, out lastMonthDaySales, out lastMonthTotal);
     LastMonth.DataBind();
     //本月
     ThisMonth.DataSource = Query(o => o.date.Year == DateTime.Now.Year && o.date.Month == DateTime.Now.Month && o.date.Day >= 1 && o.paid == true && o.price1 >= 1, out thisMonthDaySales, out thisMonthTotal);
     ThisMonth.DataBind();
     //今年
     ThisYear.DataSource = Query(o => o.date.Year == DateTime.Now.Year && o.paid == true && o.price1 >= 1, out thisYearDaySales, out thisYearTotal);
     ThisYear.DataBind();
     //全部
     AllGoods.DataSource = Query(o => o.paid == true && o.price1 >= 1, out allDaySales, out allTotal);
     AllGoods.DataBind();
 }