Пример #1
0
    void LoadData()
    {
        int id = RequestUtils.GetGalleryImageId(this);

        if (id != 0)
        {
            using (GmConnection conn = Global.CreateConnection())
            {
                galleryImage = GalleryImage.GetGalleryImage(conn, id);
            }
        }
        if (galleryImage == null)
        {
            galleryImage = new GalleryImage();
            int gl = RequestUtils.GetGalleryId(this);
            if (gl != 0)
            {
                galleryImage.galleryId = gl;
            }
        }
        using (GmConnection conn = Global.CreateConnection())
        {
            Utils.FillDDL(conn, ddlStatus, "select Id, Name from Statuses", (int)galleryImage.status);
        }
        tbFilename.Text = galleryImage.filename;
        tbName.Text     = galleryImage.name;
        tbText.Text     = galleryImage.text;

        tbName.MaxLength     = MaxLength.GalleryImages.Name;
        tbFilename.MaxLength = MaxLength.GalleryImages.Filename;
        tbText.MaxLength     = MaxLength.GalleryImages.Text;
    }
    private void LoadData()
    {
        gridHelper.ClearDataTable();
        int gl = RequestUtils.GetGalleryId(this);

        hlAdd.NavigateUrl += "?gl=" + gl;
        string query = "select GalleryImages.*, Symbol from GalleryImages left join Statuses on Statuses.Id=Status";

        query += " where GalleryId=" + gl.ToString();
        using (GmConnection conn = Global.CreateConnection())
        {
            conn.Fill(gridHelper.DataTable, query);
        }
        gridHelper.DataTable.DefaultView.Sort = "Name";
    }
    void LoadData()
    {
        int id = RequestUtils.GetGalleryId(this);

        if (id != 0)
        {
            using (GmConnection conn = Global.CreateConnection())
            {
                gallery = Gallery.GetGallery(conn, id);
            }
        }
        if (gallery == null)
        {
            gallery = new Gallery();
            int cm = RequestUtils.GetCommunityId(this);
            if (cm != 0)
            {
                gallery.communityId = cm;
            }
        }
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Log    log = MainMasterPage.InitPage(this);
        string gl  = RequestUtils.GetGalleryId(this).ToString();

        SqlDataSource1.SelectParameters["GalleryId"].DefaultValue = gl;
        SqlDataSource2.SelectParameters["GalleryId"].DefaultValue = gl;
        try
        {
            string galleryName = null;
            using (GmConnection conn = Global.CreateConnection())
            {
                galleryName = conn.ExecuteScalar("select Name from Galleries where Id=" + gl) as string;
            }
            if (galleryName != null)
            {
                (this.Master as MainMasterPage).PageInfo.AddInfo(galleryName);
            }
        }
        catch (Exception ex)
        {
            log.Exception(ex);
        }
    }