Beispiel #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Entities db   = new Entities();
                int      MaxP = 0;
                int      Aid  = Convert.ToInt32(ApId.SelectedItem);
                int      Hid  = Convert.ToInt32(HId.SelectedItem);
                int      Lid  = Convert.ToInt32(LId.SelectedItem);
                if (Price.Text != "")
                {
                    MaxP = Convert.ToInt32(Price.Text);
                }

                agent  fo    = db.agents.Where(p => p.FirstName == AId.SelectedItem.ToString()).FirstOrDefault();
                client of    = db.clients.Where(p => p.FirstName == CId.SelectedItem.ToString()).FirstOrDefault();
                var    apnew = new supply();
                apnew.Price       = MaxP;
                apnew.AgentId     = fo.Id;
                apnew.ClientId    = of.Id;
                apnew.ApartmentId = Aid;
                apnew.HouseId     = Hid;
                apnew.LandId      = Lid;
                db.supplies.Add(apnew);
                db.SaveChanges();
            }
            catch
            {
            }
        }
Beispiel #2
0
 private void Create(object sender, RoutedEventArgs e)
 {
     if (FN.Text != "" || MN.Text != "" || LN.Text != "")
     {
         var db       = new Entities();
         var agentAdd = new agent();
         agentAdd.FirstName  = FN.Text;
         agentAdd.MiddleName = MN.Text;
         agentAdd.LastName   = LN.Text;
         agentAdd.DealShare  = DS.Text;
         db.agents.Add(agentAdd);
         db.SaveChanges();
     }
 }
Beispiel #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (Ap.IsChecked == true)
                {
                    int      MaxP = 0;
                    var      MinP = 0;
                    Entities db   = new Entities();
                    if (Maxp.Text != "")
                    {
                        MaxP = Convert.ToInt32(Maxp.Text);
                    }
                    if (Minp.Text != "")
                    {
                        MinP = Convert.ToInt32(Maxp.Text);
                    }

                    agent  fo    = db.agents.Where(p => p.FirstName == AId.SelectedItem.ToString()).FirstOrDefault();
                    client of    = db.clients.Where(p => p.FirstName == CId.SelectedItem.ToString()).FirstOrDefault();
                    var    apnew = new apartment_demands();
                    apnew.MaxArea  = MaxA.Text;
                    apnew.MinArea  = MinA.Text;
                    apnew.MaxFloor = MaxF.Text;
                    apnew.MinFloor = MinF.Text;

                    apnew.MaxPrice       = MaxP;
                    apnew.MinPrice       = MinP;
                    apnew.MaxRooms       = MaxR.Text;
                    apnew.MinRooms       = MinR.Text;
                    apnew.Address_City   = Ac.Text;
                    apnew.Address_House  = Ah.Text;
                    apnew.Address_Number = An.Text;
                    apnew.Address_Street = As.Text;
                    apnew.AgentId        = fo.Id;
                    apnew.ClientId       = of.Id;
                    db.apartment_demands.Add(apnew);
                    db.SaveChanges();
                }
                if (Ho.IsChecked == true)
                {
                    int      MaxP = 0;
                    var      MinP = 0;
                    Entities db   = new Entities();
                    if (Maxp.Text != "")
                    {
                        MaxP = Convert.ToInt32(Maxp.Text);
                    }
                    if (Minp.Text != "")
                    {
                        MinP = Convert.ToInt32(Maxp.Text);
                    }

                    agent  fo    = db.agents.Where(p => p.FirstName == AId.SelectedItem.ToString()).FirstOrDefault();
                    client of    = db.clients.Where(p => p.FirstName == CId.SelectedItem.ToString()).FirstOrDefault();
                    var    apnew = new house_demands();
                    apnew.MaxArea        = MaxA.Text;
                    apnew.MinArea        = MinA.Text;
                    apnew.MaxFloors      = MaxF.Text;
                    apnew.MinFloors      = MinF.Text;
                    apnew.MaxPrice       = MaxP;
                    apnew.MinPrice       = MinP;
                    apnew.MaxRooms       = MaxR.Text;
                    apnew.MinRooms       = MinR.Text;
                    apnew.Address_City   = Ac.Text;
                    apnew.Address_House  = Ah.Text;
                    apnew.Address_Number = An.Text;
                    apnew.Address_Street = As.Text;
                    apnew.AgentId        = fo.Id;
                    apnew.ClientId       = of.Id;
                    db.house_demands.Add(apnew);
                    db.SaveChanges();
                }
                if (La.IsChecked == true)
                {
                    Entities db   = new Entities();
                    int      MaxP = 0;
                    var      MinP = 0;
                    if (Maxp.Text != "")
                    {
                        MaxP = Convert.ToInt32(Maxp.Text);
                    }
                    if (Minp.Text != "")
                    {
                        MinP = Convert.ToInt32(Maxp.Text);
                    }
                    agent  fo    = db.agents.Where(p => p.FirstName == AId.SelectedItem.ToString()).FirstOrDefault();
                    client of    = db.clients.Where(p => p.FirstName == CId.SelectedItem.ToString()).FirstOrDefault();
                    var    apnew = new land_demands();
                    apnew.MaxArea        = MaxA.Text;
                    apnew.MinArea        = MinA.Text;
                    apnew.MaxPrice       = MaxP;
                    apnew.MinPrice       = MinP;
                    apnew.Address_City   = Ac.Text;
                    apnew.Address_House  = Ah.Text;
                    apnew.Address_Number = An.Text;
                    apnew.Address_Street = As.Text;
                    apnew.AgentId        = fo.Id;
                    apnew.ClientId       = of.Id;
                    db.land_demands.Add(apnew);
                    db.SaveChanges();
                }
            }
            catch
            {
            }
        }
