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); }
private void frmSales_Load(object sender, EventArgs e) { admin = new clsAdmin(); DataTable temp = new DataTable(); // fill cboHouse cboHouse.DisplayMember = "Address"; cboHouse.ValueMember = "RefHouse"; cboHouse.DataSource = admin.HouseListToDataTable(admin.Search_All_Houses()); // fill cboClient cboClient.DisplayMember = "ClientName"; cboClient.ValueMember = "RefClient"; cboClient.DataSource = admin.ClientListToDataTable(admin.All_Client()); // fill cboAgent cboAgent.DisplayMember = "AgentName"; cboAgent.ValueMember = "RefAgent"; cboAgent.DataSource = admin.AgentListToDataTable(admin.Search_All_Agents()); if (permission != 2) { gridAll.DataSource = admin.All_Sales(); } else { gridAll.DataSource = admin.Search_Sales_Belong_To_RefAgent(RefAgent); } gridAll.ReadOnly = true; ButtonControl(true, false, false, false, true, false); }
private void frmClient_Load(object sender, EventArgs e) { agent = new clsAgent(); admin = new clsAdmin(); 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(); } gridAll.ReadOnly = true; ButtonControl(true, false, false, false, true, false); string[] status = { "Seller", "Buyer", "Inactive(Buyer)", "Inactive(Seller)" }; List <string> refhouses = new List <string>(); refhouses.Add("0"); foreach (clsHouse i in admin.Search_All_Houses()) { refhouses.Add(i.RefHouse.ToString()); } cboRefHouse.DataSource = refhouses; cboStatus.DataSource = status; }
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(); }