private void Control_Init()
        {
            #region Set Default Setting

            Lib.PhotoMgr myPhotoMgr = new Lib.PhotoMgr();

            #region Bind Data to droplist

            //Bind DisplayID default data
            droplist_DisplayID.DataSource     = myPhotoMgr.Get_Photo_Settings();
            droplist_DisplayID.DataTextField  = "DisplayID";
            droplist_DisplayID.DataValueField = "DisplayID";
            droplist_DisplayID.DataBind();

            #endregion

            rbtn_IsPageTitle.SelectedValue   = "True";
            droplist_DisplayID.SelectedIndex = 0;
            rbtn_ItemTemplate.SelectedValue  = "Default";
            tbx_ItemTemplateURL.Text         = "";

            #endregion

            if (!DataEval.IsEmptyQuery(_itemdetailid))
            {
                #region Item Properties

                rbtn_IsPageTitle.SelectedValue   = _ispagetitle.ToString();
                droplist_DisplayID.SelectedValue = _displayid;
                rbtn_ItemTemplate.SelectedValue  = _itemtemplate;
                tbx_ItemTemplateURL.Text         = _itemtemplateurl;

                #endregion
            }
        }
        protected void btn_Update_Command(object sender, CommandEventArgs e)
        {
            if (Page.IsValid)
            {
                Lib.PhotoMgr myPhotoMgr = new Lib.PhotoMgr();

                e2Data[] UpdateData =
                {
                    new e2Data("SettingID",        e.CommandArgument.ToString()),
                    new e2Data("DisplayID",        tbx_DisplayID.Text),
                    new e2Data("Image_BrokenURL",  tbx_Image_BrokenURL.Text),
                    new e2Data("IsResize",         rbtn_IsResize.SelectedValue),
                    new e2Data("Resize_Type",      droplist_ResizeType.SelectedValue),
                    new e2Data("Resize_Height",    RadNumericTbx_ResizeHeight.Text),
                    new e2Data("Resize_Width",     RadNumericTbx_ResizeWidth.Text),
                    new e2Data("IsOverlay",        rbtn_IsOverlay.SelectedValue),
                    new e2Data("Overlay_ImageURL", tbx_Overlay_ImageURL.Text),
                    new e2Data("Overlay_Opacity",  RadNumericTbx_Overlay_Opacity.Text),
                    new e2Data("Overlay_Position", droplist_Overlay_Position.SelectedValue),
                    new e2Data("Overlay_PaddingX", RadNumericTbx_Overlay_PaddingX.Text),
                    new e2Data("Overlay_PaddingY", RadNumericTbx_Overlay_PaddingY.Text)
                };

                myPhotoMgr.Edit_Photo_Setting(UpdateData);

                _isedit = false;
                MultiView_PhotoSetting.SetActiveView(View_List);

                Control_Init();
            }
        }
        private void Control_Init()
        {
            if (DataEval.IsEmptyQuery(_photo_itemlistid))
            {
                MultiView_ItemDetail.SetActiveView(View_New);
            }
            else
            {
                MultiView_ItemDetail.SetActiveView(View_Detail);

                if (Request.QueryString["PageLink"] == "Disable")
                {
                }

                // Init List View
                Lib.PhotoMgr myPhotoMgr = new Lib.PhotoMgr();

                Core.Tools.AppItemTemplates myItemTemplate = new Core.Tools.AppItemTemplates();

                switch (_itemtemplate)
                {
                case "Default":
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Gallery/Templates/ItemList_Default.ascx";
                    break;

                case "Custom":
                    myItemTemplate.ItemTemplatePath = _itemtemplateurl;
                    break;

                default:
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Gallery/Templates/ItemList_Default.ascx";
                    break;
                }

                myItemTemplate.Set_Separator("");
                myItemTemplate.Set_DataEmpty("");

                Literal_ItemList.Text  = "Item Template: " + myItemTemplate.ItemTemplatePath + "</br>";
                Literal_ItemList.Text += "Item Alternate Template: " + myItemTemplate.AltPath + "</br>";

                if (DataEval.IsEmptyQuery(myItemTemplate.Separator))
                {
                    Literal_ItemList.Text += "Separator: None" + "</br>";
                }
                else
                {
                    Literal_ItemList.Text += "Separator: " + myItemTemplate.Separator + "</br>";
                }


                if (DataEval.IsEmptyQuery(myItemTemplate.DataEmpty))
                {
                    Literal_ItemList.Text += "DataEmpty Template: None" + "</br>";
                }
                else
                {
                    Literal_ItemList.Text += "DataEmpty Template: " + myItemTemplate.DataEmpty + "</br>";
                }
            }
        }
