示例#1
0
        public override bool CreateUpdateDeleteFriendlyLink(FriendlyLinksInfo friendlyLink, DataProviderAction action)
        {
            bool result;

            if (null == friendlyLink)
            {
                result = false;
            }
            else
            {
                System.Data.Common.DbCommand storedProcCommand = this.database.GetStoredProcCommand("sub_FriendlyLink_CreateUpdateDelete");
                this.database.AddInParameter(storedProcCommand, "Action", System.Data.DbType.Int32, (int)action);
                this.database.AddOutParameter(storedProcCommand, "Status", System.Data.DbType.Int32, 4);
                if (action != DataProviderAction.Create)
                {
                    this.database.AddInParameter(storedProcCommand, "LinkId", System.Data.DbType.Int32, friendlyLink.LinkId);
                }
                this.database.AddInParameter(storedProcCommand, "DistributorUserId", System.Data.DbType.Int32, HiContext.Current.User.UserId);
                if (action != DataProviderAction.Delete)
                {
                    this.database.AddInParameter(storedProcCommand, "ImageUrl", System.Data.DbType.String, friendlyLink.ImageUrl);
                    this.database.AddInParameter(storedProcCommand, "LinkUrl", System.Data.DbType.String, friendlyLink.LinkUrl);
                    this.database.AddInParameter(storedProcCommand, "Title", System.Data.DbType.String, friendlyLink.Title);
                    this.database.AddInParameter(storedProcCommand, "Visible", System.Data.DbType.Boolean, friendlyLink.Visible);
                }
                this.database.ExecuteNonQuery(storedProcCommand);
                result = ((int)this.database.GetParameterValue(storedProcCommand, "Status") == 0);
            }
            return(result);
        }
示例#2
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.btnSubmitLinks.Click += new System.EventHandler(this.btnSubmitLinks_Click);
     this.btnPicDelete.Click   += new System.EventHandler(this.btnPicDelete_Click);
     if (!int.TryParse(base.Request.QueryString["linkId"], out this.linkId))
     {
         base.GotoResourceNotFound();
         return;
     }
     if (!base.IsPostBack)
     {
         FriendlyLinksInfo friendlyLink = StoreHelper.GetFriendlyLink(this.linkId);
         if (friendlyLink == null)
         {
             base.GotoResourceNotFound();
             return;
         }
         this.txtaddTitle.Text             = Globals.HtmlDecode(friendlyLink.Title);
         this.txtaddLinkUrl.Text           = friendlyLink.LinkUrl;
         this.radioShowLinks.SelectedValue = friendlyLink.Visible;
         this.imgPic.ImageUrl      = friendlyLink.ImageUrl;
         this.btnPicDelete.Visible = !string.IsNullOrEmpty(this.imgPic.ImageUrl);
         this.imgPic.Visible       = !string.IsNullOrEmpty(this.imgPic.ImageUrl);
     }
 }
 public static bool CreateFriendlyLink(FriendlyLinksInfo friendlyLink)
 {
     if (null == friendlyLink)
     {
         return(false);
     }
     return(SubsiteStoreProvider.Instance().CreateUpdateDeleteFriendlyLink(friendlyLink, DataProviderAction.Create));
 }
示例#4
0
 public static bool UpdateFriendlyLink(FriendlyLinksInfo friendlyLink)
 {
     if (friendlyLink == null)
     {
         return(false);
     }
     HiCache.Remove("DataCache-FriendLinks");
     return(new FriendlyLinkDao().Update(friendlyLink, null));
 }
示例#5
0
 private void AddNewFriendlyLink(FriendlyLinksInfo friendlyLink)
 {
     if (StoreHelper.CreateFriendlyLink(friendlyLink))
     {
         this.ShowMsg("成功添加了一个友情链接", true);
         return;
     }
     this.ShowMsg("未知错误", false);
 }
示例#6
0
 private void UpdateFriendlyLink(FriendlyLinksInfo friendlyLink)
 {
     if (StoreHelper.UpdateFriendlyLink(friendlyLink))
     {
         this.imgPic.ImageUrl = string.Empty;
         this.ShowMsg("修改友情链接信息成功", true);
         return;
     }
     this.ShowMsg("修改友情链接信息失败", false);
 }
 private void AddNewFriendlyLink(FriendlyLinksInfo friendlyLink)
 {
     if (SubsiteStoreHelper.CreateFriendlyLink(friendlyLink))
     {
         ShowMsg("成功添加了一个友情链接", true);
     }
     else
     {
         ShowMsg("未知错误", false);
     }
 }