Beispiel #4
0
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     try
     {
         if (Ap.IsChecked == true)
         {
             Entities db    = new Entities();
             int      MinP  = Convert.ToInt32(Maxp.Text);
             int      MaxP  = Convert.ToInt32(Maxp.Text);
             agent    fo    = db.agents.Where(p => p.FirstName == AIdU.SelectedItem.ToString()).FirstOrDefault();
             client   of    = db.clients.Where(p => p.FirstName == CIdU.SelectedItem.ToString()).FirstOrDefault();
             var      nub   = Convert.ToInt32(IdU.Text);
             var      apnew = db.apartment_demands.Where(p => p.Id == nub).FirstOrDefault();
             if (MaxAU.Text != "")
             {
                 apnew.MaxArea = MaxAU.Text;
             }
             if (MinAU.Text != "")
             {
                 apnew.MinArea = MinAU.Text;
             }
             if (MaxFU.Text != "")
             {
                 apnew.MaxFloor = MaxFU.Text;
             }
             if (MinFU.Text != "")
             {
                 apnew.MinFloor = MinFU.Text;
             }
             if (MaxPU.Text != "")
             {
                 apnew.MaxPrice = MaxP;
             }
             if (MinPU.Text != "")
             {
                 apnew.MinPrice = MinP;
             }
             if (MaxRU.Text != "")
             {
                 apnew.MaxRooms = MaxRU.Text;
             }
             if (MinRU.Text != "")
             {
                 apnew.MinRooms = MinRU.Text;
             }
             if (AcU.Text != "")
             {
                 apnew.Address_City = AcU.Text;
             }
             if (AhU.Text != "")
             {
                 apnew.Address_House = AhU.Text;
             }
             if (AnU.Text != "")
             {
                 apnew.Address_Number = AnU.Text;
             }
             if (AsU.Text != "")
             {
                 apnew.Address_Street = AsU.Text;
             }
             apnew.AgentId  = fo.Id;
             apnew.ClientId = of.Id;
             db.SaveChanges();
         }
         if (Ho.IsChecked == true)
         {
             Entities db    = new Entities();
             int      MinP  = Convert.ToInt32(Maxp.Text);
             int      MaxP  = Convert.ToInt32(Maxp.Text);
             agent    fo    = db.agents.Where(p => p.FirstName == AIdU.SelectedItem.ToString()).FirstOrDefault();
             client   of    = db.clients.Where(p => p.FirstName == CIdU.SelectedItem.ToString()).FirstOrDefault();
             var      nub   = Convert.ToInt32(IdU.Text);
             var      apnew = db.house_demands.Where(p => p.Id == nub).FirstOrDefault();
             if (MaxAU.Text != "")
             {
                 apnew.MaxArea = MaxAU.Text;
             }
             if (MinAU.Text != "")
             {
                 apnew.MinArea = MinAU.Text;
             }
             if (MaxFU.Text != "")
             {
                 apnew.MaxFloors = MaxFU.Text;
             }
             if (MinFU.Text != "")
             {
                 apnew.MinFloors = MinFU.Text;
             }
             if (MaxPU.Text != "")
             {
                 apnew.MaxPrice = MaxP;
             }
             if (MinPU.Text != "")
             {
                 apnew.MinPrice = MinP;
             }
             if (MaxRU.Text != "")
             {
                 apnew.MaxRooms = MaxRU.Text;
             }
             if (MinRU.Text != "")
             {
                 apnew.MinRooms = MinRU.Text;
             }
             if (AcU.Text != "")
             {
                 apnew.Address_City = AcU.Text;
             }
             if (AhU.Text != "")
             {
                 apnew.Address_House = AhU.Text;
             }
             if (AnU.Text != "")
             {
                 apnew.Address_Number = AnU.Text;
             }
             if (AsU.Text != "")
             {
                 apnew.Address_Street = AsU.Text;
             }
             apnew.AgentId  = fo.Id;
             apnew.ClientId = of.Id;
             db.SaveChanges();
         }
         if (La.IsChecked == true)
         {
             int      MinP  = Convert.ToInt32(Maxp.Text);
             int      MaxP  = Convert.ToInt32(Maxp.Text);
             Entities db    = new Entities();
             agent    fo    = db.agents.Where(p => p.FirstName == AIdU.SelectedItem.ToString()).FirstOrDefault();
             client   of    = db.clients.Where(p => p.FirstName == CIdU.SelectedItem.ToString()).FirstOrDefault();
             var      nub   = Convert.ToInt32(IdU.Text);
             var      apnew = db.land_demands.Where(p => p.Id == nub).FirstOrDefault();
             if (MaxAU.Text != "")
             {
                 apnew.MaxArea = MaxAU.Text;
             }
             if (MinAU.Text != "")
             {
                 apnew.MinArea = MinAU.Text;
             }
             if (MaxPU.Text != "")
             {
                 apnew.MaxPrice = MaxP;
             }
             if (MinPU.Text != "")
             {
                 apnew.MinPrice = MinP;
             }
             if (AcU.Text != "")
             {
                 apnew.Address_City = AcU.Text;
             }
             if (AhU.Text != "")
             {
                 apnew.Address_House = AhU.Text;
             }
             if (AnU.Text != "")
             {
                 apnew.Address_Number = AnU.Text;
             }
             if (AsU.Text != "")
             {
                 apnew.Address_Street = AsU.Text;
             }
             apnew.AgentId  = fo.Id;
             apnew.ClientId = of.Id;
             db.SaveChanges();
         }
     }
     catch
     {
     }
 }