示例#1
0
    public void bind(string id)
    {
        Bd_Base_Notice        Bd_Base_NoticeModel = null;
        List <Bd_Base_Notice> NoticeList          = this.baseDataManage.CallMethod("Bd_Base_Notice", "GetList", null, new object[] { string.Format(" id='{0}' ", id) }) as List <Bd_Base_Notice>;

        if (NoticeList != null && NoticeList.Count > 0)
        {
            Bd_Base_NoticeModel = NoticeList[0];
            if (Bd_Base_NoticeModel.Emergency == 1)
            {
                tle.Text = "紧急公告";
            }
            Title.Text        = Bd_Base_NoticeModel.Title;
            ReleaseTime.Text  = Bd_Base_NoticeModel.ReleaseTime.ToString();
            Name.Text         = Bd_Base_NoticeModel.ReleaseName;
            Content.InnerHtml = Bd_Base_NoticeModel.Content.Replace("&lt;", "<").Replace("&gt;", ">");
            if (Bd_Base_NoticeModel.AttachmentFileName != null &&
                Bd_Base_NoticeModel.AttachmentFileName != "" &&
                Bd_Base_NoticeModel.FileAttachment != null &&
                Bd_Base_NoticeModel.FileAttachment.Length > 1)
            {
                attach.InnerHtml = "<a href='DownLoadFile.aspx?did=" + Bd_Base_NoticeModel.id + "&currentuserid=" + this.currentuserid.Value.ToString() + "'>下载附件</a>";
            }
        }
    }
示例#2
0
    /// <summary>
    /// 绑定公告信息
    /// </summary>
    /// <param name="id"></param>
    public void bind(string id)
    {
        Bd_Base_Notice mNotice = (baseDataManage.CallMethod("Bd_Base_Notice", "GetList", null, new Object[] { "id='" + id + "'" }) as List <Bd_Base_Notice>)[0];

        if (mNotice != null)
        {
            Title.Text        = mNotice.Title;
            ReleaseTime.Text  = mNotice.ReleaseTime.ToString();
            Name.Text         = mNotice.ReleaseName;
            Content.InnerHtml = mNotice.Content;

            if (mNotice.AttachmentFileName != null &&
                mNotice.AttachmentFileName != "" &&
                mNotice.FileAttachment != null &&
                mNotice.FileAttachment.Length > 1)
            {
                attach.InnerHtml = "<a href='DownLoadFile.aspx?did=" + mNotice.id + "&currentuserid=" + this.currentuserid.Value.ToString() + "'>下载附件</a>";
                //attach.Visible = true;
            }
            else
            {
                //attach.Visible = false;
            }
        }
    }
 /// <summary>
 /// 绑定要修改的信息
 /// </summary>
 /// <param name="id"></param>
 protected void BindNoticeinfo(Guid id)
 {
     mNotice = (baseDataManage.CallMethod("Bd_Base_Notice", "GetList", null, new Object[] { "id='" + id + "'" }) as List <Bd_Base_Notice>)[0];
     if (mNotice != null)
     {
         this.Title.Text = mNotice.Title;;
         this.ExpirationDateSta.Value  = Convert.ToDateTime(mNotice.StartDate).ToString("yyyy-MM-dd");
         this.ExpirationDateStp.Value  = Convert.ToDateTime(mNotice.ExpirationDate).ToString("yyyy-MM-dd");
         this.IsInternal.SelectedValue = mNotice.IsInternal.ToString();
         this.Emergency.SelectedValue  = mNotice.Emergency.ToString();
         this.rbisroll.SelectedValue   = mNotice.RollFlag.ToString();
         this.content1.Value           = mNotice.Content;
         ClientScript.RegisterStartupScript(this.GetType(), "", " document.getElementById('trAdd').style.display = 'none';", true);
         ViewState["BdBaseNotice"] = mNotice;
     }
 }
