示例#1
0
        private void printButton_Click(object sender, EventArgs e)
        {
            if ((_oldSocnum == null && _oldFName == null && _oldMName == null && _oldLName == null) ||
                (_oldSocnum.Length == 0 && _oldFName.Length == 0 && _oldMName.Length == 0 && _oldLName.Length == 0))
            {
                MainForm.ShowInfoMessage("Нет исходных данных для оформления заявления об изменении анкетных данных", "Внимание");
                return;
            }

            string regAddress = "";

            if (this.regCountryBox.Text.Length > 0)
            {
                regAddress = this.regCountryBox.Text + " ";
            }
            if (this.regAreaBox.Text.Length > 0)
            {
                regAddress += this.regAreaBox.Text + " ";
            }
            if (this.regRegionBox.Text.Length > 0)
            {
                regAddress += this.regRegionBox.Text + " ";
            }
            if (this.regCityBox.Text.Length > 0)
            {
                regAddress += this.regCityBox.Text + " ";
            }
            if (this.regStreetBox.Text.Length > 0)
            {
                regAddress += "ул." + this.regStreetBox.Text + " ";
            }
            if (this.regBuildingBox.Text.Length > 0)
            {
                regAddress += "д." + this.regBuildingBox.Text + " ";
            }
            if (this.regAppartmentBox.Text.Length > 0)
            {
                regAddress += "кв." + this.regAppartmentBox.Text;
            }

            string factAddress = "";

            if (this.adressrealCheckBox.Checked)
            {
                if (this.factCountryBox.Text.Length > 0)
                {
                    factAddress = this.factCountryBox.Text + " ";
                }
                if (this.factAreaBox.Text.Length > 0)
                {
                    factAddress += this.factAreaBox.Text + " ";
                }
                if (this.factRegionBox.Text.Length > 0)
                {
                    factAddress += this.factRegionBox.Text + " ";
                }
                if (this.factCityBox.Text.Length > 0)
                {
                    factAddress += this.factCityBox.Text + " ";
                }
                if (this.factStreetBox.Text.Length > 0)
                {
                    factAddress += "ул." + this.factStreetBox.Text + " ";
                }
                if (this.factBuildingBox.Text.Length > 0)
                {
                    factAddress += "д." + this.factBuildingBox.Text + " ";
                }
                if (this.factAppartmentBox.Text.Length > 0)
                {
                    factAddress += "кв." + this.factAppartmentBox.Text;
                }
            }
            DataRowView citizen1Row = _citizen1BS.Current as DataRowView;
            DataRowView citizen2Row = _citizen1BS.Current as DataRowView;
            DataRowView doctypeRow  = _doctypeBS.Current as DataRowView;


            // Формирования XML для отчета для заявления об изменении анкетных данных
            Dictionary <string, string> personDict = new Dictionary <string, string>(30);

            personDict["old_socnum"] = _oldSocnum;
            personDict["old_fname"]  = _oldFName;
            personDict["old_mname"]  = _oldMName;
            personDict["old_lname"]  = _oldLName;

            personDict[PersonView.lName]     = this.lNameBox.Text;
            personDict[PersonView.fName]     = this.fNameBox.Text;
            personDict[PersonView.mName]     = this.mNameBox.Text;
            personDict[PersonView.socNumber] = this.socNumBox.Text;
            personDict[PersonView.birthday]  = this.birthdayBox.Value.ToString("dd.MM.yyyy");
            personDict[PersonView.sex]       = this.sexBox.Text;
            if (doctypeRow != null)
            {
                personDict[PersonView.docType] = doctypeRow[DocTypes.name] as string;
            }
            personDict[PersonView.docSeries]         = this.docseriesBox.Text;
            personDict[PersonView.docNumber]         = this.docnumBox.Text;
            personDict[PersonView.docDate]           = this.docdateBox.Value.ToString("dd.MM.yyyy");
            personDict[PersonView.docOrg]            = this.docorgBox.Text;
            personDict[PersonView.regAdressZipcode]  = this.regIndexBox.Text;
            personDict[PersonView.regAdress]         = regAddress;
            personDict[PersonView.factAdressZipcode] = this.factIndexBox.Text;
            personDict[PersonView.factAdress]        = factAddress;
            personDict[PersonView.bornAdressCountry] = this.bornCountryBox.Text;
            personDict[PersonView.bornAdressArea]    = this.bornAreaBox.Text;
            personDict[PersonView.bornAdressRegion]  = this.bornAreaBox.Text;
            personDict[PersonView.bornAdressCity]    = this.bornCityBox.Text;
            if (citizen1Row != null)
            {
                personDict["citizen1_id"] = citizen1Row[Country.id].ToString();
                personDict["citizen1"]    = citizen1Row[Country.name] as string;
            }
            if (citizen2Row != null)
            {
                personDict["citizen2_id"] = citizen2Row[Country.id].ToString();
                personDict["citizen2"]    = citizen2Row[Country.name] as string;
            }

            XmlDocument xml = XmlData.Adv2Xml(personDict);

            ////////
            if (_wbAnketaChenged == null)
            {
                _wbAnketaChenged         = new WebBrowser();
                _wbAnketaChenged.Visible = false;
                _wbAnketaChenged.Parent  = this;
                _wbAnketaChenged.ScriptErrorsSuppressed = true;
                _wbAnketaChenged.DocumentCompleted     += new WebBrowserDocumentCompletedEventHandler(_wbAnketaChenged_DocumentCompleted);
            }
            _wbAnketaChenged.Tag = xml;
            string file = System.IO.Path.GetFullPath(Properties.Settings.Default.report_adv2);

            _wbAnketaChenged.Navigate(file);
        }