public async Task <IActionResult> Edit(int id, [Bind("Id,Clinic_name,Clinic_address,Clinic_phone")] clinic clinic)
        {
            if (id != clinic.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clinic);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!clinicExists(clinic.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clinic));
        }
        public async Task <IActionResult> Create([Bind("Id,Clinic_name,Clinic_address,Clinic_phone")] clinic clinic)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clinic);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(clinic));
        }
        private void FillOfficeList()
        {
            clinic aClinic = new clinic();

            foreach (DataRow aRow in aClinic.GetAllData("name").Rows)
            {
                aClinic = new clinic();
                aClinic.Load(aRow);

                pnlOffices.Children.Add(GenerateClinicUI(aClinic, user_preferences_clinics.Get(ActiveUser.UserObject.id, aClinic.id)));
            }
        }
        private void FillOfficeList()
        {
            clinic aClinic = new clinic();
            int    incr    = 0;

            foreach (DataRow aRow in aClinic.GetAllData("name").Rows)
            {
                incr    = incr + 30;
                aClinic = new clinic();
                aClinic.Load(aRow);
                var a = GenerateClinicUI(aClinic, user_preferences_clinics.Get(ActiveUser.UserObject.id, aClinic.id), incr);
                pnlOffices.Controls.Add(a);
            }
        }
Exemple #5
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            clinic = await _context.clinic.FirstOrDefaultAsync(m => m.Id == id);

            if (clinic == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemple #6
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            clinic = await _context.clinic.FindAsync(id);

            if (clinic != null)
            {
                _context.clinic.Remove(clinic);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
        private void InitializeClinics()
        {
            clinic cln = new clinic();

            cmbClinic.Items.Clear();
            cmbBasicClinic.Items.Clear();
            cmbClinic.Items.Add("Show All");
            cmbBasicClinic.Items.Add("Show All");

            DataTable dt = cln.Search(cln.SearchSQL + " ORDER BY name");

            foreach (DataRow aClinic in dt.Rows)
            {
                cln = new clinic();
                cln.Load(aClinic);
                cmbClinic.Items.Add(cln);
                cmbBasicClinic.Items.Add(cln);
            }
        }
        private UIElement GenerateClinicUI(clinic c, bool isChecked)
        {
            WrapPanel toReturn = new WrapPanel();

            toReturn.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
            toReturn.ItemHeight          = 30;
            Thickness margin = toReturn.Margin;

            margin.Right    = 6;
            toReturn.Margin = margin;

            Label lbl = new Label();

            lbl.Content                    = c.name;
            lbl.VerticalAlignment          = System.Windows.VerticalAlignment.Center;
            lbl.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Right;
            lbl.FontSize                   = 14;
            lbl.Width = 120;

            CheckBox cb = new CheckBox();

            cb.VerticalAlignment = System.Windows.VerticalAlignment.Center;
            cb.FontSize          = 16;
            cb.IsChecked         = isChecked;
            cb.Tag        = c;
            cb.Checked   += cb_Checked;
            cb.Unchecked += cb_Checked;
            ClinicCheckBoxes.Add(cb);

            toReturn.Children.Add(lbl);
            toReturn.Children.Add(cb);

            /*
             * <WrapPanel HorizontalAlignment="Right" ItemHeight="30" Margin="0, 0, 6, 0">
             *                  <Label Content="New Haven " VerticalAlignment="Center" Visibility="Visible" HorizontalContentAlignment="Right" FontSize="14" Width="120" />
             *                  <CheckBox VerticalAlignment="Center" FontSize="16" IsChecked="True"></CheckBox>
             *              </WrapPanel> */

            return(toReturn);
        }
        private Panel GenerateClinicUI(clinic c, bool isChecked, int incr)
        {
            CheckBox cb = new CheckBox();

            cb.Text                    = c.name;
            cb.AutoSize                = true;
            cb.RightToLeft             = System.Windows.Forms.RightToLeft.Yes;
            cb.Size                    = new System.Drawing.Size(69, 17);
            cb.Location                = new System.Drawing.Point(112, 6);
            cb.UseVisualStyleBackColor = true;
            cb.Tag                = c;
            cb.Checked            = isChecked;
            cb.CheckedChanged    += checkBoxes_CheckedChanged;
            cb.CheckStateChanged += checkBoxes_CheckStateChanged;

            Panel toReturn = new Panel();

            toReturn.Size     = new System.Drawing.Size(188, 26);
            toReturn.Location = new System.Drawing.Point(-5, incr);
            toReturn.Controls.Add(cb);

            return(toReturn);
        }