private bool SaveIssue()
        {
            this._tc.TrackEvent("Save Issue", (IDictionary <string, string>)null, (IDictionary <string, double>)null);

            if (!this.CheckCurrentIssueProperties())
            {
                int num = (int)System.Windows.MessageBox.Show("All values should be not empty", "Issue report");
                return(false);
            }

            this.PutCurrentIssueProperties();
            RIDataModelContainer d = new RIDataModelContainer();

            this.CurrentIssue.Wrong = ReportIssueUtilities.ReportIssueUtilities.EncodeErrors(_errorGrid.ItemsSource as ObservableCollection <Error>);

            this.CurrentIssue.Pictures.Clear();
            for (int i = 0; i < this._pictureListView.Items.Count; i++)
            {
                System.Windows.Controls.ListViewItem item = _pictureListView.Items[i] as System.Windows.Controls.ListViewItem;
                Picture picture = (Picture)item.DataContext;

                this.CurrentIssue.Pictures.Add(picture);
                if (!SavePicture(picture))
                {
                    return(false);
                }

                d.Pictures.AddOrUpdate(picture);
                foreach (Marker m in picture.Markers)
                {
                    d.Markers.AddOrUpdate(m);
                }
            }

            /*
             * for (int i = 0; i < this._pictureList.Items.Count; i++)
             *          {
             *               ListBoxItem item = this._pictureList.Items[i] as ListBoxItem;
             *               Picture picture = (Picture)item.DataContext;
             *
             *               this.CurrentIssue.Pictures.Add(picture);
             *               d.Pictures.AddOrUpdate(picture);
             *               if (!SavePicture(picture))
             *               {
             *                  return false;
             *               }
             *
             *          }
             */
            this.CurrentIssue.Save();
            d.Issues.AddOrUpdate(this.CurrentIssue);

            d.SaveChanges();
            return(true);
        }
        private bool SaveIssue()
        {
            try
            {
                this._tc.TrackEvent("Save Issue", (IDictionary <string, string>)null, (IDictionary <string, double>)null);
                if (!this.CheckCurrentIssueProperties())
                {
                    int num = (int)System.Windows.MessageBox.Show("All values should be not empty", "Issue report");
                    return(false);
                }

                if (_pictureTabControl.Items.Count == 0)
                {
                    int num = (int)System.Windows.MessageBox.Show("Add at least one picture", "Issue report");
                    return(false);
                }


                foreach (TabItem i in _pictureTabControl.Items)
                {
                    ShotPanel shotPanel = i.Content as ShotPanel;
                    string    msg;
                    if (!shotPanel.IsValid(out msg))
                    {
                        System.Windows.MessageBox.Show(msg, "ReportIssue", MessageBoxButton.OK);
                        return(false);
                    }
                }

                this.PutCurrentIssueProperties();

                this.CurrentIssue.Pictures.Clear();
                StringBuilder stringBuilder = new StringBuilder();
                foreach (TabItem i in _pictureTabControl.Items)
                {
                    ShotPanel shotPanel = i.Content as ShotPanel;
                    shotPanel.Save();
                    this.CurrentIssue.Pictures.Add(shotPanel.Picture);

                    if (_pictureTabControl.Items.IndexOf(i) > 0)
                    {
                        stringBuilder.AppendFormat(",");
                    }

                    stringBuilder.AppendFormat("{0}", shotPanel.Picture.ID);
                }

                this.CurrentIssue.PictureString = stringBuilder.ToString();
                this.CurrentIssue.Save();

                RIDataModelContainer d = new RIDataModelContainer();
                foreach (Picture p in this.CurrentIssue.Pictures)
                {
                    d.Pictures.AddOrUpdate(p);
                }

                d.Issues.AddOrUpdate(this.CurrentIssue);
                d.SaveChanges();
                this._isIssueEdited = false;
                return(true);
            }
            catch (DbEntityValidationException e)
            {
                foreach (DbEntityValidationResult r in e.EntityValidationErrors)
                {
                    foreach (var err in r.ValidationErrors)
                    {
                        Console.WriteLine(err.PropertyName);
                        Console.WriteLine(err.ErrorMessage);
                    }
                }
            }

            return(false);
        }