Ejemplo n.º 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;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        Log log = MainMasterPage.InitPage(this);
        int id  = RequestUtils.GetGalleryImageId(this);

        this.SqlDataSource1.SelectParameters["GalleryImageId"].DefaultValue = id.ToString();
        try
        {
            if (id != 0)
            {
                string name = null;
                using (GmConnection conn = Global.CreateConnection())
                {
                    name = conn.ExecuteScalar("select Name from GalleryImages where Id=" + id) as string;
                }
                if (name != null)
                {
                    (this.Master as MainMasterPage).PageInfo.AddInfo(name);
                }
            }
        }
        catch (Exception ex)
        {
            log.Exception(ex);
        }
    }