public HttpResponseMessage UpdateOrgDocTypeMonthlyWork(DateRange dates)
        {
            DateTime start = DateTime.Now;

            try
            {
                //Get Distinct DocTypes for a Organization in a date range
                // Get the count
                // Get the Price for that Unit
                // Add entry in the table
                var pMonth = dates.StartDate.Month.ToString("00") + dates.StartDate.Year.ToString("0000");
                var months = _IMonthService.GetMonths().Where(m => m.Name == pMonth);
                if (months.Count() <= 0)
                {
                    _IMonthService.AddMonth(new Month {
                        Name = pMonth
                    });
                    months = _IMonthService.GetMonths().Where(m => m.Name == pMonth);
                }

                var month = months.FirstOrDefault();
                foreach (var org in _IOrgService.GetOrgs().Where(p => p.OrgTyp.TypCd == "CUST"))
                {
                    var docs = _IOrgdoctypdailyuploadService.GetOrgdoctypdailyuploads().Where(od => od.OrgId == org.Id && od.Day >= dates.StartDate && od.Day <= dates.EndDate).GroupBy(g => g.OrgDocTypId)
                               .Select(cl => new
                    {
                        Key     = cl.Key,
                        Count   = cl.Sum(c => c.Images),
                        Revenue = cl.Sum(c => c.Revenue)
                    }).ToList();

                    foreach (var doc in docs)
                    {
                        var docid   = doc.Key;
                        var count   = doc.Count;
                        var revenue = doc.Revenue;
                        var price   = _IOrgdoctypService.GetOrgdoctyps().Where(p => p.Id == docid).FirstOrDefault().SowWkflowDocSetup.FirstOrDefault().ListPrice;
                        var exist   = _IOrgdoctypmonthService.GetOrgdoctypmonths().Where(om => om.MonthId == month.Id && om.OrgId == org.Id && om.OrgDocTypId == docid).Count();
                        if (exist <= 0)
                        {
                            _IOrgdoctypmonthService.AddOrgdoctypmonth(new OrgDocTypMonth {
                                Month = month, Org = org, OrgDocTypId = docid, Price = (decimal)price, Images = (int)count, Revenue = revenue
                            });
                        }
                    }
                }

                return(Request.CreateResponse <bool>(HttpStatusCode.OK, true));
            }
            catch (Exception e)
            {
                var createresponse = Request.CreateErrorResponse(HttpStatusCode.NotFound, "Error UpdateOrgDocTypeWork");
                throw new HttpResponseException(createresponse);
            }
        }
        private void LoadStatistics()
        {
            Series series1 = new Series();

            series1.Name = cbxYears.SelectedText;
            foreach (var word in _monthService.GetMonths(Convert.ToInt32(cbxYears.SelectedText)))
            {
                series1.Points.Add(new SeriesPoint("Ocak", word.January));
                series1.Points.Add(new SeriesPoint("Şubat", word.Fabruary));
                series1.Points.Add(new SeriesPoint("Mart", word.March));
                series1.Points.Add(new SeriesPoint("Nisan", word.April));
                series1.Points.Add(new SeriesPoint("Mayıs", word.May));
                series1.Points.Add(new SeriesPoint("Haziran", word.June));
                series1.Points.Add(new SeriesPoint("Temmuz", word.July));
                series1.Points.Add(new SeriesPoint("Ağustos", word.August));
                series1.Points.Add(new SeriesPoint("Eylül", word.September));
                series1.Points.Add(new SeriesPoint("Ekim", word.October));
                series1.Points.Add(new SeriesPoint("Kasım", word.November));
                series1.Points.Add(new SeriesPoint("Aralık", word.December));
            }
            chartcColumn.Series.Clear();
            chartcColumn.Series.Add(series1);
        }
        public ActionResult GetMonth()
        {
            var Months = _MonthService.GetMonths();

            return(View(Months));
        }
Beispiel #4
0
        private void AddStatistic()
        {
            foreach (var month in _monthService.GetMonths(DateTime.Now.Year))
            {
                switch (DateTime.Now.Month)
                {
                case 1:
                    _monthService.Update(new Month
                    {
                        Monthid = DateTime.Now.Year,
                        January = month.January + 1
                    });
                    break;

                case 2:
                    _monthService.Update(new Month
                    {
                        Monthid  = DateTime.Now.Year,
                        Fabruary = month.Fabruary + 1
                    });
                    break;

                case 3:
                    _monthService.Update(new Month
                    {
                        Monthid = DateTime.Now.Year,
                        March   = month.March + 1
                    });
                    break;

                case 4:
                    _monthService.Update(new Month
                    {
                        Monthid = DateTime.Now.Year,
                        April   = month.January + 1
                    });
                    break;

                case 5:
                    _monthService.Update(new Month
                    {
                        Monthid = DateTime.Now.Year,
                        May     = month.May + 1
                    });
                    break;

                case 6:
                    _monthService.Update(new Month
                    {
                        Monthid = DateTime.Now.Year,
                        June    = month.January + 1
                    });
                    break;

                case 7:
                    _monthService.Update(new Month
                    {
                        Monthid = DateTime.Now.Year,
                        July    = month.July + 1
                    });
                    break;

                case 8:
                    _monthService.Update(new Month
                    {
                        Monthid = DateTime.Now.Year,
                        August  = month.August + 1
                    });
                    break;

                case 9:
                    _monthService.Update(new Month
                    {
                        Monthid   = DateTime.Now.Year,
                        September = month.September + 1
                    });
                    break;

                case 10:
                    _monthService.Update(new Month
                    {
                        Monthid = DateTime.Now.Year,
                        October = month.October + 1
                    });
                    break;

                case 11:
                    _monthService.Update(new Month
                    {
                        Monthid  = DateTime.Now.Year,
                        November = month.November + 1
                    });
                    break;

                case 12:
                    _monthService.Update(new Month
                    {
                        Monthid  = DateTime.Now.Year,
                        December = month.December + 1
                    });
                    break;
                }
            }

            XtraMessageBox.Show("TEBRİKLER " + lblEnglishWord.Text + " KELİMESİNİ ÖĞRENDİNİZ",
                                "Tebrikler!!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }