private void btnSave_Click(object sender, EventArgs e)
        {
            clsClient client = new clsClient();

            client.Name        = txtName.Text;
            client.PhoneNumber = txtPhone.Text;
            client.EMail       = txtEmail.Text;
            client.Status      = cboStatus.Text;
            client.RefHouse    = Convert.ToInt32(cboRefHouse.Text);

            if (Addmode)
            {
                if (admin.Add_New_Client(client))
                {
                    MessageBox.Show("New Client : " + client.Name + " is successfully added", "New Client Added");
                }
                else
                {
                    MessageBox.Show("The Client " + client.Name + " is not added.", "Try Again");
                }
                admin.Refresh_Database();
            }
            else
            {
                client.RefClient = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value;

                if (admin.Edit_Client(client))
                {
                    MessageBox.Show("Client ID " + client.RefHouse + " is successfully modified", "Client Modified");
                }
                else
                {
                    MessageBox.Show("Client ID : " + client.RefHouse + " is not modified.", "Try Again");
                }
            }
            if (permission == 2)
            {
                List <clsClient> temp = new List <clsClient>();
                temp.Add(agent.Searched_Cleint_For_This_Agent(refagent));
                gridAll.DataSource = temp;
            }
            else
            {
                gridAll.DataSource = admin.All_Client();
            }

            ButtonControl(true, true, false, false, true, false);
        }
Ejemplo n.º 2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do You really want to delete this Sales Record?", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                int refsales = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value;

                if (admin.Delete_Sales(refsales))
                {
                    MessageBox.Show("Sales Record ID" + refsales + " is successfully Deleted", "Sales Deleted");
                }
                else
                {
                    MessageBox.Show("Sales Record ID " + refsales + " is not deleted.", "Try Again");
                }
            }
            admin.Refresh_Database();
            if (permission != 2)
            {
                gridAll.DataSource = admin.All_Sales();
            }
            else
            {
                gridAll.DataSource = admin.Search_Sales_Belong_To_RefAgent(RefAgent);
            }
            ButtonControl(true, true, false, false, true, false);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            clsAdmin admin = new clsAdmin();
            clsHouse house = new clsHouse();

            house.Address = txtAddress.Text;
            house.Area    = Convert.ToInt32(txtArea.Text);
            house.Price   = Convert.ToDecimal(txtPrice.Text);
            house.Floor   = Convert.ToInt32(txtFloor.Text);
            house.NumRoom = Convert.ToInt32(txtRoom.Text);
            house.NumBath = Convert.ToInt32(txtBath.Text);
            if (cboAccess.SelectedItem.ToString() == "Yes")
            {
                house.Accessible = true;
            }
            else
            {
                house.Accessible = false;
            }
            house.Status = cboStatus.Text;

            if (Addmode)
            {
                if (admin.Add_New_House(house))
                {
                    MessageBox.Show("New House on the Address : " + house.Address + " is successfully added", "New House Added");
                }
                else
                {
                    MessageBox.Show("The house of the Address " + house.Address + " is not added.", "Try Again");
                }
                admin.Refresh_Database();
            }
            else
            {
                house.RefHouse = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value;

                if (admin.Edit_House(house))
                {
                    MessageBox.Show("House ID " + house.RefHouse + " is successfully modified", "House Modified");
                }
                else
                {
                    MessageBox.Show("House ID : " + house.RefHouse + " is not modified.", "Try Again");
                }
            }
            if (permission != 2)
            {
                gridAll.DataSource = admin.Search_All_Houses();
            }
            else
            {
                gridAll.DataSource = current.Searched_House_Belong_to_Current_Agent(RefAgent);
            }

            ButtonControl(true, true, false, false, true, false);
        }
 private void frmSearchHouse_Load(object sender, EventArgs e)
 {
     houselist = new List <clsHouse>();
     admin.Refresh_Database();
     houselist          = admin.Search_All_Houses();
     gridAll.DataSource = houselist;
     string[] rooms = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11" };
     cboNumRoom.DataSource        = rooms;
     cboNumRoomCombile.DataSource = rooms;
 }
 private void frmSearchAgent_Load(object sender, EventArgs e)
 {
     admin = new clsAdmin();
     admin.Refresh_Database();
     agent_list         = new List <clsAgent>();
     agent_list         = admin.Search_All_Agents();
     gridAll.DataSource = agent_list;
     // fill cboRefClient
     cboRefClient.DisplayMember = "RefClient";
     cboRefClient.DataSource    = admin.All_Client();
 }
Ejemplo n.º 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            clsAdmin admin = new clsAdmin();
            clsSales sales = new clsSales();

            sales.RefAgent    = Convert.ToInt32(cboAgent.SelectedValue);
            sales.RefClient   = Convert.ToInt32(cboClient.SelectedValue);
            sales.RefHouse    = Convert.ToInt32(cboHouse.SelectedValue);
            sales.Description = txtDescription.Text;
            sales.SalesDate   = DateTime.Parse(DateSales.Text);

            if (Addmode)
            {
                if (admin.Add_Sales(sales))
                {
                    MessageBox.Show("New Sales Record is successfully added", "New Sales Added");
                }
                else
                {
                    MessageBox.Show("The Sales Record is not added.", "Try Again");
                }
                admin.Refresh_Database();
            }
            else
            {
                sales.RefSales = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value;

                if (admin.Edit_Sales(sales))
                {
                    MessageBox.Show("New Sales Record ID " + sales.RefSales + " is successfully modified", "Sales Modified");
                }
                else
                {
                    MessageBox.Show("The Sales Record " + sales.RefSales + " is not modified.", "Try Again");
                }
            }
            if (permission != 2)
            {
                gridAll.DataSource = admin.All_Sales();
            }
            else
            {
                gridAll.DataSource = admin.Search_Sales_Belong_To_RefAgent(RefAgent);
            }

            ButtonControl(true, true, false, false, true, false);
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Do You really want to delete this House?", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
            {
                int refhouse = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value;

                if (admin.Delete_House(refhouse))
                {
                    MessageBox.Show("House ID" + refhouse + " is successfully Deleted", "House Deleted");
                }
                else
                {
                    MessageBox.Show("House ID " + refhouse + " is not deleted.", "Try Again");
                }
            }
            admin.Refresh_Database();
            gridAll.DataSource = admin.Search_All_Houses();
            ButtonControl(true, true, false, false, true, false);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            clsAdmin adminagent = new clsAdmin();
            clsAgent temp       = new clsAgent();

            temp.UserID      = txtID.Text.Trim();
            temp.Name        = txtName.Text.Trim();
            temp.PhoneNumber = txtPhone.Text.Trim();
            temp.SalesPoint  = Convert.ToInt32(txtSalesPoint.Text);
            temp.RefClient   = Convert.ToInt32(txtClient.Text);
            if (Addmode)
            {
                if (adminagent.Add_New_Agent(temp))
                {
                    MessageBox.Show("New Agent " + temp.Name + " is successfully added", "New Agent");
                }
                else
                {
                    MessageBox.Show("Agent " + temp.Name + " is not added.", "Try Again");
                }
                admin.Refresh_Database();
            }
            else
            {
                temp.RefAgent = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value;
                if (adminagent.Edit_Agent(temp))
                {
                    MessageBox.Show("Agent " + temp.Name + " is successfully modified", "Agent Modified");
                }
                else
                {
                    MessageBox.Show("Agent " + temp.Name + " is not edited.", "Try Again");
                }
            }
            gridAll.DataSource = admin.Search_All_Agents();
            ButtonControl(true, true, false, false, true, false);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            clsAdmin temp = new clsAdmin();

            temp.UserID      = txtID.Text.Trim();
            temp.Name        = txtName.Text.Trim();
            temp.PhoneNumber = txtPhone.Text.Trim();

            if (Addmode)
            {
                if (temp.Add_New_Admin(temp))
                {
                    MessageBox.Show("New Administrator " + temp.Name + " is successfully added", "New Admin");
                }
                else
                {
                    MessageBox.Show("Administrator " + temp.Name + " is not added.", "Try Again");
                }
                admin.Refresh_Database();
            }

            else
            {
                temp.RefAdmin = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value;
                if (temp.Edit_Admin(temp))
                {
                    MessageBox.Show("Administrator " + temp.Name + " is successfully modified", "Admin Modified");
                }
                else
                {
                    MessageBox.Show("Administrator " + temp.Name + " is not edited.", "Try Again");
                }
            }
            gridAll.DataSource = admin.Search_All_Admins();
            ButtonControl(true, true, false, false, true, false);
        }