Exemplo n.º 1
0
        void Deductions()
        {
            if (comboBoxSupply.SelectedItem != null && comboBoxDemand.SelectedItem != null)
            {
                SupplySet supply = Program.wftDb.SupplySet.Find(Convert.ToInt32(comboBoxSupply.SelectedItem.ToString().Split('.')[0]));
                DemandSet demand = Program.wftDb.DemandSet.Find(Convert.ToInt32(comboBoxDemand.SelectedItem.ToString().Split('.')[0]));
                double    customerCompanyDeductions = supply.Price * 0.03;
                textBoxCustomerCompanyDeduction.Text = customerCompanyDeductions.ToString("0.00");

                if (demand.иелтор.DealShare != null)
                {
                    double agentCustomerDeductions = customerCompanyDeductions * Convert.ToDouble(demand.иелтор.DealShare) / 100.00;
                    textBoxAgentCustomerDeduction.Text = agentCustomerDeductions.ToString("0.00");
                }
                else
                {
                    double agentCustomerDeductions = customerCompanyDeductions * 0.45;
                    textBoxAgentCustomerDeduction.Text = agentCustomerDeductions.ToString("0.00");
                }
            }
            else
            {
                textBoxCustomerCompanyDeduction.Text = "";
                textBoxAgentCustomerDeduction.Text   = "";
            }
            if (comboBoxSupply.SelectedItem != null)
            {
                SupplySet supply = Program.wftDb.SupplySet.Find(Convert.ToInt32(comboBoxSupply.SelectedItem.ToString().Split('.')[0]));
                double    sallerCompanyDeductions;
                if (supply.Недвижимость.Type == 0)
                {
                    sallerCompanyDeductions            = 36000 + supply.Price * 0.01;
                    textBoxSallerCompanyDeduction.Text = sallerCompanyDeductions.ToString("0.00");
                }
                else if (supply.Недвижимость.Type == 1)
                {
                    sallerCompanyDeductions            = 30000 + supply.Price * 0.01;
                    textBoxSallerCompanyDeduction.Text = sallerCompanyDeductions.ToString("0.00");
                }
                else
                {
                    sallerCompanyDeductions            = 30000 + supply.Price * 0.02;
                    textBoxSallerCompanyDeduction.Text = sallerCompanyDeductions.ToString("0.00");
                }
                if (supply.иелтор.DealShare != null)
                {
                    double agentSallerDeductions = sallerCompanyDeductions * 0.45;
                    textBoxAgentSallerDeduction.Text = agentSallerDeductions.ToString("0.00");
                }
                else
                {
                    textBoxSallerCompanyDeduction.Text   = "";
                    textBoxAgentSallerDeduction.Text     = "";
                    textBoxCustomerCompanyDeduction.Text = "";
                    textBoxAgentCustomerDeduction.Text   = "";
                }
            }
        }
Exemplo n.º 2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewSupply.SelectedItems.Count == 1)
     {
         SupplySet supply = listViewSupply.SelectedItems[0].Tag as SupplySet;
         supply.IdAgent      = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]);
         supply.IdClient     = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]);
         supply.IdRealEstate = Convert.ToInt32(comboBoxRealEstate.SelectedItem.ToString().Split('.')[0]);
         supply.Price        = Convert.ToInt64(textBoxPrice.Text);
         Program.wftDb.SaveChanges();
         ShowSupplySet();
     }
 }
Exemplo n.º 3
0
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     if (comboBoxAgent.SelectedItem != null && comboBoxClient.SelectedItem != null && comboBoxRealEstate.SelectedItem != null && textBoxPrice.Text != "")
     {
         SupplySet supply = new SupplySet();
         supply.IdAgent      = Convert.ToInt32(comboBoxAgent.SelectedItem.ToString().Split('.')[0]);
         supply.IdClient     = Convert.ToInt32(comboBoxClient.SelectedItem.ToString().Split('.')[0]);
         supply.IdRealEstate = Convert.ToInt32(comboBoxRealEstate.SelectedItem.ToString().Split('.')[0]);
         supply.Price        = Convert.ToInt64(textBoxPrice.Text);
         Program.wftDb.SupplySet.Add(supply);
         Program.wftDb.SaveChanges();
         ShowSupplySet();
     }
     else
     {
         MessageBox.Show("Данные не выбраны", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 4
0
 private void listViewSupply_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewSupply.SelectedItems.Count == 1)
     {
         SupplySet supply = listViewSupply.SelectedItems[0].Tag as SupplySet;
         comboBoxAgent.SelectedIndex      = comboBoxAgent.FindString(supply.IdAgent.ToString());
         comboBoxClient.SelectedIndex     = comboBoxClient.FindString(supply.IdClient.ToString());
         comboBoxRealEstate.SelectedIndex = comboBoxRealEstate.FindString(supply.IdRealEstate.ToString());
         textBoxPrice.Text = supply.Price.ToString();
     }
     else
     {
         comboBoxAgent.SelectedItem      = null;
         comboBoxClient.SelectedItem     = null;
         comboBoxRealEstate.SelectedItem = null;
         textBoxPrice.Text = "";
     }
 }
Exemplo n.º 5
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewSupply.SelectedItems.Count == 1)
         {
             SupplySet supply = listViewSupply.SelectedItems[0].Tag as SupplySet;
             Program.wftDb.SupplySet.Remove(supply);
             Program.wftDb.SaveChanges();
         }
         comboBoxAgent.SelectedItem      = null;
         comboBoxClient.SelectedItem     = null;
         comboBoxRealEstate.SelectedItem = null;
         textBoxPrice.Text = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }