Exemple #1
0
        private void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            var    jsonEmp    = JsonConvert.SerializeObject(_emp);
            string jsonResult = (string)_scriptComponent.RunFunction("validateEmployee", jsonEmp);
            var    res        = JsonConvert.DeserializeObject <Dictionary <string, string> >(jsonResult);

            if (res.Count == 0)
            {
                MessageBox.Show("Everything is OK!");
            }
            else
            {
                StringBuilder bld = new StringBuilder();
                foreach (var entry in res)
                {
                    bld.Append(entry.Key).Append(": ").AppendLine(entry.Value);
                }

                MessageBox.Show("Validation errors: \n\n" + bld);
            }
        }