Exemplo n.º 1
0
 public static void AddClient(Client client)
 {
     using (RealEstateDataDataContext conn = new RealEstateDataDataContext())
     {
         conn.Clients.InsertOnSubmit(client);
         conn.SubmitChanges();
     }
 }
Exemplo n.º 2
0
 public static void DeleteClient(Client client)
 {
     using (RealEstateDataDataContext conn = new RealEstateDataDataContext())
     {
         Client cli = (from c in conn.Clients
                       where c.Id == client.Id
                       select c).FirstOrDefault();
         conn.Clients.DeleteOnSubmit(cli);
         conn.SubmitChanges();
     }
 }
Exemplo n.º 3
0
        public static void UpdateClient(Client client)
        {
            using (RealEstateDataDataContext conn = new RealEstateDataDataContext())
            {
                Client cli = (from c in conn.Clients
                              where c.Id == client.Id
                              select c).FirstOrDefault();
                cli.FirstName = client.FirstName;
                cli.LastName = client.LastName;

                conn.SubmitChanges();
            }
        }
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            if (FirstName.Text.Trim() == "")
                MessageBox.Show("Missing name");
            if (LastName.Text.Trim() == "")
                MessageBox.Show("Missing fee");
            else
            {
                Client client = new Client();
                client.FirstName = FirstName.Text.Trim();
                client.LastName = LastName.Text.Trim();

                Admin.AddClient(client);
                MessageBox.Show(client.FirstName + " was added");
                DialogResult = true;

            }
        }
        public UpdateClient(Client client)
        {
            InitializeComponent();

            this.client = client;
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            RealEstateDataDataContext con = new RealEstateDataDataContext();
            titleLabel.Content = estate.Name;
            nameField.Text = estate.Name;
            descriptionField.Text = estate.Description;
            feeField.Text = estate.Fee.ToString();

            owner = con.Clients.Single(c => c.Id == estate.Owner);
            ownerField.Text = (owner.FirstName+" "+owner.LastName);

            byte[] barrImg = (byte[])estate.Photo.ToArray();
            string strfn = Convert.ToString(DateTime.Now.ToFileTime());
            FileStream fs1 = new FileStream(strfn, FileMode.CreateNew, FileAccess.Write);
            fs1.Write(barrImg, 0, barrImg.Length);
            fs1.Flush();
            fs1.Close();
            ImageSourceConverter imgs = new ImageSourceConverter();
            image1.SetValue(System.Windows.Controls.Image.SourceProperty, imgs.ConvertFromString(strfn));
        }
 partial void DeleteClient(Client instance);
 partial void UpdateClient(Client instance);
 partial void InsertClient(Client instance);
        public DetailsClient(Client client)
        {
            InitializeComponent();

            this.client = client;
        }