Exemple #1
0
    //添加链接
    protected void BtnSvae_Click(object sender, EventArgs e)
    {
        try
        {
            Tz888.Model.Link.LinkInfoTab Model = new Tz888.Model.Link.LinkInfoTab();
            Model.LinkInfoName = Tz888.Common.Utility.PageValidate.HtmlEncode(txtLinkName.Value.Trim());
            Model.ChannelId    = Convert.ToInt32(DropChannel.SelectedValue);
            Model.LinkId       = Convert.ToInt32(DropLinkType.SelectedValue);
            Model.LinkUrl      = Tz888.Common.Utility.PageValidate.HtmlEncode(txtLinkUrl.Value.Trim());
            Model.Logo         = (ViewState["Log"] == null) ? "" : ViewState["Log"].ToString();
            Model.Remarks      = Tz888.Common.Utility.PageValidate.HtmlEncode(txtRemarks.Value.Trim());
            Model.Sort         = (txtSort.Value.Trim() == "") ? 0 : Convert.ToInt32(txtSort.Value.Trim());

            if (LinkInfoBll.AddLink(Model))
            {
                Tz888.Common.MessageBox.ShowAndRedirect(this.Page, "添加成功!", "LinkManage.aspx", false);
            }
            else
            {
                Tz888.Common.MessageBox.Show(this.Page, "添加失败!");
            }
        }
        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
 protected void BtnModfiy_Click(object sender, EventArgs e)
 {
     try
     {
         Tz888.Model.Link.LinkInfoTab Model = new Tz888.Model.Link.LinkInfoTab();
         Model.LinkInfoId   = (ViewState["LinkInfoId"] == null) ? 0 : Convert.ToInt32(ViewState["LinkInfoId"].ToString());
         Model.LinkInfoName = txtLinkName.Value.Trim();
         Model.ChannelId    = Convert.ToInt32(DropChannel.SelectedValue);
         Model.LinkId       = Convert.ToInt32(DropLinkType.SelectedValue);
         Model.LinkUrl      = txtLinkUrl.Value.Trim();
         Model.Sort         = (txtSort.Value.Trim() == "") ? 0 : Convert.ToInt32(txtSort.Value.Trim());
         Model.Logo         = (ViewState["Logo"] == null) ? "" : ViewState["Logo"].ToString();
         Model.Remarks      = txtRemarks.Value.Trim();
         if (LinkInfoBll.ModfiyLink(Model))
         {
             string strs = ViewState["odlLogo"].ToString();
             if (strs.Length > 0)
             {
                 string[]       str    = strs.Split('/');
                 imgBiz.Service serBiz = new imgBiz.Service(); //webservice
                 serBiz.delCrmImage(str[5], str[4]);
             }
             Tz888.Common.MessageBox.ShowAndRedirect(this.Page, "修改成功!", "LinkManage.aspx", false);
         }
         else
         {
             Tz888.Common.MessageBox.Show(this.Page, "修改失败!");
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }