Пример #1
0
        private void bSave_Click(object sender, EventArgs e)
        {
            PersianDateFormatter pdf = new PersianDateFormatter();
            AppointmentRepository appRepo = new AppointmentRepository();
            ContractRepository cRepo = new ContractRepository();
            Contract contract = cRepo.getContract(contractId);

            Appointment app = new Appointment();
            string description = "";
            int value = 0;
            foreach (var item in radCheckedDropDownList1.CheckedItems)
            {
                description += item.DisplayValue.ToString() + "/";
                value += Convert.ToInt32(item.Value);
            }
            contract.ContractPayment += value;
            cRepo.updateContract(contract);
            app.ContractId = contractId;
            description = description.Remove(description.Length - 1);
            app.Description = description;

            app.AppointmentDate = pdf.convert(tDate.Text);
            TimeSpan ts = new TimeSpan(tTime.Value.TimeOfDay.Hours, tTime.Value.TimeOfDay.Minutes, 0);
            app.AppointmentTime = ts;
            appRepo.addAppointment(app);
        }