Пример #1
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int idElement = 0;

        if (Request.Cookies["idElement"] != null)
        {
            idElement = Int32.Parse(Request.Cookies["idElement"].Value);
        }

        tblInformationGroupCollection infoGroupTbl = new tblInformationGroupCollection();

        infoGroupTbl.ReadList(Criteria.NewCriteria(tblInformationGroup.Columns.id, CriteriaOperators.Equal, idElement));

        if (txtTitleUpdate.Text.Trim().Length > 0)
        {
            infoGroupTbl[0].infGroupTitle = txtTitleUpdate.Text;
        }
        else
        {
            lblError.Visible = true;
        }

        infoGroupTbl[0].infGroupDetail = txtDetailUpdate.Text;

        if (lblError.Visible == false)
        {
            infoGroupTbl[0].Update();
            Response.Redirect("information-group.aspx");
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //kill cookies
        if (!IsPostBack)
        {
            ScriptManager.RegisterStartupScript(this, GetType(), "myfunction", "killCookie();", true);
        }



        string itemsString     = string.Empty;
        string popupPageString = string.Empty;

        tblInformationGroupCollection infoGroupTbl = new tblInformationGroupCollection();

        infoGroupTbl.ReadList();

        for (int i = 0; i < infoGroupTbl.Count; i++)
        {
            //item to be shown
            itemsString += "<div class='popup panel-footer'>" +
                           (i + 1) + "- <a id=\"" + infoGroupTbl[i].id + "\" href=\"javascript:__doPostBack('ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder2$LinkButton" + infoGroupTbl[i].id + "','')\" Class='clickable'>" + infoGroupTbl[i].infGroupTitle + "</a><br />" +
                           "</div";
        }



        itemsHtml.InnerHtml = itemsString;
    }
Пример #3
0
    protected void btnDel_Click(object sender, EventArgs e)
    {
        int idElement = 0;

        if (Request.Cookies["idElement"] != null)
        {
            idElement = Int32.Parse(Request.Cookies["idElement"].Value);
        }

        tblInformationGroupCollection infoGroupTbl = new tblInformationGroupCollection();

        infoGroupTbl.ReadList(Criteria.NewCriteria(tblInformationGroup.Columns.id, CriteriaOperators.Equal, idElement));

        infoGroupTbl[0].Delete();

        Response.Redirect("information-group.aspx");
    }
Пример #4
0
    protected void lbUpdate_Click(object sender, EventArgs e)
    {
        int idElement = 0;

        if (Request.Cookies["idElement"] != null)
        {
            idElement = Int32.Parse(Request.Cookies["idElement"].Value);
        }

        tblInformationGroupCollection infoGroupTbl = new tblInformationGroupCollection();

        infoGroupTbl.ReadList(Criteria.NewCriteria(tblInformationGroup.Columns.id, CriteriaOperators.Equal, idElement));

        lblTitle.Text = infoGroupTbl[0].infGroupTitle;

        txtTitleUpdate.Text  = infoGroupTbl[0].infGroupTitle;
        txtDetailUpdate.Text = infoGroupTbl[0].infGroupDetail;

        ScriptManager.RegisterStartupScript(this, GetType(), "myfunction", "open();", true);
    }