示例#8
0
 private void UpdateFriendlyLink(FriendlyLinksInfo friendlyLink)
 {
     if (StoreHelper.UpdateFriendlyLink(friendlyLink))
     {
         this.ShowMsg("修改友情链接信息成功", true);
     }
     else
     {
         this.ShowMsg("修改友情链接信息失败", false);
     }
 }
示例#9
0
 private void UpdateFriendlyLink(FriendlyLinksInfo friendlyLink)
 {
     if (SubsiteStoreHelper.UpdateFriendlyLink(friendlyLink))
     {
         imgPic.ImageUrl = string.Empty;
         ShowMsg("修改友情链接信息成功", true);
     }
     else
     {
         ShowMsg("修改友情链接信息失败", false);
     }
 }
示例#10
0
        public static bool CreateFriendlyLink(FriendlyLinksInfo friendlyLink)
        {
            if (friendlyLink == null)
            {
                return(false);
            }
            HiCache.Remove("DataCache-FriendLinks");
            FriendlyLinkDao friendlyLinkDao = new FriendlyLinkDao();

            friendlyLink.DisplaySequence = friendlyLinkDao.GetMaxDisplaySequence <FriendlyLinksInfo>();
            return(new FriendlyLinkDao().Add(friendlyLink, null) > 0);
        }
示例#11
0
        public void SetShow(HttpContext context)
        {
            int value = base.GetIntParam(context, "id", false).Value;

            if (value < 1)
            {
                throw new HidistroAshxException("错误的参数");
            }
            FriendlyLinksInfo friendlyLink = StoreHelper.GetFriendlyLink(value);

            friendlyLink.Visible = !friendlyLink.Visible;
            StoreHelper.UpdateFriendlyLink(friendlyLink);
            base.ReturnSuccessResult(context, "操作成功", 0, true);
        }
 public override FriendlyLinksInfo GetFriendlyLink(int linkId)
 {
     FriendlyLinksInfo info = new FriendlyLinksInfo();
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM distro_FriendlyLinks WHERE LinkId=@LinkId AND DistributorUserId=@DistributorUserId");
     this.database.AddInParameter(sqlStringCommand, "LinkId", DbType.Int32, linkId);
     this.database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId);
     using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
     {
         if (reader.Read())
         {
             info = DataMapper.PopulateFriendlyLink(reader);
         }
     }
     return info;
 }
示例#13
0
        public override FriendlyLinksInfo GetFriendlyLink(int linkId)
        {
            FriendlyLinksInfo result = new FriendlyLinksInfo();

            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_FriendlyLinks WHERE LinkId=@LinkId");
            this.database.AddInParameter(sqlStringCommand, "LinkId", System.Data.DbType.Int32, linkId);
            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                if (dataReader.Read())
                {
                    result = DataMapper.PopulateFriendlyLink(dataReader);
                }
            }
            return(result);
        }
示例#14
0
        public override FriendlyLinksInfo GetFriendlyLink(int linkId)
        {
            FriendlyLinksInfo info             = new FriendlyLinksInfo();
            DbCommand         sqlStringCommand = database.GetSqlStringCommand("SELECT * FROM Hishop_FriendlyLinks WHERE LinkId=@LinkId");

            database.AddInParameter(sqlStringCommand, "LinkId", DbType.Int32, linkId);
            using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
            {
                if (reader.Read())
                {
                    info = DataMapper.PopulateFriendlyLink(reader);
                }
            }
            return(info);
        }
示例#15
0
        private void grdGroupList_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            int rowIndex = ((System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer).RowIndex;
            int linkId   = (int)this.grdGroupList.DataKeys[rowIndex].Value;

            if (e.CommandName == "SetYesOrNo")
            {
                FriendlyLinksInfo friendlyLink = StoreHelper.GetFriendlyLink(linkId);
                if (friendlyLink.Visible)
                {
                    friendlyLink.Visible = false;
                }
                else
                {
                    friendlyLink.Visible = true;
                }
                StoreHelper.UpdateFriendlyLink(friendlyLink);
                this.BindFriendlyLinks();
                return;
            }
            int displaySequence        = int.Parse((this.grdGroupList.Rows[rowIndex].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text);
            int num                    = 0;
            int replaceDisplaySequence = 0;

            if (e.CommandName == "Fall")
            {
                if (rowIndex < this.grdGroupList.Rows.Count - 1)
                {
                    num = (int)this.grdGroupList.DataKeys[rowIndex + 1].Value;
                    replaceDisplaySequence = int.Parse((this.grdGroupList.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text);
                }
            }
            else
            {
                if (e.CommandName == "Rise" && rowIndex > 0)
                {
                    num = (int)this.grdGroupList.DataKeys[rowIndex - 1].Value;
                    replaceDisplaySequence = int.Parse((this.grdGroupList.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text);
                }
            }
            if (num > 0)
            {
                StoreHelper.SwapFriendlyLinkSequence(linkId, num, displaySequence, replaceDisplaySequence);
                this.BindFriendlyLinks();
            }
        }
示例#16
0
        private void btnSubmitLinks_Click(object sender, System.EventArgs e)
        {
            string text = string.Empty;

            if (this.uploadImageUrl.HasFile)
            {
                try
                {
                    text = StoreHelper.UploadLinkImage(this.uploadImageUrl.PostedFile);
                }
                catch
                {
                    this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                    return;
                }
            }
            FriendlyLinksInfo friendlyLink = StoreHelper.GetFriendlyLink(this.linkId);

            friendlyLink.ImageUrl = (this.uploadImageUrl.HasFile ? text : friendlyLink.ImageUrl);
            friendlyLink.LinkUrl  = this.txtaddLinkUrl.Text;
            friendlyLink.Title    = Globals.HtmlEncode(this.txtaddTitle.Text.Trim());
            friendlyLink.Visible  = this.radioShowLinks.SelectedValue;
            if (string.IsNullOrEmpty(friendlyLink.ImageUrl) && string.IsNullOrEmpty(friendlyLink.Title))
            {
                this.ShowMsg("友情链接Logo和网站名称不能同时为空", false);
            }
            else
            {
                ValidationResults validationResults = Validation.Validate <FriendlyLinksInfo>(friendlyLink, new string[]
                {
                    "ValFriendlyLinksInfo"
                });
                string text2 = string.Empty;
                if (!validationResults.IsValid)
                {
                    foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults)
                    {
                        text2 += Formatter.FormatErrorMessage(current.Message);
                    }
                    this.ShowMsg(text2, false);
                    return;
                }
                this.UpdateFriendlyLink(friendlyLink);
                return;
            }
        }
示例#17
0
        private void btnSubmitLinks_Click(object sender, System.EventArgs e)
        {
            string imageUrl = string.Empty;

            if (!this.uploadImageUrl.HasFile && string.IsNullOrEmpty(this.txtaddTitle.Text.Trim()))
            {
                this.ShowMsg("友情链接Logo和网站名称不能同时为空", false);
                return;
            }
            FriendlyLinksInfo friendlyLinksInfo = new FriendlyLinksInfo();

            if (this.uploadImageUrl.HasFile)
            {
                try
                {
                    imageUrl = StoreHelper.UploadLinkImage(this.uploadImageUrl.PostedFile);
                }
                catch
                {
                    this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                    return;
                }
            }
            friendlyLinksInfo.ImageUrl = imageUrl;
            friendlyLinksInfo.LinkUrl  = this.txtaddLinkUrl.Text;
            friendlyLinksInfo.Title    = Globals.HtmlEncode(this.txtaddTitle.Text.Trim());
            friendlyLinksInfo.Visible  = this.radioShowLinks.SelectedValue;
            ValidationResults validationResults = Validation.Validate <FriendlyLinksInfo>(friendlyLinksInfo, new string[]
            {
                "ValFriendlyLinksInfo"
            });
            string text = string.Empty;

            if (validationResults.IsValid)
            {
                this.AddNewFriendlyLink(friendlyLinksInfo);
                this.Reset();
                return;
            }
            foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults)
            {
                text += Formatter.FormatErrorMessage(current.Message);
            }
            this.ShowMsg(text, false);
        }
示例#18
0
        private void btnPicDelete_Click(object sender, EventArgs e)
        {
            FriendlyLinksInfo friendlyLink = SubsiteStoreHelper.GetFriendlyLink(linkId);

            try
            {
                SubsiteStoreHelper.DeleteImage(friendlyLink.ImageUrl);
            }
            catch
            {
            }
            friendlyLink.ImageUrl = imgPic.ImageUrl = string.Empty;
            if (SubsiteStoreHelper.UpdateFriendlyLink(friendlyLink))
            {
                btnPicDelete.Visible = !string.IsNullOrEmpty(imgPic.ImageUrl);
                imgPic.Visible       = !string.IsNullOrEmpty(imgPic.ImageUrl);
            }
        }
示例#19
0
        private void btnPicDelete_Click(object sender, System.EventArgs e)
        {
            FriendlyLinksInfo friendlyLink = StoreHelper.GetFriendlyLink(this.linkId);

            try
            {
                StoreHelper.DeleteImage(friendlyLink.ImageUrl);
            }
            catch
            {
            }
            friendlyLink.ImageUrl = (this.imgPic.ImageUrl = string.Empty);
            if (StoreHelper.UpdateFriendlyLink(friendlyLink))
            {
                this.btnPicDelete.Visible = !string.IsNullOrEmpty(this.imgPic.ImageUrl);
                this.imgPic.Visible       = !string.IsNullOrEmpty(this.imgPic.ImageUrl);
            }
        }
示例#20
0
        private void btnSubmitLinks_Click(object sender, EventArgs e)
        {
            string str = string.Empty;

            if (uploadImageUrl.HasFile)
            {
                try
                {
                    str = SubsiteStoreHelper.UploadLinkImage(uploadImageUrl.PostedFile);
                }
                catch
                {
                    ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                    return;
                }
            }
            FriendlyLinksInfo friendlyLink = SubsiteStoreHelper.GetFriendlyLink(linkId);

            friendlyLink.ImageUrl = uploadImageUrl.HasFile ? str : friendlyLink.ImageUrl;
            friendlyLink.LinkUrl  = txtaddLinkUrl.Text;
            friendlyLink.Title    = Globals.HtmlEncode(txtaddTitle.Text.Trim());
            friendlyLink.Visible  = radioShowLinks.SelectedValue;
            if (!string.IsNullOrEmpty(friendlyLink.ImageUrl) || !string.IsNullOrEmpty(friendlyLink.Title))
            {
                ValidationResults results = Hishop.Components.Validation.Validation.Validate <FriendlyLinksInfo>(friendlyLink, new string[] { "ValFriendlyLinksInfo" });
                string            msg     = string.Empty;
                if (!results.IsValid)
                {
                    foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                    {
                        msg = msg + Formatter.FormatErrorMessage(result.Message);
                    }
                    ShowMsg(msg, false);
                }
                else
                {
                    UpdateFriendlyLink(friendlyLink);
                }
            }
            else
            {
                ShowMsg("友情链接Logo和网站名称不能同时为空", false);
            }
        }
示例#21
0
        private void btnSubmitLinks_Click(object sender, EventArgs e)
        {
            string empty = string.Empty;

            try
            {
                empty = this.UploadImage();
            }
            catch
            {
                this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                return;
            }
            FriendlyLinksInfo friendlyLink = StoreHelper.GetFriendlyLink(this.linkId);

            friendlyLink.ImageUrl   = empty;
            this.hidOldImages.Value = empty;
            friendlyLink.LinkUrl    = this.txtaddLinkUrl.Text;
            friendlyLink.Title      = Globals.HtmlEncode(this.txtaddTitle.Text.Trim());
            friendlyLink.Visible    = this.ooShowLinks.SelectedValue;
            if (string.IsNullOrEmpty(friendlyLink.ImageUrl) && string.IsNullOrEmpty(friendlyLink.Title))
            {
                this.ShowMsg("友情链接Logo和网站名称不能同时为空", false);
            }
            else
            {
                this.UpdateFriendlyLink(friendlyLink);

                /*ValidationResults validationResults = Validation.Validate(friendlyLink, "ValFriendlyLinksInfo");
                 *              string text = string.Empty;
                 *              if (!validationResults.IsValid)
                 *              {
                 *                      foreach (ValidationResult item in (IEnumerable<ValidationResult>)validationResults)
                 *                      {
                 *                              text += Formatter.FormatErrorMessage(item.Message);
                 *                      }
                 *                      this.ShowMsg(text, false);
                 *              }
                 *              else
                 *              {
                 *                      this.UpdateFriendlyLink(friendlyLink);
                 *              }*/
            }
        }
示例#22
0
        private void grdGroupList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex = ((GridViewRow)((Control)e.CommandSource).NamingContainer).RowIndex;
            int linkId   = (int)grdGroupList.DataKeys[rowIndex].Value;

            if (e.CommandName == "SetYesOrNo")
            {
                FriendlyLinksInfo friendlyLink = SubsiteStoreHelper.GetFriendlyLink(linkId);
                if (friendlyLink.Visible)
                {
                    friendlyLink.Visible = false;
                }
                else
                {
                    friendlyLink.Visible = true;
                }
                SubsiteStoreHelper.UpdateFriendlyLink(friendlyLink);
                BindFriendlyLinks();
            }
            else
            {
                int displaySequence        = int.Parse((grdGroupList.Rows[rowIndex].FindControl("lblDisplaySequence") as Literal).Text);
                int replaceLinkId          = 0;
                int replaceDisplaySequence = 0;
                if (e.CommandName == "Fall")
                {
                    if (rowIndex < (grdGroupList.Rows.Count - 1))
                    {
                        replaceLinkId          = (int)grdGroupList.DataKeys[rowIndex + 1].Value;
                        replaceDisplaySequence = int.Parse((grdGroupList.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as Literal).Text);
                    }
                }
                else if ((e.CommandName == "Rise") && (rowIndex > 0))
                {
                    replaceLinkId          = (int)grdGroupList.DataKeys[rowIndex - 1].Value;
                    replaceDisplaySequence = int.Parse((grdGroupList.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as Literal).Text);
                }
                if (replaceLinkId > 0)
                {
                    SubsiteStoreHelper.SwapFriendlyLinkSequence(linkId, replaceLinkId, displaySequence, replaceDisplaySequence);
                    BindFriendlyLinks();
                }
            }
        }
示例#23
0
        private void btnSubmitLinks_Click(object sender, EventArgs e)
        {
            string str = string.Empty;

            if (!(uploadImageUrl.HasFile || !string.IsNullOrEmpty(txtaddTitle.Text.Trim())))
            {
                ShowMsg("友情链接Logo和网站名称不能同时为空", false);
            }
            else
            {
                FriendlyLinksInfo target = new FriendlyLinksInfo();
                if (uploadImageUrl.HasFile)
                {
                    try
                    {
                        str = SubsiteStoreHelper.UploadLinkImage(uploadImageUrl.PostedFile);
                    }
                    catch
                    {
                        ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                        return;
                    }
                }
                target.ImageUrl = str;
                target.LinkUrl  = txtaddLinkUrl.Text;
                target.Title    = Globals.HtmlEncode(txtaddTitle.Text.Trim());
                target.Visible  = radioShowLinks.SelectedValue;
                ValidationResults results = Hishop.Components.Validation.Validation.Validate <FriendlyLinksInfo>(target, new string[] { "ValFriendlyLinksInfo" });
                string            msg     = string.Empty;
                if (results.IsValid)
                {
                    AddNewFriendlyLink(target);
                    Reset();
                }
                else
                {
                    foreach (ValidationResult result in (IEnumerable <ValidationResult>)results)
                    {
                        msg = msg + Formatter.FormatErrorMessage(result.Message);
                    }
                    ShowMsg(msg, false);
                }
            }
        }
示例#24
0
        private void btnSubmitLinks_Click(object sender, EventArgs e)
        {
            string empty = string.Empty;

            if (this.hidUploadImages.Value.Trim().Length == 0 && string.IsNullOrEmpty(this.txtaddTitle.Text.Trim()))
            {
                this.ShowMsg("友情链接Logo和网站名称不能同时为空", false);
            }
            else
            {
                FriendlyLinksInfo friendlyLinksInfo = new FriendlyLinksInfo();
                try
                {
                    empty = this.UploadImage();
                }
                catch
                {
                    this.ShowMsg("图片上传失败,您选择的不是图片类型的文件,或者网站的虚拟目录没有写入文件的权限", false);
                    return;
                }
                friendlyLinksInfo.ImageUrl = empty;
                this.hidOldImages.Value    = empty;
                friendlyLinksInfo.LinkUrl  = this.txtaddLinkUrl.Text;
                friendlyLinksInfo.Title    = Globals.HtmlEncode(this.txtaddTitle.Text.Trim());
                friendlyLinksInfo.Visible  = this.ooShowLinks.SelectedValue;
                ValidationResults validationResults = Validation.Validate(friendlyLinksInfo, "ValFriendlyLinksInfo");
                string            text = string.Empty;
                if (!validationResults.IsValid)
                {
                    foreach (ValidationResult item in (IEnumerable <ValidationResult>)validationResults)
                    {
                        text += Formatter.FormatErrorMessage(item.Message);
                    }
                    this.ShowMsg(text, false);
                }
                else
                {
                    this.AddNewFriendlyLink(friendlyLinksInfo);
                    this.Reset();
                }
            }
        }
