Esempio n. 1
0
        protected void lnkSaveLegalActsSettings_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    if (fuLegalActsXslt.HasFile && fuLegalActsSchema.HasFile)
                    {
                        string schema = GetLegalActsSchema(fuLegalActsSchema);
                        string xslt   = GetLegalActsXslt(fuLegalActsXslt);

                        LegalActsSettingsDTO legalActsSettings = dao.GetLegalActsSettings();
                        if (legalActsSettings != null)
                        {
                            dao.SaveLegalActSettings(legalActsSettings.ID, schema, xslt);
                        }
                        else
                        {
                            dao.AddLegalActSettings("1.0", schema, xslt);
                        }
                        LoadLegalActsSettings();
                    }
                    else
                    {
                        lblMessage.Text = "W celu zapisania ustawieñ aktów prawnych nale¿y podaæ pliki XSD oraz XSL.";
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.Message;
            }
        }
Esempio n. 2
0
        private void LoadLegalActsSettings()
        {
            LegalActsSettingsDTO legalActsSettings = dao.GetLegalActsSettings();

            if (legalActsSettings != null)
            {
                lblLegalActsSettingsVersion.Text = "Wersja: " + legalActsSettings.Version;
                lnkCurrentSchema.Visible         = true;
                lnkCurrentXslt.Visible           = true;
            }
            else
            {
                lblLegalActsSettingsVersion.Text = "Brak bie¿¹cych ustawieñ.";
                lnkCurrentSchema.Visible         = false;
                lnkCurrentXslt.Visible           = false;
            }
        }
Esempio n. 3
0
        protected void lnkCurrentSchema_Click(object sender, EventArgs e)
        {
            LegalActsSettingsDTO legalActsSettings = dao.GetLegalActsSettings();

            if (legalActsSettings != null)
            {
                byte[] buff = Encoding.UTF8.GetBytes(legalActsSettings.Schema);

                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("Content-Length", buff.Length.ToString());
                Response.AddHeader("Content-Disposition", "attachment; filename=\"akt-prawny.xsd\"");
                Response.ContentType = "text/xml";
                Response.OutputStream.Write(buff, 0, buff.Length);
                Response.Flush();
                Response.Close();
            }
        }
Esempio n. 4
0
        public LegalActsSettingsDTO GetLegalActsSettings()
        {
            SqlDatabase db = DatabaseFactory.CreateDatabase() as SqlDatabase;

            if (db == null)
            {
                throw new Exception("Do poprawnego działania wymagany jest SQL Server 2005!");
            }

            LegalActsSettingsDTO settings = null;
            DbCommand            cmd      = db.GetStoredProcCommand("Dokumenty.pobierzUstawieniaAktuPrawnego");

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                if (dr.Read())
                {
                    settings = new LegalActsSettingsDTO(int.Parse(dr["id"].ToString()), dr["numerWersji"].ToString(), (DateTime)dr["dataUtworzenia"], dr["xsd"].ToString(), dr["xslt"].ToString());
                }
            };

            return(settings);
        }