Пример #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int itemGet = 0;

        if (Request.QueryString["item"] != null)
        {
            itemGet = int.Parse(Request.QueryString["item"]);
        }
        else
        {
            Response.Redirect("information-add.aspx");
        }

        //fill data

        tblInformationDetailCollection DetailsTbl = new tblInformationDetailCollection();

        DetailsTbl.ReadList(Criteria.NewCriteria(tblInformationDetail.Columns.id, CriteriaOperators.Equal, itemGet));

        if (DetailsTbl.Count > 0)
        {
            setPicHtml.InnerHtml = "<img src='../images/inf/" + DetailsTbl[0].frontFile + "' class='img-responsive' draggable='false'>";
        }

        string             writerStr      = string.Empty;
        tblStaffCollection NewsCreatorTbl = new tblStaffCollection();

        NewsCreatorTbl.ReadList(Criteria.NewCriteria(tblStaff.Columns.id, CriteriaOperators.Equal, DetailsTbl[0].infWriter));

        if (NewsCreatorTbl.Count > 0)
        {
            writerStr = NewsCreatorTbl[0].StaffName + " " + NewsCreatorTbl[0].StaffFamily;
        }

        string addDataString = string.Empty;

        addDataString += "<h3>" + DetailsTbl[0].infDetailTitle + "</h3><br>" +
                         "<span class='code'>Writer: <a>" + writerStr + "</a></span>" +
                         "<p>Information Details: " + DetailsTbl[0].infDetailDescription + "</p>" +
                         "<div class='price'>" +
                         "<span class='text'></span>";

        addDataString += "<span class='price-new'></span>";


        addDataString += "<span class='price-tax'><label class='checkbox'></label></span><br>";


        addDataString += "<span class='points'><small>Insert Date: " + DetailsTbl[0].infDetailInsertDate + "</small></span><br>";

        addDataString += "</div>";

        addDetailHtml.InnerHtml = addDataString;

        //fill data in change part
        //Groups
        tblInformationGroupCollection GroupTbl = new tblInformationGroupCollection();

        GroupTbl.ReadList();


        //Select old items
        if (!IsPostBack)
        {
            if (DetailsTbl[0].infDetailTitle.Length > 0)
            {
                txtTitle.Text = DetailsTbl[0].infDetailTitle;
            }

            if (DetailsTbl[0].infDetailDescription.Length > 0)
            {
                txtDetail.Text = DetailsTbl[0].infDetailDescription;
            }

            for (int i = 0; i < GroupTbl.Count; i++)
            {
                ddlNewsGroup.Items.Add(new ListItem(GroupTbl[i].infGroupTitle, GroupTbl[i].id.ToString()));
            }
            ddlNewsGroup.SelectedValue = DetailsTbl[0].idInfoGroup.ToString();
        }
    }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Add ddl
        tblInformationGroupCollection GroupTbl = new tblInformationGroupCollection();

        GroupTbl.ReadList();

        //tblNewsPicArtCollection newsPicTbl = new tblNewsPicArtCollection();

        if (!IsPostBack)
        {
            for (int i = 0; i < GroupTbl.Count; i++)
            {
                ddlNewsGroup.Items.Add(new ListItem(GroupTbl[i].infGroupTitle, GroupTbl[i].id.ToString()));
            }
        }
        //place data
        string infoString = string.Empty;
        tblInformationDetailCollection detTbl = new tblInformationDetailCollection();

        detTbl.ReadList();

        string addRow     = "<div class='row'>";
        int    countSteps = 0;

        for (int i = 0; i < detTbl.Count; i++)
        {
            GroupTbl.ReadList(Criteria.NewCriteria(tblInformationGroup.Columns.id, CriteriaOperators.Equal, detTbl[i].idInfoGroup));
            //newsPicTbl.ReadList(Criteria.NewCriteria(tblNewsPicArt.Columns.newsId, CriteriaOperators.Equal, newsTbl[i].id));

            if (countSteps == 0)
            {
                infoString += addRow;
            }

            infoString += "<div class='col-md-6 graph-2'>" +
                          "<h3 class='inner-tittle'>Information " + (i + 1) + " </h3>" +
                          "<div class='panel panel-primary two'>" +
                          "<div class='panel-heading'>" + detTbl[i].infDetailTitle + "(" + GroupTbl[0].infGroupTitle + ")" + "</div><div class='panel-body ont two'>";
            if (detTbl[i].frontFileType == 0)
            {
                infoString += "<div><img src='../images/inf/" + detTbl[i].frontFile + "' alt='" + detTbl[i].frontFile + "' style='width: 100%;' /></div>";
            }
            else if (detTbl[i].frontFileType == 1)
            {
                infoString += "<div><video id='video1'><source src='../movie/inf/" + detTbl[i].frontFile + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
            }
            else
            {
                infoString += "<div>" + detTbl[i].frontFile + "</div>";
            }

            infoString += "<p>" + detTbl[i].infDetailDescription + "</p></div>" +
                          "<div class='panel-footer'><a href='information-details.aspx?item=" + detTbl[i].id + "'>edit</a></div></div></div>";
            countSteps++;
            if (countSteps == 2)
            {
                countSteps  = 0;
                infoString += "</div>";
            }
        }

        infHtml.InnerHtml = infoString;
    }