Пример #1
0
 private void AddAppointment_Load(object sender, EventArgs e)
 {
     DefaultSettingsRepository repo = new DefaultSettingsRepository();
     radCheckedDropDownList1.DataSource = repo.GetSetingsByType("price").ToList();
     radCheckedDropDownList1.DisplayMember = "Name";
     radCheckedDropDownList1.ValueMember = "Value";
     bSave.DialogResult = DialogResult.OK;
     bCancel.DialogResult = DialogResult.Cancel;
     PersianDateFormatter pdf = new PersianDateFormatter();
     tTime.Format = DateTimePickerFormat.Custom;
     tTime.CustomFormat = "HH:mm";
     tTime.ShowUpDown = true;
     tDate.Text = pdf.getDateString(DateTime.Now);
 }
        private void radGridView2_UserDeletingRow(object sender, Telerik.WinControls.UI.GridViewRowCancelEventArgs e)
        {
            DialogResult result = MessageBox.Show("آیا از عملیات حذف مطمئن هستید؟", "هشدار", MessageBoxButtons.YesNo);
            if (result == DialogResult.No)
            {
                e.Cancel = true;
            }
            else
            {
                DefaultSettingsRepository repo = new DefaultSettingsRepository();
                string name = radGridView2.SelectedRows[0].Cells[1].Value.ToString();
                repo.delete(name);
                DefaultSettingsRepository repo2 = new DefaultSettingsRepository();
                radGridView2.DataSource = repo2.GetSetingsByType("price").ToList();

            }
        }
        private void bSave_Click(object sender, EventArgs e)
        {
            DefaultSettingsRepository repo = new DefaultSettingsRepository();
            DefaultSetting ds = new DefaultSetting();
            ds.Name = tMahalDarman.Text;
            ds.Value = tPrice.Text;
            ds.Type = "price";

            DefaultSetting dsDB = repo.GetSetting(tMahalDarman.Text);
            if (dsDB == null)
            {
                repo.AddSettings(ds);
            }
            else
            {
                dsDB.Name = tMahalDarman.Text;
                dsDB.Value = tPrice.Text;
                dsDB.Type = "price";
                repo.UpdateSetting(dsDB);
            }
            DefaultSettingsRepository repo2 = new DefaultSettingsRepository();
            radGridView2.DataSource = repo2.GetSetingsByType("price").ToList();
        }
 private void DefaultSettingsForm_Load(object sender, EventArgs e)
 {
     DefaultSettingsRepository repo2 = new DefaultSettingsRepository();
     radGridView2.DataSource = repo2.GetSetingsByType("price").ToList();
     ((GridTableElement)radGridView2.TableElement).AlternatingRowColor = Color.FromArgb(215, 234, 124);
     radGridView2.TableElement.RowHeight = 35;
 }
        private void EditAppointmentForm_Load(object sender, EventArgs e)
        {
            DefaultSettingsRepository dRepo = new DefaultSettingsRepository();
            radCheckedDropDownList1.DataSource = dRepo.GetSetingsByType("price").ToList();
            radCheckedDropDownList1.DisplayMember = "Name";
            radCheckedDropDownList1.ValueMember = "Value";

            PersianDateFormatter pdf = new PersianDateFormatter();
            tTime.Format = DateTimePickerFormat.Custom;
            tTime.CustomFormat = "HH:mm";
            tTime.ShowUpDown = true;
            bSave.DialogResult = DialogResult.OK;
            bCancel.DialogResult = DialogResult.Cancel;
            AppointmentRepository repo = new AppointmentRepository();
            Appointment appo = repo.getAppointment(appointmentId);
            DateTime dt = new DateTime(2000, 1, 1, 0, 0, 0).Add(appo.AppointmentTime.Value);
            tTime.Value = dt;
            tDate.Text = pdf.convert(appo.AppointmentDate.Value);
            string[] parts = appo.Description.Split('/');

            foreach (RadCheckedListDataItem item in radCheckedDropDownList1.Items)
            {
                if (parts.Contains(item.DisplayValue.ToString()))
                {
                    item.Checked = true;
                    unchangedValue += Convert.ToInt32(item.Value.ToString());
                }
            }
        }