Výpis zdrojového kódu súboru Adresar.aspx.cs


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
 
 
public partial class Adresar : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if ((!IsPostBack) && (wquObec.Active == false))
        {
            wquObec.ConnectString = "Database=db;Data Source=localhost;User Id=root;Password=aa21aa;";
            wquObec.SQLSelect = @"SELECT COBEC.ID_OBEC AS IDOBEC, COBEC.NAZOV_OBEC AS OBEC, 
                                 COBEC.ID_OKRES AS IDOKRES, COKRES.NAZOV_OKRES AS OKRES,
                                 COBEC.ID_KRAJ AS IDKRAJ,CKRAJ.NAZOV_KRAJ AS KRAJ 
                                 FROM 
                                     COBEC,COKRES,CKRAJ 
                                 WHERE COBEC.ID_OKRES=COKRES.ID_OKRES AND 
                                     COBEC.ID_KRAJ=CKRAJ.ID_KRAJ";
 
            wquObec.Open();
 
            wquObec.Columns["IDOBEC"].Caption = "Id Obec";
            wquObec.Columns["OBEC"].Caption = "Obec";
            wquObec.Columns["IDOKRES"].Caption = "Id Okres";
            wquObec.Columns["OKRES"].Caption = "Okres";
            wquObec.Columns["IDKRAJ"].Caption = "Id Kraj";
            wquObec.Columns["KRAJ"].Caption = "Kraj";
        }
        else
        {
        }
              
        if ((!IsPostBack)&&(wquAdresar.Active==false))
        {
            string sSQLText1 = "SELECT IDPRAVFORM AS aKEY, NAME AS aVALUE FROM PRAVFORM ORDER BY NAME";
 
            wquAdresar.ConnectString = "Database=db;Data Source=localhost;User Id=root;Password=aa21aa;";
            wquAdresar.SQLSelect = @"SELECT IDADRESAR , NAME, ADDRESS, IDPRAVNAFORMA, 
                                    CREATE_DATE, INVALID_ADRESS, IDKRAJ, IDOKRES, 
                                    IDOBEC, PSC, TEL1, TEL_POZN1, TEL2, TEL_POZN2,
                                    TEL3, TEL_POZN3, FAX1, FAX_POZN1,
                                    FAX2, FAX_POZN2 FROM ADRESAR05";
            
            wquAdresar.AddParamKey("IDPRAVNAFORMA", "aKEY", "aVALUE", "aVALUE", "aKEY", sSQLText1);
            wquAdresar.AddParamCheck("INVALID_ADRESS", "A", "N", false);
            wquAdresar.AddParamFlyComboBox("miesto", "idkraj;idokres;idobec", "idkraj;idokres;idobec", "kraj;okres;obec",
                                            "Obec;Okres;Kraj", "wquObec", "mvNameAndBR");
 
            wquAdresar.AddParamGreatWebQuery("Telefon", "Tel1;Tel_Pozn1", "Tel1 - Tel_Pozn1", 3, "mvLineNumber");
            wquAdresar.AddParamGreatWebQuery("Fax", "Fax1;Fax_Pozn1", "Fax1 - Fax_Pozn1", 2, "");
 
            wquAdresar.AddParamValidation("NAME", "vtIsNotNull", "", 0, "Nezadali ste meno osoby !!!");
            wquAdresar.AddParamValidation("IDPRAVNAFORMA", "vtIsNotNull");
 
            //Regulárny výraz pre zadanie platného PSČ
            string sRegVyrazToPSC = @"^\d{5}$|^\d{3}\s\d{2}$";
            wquAdresar.AddParamValidation("PSC", "vtValidToRegularExpression", sRegVyrazToPSC, 0, "Nezadali ste platné poštové smerovacie číslo !!!");
 
            wquAdresar.Open(); 
 
            wquAdresar.Columns["idadresar"].Caption = "ID";          
            wquAdresar.Columns["name"].Caption = "Meno Osoby";          
            wquAdresar.Columns["idpravnaforma"].Caption = "Právna Forma";
            wquAdresar.Columns["address"].Caption = "Ulica";  
            wquAdresar.Columns["create_date"].Caption = "Dátum založenia";
            wquAdresar.Columns["invalid_adress"].Caption = "Adresa neplatná";
            wquAdresar.Columns["miesto"].Caption = "Obec, Okres";
            wquAdresar.Columns["psc"].Caption = "PSČ";
            
            wquAdresar.Columns["tel1"].Caption = "Telefón";
            wquAdresar.Columns["tel_pozn1"].Caption = "Poznámka";
            wquAdresar.Columns["tel2"].Caption = "Telefón";
            wquAdresar.Columns["tel_pozn2"].Caption = "Poznámka";
            wquAdresar.Columns["tel3"].Caption = "Telefón";
            wquAdresar.Columns["tel_pozn3"].Caption = "Poznámka";
           
            wquAdresar.Columns["fax1"].Caption = "Fax";
            wquAdresar.Columns["fax_pozn1"].Caption = "Poznámka";
            wquAdresar.Columns["fax2"].Caption = "Fax";
            wquAdresar.Columns["fax_pozn2"].Caption = "Poznámka";
 
            wquAdresar.Columns["telefon"].Caption = "Spojenie";
                    
        }
        else
        {          
        }
        grdAdresar.VisibleFields = "idadresar;name;idpravnaforma;address;miesto;psc;telefon";    
       
        dbnAdresar.PxDataSource = wquAdresar;
        dbnAdresar.PxVisibleButtons = "FRNL";
        grdAdresar.PxDataSource = wquAdresar;
        grdAdresar.DataBind();
            
    }
 
}


Návrat na pôvodnú stránku