Пример #1
0
        public static void ResetAllControls(this ControlCollection controls)
        {
            foreach (Control control in controls)
            {
                if (control is Guna2TextBox)
                {
                    Guna2TextBox textBox = (Guna2TextBox)control;
                    textBox.Text = null;
                }

                if (control is Guna2ComboBox)
                {
                    Guna2ComboBox comboBox = (Guna2ComboBox)control;
                    if (comboBox.Items.Count > 0)
                    {
                        comboBox.SelectedIndex = 0;
                    }
                }

                if (control is Guna2CheckBox)
                {
                    Guna2CheckBox checkBox = (Guna2CheckBox)control;
                    checkBox.Checked = false;
                }
            }
        }
        private void add_module_btn_Click(object sender, EventArgs e)
        {
            int           count      = flowLayoutPanel1.Controls.OfType <Guna2TextBox>().ToList().Count;
            Guna2ComboBox select_mod = new Guna2ComboBox();

            select_mod.Size                = new Size(328, 24);
            select_mod.DrawMode            = DrawMode.Normal;
            select_mod.Name                = "combo_" + (count + 1);
            select_sem_combo.DropDownStyle = ComboBoxStyle.DropDownList;
            select_sem_combo.Font          = new Font("Segoe UI", 9);
            foreach (DataRow dr in dt.Rows)
            {
                select_mod.Items.Add(dr["lecture_module"].ToString());
            }
            //  select_mod.SelectedIndex = 0;

            Guna2ImageButton delete = new Guna2ImageButton();

            delete.Size                 = new Size(24, 24);
            delete.BackColor            = Color.White;
            delete.Name                 = "btnDelete_" + (count + 1);
            delete.Image                = Resources.delete_red;
            delete.HoverState.ImageSize = new Size(22, 22);
            delete.Click               += new EventHandler(deleteBtn_Click);



            flowLayoutPanel1.Controls.Add(delete);
            flowLayoutPanel1.Controls.Add(select_mod);
        }
        private void OnChangeCliente(object sender, EventArgs e)
        {
            Guna2ComboBox comboBox = (Guna2ComboBox)sender;

            if (comboBox.SelectedValue != null)
            {
                dynamic Selected = ListaClientes.Find(find => (int)find.Id == (int)comboBox.SelectedValue);

                if (comboBox.Name == "combRemetente")
                {
                    textSaidaCidade.Text      = Selected.Cidade;
                    combSaidaUF.SelectedValue = Selected.UF;
                }
                else if (comboBox.Name == "combDestinatario")
                {
                    textDestinoCidade.Text      = Selected.Cidade;
                    combDestinoUF.SelectedValue = Selected.UF;
                }
            }
            else
            {
                textSaidaCidade.ResetText();
                combSaidaUF.SelectedValue = -1;

                textDestinoCidade.ResetText();
                combDestinoUF.SelectedValue = -1;
            }
        }
Пример #4
0
        private string GetComboBoxValue(Guna2ComboBox comboBox)
        {
            if (comboBox.Text?.IndexOf("--") == -1)
            {
                return(comboBox.Text);
            }

            return(null);
        }
        public void onEdit()
        {
            databaseConnection.Open();
            MySqlCommand     getmoduleId = new MySqlCommand("Select module_id from lecturer_module_tb where lecturer_id = '" + getID + "'", databaseConnection);
            MySqlDataAdapter sda         = new MySqlDataAdapter(getmoduleId);

            sda.Fill(modIdTable);
            //  DataTable dts = new DataTable();

            foreach (DataRow dr in modIdTable.Rows)
            {
                MySqlCommand getModule  = new MySqlCommand("Select lecture_module from module_info where id='" + dr["module_id"] + "'", databaseConnection);
                string       modulename = getModule.ExecuteScalar().ToString();

                int           count      = flowLayoutPanel1.Controls.OfType <Guna2TextBox>().ToList().Count;
                Guna2ComboBox select_mod = new Guna2ComboBox();

                select_mod.Size                = new Size(328, 24);
                select_mod.DrawMode            = DrawMode.Normal;
                select_mod.Name                = "combo_" + (count + 1);
                select_sem_combo.DropDownStyle = ComboBoxStyle.DropDownList;
                select_sem_combo.Font          = new Font("Segoe UI", 9);

                loadForEdit();

                foreach (DataRow drt in editDT.Rows)
                {
                    select_mod.Items.Add(drt["lecture_module"].ToString());
                }
                select_mod.SelectedItem = modulename;

                Guna2ImageButton delete = new Guna2ImageButton();
                delete.Size                 = new Size(24, 24);
                delete.BackColor            = Color.White;
                delete.Name                 = "btnDelete_" + (count + 1);
                delete.Image                = Resources.delete_red;
                delete.HoverState.ImageSize = new Size(22, 22);
                delete.Click               += new EventHandler(deleteBtn_Click);



                flowLayoutPanel1.Controls.Add(delete);
                flowLayoutPanel1.Controls.Add(select_mod);
            }
            databaseConnection.Close();
        }
 private void InitializarecomboBoxSchimbareOrdonare(Form form)
 {
     string[] texte = new string[] { "Relevanță", "Preț crescător", "Preț descrescător" };
     comboBoxSchimbareOrdonare = new Guna2ComboBox
     {
         Location     = new Point(380, 96),
         Width        = 175,
         Height       = 24,
         BorderRadius = 10,
         ItemHeight   = 18,
         FillColor    = Color.FromArgb(235, 233, 233),
         BorderColor  = Color.FromArgb(217, 221, 226),
         Cursor       = Cursors.Hand
     };
     comboBoxSchimbareOrdonare.Items.AddRange(texte);
     comboBoxSchimbareOrdonare.SelectedIndex         = VariabileGlobale.optiuneSortareProduse;
     comboBoxSchimbareOrdonare.SelectedIndexChanged += (sender, EventArgs) => { SchimbareIndex(sender, form, tabelGeneralProduse); };
 }
Пример #7
0
        private void createComboBox(PropertyInfo property, Label label, int x, int y, int selectedIndex)
        {
            Guna2ComboBox combo = new Guna2ComboBox()
            {
                Location = new System.Drawing.Point(x += 120, y),
                Tag      = property,
            };

            if (property.Name.Contains("gioiTinh"))
            {
                combo.Items.AddRange(listGioiTinh.ToArray());
            }

            else if (property.Name.Contains("diaChi"))
            {
                combo.Items.AddRange(listQueQuan.ToArray());
            }

            else if (property.Name.Contains("soPhong"))
            {
                if (y == 60)
                {
                    combo.Items.AddRange(listPhong.ToArray());

                    combo.SelectedIndexChanged += new EventHandler(setPhongEdit);
                }
                else
                {
                    combo.Items.AddRange(listPhongTrong.ToArray());
                }
            }

            else if (property.Name.Contains("maNV"))
            {
                combo.Items.AddRange(listMaNV.ToArray());

                combo.SelectedIndexChanged += new EventHandler(setNhanVienEdit);
            }

            else if (property.Name.Contains("maCV"))
            {
                combo.Items.AddRange(listMaCV.ToArray());
            }

            else if (property.Name.Contains("maLoai"))
            {
                combo.Items.AddRange(listMaPhong.ToArray());
            }

            else if (property.Name.Contains("maHD"))
            {
                combo.Items.AddRange(listMaHD.ToArray());

                combo.SelectedIndexChanged += new EventHandler(setDatPhongEdit);
            }

            combo.SelectedIndex = selectedIndex;

            formGroupBox.Controls.Add(label);
            formGroupBox.Controls.Add(combo);
        }