Listing the source code file AddCDTitul.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;
using PxControls;
using PxFiles;
using System.Globalization;

public partial class AddCDTitul : BasePage
{

     protected void Page_Load(object sender, EventArgs e)
     {
         //rutina na vypnutie BackButonu v Browsery
         this.Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
         this.Context.Response.Cache.SetAllowResponseInBrowserHistory(false);

         if (Request.Browser.MSDomVersion.Major == 0// Non IE Browser?)
             this.Context.Response.Cache.SetNoStore();


         PxCulture.CurrentCulture = new CultureInfo("en-US");

        if (/*(!IsPostBack)&&*/(wquQAuthor.Active==false))
        {

            wquQAuthor.ConnectString = AppConst.ConnectString;
            wquQAuthor.SQLSelect = "select IDAuthor, CONCAT_WS(' ', Last_Name, First_Name) as Name  from Author";

            wquQAuthor.Open();

            wquQAuthor.AutomaticRefresh = true;
            wquQAuthor.IntervalQueryRefresh = 30;

        }
        else
        {

        }

        if (/*(!IsPostBack) &&*/ (wquQZaner.Active == false))
        {

            wquQZaner.ConnectString = AppConst.ConnectString;
            wquQZaner.SQLSelect = "select     Zaner.IDZaner as IDZaner,   Zaner.Name as Zaner,     Zaner.IDKateg_Zaner as IDKateg_Zaner,   Kateg_Zaner.Name as Kateg_Zaner  from   Zaner, Kateg_Zaner where Kateg_Zaner.IDKateg_Zaner=Zaner.IDKateg_Zaner";

            wquQZaner.Open();

            wquQZaner.Columns["IDKateg_Zaner"].Caption = "ID category";

            wquQZaner.Columns["Kateg_Zaner"].Caption = "Category";

            wquQZaner.Columns["IDZaner"].Caption = "ID Genre";

            wquQZaner.Columns["Zaner"].Caption = "Genre";
        }
        else
        {

        }
        if (/*(!IsPostBack)&&*/(wquCdTitul.Active==false))
        {
            string sSQLText1 = "select IdCDNosic as aKey, Name as aValue from CDNosic Order By aValue";
            string sSQLText2 = "select IDCDFormat as aKey, Name as aValue from CDFormat Order By aValue";
            string sSQLText3 = "select IdVydavatel as aKey, Vydavatel as aValue from Vydavatel Order By aValue";

            wquCdTitul.ConnectString = AppConst.ConnectString;
            wquCdTitul.SQLSelect = "select IDCDTitul, Titul, IDKATEG_ZANER, IDZaner, IdVydavatel, IdCDNosic, IDCDFormat, Create_Date, IdAuthor1, IdAuthor2, IdAuthor3, IdAuthor4 from CdTitul";


            wquCdTitul.AddParamKey("IdCDNosic""aKey""aValue""aValue""aKey", sSQLText1);
            wquCdTitul.AddParamKey("IDCDFormat""aKey""aValue""aValue""aKey", sSQLText2);
            wquCdTitul.AddParamKey("IdVydavatel""aKey""aValue""aValue""aKey", sSQLText3);

            wquCdTitul.AddParamWebQuery("IdAuthor1""IDAuthor""Name""Name""IDAuthor""wquQAuthor");
            wquCdTitul.AddParamWebQuery("IdAuthor2""IDAuthor""Name""Name""IDAuthor""wquQAuthor");
            wquCdTitul.AddParamWebQuery("IdAuthor3""IDAuthor""Name""Name""IDAuthor""wquQAuthor");
            wquCdTitul.AddParamWebQuery("IdAuthor4""IDAuthor""Name""Name""IDAuthor""wquQAuthor");

            wquCdTitul.AddParamGreatWebQuery("Author""IdAuthor1""IdAuthor1"4"mvBreakHR");
            wquCdTitul.AddParamFlyComboBox("ZanerFull""IDKATEG_ZANER;IDZaner""IDKateg_Zaner;IDZaner""Kateg_Zaner;Zaner""Kateg_Zaner;Zaner","wquQZaner""mvNameAndBR");

            wquCdTitul.Open();

            wquCdTitul.AutomaticRefresh = true;
            wquCdTitul.IntervalQueryRefresh = 30;

            wquCdTitul.Columns["IDCDTitul"].Caption = "Id Title";

            wquCdTitul.Columns["Titul"].Caption = "CD Title";

            wquCdTitul.Columns["IDKATEG_ZANER"].Caption = "Category the Genre";

            wquCdTitul.Columns["IDZaner"].Caption = "Genre";

            wquCdTitul.Columns["IdVydavatel"].Caption = "Publisher";

            wquCdTitul.Columns["IdCDNosic"].Caption = "CD Media";

            wquCdTitul.Columns["IDCDFormat"].Caption = "CD Format";

            wquCdTitul.Columns["Create_Date"].Caption = "Creation date";

            wquCdTitul.Columns["IdAuthor1"].Caption = "Author";

            wquCdTitul.Columns["IdAuthor2"].Caption = "Author";

            wquCdTitul.Columns["IdAuthor3"].Caption = "Author";

            wquCdTitul.Columns["IdAuthor4"].Caption = "Author";

            wquCdTitul.Columns["Author"].Caption = "Author";

        }
        else
        {

        }

       if (wquCdTitul.StateQuery == PxWebQuery.eStateQuery.sqInsert)
             lblAddEditPanel.Text = "Add new CD Title";
       else lblAddEditPanel.Text = "Edit CD Title";

        edtIDCDTitul.PxDataSource = wquCdTitul;
        edtIDCDTitul.FieldName = "IDCDTitul";

        edtTitul.PxDataSource = wquCdTitul;
        edtTitul.FieldName = "Titul";

        cmbIdVydavatel.PxDataSource = wquCdTitul;
        cmbIdVydavatel.FieldName = "IdVydavatel";

        cmbIdCDNosic.PxDataSource = wquCdTitul;
        cmbIdCDNosic.FieldName = "IdCDNosic";

        cmbIDCDFormat.PxDataSource = wquCdTitul;
        cmbIDCDFormat.FieldName = "IDCDFormat";

        edtCreate_Date.PxDataSource = wquCdTitul;
        edtCreate_Date.FieldName = "Create_Date";

        gtrAuthor.PxDataSource = wquCdTitul;
        gtrAuthor.FieldName = "Author";

        fcmbZanerfull.PxDataSource = wquCdTitul;
        fcmbZanerfull.FieldName = "Zanerfull";

        dbpVydavatel.LoadData += new LoadDataEventHandler(dbpVydavatel_LoadData);
     }

     void dbpVydavatel_LoadData(object sender, EventArgs e)
     {
        if (/*(!IsPostBack)&&*/(wquVydavatel.Active==false))
        {
            wquVydavatel.ConnectString = AppConst.ConnectString;
            wquVydavatel.SQLSelect = "select IdVydavatel, Vydavatel from Vydavatel";

            wquVydavatel.Open();

            wquVydavatel.Columns["IdVydavatel"].Caption = "Id Publisher";

            wquVydavatel.Columns["Vydavatel"].Caption = "Publisher";
        }
        else
        {

        }
         dbpVydavatel.Caption = "Choose the Publisher";
         dbpVydavatel.VisibleFields = "IdVydavatel;Vydavatel";
         dbpVydavatel.PxDataSource = wquVydavatel;
         dbpVydavatel.Width = 300;
         dbpVydavatel.Height = 200;

         dbpVydavatel.OutKomponentName = "ctl00_cphContent_cmbIdVydavatel";
         dbpVydavatel.OutFieldName = "Vydavatel";

     }

     protected void ButtonOk_Click(object sender, EventArgs e)
     {
        wquCdTitul.Post();
        wquCdTitul.GoBackPreviousPage();
     }

     protected void ButtonStorno_Click(object sender, EventArgs e)
     {
        wquCdTitul.Cancel();
        wquCdTitul.GoBackPreviousPage();
     }

}

Return to original page