Exemple #1
0
        private void change3_Click(object sender, EventArgs e)
        {
            try {
                string         token      = File.ReadAllText("token.txt");
                Bitmap         threeB     = new Bitmap(pictureBox3.ImageLocation);
                ImageConverter converter3 = new ImageConverter();
                byte[]         three      = (byte[])converter3.ConvertTo(threeB, typeof(byte[]));


                HousesEndpointClient hu = new HousesEndpointClient();
                responseDto          re = hu.changeHousePhotoThree(houseCurrentNow.id, three, token);
                if (re.status == true)
                {
                    DialogResult result = MessageBox.Show(
                        re.message, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    this.Hide();
                    Dashboard dh = new Dashboard();
                    dh.Show();
                }
                else
                {
                    DialogResult result = MessageBox.Show(
                        re.message, "Success", MessageBoxButtons.OKCancel,
                        MessageBoxIcon.Error);
                }
            }
            catch
            {
                DialogResult result = MessageBox.Show(
                    "Unknown error", "Exception", MessageBoxButtons.OKCancel,
                    MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        private void changestatus_Click(object sender, EventArgs e)
        {
            string token            = File.ReadAllText("token.txt");
            HousesEndpointClient h  = new HousesEndpointClient();
            responseDto          re = h.changeHouseStatus(houseCurrentNow.id, token);

            if (re.status == true)
            {
                DialogResult result = MessageBox.Show(
                    re.message, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                this.Hide();
                Dashboard dh = new Dashboard();
                dh.Show();
            }
            else
            {
                DialogResult result = MessageBox.Show(
                    re.message, "Success", MessageBoxButtons.OKCancel,
                    MessageBoxIcon.Error);
            }
        }
Exemple #3
0
        public void getSearchByBetweenPrice(searchBetweenPriceDto searchByPrice)
        {
            panel1.Controls.Clear();
            HousesEndpointClient houseClient = new HousesEndpointClient();
            houseListResponseDto listHouse   = houseClient.searchBetweenPrice(searchByPrice);

            //Console.WriteLine("COUNT "+listHouse.housesDtoList.Length.ToString());
            if (listHouse.responseDto.status == false)
            {
            }
            else
            {
                int x     = 10;
                int y     = 0;
                int delta = 10;
                for (int i = 0; i < listHouse.paginationDto.count; i++)
                {
                    housesDto      house = listHouse.housesDtoList[i];
                    ImageConverter ic    = new ImageConverter();
                    Image          img;
                    Bitmap         bitmap1;
                    PictureBox     picture = new PictureBox();;
                    if (listHouse.housesDtoList[i].photoone == null || listHouse.housesDtoList[i].photoone.Length < 100)
                    {
                        Console.WriteLine("hhhhhh");
                    }
                    else
                    {
                        img     = (Image)ic.ConvertFrom(listHouse.housesDtoList[i].photoone);
                        bitmap1 = new Bitmap(img);

                        picture.Image    = img;
                        picture.Location = new Point(x, y);
                        //picture.Size = new Size(picture.Image.Width, picture.Image.Height);
                        picture.Size     = new Size(200, 100);
                        picture.SizeMode = PictureBoxSizeMode.StretchImage;
                    }

                    int dx = 300 + delta;
                    // Create name label
                    var labelName = new Label();
                    labelName.AutoSize = true;
                    labelName.Location = new Point(x + dx, y);
                    labelName.Font     = new Font(labelName.Font, FontStyle.Bold);
                    labelName.Text     = "Name: " + listHouse.housesDtoList[i].name + " Price: " + listHouse.housesDtoList[i].totalprice;
                    // Create mail label
                    var labelMail = new Label();
                    labelMail.AutoSize = true;
                    labelMail.Location = new Point(x + dx, y + labelName.Height);
                    labelMail.Text     = "For: " + listHouse.housesDtoList[i].for_ + " Location: " + listHouse.housesDtoList[i].location + " Area: " + listHouse.housesDtoList[i].area;

                    // Create phone label
                    var labelPhone = new Label();
                    labelPhone.AutoSize = true;
                    labelPhone.Location = new Point(x + dx, y + labelName.Height + labelMail.Height);
                    labelPhone.Text     = listHouse.housesDtoList[i].location;
                    //
                    var btn = new Button();
                    btn.Text     = "Detail";
                    btn.Name     = "detail";
                    btn.Location = new Point(x + dx, y + labelName.Height + labelMail.Height);
                    btn.Click   += (object s, EventArgs ee) =>
                    {
                        //
                        this.Hide();
                        houseCurrent = house;
                        HouseDetaile houseDetaile = new HouseDetaile();
                        houseDetaile.Show();
                        //MessageBox.Show(house.finishing, "Test",
                        //MessageBoxButtons.OK, MessageBoxIcon.Error);
                    };

                    // Add controls
                    panel1.Controls.Add(picture);
                    panel1.Controls.Add(labelName);
                    panel1.Controls.Add(labelMail);
                    //panel1.Controls.Add(labelPhone);
                    panel1.Controls.Add(btn);
                    // Iterate
                    int dy1 = labelName.Height + labelMail.Height + labelPhone.Height;
                    int dy2 = picture.Height;
                    y += Math.Max(dy1, dy2) + delta;
                }
            }
        }
Exemple #4
0
        private void First_Load(object sender, EventArgs e)
        {
            try {
                //string token = File.ReadAllText("token.txt");
                HousesEndpointClient houseClient = new HousesEndpointClient();
                paginationDto        pag         = new paginationDto();
                pag.start = 8;
                pag.max   = 30;
                pag.count = 0;

                houseListResponseDto listHouse = houseClient.listAll(pag);
                if (listHouse.responseDto.status == false)
                {
                }
                else
                {
                    int x     = 10;
                    int y     = 0;
                    int delta = 10;
                    for (int i = 0; i < listHouse.paginationDto.count; i++)
                    {
                        housesDto      house = listHouse.housesDtoList[i];
                        ImageConverter ic    = new ImageConverter();
                        Image          img;
                        Bitmap         bitmap1;
                        PictureBox     picture = new PictureBox();;
                        if (listHouse.housesDtoList[i].photoone == null || listHouse.housesDtoList[i].photoone.Length < 100)
                        {
                            Console.WriteLine("hhhhhh");
                        }
                        else
                        {
                            img     = (Image)ic.ConvertFrom(listHouse.housesDtoList[i].photoone);
                            bitmap1 = new Bitmap(img);

                            picture.Image    = img;
                            picture.Location = new Point(x, y);
                            //picture.Size = new Size(picture.Image.Width, picture.Image.Height);
                            picture.Size     = new Size(200, 100);
                            picture.SizeMode = PictureBoxSizeMode.StretchImage;
                        }

                        int dx = 300 + delta;
                        // Create name label
                        var labelName = new Label();
                        labelName.AutoSize = true;
                        labelName.Location = new Point(x + dx, y);
                        labelName.Font     = new Font(labelName.Font, FontStyle.Bold);
                        labelName.Text     = "Name: " + listHouse.housesDtoList[i].name + " Price: " + listHouse.housesDtoList[i].totalprice;
                        // Create mail label
                        var labelMail = new Label();
                        labelMail.AutoSize = true;
                        labelMail.Location = new Point(x + dx, y + labelName.Height);
                        labelMail.Text     = "For: " + listHouse.housesDtoList[i].for_ + " Location: " + listHouse.housesDtoList[i].location + " Area: " + listHouse.housesDtoList[i].area;
                        // Create phone label
                        var labelPhone = new Label();
                        labelPhone.AutoSize = true;
                        labelPhone.Location = new Point(x + dx, y + labelName.Height + labelMail.Height);
                        labelPhone.Text     = "Area: " + listHouse.housesDtoList[i].area + " Price: " + listHouse.housesDtoList[i].totalprice;
                        //
                        var btn = new Button();
                        btn.Text     = "Detail";
                        btn.Name     = "detail";
                        btn.Location = new Point(x + dx, y + labelName.Height + labelMail.Height);
                        btn.Click   += (object s, EventArgs ee) =>
                        {
                            //
                            this.Hide();
                            houseCurrent = house;
                            HouseDetaile houseDetaile = new HouseDetaile();
                            houseDetaile.Show();
                            //MessageBox.Show(house.finishing, "Test",
                            //MessageBoxButtons.OK, MessageBoxIcon.Error);
                        };

                        // Add controls
                        panel1.Controls.Add(picture);
                        panel1.Controls.Add(labelName);
                        panel1.Controls.Add(labelMail);
                        //panel1.Controls.Add(labelPhone);
                        panel1.Controls.Add(btn);
                        // Iterate
                        int dy1 = labelName.Height + labelMail.Height + labelPhone.Height;
                        int dy2 = picture.Height;
                        y += Math.Max(dy1, dy2) + delta;
                    }
                }
            }
            catch
            {
                MessageBox.Show("Unknown error", "Connection Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                //Application.Run(new First());
            }
        }
Exemple #5
0
        private void update_Click(object sender, EventArgs e)
        {
            Boolean vname = false;

            if (string.IsNullOrWhiteSpace(name.Text) | name.Text.Length < 4)
            {
                vname = false; name.Focus(); errorProvider1.SetError(name, "Name should contain at least four character.");
            }
            else
            {
                vname = true; errorProvider1.SetError(name, "");
            }

            Boolean vtype = false;

            if (string.IsNullOrWhiteSpace(type.Text) | type.Text.Length < 3)
            {
                vtype = false; type.Focus(); errorProvider1.SetError(type, "Type should be selected.");
            }
            else
            {
                vtype = true; errorProvider1.SetError(type, "");
            }

            Boolean vfor = false;

            if (string.IsNullOrWhiteSpace(for_.Text) | for_.Text.Length < 3)
            {
                vfor = false; type.Focus(); errorProvider1.SetError(for_, "Type should be selected.");
            }
            else
            {
                vfor = true; errorProvider1.SetError(for_, "");
            }
            Boolean vlocation = false;

            if (string.IsNullOrWhiteSpace(location.Text) | location.Text.Length < 4)
            {
                vlocation = false; location.Focus(); errorProvider1.SetError(location, "Loation should contain at least four character.");
            }
            else
            {
                vlocation = true; errorProvider1.SetError(location, "");
            }
            Boolean varea = false;

            if (string.IsNullOrWhiteSpace(area.Text) | !Regex.IsMatch(totalprice.Text, @"[0-9]{1,20}"))
            {
                varea = false; location.Focus(); errorProvider1.SetError(area,
                                                                         "Area should be number.");
            }
            else
            {
                varea = true; errorProvider1.SetError(area, "");
            }
            Boolean vpriceperhectar = false;

            if (string.IsNullOrWhiteSpace(priceheactar.Text) | !Regex.IsMatch(totalprice.Text, @"[0-9]{1,20}"))
            {
                vpriceperhectar = false; location.Focus(); errorProvider1.SetError(priceheactar,
                                                                                   "Price per hectar should be number.");
            }
            else
            {
                vpriceperhectar = true; errorProvider1.SetError(priceheactar, "");
            }

            Boolean vtotalprice = false;

            if (string.IsNullOrWhiteSpace(totalprice.Text) | !Regex.IsMatch(totalprice.Text, @"[0-9]{1,20}"))
            {
                vtotalprice = false; totalprice.Focus(); errorProvider1.SetError(totalprice,
                                                                                 "Total price should be number.");
            }
            else
            {
                vtotalprice = true; errorProvider1.SetError(totalprice, "");
            }
            Boolean vfinishing = false;

            if (string.IsNullOrWhiteSpace(finishing.Text) | finishing.Text.Length < 2)
            {
                vfinishing = false; type.Focus(); errorProvider1.SetError(finishing, "Finishing should be selected.");
            }
            else
            {
                vfinishing = true; errorProvider1.SetError(finishing, "");
            }
            Boolean vcompany = false;

            if (string.IsNullOrWhiteSpace(company.Text) | company.Text.Length < 3)
            {
                vcompany = false; company.Focus(); errorProvider1.SetError(company,
                                                                           "Company name should contain atleast two character.");
            }
            else
            {
                vcompany = true; errorProvider1.SetError(company, "");
            }

            if (vname == true & vtype == true & vfor == true & vlocation == true & varea == true & vpriceperhectar == true
                & vtotalprice == true & vfinishing == true & vcompany == true)
            {
                string token = File.ReadAllText("token.txt");
                HousesEndpointClient   houseClient = new HousesEndpointClient();
                housesUpdateRequestDto house       = new housesUpdateRequestDto();
                house.name           = name.Text;
                house.type           = type.Text;
                house.for_           = for_.Text;
                house.location       = location.Text;
                house.area           = area.Text;
                house.priceperhectar = priceheactar.Text;
                house.totalprice     = totalprice.Text;
                house.finishing      = finishing.Text;
                house.id             = houseCurrentNow.id;
                house.company        = company.Text;
                Console.WriteLine(" house id == " + houseCurrentNow.id + " " + house.id);
                responseDto response = houseClient.updateHouse(house, houseCurrentNow.id, token);
                if (response.status == true)
                {
                    DialogResult result = MessageBox.Show(
                        response.message, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    //if (result == DialogResult.OK)
                    //{
                    this.Hide();
                    Dashboard userDb = new Dashboard();
                    userDb.Show();
                    //}
                    //else
                    //{

                    //    DialogResult res = MessageBox.Show(response.message, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop);
                    //}
                }
                else
                {
                    DialogResult result = MessageBox.Show(
                        response.message, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
                }
            }
        }
Exemple #6
0
        private void save_Click(object sender, EventArgs e)
        {
            Boolean vname = false;

            if (string.IsNullOrWhiteSpace(name.Text) | name.Text.Length < 4)
            {
                vname = false; name.Focus(); errorProvider1.SetError(name, "Name should contain at least four character.");
            }
            else
            {
                vname = true; errorProvider1.SetError(name, "");
            }

            Boolean vtype = false;

            if (string.IsNullOrWhiteSpace(type.Text) | type.Text.Length < 3)
            {
                vtype = false; type.Focus(); errorProvider1.SetError(type, "Type should be selected.");
            }
            else
            {
                vtype = true; errorProvider1.SetError(type, "");
            }

            Boolean vfor = false;

            if (string.IsNullOrWhiteSpace(for_.Text) | for_.Text.Length < 3)
            {
                vfor = false; type.Focus(); errorProvider1.SetError(for_, "Type should be selected.");
            }
            else
            {
                vfor = true; errorProvider1.SetError(for_, "");
            }
            Boolean vlocation = false;

            if (string.IsNullOrWhiteSpace(location.Text) | location.Text.Length < 4)
            {
                vlocation = false; location.Focus(); errorProvider1.SetError(location, "Loation should contain at least four character.");
            }
            else
            {
                vlocation = true; errorProvider1.SetError(location, "");
            }
            Boolean varea = false;

            if (string.IsNullOrWhiteSpace(area.Text) | !Regex.IsMatch(totalprice.Text, @"[0-9]{1,20}"))
            {
                varea = false; location.Focus(); errorProvider1.SetError(area,
                                                                         "Area should be number.");
            }
            else
            {
                varea = true; errorProvider1.SetError(area, "");
            }
            Boolean vpriceperhectar = false;

            if (string.IsNullOrWhiteSpace(priceheactar.Text) | !Regex.IsMatch(totalprice.Text, @"[0-9]{1,20}"))
            {
                vpriceperhectar = false; location.Focus(); errorProvider1.SetError(priceheactar,
                                                                                   "Price per hectar should be number.");
            }
            else
            {
                vpriceperhectar = true; errorProvider1.SetError(priceheactar, "");
            }

            Boolean vtotalprice = false;

            if (string.IsNullOrWhiteSpace(totalprice.Text) | !Regex.IsMatch(totalprice.Text, @"[0-9]{1,20}"))
            {
                vtotalprice = false; totalprice.Focus(); errorProvider1.SetError(totalprice,
                                                                                 "Total price should be number.");
            }
            else
            {
                vtotalprice = true; errorProvider1.SetError(totalprice, "");
            }
            Boolean vfinishing = false;

            if (string.IsNullOrWhiteSpace(finishing.Text) | finishing.Text.Length < 2)
            {
                vfinishing = false; type.Focus(); errorProvider1.SetError(finishing, "Finishing should be selected.");
            }
            else
            {
                vfinishing = true; errorProvider1.SetError(finishing, "");
            }
            Boolean vcompany = false;

            if (string.IsNullOrWhiteSpace(company.Text) | company.Text.Length < 3)
            {
                vcompany = false; company.Focus(); errorProvider1.SetError(company,
                                                                           "Company name should contain atleast two character.");
            }
            else
            {
                vcompany = true; errorProvider1.SetError(company, "");
            }

            Boolean vpictureBox1 = false;

            if (string.IsNullOrWhiteSpace(pictureBox1.ImageLocation))
            {
                vpictureBox1 = false; pictureBox1.Focus(); errorProvider1.SetError(pictureBox1,
                                                                                   "Photo one should not be empty");
            }
            else
            {
                vpictureBox1 = true; errorProvider1.SetError(pictureBox1, "");
            }
            Boolean vpictureBox2 = false;

            if (string.IsNullOrWhiteSpace(pictureBox2.ImageLocation))
            {
                vpictureBox2 = false; pictureBox2.Focus(); errorProvider1.SetError(pictureBox2,
                                                                                   "Photo two should not be empty");
            }
            else
            {
                vpictureBox2 = true; errorProvider1.SetError(pictureBox2, "");
            }
            Boolean vpictureBox3 = false;

            if (string.IsNullOrWhiteSpace(pictureBox3.ImageLocation))
            {
                vpictureBox3 = false; pictureBox3.Focus(); errorProvider1.SetError(pictureBox3,
                                                                                   "Photo three should not be empty");
            }
            else
            {
                vpictureBox3 = true; errorProvider1.SetError(pictureBox3, "");
            }

            if (vname == true & vtype == true & vfor == true & vlocation == true & varea == true & vpriceperhectar == true
                & vtotalprice == true & vfinishing == true & vcompany == true & vpictureBox3 == true & vpictureBox2 == true
                & vpictureBox1 == true)
            {
                string token = File.ReadAllText("token.txt");
                HousesEndpointClient houseClient = new HousesEndpointClient();
                housesRequestDto     house       = new housesRequestDto();
                house.name           = name.Text;
                house.type           = type.Text;
                house.for_           = for_.Text;
                house.location       = location.Text;
                house.area           = area.Text;
                house.priceperhectar = priceheactar.Text;
                house.totalprice     = totalprice.Text;
                house.finishing      = finishing.Text;
                house.status         = true;
                house.id             = 0;
                house.company        = company.Text;

                Bitmap         oneB      = new Bitmap(pictureBox1.ImageLocation);
                ImageConverter converter = new ImageConverter();
                byte[]         one       = (byte[])converter.ConvertTo(oneB, typeof(byte[]));
                house.photoone = one;

                Bitmap         twoB       = new Bitmap(pictureBox2.ImageLocation);
                ImageConverter converter2 = new ImageConverter();
                byte[]         two        = (byte[])converter2.ConvertTo(twoB, typeof(byte[]));
                house.phototwo = two;

                Bitmap         threeB     = new Bitmap(pictureBox3.ImageLocation);
                ImageConverter converter3 = new ImageConverter();
                byte[]         three      = (byte[])converter3.ConvertTo(threeB, typeof(byte[]));
                house.photothree = three;

                responseDto response = houseClient.createHouse(house, token);
                if (response.status == true)
                {
                    DialogResult result = MessageBox.Show(
                        response.message, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    if (result == DialogResult.OK)
                    {
                        this.Hide();
                        Dashboard userDb = new Dashboard();
                        userDb.Show();
                    }
                    else
                    {
                        DialogResult res = MessageBox.Show(response.message, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop);
                        //if (result == DialogResult.Cancel)
                        //{
                        //    this.Close();
                        //}
                    }
                }
            }
        }
Exemple #7
0
        private void Dashboard_Load(object sender, EventArgs e)
        {
            //HousesEndpointClient houseClient1 = new HousesEndpointClient();
            //byte[] d = houseClient1.download();
            ////nikos") && password.equals("superpassword
            //ImageConverter ic = new ImageConverter();
            //Image img = (Image)ic.ConvertFrom(d);
            //Bitmap bitmap1 = new Bitmap(img);


            string token = File.ReadAllText("token.txt");
            HousesEndpointClient houseClient = new HousesEndpointClient();
            paginationDto        pag         = new paginationDto();

            pag.start = 8;
            pag.max   = 30;
            pag.count = 0;

            houseListResponseDto listHouse = houseClient.listMyHouse(pag, token);

            if (listHouse.responseDto.status == false)
            {
            }
            else
            {
                //Bitmap l = (Bitmap)converter.ConvertTo(d, typeof(Bitmap));
                //pictureBox1.Image = new Bitmap(bitmap1);
                int x     = 10;
                int y     = 0;
                int delta = 10;
                for (int i = 0; i < listHouse.paginationDto.count; i++)
                {
                    housesDto      house = listHouse.housesDtoList[i];
                    ImageConverter ic    = new ImageConverter();
                    Image          img;
                    Bitmap         bitmap1;
                    PictureBox     picture = new PictureBox();;
                    if (listHouse.housesDtoList[i].photoone == null || listHouse.housesDtoList[i].photoone.Length < 100)
                    {
                        Console.WriteLine("hhhhhh");
                    }
                    else
                    {
                        img     = (Image)ic.ConvertFrom(listHouse.housesDtoList[i].photoone);
                        bitmap1 = new Bitmap(img);

                        picture.Image    = img;
                        picture.Location = new Point(x, y);
                        //picture.Size = new Size(picture.Image.Width, picture.Image.Height);
                        picture.Size     = new Size(200, 100);
                        picture.SizeMode = PictureBoxSizeMode.StretchImage;
                    }
                    //byte[] d = listHouse.housesDtoList[i].phototwo;
                    //ImageConverter ic = new ImageConverter();


                    //Bitmap l = (Bitmap)converter.ConvertTo(d, typeof(Bitmap));
                    //pictureBox1.Image = new Bitmap(bitmap1);

                    //byte[] d = proxy.download();
                    //nikos") && password.equals("superpassword
                    //ImageConverter ic = new ImageConverter();
                    //Image img = (Image)ic.ConvertFrom(listHouse.housesDtoList[i].phototwo);
                    //Bitmap bitmap1 = new Bitmap(img);

                    //Bitmap l = (Bitmap)converter.ConvertTo(d, typeof(Bitmap));
                    //pictureBox1.Image = new Bitmap(bitmap1);

                    // Create picture box
                    //var picture = new PictureBox();
                    //picture.Image = new Bitmap(bitmap1);//Image.FromFile(listHouse.housesDtoList[i].pathImage);
                    //picture.Location = new Point(x, y);
                    //picture.Size = new Size(picture.Image.Width, picture.Image.Height);
                    int dx = 300 + delta;
                    // Create name label
                    var labelName = new Label();
                    labelName.AutoSize = true;
                    labelName.Location = new Point(x + dx, y);
                    labelName.Font     = new Font(labelName.Font, FontStyle.Bold);
                    labelName.Text     = "Name: " + listHouse.housesDtoList[i].name + " Type: " + listHouse.housesDtoList[i].type;
                    // Create mail label
                    var labelMail = new Label();
                    labelMail.AutoSize = true;
                    labelMail.Location = new Point(x + dx, y + labelName.Height);
                    labelMail.Text     = "For:" + listHouse.housesDtoList[i].for_ + " Location: " + listHouse.housesDtoList[i].location;
                    // Create phone label
                    var labelPhone = new Label();
                    labelPhone.AutoSize = true;
                    labelPhone.Location = new Point(x + dx, y + labelName.Height + labelMail.Height);
                    labelPhone.Text     = "Area " + listHouse.housesDtoList[i].area + "msqr " + " Price: " + listHouse.housesDtoList[i].totalprice + "birr";
                    //
                    var btn = new Button();
                    btn.Text     = "Edit";
                    btn.Name     = "edit";
                    btn.Location = new Point(x + dx, y + labelName.Height + labelMail.Height);
                    btn.Click   += (object s, EventArgs ee) =>
                    {
                        //
                        this.Hide();
                        houseCurrent = house;
                        House houseForm = new House();
                        houseForm.Show();
                        //MessageBox.Show(house.finishing, "Test",
                        //MessageBoxButtons.OK, MessageBoxIcon.Error);
                    };

                    // Add controls
                    panel1.Controls.Add(picture);
                    panel1.Controls.Add(labelName);
                    panel1.Controls.Add(labelMail);
                    //panel1.Controls.Add(labelPhone);
                    panel1.Controls.Add(btn);
                    // Iterate
                    int dy1 = labelName.Height + labelMail.Height + labelPhone.Height;
                    int dy2 = picture.Height;
                    y += Math.Max(dy1, dy2) + delta;
                }
            }
        }