示例#4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request["did"] != null && Request["did"].ToString() != "" && Request["did"].ToString() != "0")
     {
         Bd_Base_Notice mNotice  = (baseDataManage.CallMethod("Bd_Base_Notice", "GetList", null, new Object[] { "id='" + Request.QueryString["did"] + "'" }) as List <Bd_Base_Notice>)[0];
         Byte[]         bytes    = mNotice.FileAttachment;
         string         filename = mNotice.AttachmentFileName.Split('|')[0];
         string         fileType = mNotice.AttachmentFileName.Split('|')[1];
         Response.Clear();
         Response.Buffer      = true;
         Response.ContentType = fileType;
         Response.AddHeader("Content-Disposition: ", "attachment;   filename= " + HttpUtility.UrlEncode(filename));
         Response.BinaryWrite(bytes);
         Response.Flush();
         Response.End();
     }
 }
示例#5
0
    /// <summary>
    /// 绑定公告
    /// </summary>
    public void BindNotice()
    {
        StringBuilder sbSQLwhere = new StringBuilder();

        sbSQLwhere.AppendFormat(" (ReleaseCpyNo=left('{0}',12) or ReleaseCpyNo=left('{0}',6)) and CallboardType=1  ", mCompany.UninCode);
        //获取已审核 有效公告 内部或者全部公告
        if (mCompany.RoleType == 1)//平台管理员
        {
            //sbSQLwhere.Append(" and (IsInternal=1 or IsInternal=3) ");
        }
        else if (mCompany.RoleType == 2 || mCompany.RoleType == 3)//供应商和落地运营商
        {
            sbSQLwhere.Append(" and (IsInternal=1 or IsInternal=3) ");
        }
        else if (mCompany.RoleType > 3)//采购 分销
        {
            sbSQLwhere.Append(" and (IsInternal=2 or IsInternal=3) ");
        }
        sbSQLwhere.AppendFormat(" and StartDate <= '{0}' and ExpirationDate >= '{1}'", DateTime.Now.ToString(), DateTime.Now.ToString());
        int         TotalCount = 0;
        IHashObject outParams  = new HashObject();

        outParams.Add("1", "out");
        List <Bd_Base_Notice> notice = baseDataManage.CallMethod("Bd_Base_Notice", "GetBasePager1", outParams, new object[] { TotalCount, AspNetPager1.PageSize, Curr, "*", sbSQLwhere.ToString(), " Emergency " }) as List <Bd_Base_Notice>;

        TotalCount = outParams.GetValue <int>("1");
        AspNetPager1.RecordCount      = TotalCount;
        AspNetPager1.CurrentPageIndex = Curr;
        AspNetPager1.CustomInfoHTML   = "&nbsp;&nbsp;&nbsp;  页码 : <font color=\"red\" size='2px'>" + Curr + "</font> / " + AspNetPager1.PageCount;

        //查找紧急公告
        Bd_Base_Notice Notice = notice.Find(delegate(Bd_Base_Notice _notice)
        {
            return(_notice.Emergency == 1);
        });

        if (Notice != null)
        {
            Hid_Emergency.Value = Notice.id.ToString();
        }
        else
        {
            Hid_Emergency.Value = "";
        }
        if (notice.Count > 0)
        {
            divNotice.Attributes.Add("class", "show");
        }
        else
        {
            divNotice.Attributes.Add("class", "hide");
        }
        //绑定
        Repeater.DataSource = notice;
        Repeater.DataBind();
        if (AspNetPager1.PageCount > 1)
        {
            Pagefooter.Attributes.Add("class", "show");
        }
        else
        {
            Pagefooter.Attributes.Add("class", "hide");
        }
    }
    /// <summary>
    /// 保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btsave_Click(object sender, EventArgs e)
    {
        string msg      = "";
        string FileName = fup.PostedFile.FileName;

        Byte[] bytes      = null;
        string AttachName = "";//附件名

        try
        {
            if (mCompany.RoleType == 1 || mCompany.RoleType == 2)
            {
                if (!string.IsNullOrEmpty(FileName))
                {
                    bytes = new Byte[fup.PostedFile.InputStream.Length];//附件内容
                    fup.PostedFile.InputStream.Read(bytes, 0, bytes.Length);
                    string ex = System.IO.Path.GetExtension(fup.PostedFile.FileName);
                    if (FileSizeIsOver())
                    {
                        msg = "文件大小不能超过4MB";
                    }
                    else
                    {
                        if (attachName.Value.Trim() != "")
                        {
                            AttachName = attachName.Value.Trim() + ex + "|" + fup.PostedFile.ContentType;
                        }
                        else
                        {
                            AttachName = System.IO.Path.GetFileName(fup.PostedFile.FileName) + "|" + fup.PostedFile.ContentType;
                        }
                    }
                }
                if (msg == "")
                {
                    string         strTitle       = CommonManage.TrimSQL(Title.Text.Trim());
                    string         strCon         = CommonManage.TrimSQL(content1.Value);
                    Bd_Base_Notice bd_base_notice = ViewState["BdBaseNotice"] as Bd_Base_Notice;
                    if (bd_base_notice == null || lblid.Text.Trim() == "0" || lblid.Text.Trim() == "")
                    {
                        bd_base_notice = new Bd_Base_Notice();
                    }
                    bd_base_notice.Title          = strTitle;
                    bd_base_notice.Content        = strCon;
                    bd_base_notice.ReleaseTime    = DateTime.Now;
                    bd_base_notice.Emergency      = int.Parse(Emergency.SelectedItem.Value);
                    bd_base_notice.RollFlag       = Convert.ToInt32(rbisroll.SelectedValue);
                    bd_base_notice.IsInternal     = int.Parse(IsInternal.SelectedItem.Value);
                    bd_base_notice.ReleaseAccount = mUser.LoginName;
                    bd_base_notice.ReleaseName    = mUser.UserName;
                    bd_base_notice.ReleaseCpyNo   = mCompany.UninCode;
                    bd_base_notice.ReleaseCpyName = mCompany.UninAllName;
                    bd_base_notice.StartDate      = DateTime.Parse(ExpirationDateSta.Value);
                    bd_base_notice.ExpirationDate = DateTime.Parse(ExpirationDateStp.Value);


                    if (lblid.Text == "0" || lblid.Text.Length == 0)
                    {
                        #region 添加
                        //平台不用审核
                        bd_base_notice.ClickCount         = 0;
                        bd_base_notice.AttachmentFileName = AttachName;
                        bd_base_notice.FileAttachment     = bytes == null ? new byte[0] : bytes;
                        bd_base_notice.CallBoardType      = mCompany.UninCode.Length == 6 ? 1 : 2;
                        //该标题是否已存在
                        bool IsExist = (bool)baseDataManage.CallMethod("Bd_Base_Notice", "IsExist", null, new Object[] { string.Format(" Title='{0}' and ReleaseCpyNo='{1}' ", strTitle, mCompany.UninCode) });
                        if (IsExist)
                        {
                            msg = "该标题已经存在,添加失败!";
                        }
                        else
                        {
                            msg = (bool)baseDataManage.CallMethod("Bd_Base_Notice", "Insert", null, new Object[] { bd_base_notice }) == true ? "添加成功" : "添加失败";
                        }
                        #endregion
                    }
                    else
                    {
                        #region 修改
                        bd_base_notice.id = Guid.Parse(lblid.Text);
                        switch (rbtnlFujian.SelectedValue)
                        {
                        case "0":    //取消附件
                            bd_base_notice.FileAttachment     = new byte[0];
                            bd_base_notice.AttachmentFileName = "";
                            break;

                        case "2":    //重置附件
                            bd_base_notice.FileAttachment = bytes == null ? new byte[0] : bytes;
                            if (AttachName != "")
                            {
                                bd_base_notice.AttachmentFileName = AttachName;
                            }
                            break;
                        }
                        msg = (bool)baseDataManage.CallMethod("Bd_Base_Notice", "Update", null, new Object[] { bd_base_notice }) == true ? "更新成功" : "更新失败";
                        #endregion
                    }
                }
            }
            else
            {
                msg = "当前用户无发布公告权限";
            }
        }
        catch (Exception)
        {
            msg = "操作异常";
        }
        ScriptManager.RegisterStartupScript(this, GetType(), "", "showdialog('" + msg + "');", true);
    }