示例#1
0
        public EditWindow2(CrossDocument document)
        {
            DataContext = this;

            docData = document;

            docData.BeginEdit();

            this.Resources.Add("Title", string.Format("{0} ({1})", docData.DocTitle, docData.IsReadOnly ? "Просмотр" : "Редактирование"));
            this.Resources.Add("Info", docData.DocInfo);

            Dictionary <int, string> map = new Dictionary <int, string>();

            foreach (DataRow row in docData.Rows.Rows)
            {
                map[(int)row["RowKey"]] = (string)row["RowName"];
            }
            RowToString converter = new RowToString(map);

            this.Resources.Add("RowConverter", converter);

            InitializeComponent();

            btnSave.IsEnabled   = !docData.IsReadOnly;
            gridData.IsReadOnly = docData.IsReadOnly;
        }
示例#2
0
        public EditWindow(Document document)
        {
            DataContext = this;

            docData = document;

            docData.BeginEdit(); // throw new PluginInterface.DocException("Не удалось открыть документ для редактирования.");

            this.Resources["Sum"] = "Сумма: " + ((double)docData.Body.Compute("SUM(EntityData)", "")).ToString("0.00");;
            this.Resources.Add("Title", string.Format("{0} ({1})", docData.DocTitle, docData.IsReadOnly ? "Просмотр" : "Редактирование"));
            this.Resources.Add("Info", docData.DocInfo);
            this.Resources.Add("Data", docData);

            Dictionary <int, string> map = new Dictionary <int, string>();

            foreach (DataRow row in docData.Rows.Rows)
            {
                map[(int)row["RowKey"]] = (string)row["RowName"];
            }
            RowToString converter = new RowToString(map);

            this.Resources.Add("RowConverter", converter);

            InitializeComponent();

            gridData.IsReadOnly = docData.IsReadOnly;
            btnSave.IsEnabled   = !docData.IsReadOnly;
        }