예제 #1
0
 void dataGridViewClients_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex == -1)
     {
         return;
     }
     int id = (int)dataGridViewClients.Rows[e.RowIndex].Cells[0].Value;
     FormReturn cu = new FormReturn(id);
     cu.Show();
 }
예제 #2
0
        void dataGridViewClients_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex == -1)
            {
                return;
            }
            int        id = (int)dataGridViewClients.Rows[e.RowIndex].Cells[0].Value;
            FormReturn cu = new FormReturn(id);

            cu.Show();
        }
예제 #3
0
 private void презаписванеToolStripMenuItem_Click(object sender, EventArgs e)
 {
     FormReturn fR = new FormReturn(id);
     fR.Show();
 }
        private void buttonFind_Click(object sender, EventArgs e)
        {
            LibraryEntities1 context = new LibraryEntities1();
            if (radioButtonID.Checked)
            {
                if (textBoxFind.Text != "")
                {
                    int find = int.Parse(textBoxFind.Text);
                    Client cl = context.Clients.FirstOrDefault(
                         p => p.ClientID == find);
                    if (cl != null)
                    {
                        FormReturn fR = new FormReturn(cl.ClientID);
                        fR.Show();
                        this.Close();
                    }
                    else MessageBox.Show("Няма читател с този читателски номер!");
                }
                else MessageBox.Show("Грешка!Няма въведени данни.");

            }
            else
            {
                if (textBoxFind.Text == "")
                {
                    MessageBox.Show("Грешка!Няма въведени данни.");
                }
                else
                {
                    string egn = textBoxFind.Text;
                    decimal idValue;
                    int[] digits = null;

                    bool flag = true;

                    if (!string.IsNullOrEmpty(egn))
                    {
                        if (decimal.TryParse(egn, out idValue))
                        {
                            digits = (from d in egn.ToCharArray()
                                      select Convert.ToInt32(d.ToString())).ToArray();
                            if (digits.Length != 10 || !ValidateEGN(egn, digits))
                                flag = false;
                        }
                        else
                            flag = false;
                    }

                    if (!flag)
                    {
                        MessageBox.Show("Грешно ЕГН!!!");
                        textBoxFind.Clear();
                        textBoxFind.Focus();

                    }
                    else
                    {
                        Client cl = context.Clients.FirstOrDefault(
                        p => p.EGN == egn);
                        FormReturn fR = new FormReturn(cl.ClientID);
                        fR.Show();
                        this.Close();
                    }
            }
             }
        }
예제 #5
0
        private void buttonFind_Click(object sender, EventArgs e)
        {
            LibraryEntities1 context = new LibraryEntities1();

            if (radioButtonID.Checked)
            {
                if (textBoxFind.Text != "")
                {
                    int    find = int.Parse(textBoxFind.Text);
                    Client cl   = context.Clients.FirstOrDefault(
                        p => p.ClientID == find);
                    if (cl != null)
                    {
                        FormReturn fR = new FormReturn(cl.ClientID);
                        fR.Show();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Няма читател с този читателски номер!");
                    }
                }
                else
                {
                    MessageBox.Show("Грешка!Няма въведени данни.");
                }
            }
            else
            {
                if (textBoxFind.Text == "")
                {
                    MessageBox.Show("Грешка!Няма въведени данни.");
                }
                else
                {
                    string  egn = textBoxFind.Text;
                    decimal idValue;
                    int[]   digits = null;

                    bool flag = true;

                    if (!string.IsNullOrEmpty(egn))
                    {
                        if (decimal.TryParse(egn, out idValue))
                        {
                            digits = (from d in egn.ToCharArray()
                                      select Convert.ToInt32(d.ToString())).ToArray();
                            if (digits.Length != 10 || !ValidateEGN(egn, digits))
                            {
                                flag = false;
                            }
                        }
                        else
                        {
                            flag = false;
                        }
                    }

                    if (!flag)
                    {
                        MessageBox.Show("Грешно ЕГН!!!");
                        textBoxFind.Clear();
                        textBoxFind.Focus();
                    }
                    else
                    {
                        Client cl = context.Clients.FirstOrDefault(
                            p => p.EGN == egn);
                        FormReturn fR = new FormReturn(cl.ClientID);
                        fR.Show();
                        this.Close();
                    }
                }
            }
        }