Example #1
0
        private bool SaveBagImageLogo()
        {
            // Dim ftpPath As String = "Emilio.2020", path As String = "Operations/EmptyBags/BagPictures"
            string imageName = tbLogoDescription.Text.Replace(" ", "") + "-" + DateAndTime.Now.ToString("ddMMMyyyyHHmmss") + SelectedLogo.Extension;
            var    ftpMdl    = new MdlFtp();
            bool   imageUploaded;

            // Dim name = pbBagLogo.Image.Tag

            if (isNewLogo == false && !SelectedLogoInfo.ImagePath.Equals("N/A"))
            {
                var isDeleted = ftpMdl.deleteFTPImage(SelectedLogoInfo.ImagePath);
            }

            if (!Information.IsNothing(pbBagLogo.Image))
            {
                string remotePath = "/Operations/EmptyBags/BagPictures/";
                imageUploaded = ftpMdl.uploadFtpFile(SelectedLogo.Name, remotePath, imageName);
                if (imageUploaded == false)
                {
                    My.MyProject.Forms.MessageBoxCeresOK.ShowDialog("Image not saved", @"An error occured while saving the image into FTP server.Please make sure you are connected to WTC network.
If problem persist, contact the IT department.", this);
                    imagePath = "N/A";
                }
                else
                {
                    imagePath = "Operations/EmptyBags/BagPictures/" + imageName;
                }
            }
            else
            {
                imagePath     = "N/A";
                imageUploaded = true;
            }

            return(imageUploaded);
        }
Example #2
0
        private void Button2_Click(object sender, EventArgs e)
        {
            var    ftpModule = new MdlFtp();
            string imageName;

            if (string.IsNullOrEmpty(firstNameTextBox.Text) | string.IsNullOrEmpty(lastNameLabel.Text) | typeComboBox.SelectedIndex == -1 | yardComboBox.SelectedIndex == -1 | genderComboBox.SelectedIndex == -1 | string.IsNullOrEmpty(jobDescriptionComboBox.Text) | payMehodComboBox.SelectedIndex == -1)
            {
                MdlControllerModifier.warning("incomplete information", titlePersonalInfoLabel);
            }
            else if (personalInfoButton.Text.Equals("Save and Continue"))
            {
                if (!Information.IsNothing(remoteFtpPath) && remoteFtpPath.Equals(""))
                {
                    imageName     = Strings.Trim(aliasTextBox.Text).Replace("/", "").Replace(@"\", "").Replace(" ", "") + DateAndTime.Now.ToString("dd-MMMd-yyyy_HHmmss") + pictureExtendsion;
                    remoteFtpPath = "/Operations/EmployeeManagement/EmployeePictures/";
                    ftpModule.uploadFtpFile(PictureLocalPath, remoteFtpPath, imageName);
                }
                else
                {
                    remoteFtpPath = "";
                }

                if (Conversions.ToBoolean(db.saveEmployee()))
                {
                    if (!newEmployeeTabControl.TabPages.Contains(certificationsTabPage))
                    {
                        newEmployeeTabControl.TabPages.Add(certificationsTabPage);
                        newEmployeeTabControl.SelectTab(1);
                    }

                    _employeeFirstName = firstNameTextBox.Text;
                    _employeeLasttName = lastNameTextBox.Text;
                    _alias             = aliasTextBox.Text;
                    SkillsCertificationPictureBox.BackgroundImage = employeePictureBox.BackgroundImage;
                    titlePersonalInfoLabel.ForeColor = Color.FromArgb(64, 64, 64);
                    titlePersonalInfoLabel.Text      = "Fill up all that apply";
                }
                else
                {
                    MdlControllerModifier.warning("user already exists", titlePersonalInfoLabel);
                }
            }
            else
            {
                if (!PictureLocalPath.Equals(""))
                {
                    imageName     = Strings.Trim(aliasTextBox.Text).Replace("/", "").Replace(@"\", "").Replace(" ", "") + DateAndTime.Now.ToString("dd-MMMd-yyyy_HHmmss") + pictureExtendsion;
                    remoteFtpPath = "/Operations/EmployeeManagement/EmployeePictures/" + imageName;
                    if ((OldPictureRemotelPath ?? "") != (remoteFtpPath ?? "") && !OldPictureRemotelPath.Equals(""))
                    {
                        ftpModule.deleteFTPImage(OldPictureRemotelPath);
                    }

                    ftpModule.uploadFtpFile(PictureLocalPath, "/Operations/EmployeeManagement/EmployeePictures/", imageName);
                    SkillsCertificationPictureBox.BackgroundImage = employeePictureBox.BackgroundImage;
                    ScanCardPictureBox.BackgroundImage            = employeePictureBox.BackgroundImage;
                }
                else
                {
                    remoteFtpPath = "";
                }

                db.updateEmployeeInfo(MdlModifyData.userID);
                if (!newEmployeeTabControl.TabPages.Contains(certificationsTabPage))
                {
                    newEmployeeTabControl.TabPages.Add(certificationsTabPage);
                    newEmployeeTabControl.SelectTab(1);
                }

                MdlModifyData.fillSkillsCheckBoxes();
                newEmployeeTabControl.SelectTab(1);
            }
        }