示例#1
0
        void GetGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.ToLower() == "add")
            {
                var row = (e.CommandSource as Control).Parent.Parent as GridViewRow;
                var htd = new Hashtable();

                foreach (TemplateField tf in GridViewManager1.GridView.Columns)
                {
                    var item = tf.FooterTemplate as GenericItem;
                    if (item == null)
                    {
                        continue;
                    }
                    try
                    {
                        foreach (DictionaryEntry de in item.ExtractValues(row))
                        {
                            htd.Add(de.Key, de.Value);
                        }
                    }
                    catch (Exception ex)
                    {
                        //Exceptions.Logger.Error(ex);
                        HtmlHelper.Alert(ex.Message, Page);
                        return;
                    }
                }

                try
                {
                    var ctrl = new LinkWebsiteController();
                    var info = new LinkWebsiteInfo();
                    foreach (System.Reflection.PropertyInfo property in CBO.GetPropertyInfo(typeof(LinkWebsiteInfo)))
                    {
                        if (htd[property.Name] != null)
                        {
                            property.SetValue(info, htd[property.Name], null);
                        }
                    }
                    ctrl.InsertLinkWebsite(info);
                    GridViewManager1.GridView.PageIndex = GridViewManager1.GridView.PageCount;
                    GridViewManager1.LoadData();
                }
                catch (Exception ex)
                {
                    Exceptions.Logger.Error(ex);
                    HtmlHelper.Alert(ex.Message, Page);
                }
            }
        }
示例#2
0
        public ActionResult BoxLinkWebsite(byte priority = 0)
        {
            var linkWebsites = new LinkWebsiteController().ListLinkWebsiteByPriority(priority, _isClearCache);

            return(PartialView(linkWebsites));
        }