예제 #1
0
        protected void PhotoGridView_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e)
        {
            int rowIndex = int.TryParse(e.Parameters, out int result) ? result : -1;

            Session["ads_id"] = AdvertGridView.GetRowValues(rowIndex, "ads_id");
            PhotoGridView.DataBind();
        }
예제 #2
0
        protected void PhotoGridView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxUploadControl uc = PhotoGridView.FindEditRowCellTemplateControl((GridViewDataColumn)PhotoGridView.Columns["file_name"], "PhotoUploadControl") as ASPxUploadControl;

            if (uc != null)
            {
                uc.Visible = false;
            }
            e.Cancel = true;
            PhotoGridView.CancelEdit();
        }
예제 #3
0
        protected void PhotoCallbackPanel_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e)
        {
            List <AdvertPhoto> photoList  = new List <AdvertPhoto>();
            DataTable          PhotoTable = new DataTable();

            int rowIndex = int.TryParse(e.Parameter, out int result) ? result : -1;

            if (rowIndex >= 0)
            {
                int ads_photo_id = PhotoGridView.GetRowValues(rowIndex, "ads_photo_id") as int? ?? 0;
                using (var cnn = new SqlConnection(connectionString))
                {
                    cnn.Open();
                    using (var cmd = cnn.CreateCommand())
                    {
                        cmd.CommandText = "SELECT * FROM dbo.AdvertPhotos WHERE ads_photo_id = @ads_photo_id";
                        cmd.Parameters.Add("@ads_photo_id", SqlDbType.Int).Value = ads_photo_id;
                        PhotoTable.Load(cmd.ExecuteReader());
                        foreach (DataRow row in PhotoTable.Rows)
                        {
                            photoList.Add(new AdvertPhoto()
                            {
                                ads_photo_id = int.Parse(row["ads_photo_id"].ToString()),
                                ads_id       = int.Parse(row["ads_id"].ToString()),
                                file_name    = row["file_name"].ToString(),
                                photo        = (byte[])row["photo"]
                            });
                            row["url"] = string.Format("~/PhotoHandler.ashx?ads_photo_id={0}", row["ads_photo_id"].ToString());
                            PhotoTable.AcceptChanges();

                            Session["photo_url"]     = photoList;
                            PhotoRepeater.DataSource = PhotoTable;
                            PhotoRepeater.DataBind();
                        }
                    }
                }
            }
        }
예제 #4
0
파일: MainWindow.cs 프로젝트: rubenv/tripod
        void BuildLayout ()
        {
            primary_vbox = new VBox ();

            var shell = action_manager.UIManager.GetWidget ("/MainMenu");
            primary_vbox.PackStart (shell, false, false, 0);
            
            photo_view = new PhotoGridView ();
            photo_view.Show ();

            var photo_view_scrolled = new ScrolledWindow ();
            photo_view_scrolled.Add (photo_view);
            photo_view_scrolled.Show ();
            primary_vbox.PackStart (photo_view_scrolled, true, true, 8);

            var model = PhotoModelFactory.GetModel (Core.MainPhotoSourceCache.AllPhotos);
            model.Reload ();
            Hyena.Log.DebugFormat ("Model count: {0}", model.Count);
            photo_view.SetModel (model);

            var hbox = new HBox (false, 5);

            hbox.Add (new Label ("Size"));

            var scale = new HScale (50, 800, 10);
            scale.Value = 140;
            scale.ValueChanged += (s, a) => {
                photo_view.ThumbnailSize = (int) scale.Value;
            };
            hbox.Add (scale);
            hbox.ShowAll ();

            primary_vbox.PackEnd (hbox, false, true, 0);

            primary_vbox.Show ();
            Add (primary_vbox);
        }