Esempio n. 4
0
        protected void btn_Update_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                Lib.PhotoMgr myPhotoMgr = new Lib.PhotoMgr();

                e2Data[] UpdateData =
                {
                    new e2Data("PhotoID",           _itemid),
                    new e2Data("Photo_Title",       tbx_Photo_Title.Text),
                    new e2Data("Description",       TextEditor_Description.Content),
                    new e2Data("ImageURL",          tbx_ImageURL.Text),
                    new e2Data("ImageURL_Type",     droplist_ImageType.SelectedValue),
                    new e2Data("AlternateText",     tbx_AlternateText.Text),
                    new e2Data("IsActive",          rbtn_IsActive.SelectedValue),
                    new e2Data("LastUpdate_Date",   DateTime.Now.ToString()),
                    new e2Data("LastUpdate_UserID", Security.Users.UserStatus.Current_UserID(this.Page))
                };

                myPhotoMgr.Edit_Photo(UpdateData);

                // Finish Update Close Window
                string _finishupdate_script = string.Format("CloseAndRebind({0});", DataEval.QuoteText("Module_ControlPanel"));
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "myScript", _finishupdate_script, true);
            }
        }
        protected void lbtn_Edit_Command(object sender, CommandEventArgs e)
        {
            btn_Add.Visible    = false;
            btn_Update.Visible = true;

            _isedit = true;
            _isnew  = false;

            Reset_Form();

            // Load Data
            Lib.PhotoMgr      myPhotoMgr      = new Lib.PhotoMgr();
            Lib.Photo_Setting myPhoto_Setting = myPhotoMgr.Get_Photo_Setting_byID(e.CommandArgument.ToString());

            if (e.CommandArgument.ToString() == "1")
            {
                tbx_DisplayID.Enabled = false;
            }
            else
            {
                tbx_DisplayID.Enabled = true;
            }

            btn_Update.CommandArgument  = myPhoto_Setting.SettingID;
            HiddenField_DisplayID.Value = myPhoto_Setting.DisplayID;
            tbx_DisplayID.Text          = myPhoto_Setting.DisplayID;
            tbx_Image_BrokenURL.Text    = myPhoto_Setting.Image_BrokenURL;

            rbtn_IsResize.SelectedValue = myPhoto_Setting.IsResize.ToString();

            if (myPhoto_Setting.IsResize)
            {
                Panel_IsResize.Visible            = true;
                droplist_ResizeType.SelectedValue = StringEnum.GetStringValue(myPhoto_Setting.Resize_Type);
                RadNumericTbx_ResizeHeight.Value  = myPhoto_Setting.Resize_Height;
                RadNumericTbx_ResizeWidth.Value   = myPhoto_Setting.Resize_Width;
            }

            rbtn_IsOverlay.SelectedValue = myPhoto_Setting.IsOverlay.ToString();

            if (myPhoto_Setting.IsOverlay)
            {
                Panel_IsOverlay.Visible                 = true;
                tbx_Overlay_ImageURL.Text               = myPhoto_Setting.Overlay_ImageURL;
                RadNumericTbx_Overlay_Opacity.Value     = myPhoto_Setting.Overlay_Opacity;
                droplist_Overlay_Position.SelectedValue = StringEnum.GetStringValue(myPhoto_Setting.Overlay_Position);
                RadNumericTbx_Overlay_PaddingX.Value    = myPhoto_Setting.Overlay_PaddingX;
                RadNumericTbx_Overlay_PaddingY.Value    = myPhoto_Setting.Overlay_PaddingY;
            }

            MultiView_PhotoSetting.SetActiveView(View_Edit);
        }
        protected void lbtn_Delete_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandArgument.ToString() == "1")
            {
                Nexus.Core.Tools.AlertMessage.Show_Alert(
                    this.Page,
                    "<h4>Default photo setting cannot be deleted.</h4>", "Warning!");
            }
            else
            {
                Lib.PhotoMgr myPhotoMgr = new Lib.PhotoMgr();
                myPhotoMgr.Remove_Photo_Setting(e.CommandArgument.ToString());

                Control_Init();
            }
        }
        private void Control_Init()
        {
            #region Set Default Setting

            Lib.PhotoMgr myPhotoMgr = new Lib.PhotoMgr();

            #region Bind Data to droplist

            //Bind DisplayID default data
            droplist_DisplayID.DataSource     = myPhotoMgr.Get_Photo_Settings();
            droplist_DisplayID.DataTextField  = "DisplayID";
            droplist_DisplayID.DataValueField = "DisplayID";
            droplist_DisplayID.DataBind();

            #endregion

            CategoryTree_Menu.UnSelectItems();
            tbx_Photo_ItemDetailURL.Text       = "/";
            droplist_SortOrder.SelectedIndex   = 0;
            droplist_Orientation.SelectedIndex = 0;
            droplist_DisplayID.SelectedIndex   = 0;
            rbtn_ItemTemplate.SelectedValue    = "Default";
            tbx_ItemTemplateURL.Text           = "";
            rbtn_Enable_Pager.SelectedValue    = "True";
            RadNumericTbx_NumPerPage.Value     = 12;
            RadNumericTbx_TotalNumber.Value    = 100;

            #endregion

            if (!DataEval.IsEmptyQuery(_photo_itemlistid))
            {
                #region Item Properties

                CategoryTree_Menu.Checked_CategoryID = _categoryid;
                tbx_Photo_ItemDetailURL.Text         = _photo_itemdetailurl;
                droplist_SortOrder.SelectedValue     = _sortorder;
                droplist_Orientation.SelectedValue   = _orientation;
                droplist_DisplayID.SelectedValue     = _displayid;
                rbtn_ItemTemplate.SelectedValue      = _itemtemplate;
                tbx_ItemTemplateURL.Text             = _itemtemplateurl;
                rbtn_Enable_Pager.SelectedValue      = _enable_pager.ToString();
                RadNumericTbx_NumPerPage.Value       = _numberperpage;
                RadNumericTbx_TotalNumber.Value      = _totalnumber;

                #endregion
            }
        }
        private void Control_Init()
        {
            //if (_isedit)
            //{
            //    MultiView_PhotoSetting.SetActiveView(View_Edit);
            //}
            //else
            //{
            //    MultiView_PhotoSetting.SetActiveView(View_List);
            //}

            Lib.PhotoMgr myPhotoMgr = new Lib.PhotoMgr();

            ListView_PhotoSettings.DataSource   = myPhotoMgr.Get_Photo_Settings();
            ListView_PhotoSettings.DataKeyNames = new string[] { "SettingID" };
            ListView_PhotoSettings.DataBind();
        }
