Пример #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            int serviceId = 0;
            int.TryParse(txtServiceId.Text, out serviceId);
            var serviceObj = new Service
            {
                Id = serviceId,
                Name = txtName.Text,
                Type = (cmbType.SelectedItem as ServiceType).Id,
                Cost = Convert.ToDouble(txtCost.Text),
                Status = Convert.ToSByte(chkStatus.Checked),
                CreatedOn = DateTime.Now,
                CreeatedBy = App.LoggedInEmployee.Id,
                ModifiedOn = DateTime.Now,
                ModifiedBy = App.LoggedInEmployee.Id,
                AllowMultiple = Convert.ToSByte(chkAllowMultiple.Checked)
            };

            var serviceDao = new ServiceDao();
            int scid = serviceDao.SavePrintSeries(serviceObj);

            if (serviceId == 0)
            {
                var sdDao = new StockDetailsDao();
                var sdObj = new StockDetail
                {
                    ServiceId = scid,
                    Stock = 0
                };
                sdDao.SaveStockDetail(sdObj);
            }

            ShowServices();
        }
 private void btnViewReport_Click(object sender, EventArgs e)
 {
     dgvOperatorReport.AutoGenerateColumns = false;
     int cUser = (cmbUsername.SelectedItem as Employee).Id;
     var data = new ServiceDao().GetOperatorReport(dtpDate.Value, cUser);
     var totals = new Service();
     totals.Name = "Total";
     totals.SoldQuantity = data.Sum(x => x.SoldQuantity);
     totals.TotalCollection = data.Sum(x => x.TotalCollection);
     data.Add(totals);
     dgvOperatorReport.DataSource = data;
 }
Пример #3
0
        public void LoadReport()
        {
            dgvReport.AutoGenerateColumns = false;
            var data = new ServiceDao().GetDcrReport(dtpFromDate.Value, dtpToDate.Value);
            DateTime fromDate = dtpFromDate.Value;
            DateTime toDate = dtpToDate.Value;

            var startDate = new DateTime(fromDate.Year, fromDate.Month, fromDate.Day);
            var endDate = new DateTime(toDate.Year, toDate.Month, toDate.Day);

            if (startDate == endDate)
                endDate.AddDays(1);

            //MessageBox.Show("select s.Id, s.Name, s.Cost, sum(t.Quantity) as SoldQuantity, s.Type, sum(t.TotalCost) as TotalCollection, max(t.ServiceDailyNumber) as EndingNumber, min(t.ServiceDailyNumber) as StartingNumber from Services s left outer join Tokens t on ( s.Id = t.ServiceId and t.CreatedOn between " + startDate + " and " + endDate + " and t.Status=1 and s.Type not in(16) ) group by s.Id, s.Name");

            var totals = new Service();
            totals.Name = "Totals";
            //totals.SoldQuantity = data.Sum(x => x.SoldQuantity);
            totals.TotalCollection = data.Sum(x => x.TotalCollection);
            data.Add(totals);

            dgvReport.DataSource = data;
        }
Пример #4
0
 public int UpdatePrintSeries(Service ps)
 {
     using (var db = new eTempleDbDB())
     {
         return db.Update(ps);
     }
 }
Пример #5
0
 public int SavePrintSeries(Service ps)
 {
     using (var db = new eTempleDbDB())
     {
         db.Save(ps);
         return ps.Id;
     }
 }
Пример #6
0
 private void ShowService(Service serviceObj)
 {
     txtServiceId.Text = serviceObj.Id.ToString();
     cmbType.SelectedValue = serviceObj.Type;
     txtName.Text = serviceObj.Name;
     txtCost.Text = serviceObj.Cost.ToString();
 }