예제 #1
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
            AllAdvisors frm = new AllAdvisors();

            frm.Show();
        }
예제 #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (comboBox1.Text == "")
            {
                lblerror.Text = "Select Designation";
                lblerror.Show();
            }
            if (lblsalary.Text == "" && lbllastname.Text == "" && lblerror.Text == "" && lblFirstname.Text == "" && lblemail.Text == "" && lbldob.Text == "" && lblcontact.Text == "" && lblgender.Text == "")
            {
                try
                {
                    string  k  = "Select Count(Id) from  Person where FirstName ='" + txtfirstname.Text + "' and LastName = '" + txtlastname.Text + "' and Contact = '" + txtcontact.Text + "'and Id != '" + Convert.ToInt32(dataGridView1.CurrentRow.Cells["Id"].Value) + "'";
                    Advisor ad = new Advisor();
                    bool    ry = ad.uniqueperson(txtfirstname.Text, txtlastname.Text, txtcontact.Text, k);
                    if (ry == false)
                    {
                        lblerror.Text    = "This Person has already been added in Record";
                        lblerror.Visible = true;
                    }
                    else if (ry == true)
                    {
                        int id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["Id"].Value);
                        int y  = dbConnection.getInstance().getScalerData("Select Id from Lookup where Value = '" + comboBox1.Text + "'");
                        int yy = dbConnection.getInstance().getScalerData("Select Id from Lookup where Value = '" + comboBox2.Text + "'");
                        dbConnection.getInstance().exectuteQuery("Update Advisor SET Designation = '" + y + "', Salary = '" + txtsalary.Text + "'  where Id = '" + id + "' ");
                        dbConnection.getInstance().exectuteQuery("Update Person SET FirstName = '" + txtfirstname.Text + "', LastName = '" + txtlastname.Text + "',Contact = '" + txtcontact.Text + "',Email = '" + txtemail.Text + "',DateOfBirth = '" + dateTimePicker1.Value + "',Gender = '" + yy + "'  where Id = '" + id + "' ");
                        MessageBox.Show("Updated");
                        this.Hide();
                        AllAdvisors frm = new AllAdvisors();
                        frm.Show();
                    }
                }

                catch (Exception et)
                {
                    throw (et);
                }
            }
        }