Esempio n. 1
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            string err     = "";
            string name    = clientName.Text.Trim().ToUpper();
            string phone   = clientPhone.Text.Trim();
            string email   = clientEmail.Text.Trim();
            string cnp     = clientCnp.Text.Trim();
            string address = clientAddress.Text.Trim().ToUpper();
            string notes   = clientNotes.Text.Trim();

            if (name.Length < 1)
            {
                err += "Please enter a client name!\n";
            }
            if (!Regex.Match(phone, @"^([0-9]{10})$").Success)
            {
                err += "Please enter a valid phone number!\n";
            }
            try
            {
                MailAddress mail = new MailAddress(email);
            }
            catch (Exception ex)
            {
                err += "Please enter a valid email!\n";
            }
            if (address.Length < 2)
            {
                err += "Please enter a valid address!\n";
            }
            if (!Regex.Match(cnp, @"^([0-9]+)$").Success)
            {
                err += "Please enter a valid CNP!\n";
            }
            if (pic == null)
            {
                err += "Please take a picture before saving!\n";
            }
            if (DBQ.Instance.ClientAlreadyExists(cnp))
            {
                err += "This CNP is already in use!\n";
            }
            errors.Text = err;
            if (err.Length == 0)
            {
                Client client = new Client(name, phone, email, cnp, address, notes, PictureManipulation.ImageToByte(pic));
                if (update)
                {
                    client.Id = upClient.Id;
                    DBQ.Instance.Update <Client>(client, upClient.Id);
                }
                else
                {
                    client = DBQ.Instance.Insert <Client>(client);
                }
                InitCustomFont(client.barcode.ToString());
                historyButton.Show();
                AwesomeFormControllMagicWizzard.AwesomeNextPageMagicFunction("ClientTickets", client);
            }
        }
Esempio n. 2
0
 public LittleUser(Client client, bool showAll = true)
 {
     InitializeComponent();
     name.Text     = client.name;
     cnp.Text      = client.cnp;
     picture.Image = PictureManipulation.ResizeImage(PictureManipulation.ByteToImage(client.image), 200, 150);
     this.client   = client;
     if (!showAll)
     {
         editButton.Hide();
         ticketButton.Hide();
     }
 }
Esempio n. 3
0
 public NewClient(Client client)
 {
     InitializeComponent();
     errors.Text         = "";
     pic                 = PictureManipulation.ResizeImage(PictureManipulation.ByteToImage(client.image), 400, 300);
     clientPicture.Image = pic;
     takePic.Hide();
     retakePic.Show();
     filterInfoCollection = new FilterInfoCollection(FilterCategory.VideoInputDevice);
     if (filterInfoCollection.Count > 0)
     {
         videoCaptureDevice           = new VideoCaptureDevice(filterInfoCollection[0].MonikerString);
         videoCaptureDevice.NewFrame += VideoCaptureDevice_NewFrame;
     }
     clientName.Text    = client.name;
     clientPhone.Text   = client.phone;
     clientEmail.Text   = client.email;
     clientCnp.Text     = client.cnp;
     clientAddress.Text = client.address;
     clientNotes.Text   = client.notes;
     update             = true;
     upClient           = client;
     InitCustomFont(client.barcode.ToString());
 }
Esempio n. 4
0
 private void VideoCaptureDevice_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs)
 {
     clientPicture.Image = PictureManipulation.ResizeImage((Bitmap)eventArgs.Frame.Clone(), 400, 300);
 }
Esempio n. 5
0
        private void VideoCaptureDevice_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs)
        {
            map = PictureManipulation.ResizeImage((Bitmap)eventArgs.Frame.Clone(), 300, 150);

            pictureBox1.Image = map;
        }