示例#25
0
        private void grdGroupList_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            int linkId = (int)this.grdGroupList.DataKeys[e.RowIndex].Value;
            FriendlyLinksInfo friendlyLink = StoreHelper.GetFriendlyLink(linkId);

            if (StoreHelper.FriendlyLinkDelete(linkId) > 0)
            {
                try
                {
                    StoreHelper.DeleteImage(friendlyLink.ImageUrl);
                }
                catch
                {
                }
                this.BindFriendlyLinks();
                this.ShowMsg("成功删除了选择的友情链接", true);
                return;
            }
            this.ShowMsg("未知错误", false);
        }
示例#26
0
        private void grdGroupList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int linkId = (int)grdGroupList.DataKeys[e.RowIndex].Value;
            FriendlyLinksInfo friendlyLink = SubsiteStoreHelper.GetFriendlyLink(linkId);

            if (SubsiteStoreHelper.FriendlyLinkDelete(linkId) > 0)
            {
                try
                {
                    SubsiteStoreHelper.DeleteImage(friendlyLink.ImageUrl);
                }
                catch
                {
                }
                BindFriendlyLinks();
                ShowMsg("成功删除了选择的友情链接", true);
            }
            else
            {
                ShowMsg("未知错误", false);
            }
        }
示例#27
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.btnSubmitLinks.Click += this.btnSubmitLinks_Click;
     if (!int.TryParse(base.Request.QueryString["linkId"], out this.linkId))
     {
         base.GotoResourceNotFound();
     }
     else if (!base.IsPostBack)
     {
         FriendlyLinksInfo friendlyLink = StoreHelper.GetFriendlyLink(this.linkId);
         if (friendlyLink == null)
         {
             base.GotoResourceNotFound();
         }
         else
         {
             this.txtaddTitle.Text          = Globals.HtmlDecode(friendlyLink.Title);
             this.txtaddLinkUrl.Text        = friendlyLink.LinkUrl;
             this.ooShowLinks.SelectedValue = friendlyLink.Visible;
             this.hidOldImages.Value        = friendlyLink.ImageUrl;
         }
     }
 }
示例#28
0
        public void Delete(HttpContext context)
        {
            int value = base.GetIntParam(context, "id", false).Value;

            if (value < 1)
            {
                throw new HidistroAshxException("错误的参数");
            }
            FriendlyLinksInfo friendlyLink = StoreHelper.GetFriendlyLink(value);

            if (StoreHelper.FriendlyLinkDelete(value))
            {
                try
                {
                    StoreHelper.DeleteImage(friendlyLink.ImageUrl);
                }
                catch
                {
                }
                base.ReturnSuccessResult(context, "成功删除了选择的友情链接", 0, true);
                return;
            }
            throw new HidistroAshxException("未知错误");
        }
示例#29
0
        public override bool CreateUpdateDeleteFriendlyLink(FriendlyLinksInfo friendlyLink, DataProviderAction action)
        {
            if (null == friendlyLink)
            {
                return(false);
            }
            DbCommand storedProcCommand = database.GetStoredProcCommand("cp_FriendlyLink_CreateUpdateDelete");

            database.AddInParameter(storedProcCommand, "Action", DbType.Int32, (int)action);
            database.AddOutParameter(storedProcCommand, "Status", DbType.Int32, 4);
            if (action != DataProviderAction.Create)
            {
                database.AddInParameter(storedProcCommand, "LinkId", DbType.Int32, friendlyLink.LinkId);
            }
            if (action != DataProviderAction.Delete)
            {
                database.AddInParameter(storedProcCommand, "ImageUrl", DbType.String, friendlyLink.ImageUrl);
                database.AddInParameter(storedProcCommand, "LinkUrl", DbType.String, friendlyLink.LinkUrl);
                database.AddInParameter(storedProcCommand, "Title", DbType.String, friendlyLink.Title);
                database.AddInParameter(storedProcCommand, "Visible", DbType.Boolean, friendlyLink.Visible);
            }
            database.ExecuteNonQuery(storedProcCommand);
            return(((int)database.GetParameterValue(storedProcCommand, "Status")) == 0);
        }
示例#30
0
 public abstract bool CreateUpdateDeleteFriendlyLink(FriendlyLinksInfo friendlyLink, DataProviderAction action);