Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var mcd = new MatCenData();
            mcd.NazvOrg = NazvOrg.Text;
            mcd.GiveDate = GiveDate.Value;
            mcd.LongDate = LongDate.Value;
            mcd.NaimAdress = NaimAdress.Text;
            mcd.CountNumber = CountNumber.Text;
            mcd.Bank = Bank.Text;
            mcd.Job = Job.Text;
            mcd.SurName = SurName.Text;
            mcd.Name1 = Name1.Text;
            mcd.PatronimicName = PatronimicName.Text;
            mcd.PassSer = PassSer.Text;
            mcd.PassNumber = PassNumber.Text;
            mcd.PassGive = PassGive.Text;
            mcd.PassGiveDate = PassGiveDate.Value;
            mcd.DillerName = DillerName.Text;
            mcd.NaimNumberDocum = NaimNumberDocum.Text;
            mcd.DateDocum = DateDocum.Value;

            foreach (MatData ed in listBox.Items)
            {
                mcd.Mat.Add(ed);
            }

            var rpt = new ReportPrintTool(new MatCenXtraReport()
            {
                DataSource = new BindingSource()
                {
                  DataSource = mcd
                }
            });
            rpt.Report.CreateDocument(false);
            rpt.ShowPreview();
        }
Beispiel #2
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            var sfd = new SaveFileDialog() { Title = "Сохранение данных", Filter = "файл доверенности|*.mc" };
            var result = sfd.ShowDialog(this);
            if (result != DialogResult.OK)
                return;

            var mcd = new MatCenData();
            mcd.NazvOrg = NazvOrg.Text;
            mcd.GiveDate = GiveDate.Value;
            mcd.LongDate = LongDate.Value;
            mcd.NaimAdress = NaimAdress.Text;
            mcd.CountNumber = CountNumber.Text;
            mcd.Bank = Bank.Text;
            mcd.Job = Job.Text;
            mcd.SurName = SurName.Text;
            mcd.Name1 = Name1.Text;
            mcd.PatronimicName = PatronimicName.Text;
            mcd.PassSer = PassSer.Text;
            mcd.PassNumber = PassNumber.Text;
            mcd.PassGive = PassGive.Text;
            mcd.PassGiveDate = PassGiveDate.Value;
            mcd.DillerName = DillerName.Text;
            mcd.NaimNumberDocum = NaimNumberDocum.Text;
            mcd.DateDocum = DateDocum.Value;

            foreach (MatData ed in listBox.Items)
            {
                mcd.Mat.Add(ed);
            }

               // MatCenData mcd = GeMatCenData();

            var xs = new XmlSerializer(typeof(MatCenData));
            var file = File.Create(sfd.FileName);
            xs.Serialize(file, mcd);
            file.Close();
        }