Esempio n. 9
0
        private void Control_PreInit()
        {
            if (!DataEval.IsEmptyQuery(Request["NexusPhotoID"]))
            {
                // Add View Count
                Lib.PhotoMgr myPhotoMgr = new Lib.PhotoMgr();

                Lib.Photo myPhoto = myPhotoMgr.Get_Photo(Request["NexusPhotoID"]);

                int _view_count = Convert.ToInt32(myPhoto.View_Count) + 1;

                e2Data[] UpdateData_Item =
                {
                    new e2Data("PhotoID",    myPhoto.PhotoID),
                    new e2Data("View_Count", _view_count.ToString())
                };

                myPhotoMgr.Edit_Photo(UpdateData_Item);
            }
        }
Esempio n. 10
0
        private void Control_Init()
        {
            if (!DataEval.IsEmptyQuery(Request["NexusPhotoID"]))
            {
                Lib.PhotoMgr myPhotoMgr = new Lib.PhotoMgr();
                Lib.Photo    myPhoto    = myPhotoMgr.Get_Photo(Request["NexusPhotoID"]);

                tbx_Photo_Title.Text             = myPhoto.Photo_Title;
                TextEditor_Description.Content   = myPhoto.Description;
                droplist_ImageType.SelectedValue = StringEnum.GetStringValue(myPhoto.ImageURL_Type);
                tbx_ImageURL.Text           = myPhoto.ImageURL;
                tbx_AlternateText.Text      = myPhoto.AlternateText;
                rbtn_IsActive.SelectedValue = myPhoto.IsActive.ToString();

                _itemid = myPhoto.PhotoID;
                ViewState["PhotoID"] = _itemid;
            }
            else
            {
                btn_Update.Enabled = false;
            }
        }
        protected void CustomValidator_DisplayID_ServerValidate(object source, ServerValidateEventArgs args)
        {
            Lib.PhotoMgr myPhotoMgr = new Lib.PhotoMgr();

            if (_isnew)
            {
                // Add New
                if (myPhotoMgr.Chk_Photo_Setting(tbx_DisplayID.Text))
                {
                    args.IsValid = false;
                }
                else
                {
                    args.IsValid = true;
                }
            }
            else
            {
                // Edit
                if (HiddenField_DisplayID.Value == tbx_DisplayID.Text)
                {
                    args.IsValid = true;
                }
                else
                {
                    if (myPhotoMgr.Chk_Photo_Setting(tbx_DisplayID.Text))
                    {
                        args.IsValid = false;
                    }
                    else
                    {
                        args.IsValid = true;
                    }
                }
            }
        }
