Beispiel #1
0
        private void btnSerch_Click(object sender, EventArgs e)
        {
            Business.Person Personlist = new Business.Person();
            Personlist.Ntiolecode = txtSerch.Text;
            Personlist.FirstName  = txtSerchName.Text;
            if (txtSerch.Text == "" && txtSerchName.Text == "")
            {
                MessageBox.Show("لطفا یکی ار فیلد هارا برای جستجو پر کنید.");
                dataGridView1.AutoGenerateColumns = true;
                dataGridView1.DataSource          = Personlist.Read();
            }
            if (txtSerch.Text != string.Empty)
            {
                Personlist.serch();
                dataGridView1.AutoGenerateColumns = true;
                dataGridView1.DataSource          = Personlist.serch();
            }

            if (txtSerchName.Text != string.Empty)
            {
                Personlist.serchName();
                dataGridView1.AutoGenerateColumns = true;
                dataGridView1.DataSource          = Personlist.serchName();
            }
        }
Beispiel #2
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            UI.frmPerson    insert     = new UI.frmPerson();
            Business.Person Personlist = new Business.Person();

            insert.Show();

            dataGridView1.DataSource = Personlist.Read();


            //ReadFromDatabase();
        }
Beispiel #3
0
        private void btnDelet_Click(object sender, EventArgs e)
        {
            Business.Person Personlist = new Business.Person();
            var             result     = MessageBox.Show("آیا مایل به حذف این کاربر هتسید؟", "هشدار", MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                Personlist.ID = Convert.ToInt32(dataGridView1.CurrentRow.Cells["clmnID"].Value);
                Personlist.Deleat();
                dataGridView1.AutoGenerateColumns = true;

                MessageBox.Show("حذف با موفقیت انجام شد");
                dataGridView1.DataSource = Personlist.Read();
            }
        }
Beispiel #4
0
        private void btnEdit_Click_1(object sender, EventArgs e)
        {
            Business.Person  editperson = new Business.Person();
            UI.frmPersonEdit personEdit = new UI.frmPersonEdit();
            #region setProperties

            personEdit.Name         = dataGridView1.CurrentRow.Cells["clmnFirstName"].Value.ToString();
            personEdit.lastName     = dataGridView1.CurrentRow.Cells["clmnLastname"].Value.ToString();
            personEdit.Tell         = dataGridView1.CurrentRow.Cells["clmnTell"].Value.ToString();
            personEdit.Cell         = dataGridView1.CurrentRow.Cells["clmnCell"].Value.ToString();
            personEdit.NationalCode = dataGridView1.CurrentRow.Cells["clmnNationalCode"].Value.ToString();
            personEdit.ID           = Convert.ToInt32(dataGridView1.CurrentRow.Cells["clmnID"].Value.ToString());
            personEdit.ShowDialog();

            MessageBox.Show("ویرایش با موفقیت انجام شد");

            dataGridView1.DataSource = editperson.Read();
            #endregion
        }
Beispiel #5
0
 private void frmPersonsList_Load(object sender, EventArgs e)
 {
     Business.Person persons = new Business.Person();
     dataGridView1.AutoGenerateColumns = true;
     dataGridView1.DataSource          = persons.Read();
 }