private void Back_Click(object sender, EventArgs e)
        {
            this.Hide();
            ViewAgents viewagents_page = new ViewAgents();

            viewagents_page.Show();
        }
Пример #2
0
        private void Backbutton_Click(object sender, EventArgs e)
        {
            this.Hide();
            ViewAgents Home_page = new ViewAgents();

            Home_page.Show();
        }
        private void button5_Click(object sender, EventArgs e)
        {
            this.Hide();
            ViewAgents Agents_page = new ViewAgents();

            Agents_page.Show();
        }
Пример #4
0
        public void updateAgent(string AgentID, string Fname, string Lname, string Address, string city, string state, string zip, string phone,
                                string Email, DateTimePicker DOB, DateTimePicker StartDate, string Status)
        {
            {
                SqlCommand updateAgent = SqlConnectionCommand.getCommand();
                updateAgent.CommandText = "USE SRDB UPDATE AGENT SET " +
                                          "First_name = @strFirst_name, Last_name =  @strLast_name, Street = @strStreet, City = @strCity, State =  @strState, Zip = @strZip, A_phone = @strA_phone," +
                                          " A_email =  @strA_email, Start_Date = @strDate, DOB = @strDOB, Status = @strstatus WHERE Agent_id = @strAgent_id";

                //addproperty.Parameters.AddWithValue("@strproperty", comboboxtype.SelectedText);
                updateAgent.Parameters.AddWithValue("@strAgent_id", AgentID);
                updateAgent.Parameters.AddWithValue("@strFirst_name", Fname);
                updateAgent.Parameters.AddWithValue("@strLast_name", Lname);
                updateAgent.Parameters.AddWithValue("@strStreet", Address);
                updateAgent.Parameters.AddWithValue("@strCity", city);
                updateAgent.Parameters.AddWithValue("@strState", state);
                updateAgent.Parameters.AddWithValue("@strZip", zip);
                updateAgent.Parameters.AddWithValue("@strA_phone", phone);
                updateAgent.Parameters.AddWithValue("@strA_email", Email);
                updateAgent.Parameters.AddWithValue("@strDate", StartDate.Value);
                updateAgent.Parameters.AddWithValue("@strDOB", DOB.Value);
                updateAgent.Parameters.AddWithValue("@strstatus", Status);


                //  MessageBox.Show(updateAgent.CommandText.ToString());
                try
                {
                    updateAgent.ExecuteNonQuery();
                    MessageBox.Show("Successfully Updated" + " " + AgentID + " " + Fname,
                                    "Added as an Agent", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    this.Hide();
                    ViewAgents view_agent = new ViewAgents();
                    view_agent.Show();
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    // MessageBox.Show(" Please Enter a Different Agent Number ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    // MessageBox.Show("Faild to Add a property: " + ex.Message, "Add Property Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }    //end
            }
        }
Пример #5
0
        public void SearchAgent(string AgentID, string Fname, string Lname, string Address, string city, string state, string zip, string phone,
                                string Email, DateTimePicker DOB, DateTimePicker StartDate, string status)
        {
            {
                SqlCommand SearchAgent = SqlConnectionCommand.getCommand();
                SearchAgent.CommandText = "USE SRDB INSERT INTO AGENT Values" +
                                          "(@strAgent_id, @strFirst_name, @strLast_name, @strStreet, @strCity, @strState, @strZip, @strA_phone," +
                                          " @strA_email, @strDate, @strDOB, @strstatus)";

                //addproperty.Parameters.AddWithValue("@strproperty", comboboxtype.SelectedText);
                SearchAgent.Parameters.AddWithValue("@strstatus", status);
                SearchAgent.Parameters.AddWithValue("@strAgent_id", AgentID);
                SearchAgent.Parameters.AddWithValue("@strFirst_name", Fname);
                SearchAgent.Parameters.AddWithValue("@strLast_name", Lname);
                SearchAgent.Parameters.AddWithValue("@strStreet", Address);
                SearchAgent.Parameters.AddWithValue("@strCity", city);
                SearchAgent.Parameters.AddWithValue("@strState", state);
                SearchAgent.Parameters.AddWithValue("@strZip", zip);
                SearchAgent.Parameters.AddWithValue("@strA_phone", phone);
                SearchAgent.Parameters.AddWithValue("@strA_email", Email);
                SearchAgent.Parameters.AddWithValue("@strDate", StartDate.Value);
                SearchAgent.Parameters.AddWithValue("@strDOB", DOB.Value);

                //   MessageBox.Show(SearchAgent.CommandText.ToString());
                try
                {
                    SearchAgent.ExecuteNonQuery();
                    MessageBox.Show("Successfully added" + " " + AgentID + " " + Fname,
                                    "Added as an Agent", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    this.Hide();
                    ViewAgents Home_page = new ViewAgents();
                    Home_page.Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    // MessageBox.Show(" Please Enter a Different Agent Number ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    // MessageBox.Show("Faild to Add a property: " + ex.Message, "Add Property Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }//end
            }
        }