Esempio n. 12
0
        private void Control_Init()
        {
            if (DataEval.IsEmptyQuery(_itemdetailid))
            {
                MultiView_ItemDetail.SetActiveView(View_New);
            }
            else
            {
                MultiView_ItemDetail.SetActiveView(View_Detail);

                if (Request.QueryString["PageLink"] == "Disable")
                {
                    hlink_Edit_Item.Enabled = false;
                }

                Lib.Photo myPhoto;

                // Init Comment Form
                if (!DataEval.IsEmptyQuery(Request["NexusPhotoID"]))
                {
                    Lib.PhotoMgr myPhotoMgr = new Lib.PhotoMgr();

                    myPhoto = myPhotoMgr.Get_Photo(Request["NexusPhotoID"], _displayid);

                    if (Security.Users.UserStatus.Validate_PageAuth_Modify(this.Page))
                    {
                        hlink_Edit_Item.Visible = true;

                        hlink_Edit_Item.Attributes["href"]    = "#";
                        hlink_Edit_Item.Attributes["onclick"] = string.Format(
                            "return Show_ControlManager('/App_AdminCP/SiteAdmin/PoP_ControlPanel.aspx?ControlID={0}&NexusPhotoID={1}');",
                            "43D902AF-A0DC-4036-BC46-C98EC84B6698",
                            myPhoto.PhotoID);
                    }
                    else
                    {
                        hlink_Edit_Item.Visible = false;
                    }

                    // Page Title
                    if (_ispagetitle)
                    {
                        Page.Title = myPhoto.Photo_Title;
                    }


                    Core.Tools.AppItemTemplates myItemTemplate = new Core.Tools.AppItemTemplates();

                    switch (_itemtemplate)
                    {
                    case "Default":
                        myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Gallery/Templates/ItemDetail_Default.ascx";
                        break;

                    case "Custom":
                        myItemTemplate.ItemTemplatePath = _itemtemplateurl;
                        break;

                    default:
                        myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Gallery/Templates/ItemDetail_Default.ascx";
                        break;
                    }

                    FormView_ItemDetail.ItemTemplate = Page.LoadTemplate(myItemTemplate.ItemTemplatePath);

                    List <Lib.Photo> myPhotos = new List <Lib.Photo>();
                    myPhotos.Add(myPhoto);

                    try
                    {
                        FormView_ItemDetail.DataSource   = myPhotos;
                        FormView_ItemDetail.DataKeyNames = new string[] { "PhotoID" };
                        FormView_ItemDetail.DataBind();
                    }
                    catch
                    {
                        // Load Template Failed
                    }
                }
                else
                {
                    // No Post ID
                    hlink_Edit_Item.Visible = false;
                }
            }
        }
        private void Control_Init()
        {
            // Enable Photo Manger
            if (Security.Users.UserStatus.Validate_PageAuth_Modify(this.Page))
            {
                hlink_Edit_Item.Visible = true;

                hlink_Edit_Item.Attributes["href"]    = "#";
                hlink_Edit_Item.Attributes["onclick"] = string.Format(
                    "return Show_ControlManager('/App_AdminCP/SiteAdmin/PoP_ControlPanel.aspx?ControlID={0}');",
                    "4979A4B0-3F09-4579-9520-90AC64257116"
                    );
            }
            else
            {
                hlink_Edit_Item.Visible = false;
            }

            // Init Control
            if (!DataEval.IsEmptyQuery(_photo_itemlistid))
            {
                if (Request.QueryString["PageLink"] == "Disable")
                {
                    ListView_ItemList.Enabled = false;
                    hlink_Edit_Item.Enabled   = false;
                }

                // Init List View
                Lib.PhotoMgr myPhotoMgr = new Lib.PhotoMgr();


                ListView_ItemList.DataSource = myPhotoMgr.Get_Photos(_categoryid,
                                                                     _sortorder,
                                                                     _orientation,
                                                                     true.ToString(),
                                                                     _totalnumber,
                                                                     _photo_itemdetailurl,
                                                                     _displayid);

                ListView_ItemList.DataKeyNames = new string[] { "PhotoID" };

                Core.Tools.AppItemTemplates myItemTemplate = new Core.Tools.AppItemTemplates();

                switch (_itemtemplate)
                {
                case "Default":
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Gallery/Templates/ItemList_Default.ascx";
                    break;

                case "Custom":
                    myItemTemplate.ItemTemplatePath = _itemtemplateurl;
                    break;

                default:
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_Gallery/Templates/ItemList_Default.ascx";
                    break;
                }

                myItemTemplate.Set_DataEmpty("");

                ListView_ItemList.ItemTemplate            = Page.LoadTemplate(myItemTemplate.ItemTemplatePath);
                ListView_ItemList.AlternatingItemTemplate = Page.LoadTemplate(myItemTemplate.AltPath);

                if (!DataEval.IsEmptyQuery(myItemTemplate.DataEmpty))
                {
                    ListView_ItemList.EmptyDataTemplate = Page.LoadTemplate(myItemTemplate.DataEmpty);
                }

                try
                {
                    ListView_ItemList.DataBind();
                }
                catch
                {
                    // Load Template Failed
                }

                DataPager_ItemList.PageSize = _numberperpage;
                DataPager_ItemList.Visible  = _enable_pager;
            }
        }