Example #1
0
        public RecordForDisplay Save(RecordForDisplay recordForDisplay)
        {
            // Double ID Checker
            //if (recordForDisplay.Id == Guid.Empty) { recordForDisplay.Id = Guid.NewGuid(); }
            var record = recordForDisplay.ToDataModel();
            var data   = this.EncryptData(record);

            this.AddOrUpdateResource(record.Id, data);
            return(recordForDisplay);
        }
Example #2
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(this.textBoxName.Text))
            {
                MessageBox.Show("Please select a valid name for current item.", "Save Item", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Image logo         = null;
            var   logoFilePath = this.textBoxLogoFilePath.Text;

            if (!string.IsNullOrWhiteSpace(logoFilePath))
            {
                try
                {
                    logo = Image.FromFile(logoFilePath);
                    logo = ImageHelper.ZoomPicture(logo, 100, 50);
                }
                catch
                {
                    MessageBox.Show("Please select a valid image for Logo.", "Save Item", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            if (this.record == null)
            {
                this.record = new RecordForDisplay {
                    Id = Guid.NewGuid()
                };
            }

            this.record.Name = this.textBoxName.Text;
            var image = this.textBoxLogoFilePath.Text;

            this.record.PictureForLogo = logo;
            this.record.Username       = this.textBoxUsername.Text;
            this.record.Password       = SecureStringHelper.GetSecureStringFromString(this.textBoxPassword.Text);
            this.record.Keywords       = this.textBoxKeywords.Text;
            this.record.Remarks        = this.textBoxRemarks.Text;

            ResourceProcessor.GetInstance().Save(this.record);
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Example #3
0
 public Edit(RecordForDisplay record)
 {
     this.record = record;
     this.InitializeComponent();
     this.InitializeForm();
 }