Hello,
I able to upload and save data correctly to my database thru wcf, using the basic OpenFileDialog.
At this point I'm not able to preview te picture after selection just during selection.
I tried to use the upload control in my situtuion but no luck
Thoughts?
Rick
I'm trying to upload the image with data and preview the image, When the user is satisified then click submit and it loads into the database
Thank you
I able to upload and save data correctly to my database thru wcf, using the basic OpenFileDialog.
At this point I'm not able to preview te picture after selection just during selection.
I tried to use the upload control in my situtuion but no luck
Thoughts?
Rick
ublic void Preview_Record(object sender, RoutedEventArgs e)
{
// select an image into byte[] bytes
byte[] bytes = null;
OpenFileDialog dlg = new OpenFileDialog();
dlg.Multiselect = false;
dlg.Filter = "JPEG files| *.jpg";
bool? retval = dlg.ShowDialog();
if (retval != null && retval == true)
{
Stream stream = (Stream)dlg.File.OpenRead();
bytes = new byte[stream.Length];
stream.Read(bytes, 0, (int)stream.Length);
StatusText.Text = dlg.File.Name;
}
else
{
StatusText.Text = "No Image selected...";
}
ublic void Submit_Record(object sender, RoutedEventArgs e)
// Save record to data base
MySev.MyWebClient proxy = new MySev.MyWebClient();
EMPLOYEE record = new EMPLOYEE();
record.LAST_NAME = this.lastName.Text;
record.FIRST_NAME = this.FirstName.Text;
record.ADDRESS = this.Addy.Text;
record.CITY = this.CityTxt.Text;
record.STATE = this.State.Text;
record.ZIP = this.Ziptxt.Text;
record.PHONE1 = this.ph1.Text;
record.RATING = 3;
record.PICTURE = bytes;
record.USER_ADDED = "Test"; // required for all insert wcf
record.LAST_USER_UPDT = "Test"; // required for all insert wcf
//string ret = proxy.InsertEmployeeCompleted(record); This statement is for WPF application
// For Silverlight use these statements
proxy.InsertEmployeeAsync(record);
proxy.InsertEmployeeCompleted += (s, arg) =>
{
string ret = arg.Result;
MessageBox.Show(ret);
};
}
Thank you