public static NoticeInfo getNoticeByID(int id)
    {
        SqlConnection con = ConnectionHelper.GetConnection();
        string sp = "USP_getNotice_ByNoticeID";
        SqlCommand cmd = new SqlCommand(sp, con);
        cmd.Parameters.Add(new SqlParameter("@ID",id));
        cmd.CommandType=CommandType.StoredProcedure;
        try
        {
            SqlDataReader _Reader = cmd.ExecuteReader();
            _Reader.Read();

            NoticeInfo _notice = new NoticeInfo();
            _notice.FacutlyID = int.Parse(_Reader["FacultyID"].ToString());
            _notice.BatchID = int.Parse(_Reader["BatchID"].ToString());
            _notice.Reference= _Reader["Reference"].ToString();
            _notice.Notice= _Reader["Notice"].ToString();
            _notice.PostedOn= Convert.ToDateTime(_Reader["PostedOn"]);
            _notice.PostedBy= int.Parse(_Reader["PostedBy"].ToString());
            return _notice;
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    protected void lbtnSave_Click(object sender, EventArgs e)
    {
        try
        {
            NoticeFacade facade = new NoticeFacade();
            NoticeInfo notice = new NoticeInfo();
            notice.Name = txtName.Text.Trim();
            notice.Title = txtTitle.Text.Trim();
            notice.Message = txtContent.Text;
            DateTime startTime = DateTime.Now;
            if (txtStartTime.Text.Trim() != "")
            {
                startTime = DateTime.Parse(txtStartTime.Text);
            }
            notice.StartTime = startTime;
            DateTime endTime = DateTime.Now.AddYears(100);
            if (txtEndTime.Text.Trim() != "")
            {
                endTime = DateTime.Parse(txtEndTime.Text);
            }
            notice.EndTime = endTime;
            notice.IsHasDetail = cbHasDetail.Checked;
            notice.IsForeBold = cbIsForeBold.Checked;
            notice.IsForeRed = cbIsForeRed.Checked;
            notice.IsEnd = cbIsEnd.Checked;

            string msg;
            if (IsAdd)
            {
                facade.AddNotice(notice);
                msg = string.Format("添加通知成功 - \"{0}\"", txtName.Text.Trim());
            }
            else
            {
                notice.Id = Request["id"];
                facade.ModifyNotice(notice);
                msg = string.Format("修改通知成功 - \"{0}\"", txtName.Text.Trim());
            }
            JavascriptAlertAndRedirect(msg, "NoticeManagement.aspx");
        }
        catch
        {
            JavascriptAlert(@"保存通知发生未知错误,请联系系统配置人员!");
        }
    }
Beispiel #3
0
    public void EditNotice()
    {
        int    Notice_ID        = tools.CheckInt(Request.Form["Notice_ID"]);
        int    Notice_Cate      = tools.CheckInt(Request.Form["Notice_Cate"]);
        int    Notice_IsHot     = tools.CheckInt(Request.Form["Notice_IsHot"]);
        int    Notice_IsAudit   = tools.CheckInt(Request.Form["Notice_IsAudit"]);
        int    Notice_SysUserID = tools.CheckInt(Request.Form["Notice_SysUserID"]);
        int    Notice_SellerID  = tools.CheckInt(Request.Form["Notice_SellerID"]);
        string Notice_Title     = tools.CheckStr(Request.Form["Notice_Title"]);
        string Notice_Content   = Request.Form["Notice_Content"];

        if (Notice_Cate == 0)
        {
            Public.Msg("error", "错误信息", "请选择类别!", false, "{back}"); return;
        }
        if (Notice_Title == "")
        {
            Public.Msg("error", "错误信息", "请填写公告主题", false, "{back}"); return;
        }

        NoticeInfo entity = new NoticeInfo();

        entity.Notice_ID        = Notice_ID;
        entity.Notice_Cate      = Notice_Cate;
        entity.Notice_IsHot     = Notice_IsHot;
        entity.Notice_IsAudit   = Notice_IsAudit;
        entity.Notice_SysUserID = Notice_SysUserID;
        entity.Notice_SellerID  = Notice_SellerID;
        entity.Notice_Title     = Notice_Title;
        entity.Notice_Content   = Notice_Content;
        entity.Notice_Addtime   = DateTime.Now;
        entity.Notice_Site      = Public.GetCurrentSite();

        if (MyBLL.EditNotice(entity, Public.GetUserPrivilege()))
        {
            Public.Msg("positive", "操作成功", "操作成功", true, "notice_list.aspx");
        }
        else
        {
            Public.Msg("error", "错误信息", "操作失败,请稍后重试", false, "{back}");
        }
    }
Beispiel #4
0
        protected override void AttachChildControls()
        {
            string str = Globals.RequestQueryStr("type");
            int    id  = Globals.RequestQueryNum("id");

            this.litTitle   = (Literal)this.FindControl("litTitle");
            this.litPubTime = (Literal)this.FindControl("litPubTime");
            this.litMemo    = (Literal)this.FindControl("litMemo");
            NoticeInfo noticeInfo = NoticeBrowser.GetNoticeInfo(id);

            if (noticeInfo != null)
            {
                int    sendType = noticeInfo.SendType;
                string str2     = "公告";
                if (sendType == 1)
                {
                    str2 = "消息";
                }
                this.litTitle.Text = noticeInfo.Title;
                DateTime time = noticeInfo.PubTime.HasValue ? noticeInfo.PubTime.Value : noticeInfo.AddTime;
                this.litPubTime.Text = "<span>" + time.ToString("yyyy-MM-dd") + "</span><span><i class='glyphicon glyphicon-time'></i>" + time.ToString("HH:mm") + "</span>";
                this.litMemo.Text    = string.Concat(new object[] { noticeInfo.Memo, "<p class=\"lookall\"><a href=\"notice.aspx?type=", sendType, "\">更多", str2, "&gt;&gt;</a></p>" });
                PageTitle.AddSiteNameTitle(noticeInfo.Title);
                if (str != "view")
                {
                    if (noticeInfo.IsPub == 1)
                    {
                        NoticeBrowser.ViewNotice(MemberProcessor.GetCurrentMember().UserId, id);
                    }
                    else
                    {
                        HttpContext.Current.Response.Write("文章未发布!");
                        HttpContext.Current.Response.End();
                    }
                }
            }
            else
            {
                HttpContext.Current.Response.Redirect("/default.aspx");
                HttpContext.Current.Response.End();
            }
        }
    public void Update(float dTime)
    {
        if (bShowSetting)
        {
            m_SettingWind.Update(dTime);
        }
        if (bShowTipBox_0)
        {
            if (!m_TipBox_0.Update(dTime))
            {
                bShowTipBox_0 = false;
                ShowMask(false, 9);
            }
        }
        if (m_Notice.m_BaseWndObject == null)
        {
            NoticeInfo info = m_NoticeMgr.Update(dTime);
            if (info != null)
            {
                m_Notice.ShowNotice(info);
            }
        }
        else
        {
            m_Notice.Update(dTime);
        }


        m_FriendSysMgr.Update(dTime);
        m_ShopLogicMgr.Update(dTime);
        m_MatchMsgBox.Update(dTime);
        if (m_SysTipsUI.m_BaseWndObject != null)
        {
            m_SysTipsUI.Update(dTime);
        }
        m_NameCardsUI.Update(dTime);
        m_ActivityRewardWnd.Upate(dTime);
        m_HeadWind.UpdateMatchTime();
        m_HeadWind.UpdateGameDelayedData();
        m_AccountMgrUI.Update(dTime);
        m_GameLogicMgr.Update(dTime);
    }
Beispiel #6
0
    void refreshNotice()
    {
        NetMgr nm = NetMgr.GetInstance();

        nm.request_apis("get_message", "type", "notice", data => {
            GetMessage msg = JsonUtility.FromJson <GetMessage> (data.ToString());
            if (msg.errcode != 0)
            {
                Debug.Log("get_message fail " + msg.errcode);
                return;
            }

            NoticeInfo info = new NoticeInfo();
            info.content    = msg.msg;
            info.playtimes  = 0;

            notices.Add(info);
            play();
        });
    }
Beispiel #7
0
        private NoticeInfo ReadFromXml(string path)
        {
            NoticeInfo notice = new NoticeInfo();

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(path);

            XmlNode root        = xmlDoc.SelectSingleNode("Notice");
            XmlNode nodeTitle   = root.SelectSingleNode("Title");
            XmlNode nodeTime    = root.SelectSingleNode("CreateTime");
            XmlNode nodeContent = root.SelectSingleNode("Content");

            notice.Title      = nodeTitle.InnerText;
            notice.TimeString = nodeTime.InnerText;
            notice.Content    = nodeContent.InnerText;
            notice.FileName   = Path.GetFileNameWithoutExtension(path);

            return(notice);
        }
Beispiel #8
0
        protected void gvDataBind()
        {
            DataTable dt = NoticeInfo.getNoticeList();

            DataView view = dt.DefaultView;
            string   sort = (string)ViewState["SortExpression"] + " " + (string)ViewState["SortDir"];

            view.Sort = sort;

            if (dt.Rows.Count == 0)
            {
                dt.Rows.Add(dt.NewRow());
                UI.BindCtrl(dt.DefaultView, gvNotice, AspNetPager1);
                gvNotice.Rows[0].Visible = false;
            }
            else
            {
                UI.BindCtrl(dt.DefaultView, gvNotice, AspNetPager1);
            }
        }
Beispiel #9
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         for (int i = 0; i < gvNotice.Rows.Count; i++)
         {
             CheckBox ckb = gvNotice.Rows[i].FindControl("ckbChoose") as CheckBox;
             if (ckb.Checked == true)
             {
                 int noticeid = Convert.ToInt32(gvNotice.DataKeys[i].Value);
                 NoticeInfo.DelNotice(noticeid);
             }
         }
         gvDataBind();
     }
     catch (Exception Ex)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('错误信息:" + Ex.Message + "');", true);
     }
 }
Beispiel #10
0
        protected void NoticeInit()
        {
            DataTable dt = NoticeInfo.getNoticeAsc();

            if (dt.Rows.Count > 7)
            {
                for (int i = 0; i < 7; i++)
                {
                    string strTitle = dt.Rows[i]["NoticeTitle"].ToString();
                    string strTime  = "[" + dt.Rows[i]["NoticeTime"].ToString() + "]";
                    int    NoticeId = Convert.ToInt32(dt.Rows[i]["NoticeId"].ToString());
                    string strUrl   = "Notice/NoticeManage.aspx";

                    HtmlGenericControl li = new HtmlGenericControl();
                    li.InnerHtml = "<li> <a href='" + strUrl + "' style='text-decoration:none; color:Blank;'>" + strTitle + "</a> </li>";
                    uNotice.Controls.Add((Control)li);

                    HtmlGenericControl lit = new HtmlGenericControl();
                    lit.InnerHtml = "<li> <a style='text-decoration:none'>" + strTime + "</a> </li>";
                    uTime5.Controls.Add((Control)lit);
                }
            }
            else
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string strTitle = dt.Rows[i]["NoticeTitle"].ToString();
                    string strTime  = "[" + dt.Rows[i]["NoticeTime"].ToString() + "]";
                    int    NoticeId = Convert.ToInt32(dt.Rows[i]["NoticeId"].ToString());
                    string strUrl   = "Notice/NoticeManage.aspx";

                    HtmlGenericControl li = new HtmlGenericControl();
                    li.InnerHtml = "<li> <a href='" + strUrl + "' style='text-decoration:none; color:Blank;'>" + strTitle + "</a> </li>";
                    uNotice.Controls.Add((Control)li);

                    HtmlGenericControl lit = new HtmlGenericControl();
                    lit.InnerHtml = "<li> <a style='text-decoration:none'>" + strTime + "</a> </li>";
                    uTime5.Controls.Add((Control)lit);
                }
            }
        }
	 public static void CreateNotice(NoticeInfo _notice)
    {
        SqlConnection Con = ConnectionHelper.GetConnection();
        string Sp = "USP_Create_Faculty";
         SqlCommand cmd = new SqlCommand(Sp, Con);
        cmd.Parameters.Add(new SqlParameter("@FacultyID",_notice.FacutlyID));
        cmd.Parameters.Add(new SqlParameter("@BatchID",_notice.BatchID));
        cmd.Parameters.Add(new SqlParameter("@Reference",_notice.Reference));
        cmd.Parameters.Add(new SqlParameter("@Notice",_notice.Notice));
        cmd.Parameters.Add(new SqlParameter("@PostedOn",_notice.PostedOn));
        cmd.Parameters.Add(new SqlParameter("@PostedBy",_notice.PostedBy));
        cmd.CommandType=CommandType.StoredProcedure;
        try
        {
            cmd.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
        /// <summary>
        /// 发送应用通知
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="toUid"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static int SendApplicationNotice(int uid, int toUid, string message)
        {
            ShortUserInfo userInfo = Users.GetShortUserInfo(uid);

            if (userInfo == null || userInfo.Uid <= 0)
            {
                return(0);
            }

            NoticeInfo noticeinfo = new NoticeInfo();

            noticeinfo.Note         = Utils.HtmlEncode(message);
            noticeinfo.Type         = Noticetype.ApplicationNotice;
            noticeinfo.New          = 1;
            noticeinfo.Posterid     = userInfo.Uid;
            noticeinfo.Poster       = userInfo.Username.Trim();
            noticeinfo.Postdatetime = Utils.GetDateTime();
            noticeinfo.Uid          = toUid;

            return(Notices.CreateNoticeInfo(noticeinfo));
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         NoticeFacade facade = new NoticeFacade();
         if (IsAdd)
         {
             lblTitle.Text = "添加新通知";
         }
         else
         {
             string     noticeId   = Request["id"];
             NoticeInfo noticeInfo = facade.GetNoticeMessage(noticeId);
             if (noticeInfo != null)
             {
                 BindNoticeInfo(noticeInfo);
                 lblTitle.Text = "编辑通知 -> " + noticeInfo.Name;
             }
         }
     }
 }
Beispiel #14
0
        public bool Invoke(IMessage obj)
        {
            EventSessionInfo sessionInfo = obj as EventSessionInfo;
            bool             br          = false;

            if (sessionInfo == null)
            {
                return(false);
            }

            NoticeInfo noticeInfo =
                sessionInfo.ChatTranscript.ChatEventList.GetAsNoticeInfo(
                    sessionInfo.ChatTranscript.ChatEventList.Count - 1);

            if (noticeInfo != null)
            {
                br = true;
            }

            return(br);
        }
Beispiel #15
0
        public async Task <Pager <IQueryable <NoticeEntity> > > List(NoticeInfo noticeInfo)
        {
            //判断查询参数
            Expression <Func <NoticeEntity, bool> > where = LinqUtil.True <NoticeEntity>();
            if (!string.IsNullOrEmpty(noticeInfo.notice_desc))
            {
                where = where.AndAlso(c => c.notice_desc.Contains(noticeInfo.notice_desc));
            }
            if (noticeInfo.disable != -1)
            {
                where = where.AndAlso(c => c.disable == noticeInfo.disable);
            }

            //调用仓储方法查询分页并且响应给前台
            int total = await noticeRepository.CountAsync(where);

            IQueryable <NoticeEntity> list = await noticeRepository.GetPageAllAsync <NoticeEntity, DateTime, NoticeEntity>(
                noticeInfo.pageindex, noticeInfo.pagesize, where, c => c.createtime, null, false);

            return(new Pager <IQueryable <NoticeEntity> >(total, list.AsQueryable()));
        }
Beispiel #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string desc_tmpl = "信息来源:{0}&nbsp;&nbsp;&nbsp;&nbsp;发稿作者:{1}&nbsp;&nbsp;&nbsp;&nbsp;发布时间:{2}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";

            if (!IsPostBack)
            {
                NoticeInfo        nr    = new NoticeInfo();
                NoticeInfoManager nrMgr = new NoticeInfoManager();
                string            id    = Request.QueryString.Get("id");
                if (!string.IsNullOrEmpty(id))
                {
                    nr = nrMgr.GetItemById(new Guid(id));
                    if (nr != null)
                    {
                        news_title.InnerHtml   = nr.TITLE;
                        news_desc.InnerHtml    = string.Format(desc_tmpl, nr.SOURCE, nr.PUBUSER, nr.PUBDATE);
                        news_content.InnerHtml = nr.CONTENT;
                    }
                }
            }
        }
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if (this.txtNoticeTitle.Text == "")
            {
                MessageBox.Show("请填写标题");
                return;
            }
            if (this.txtNoticeContent.Text == "")
            {
                MessageBox.Show("请填写内容");
                return;
            }

            bool isOK = false;

            if (_notice == null)
            {
                _notice = new NoticeInfo()
                {
                    Title   = this.txtNoticeTitle.Text,
                    Content = this.txtNoticeContent.Text,
                    Time    = DateTime.Now
                };
            }
            else
            {
                _notice.Content = this.txtNoticeContent.Text;
            }

            isOK = NoticeController.Instance.SaveNotice(_notice, isAdd);
            if (isOK)
            {
                MessageBox.Show("保存通知成功!");
                this.DialogResult = true;
            }
            else
            {
                MessageBox.Show("保存通知失败!");
            }
        }
Beispiel #18
0
        /// <summary>
        /// 发送邮件通知,并记录邮件
        /// </summary>
        /// wangpf  16.09.12
        /// <param name="mail">邮箱内容等配置实体</param>
        /// <returns></returns>
        public bool SendEmail(List <Mail> mail)
        {
            bool result    = true;
            var  emailUtil = new EmailUtil();

            using (TransactionScope scope = new TransactionScope())
            {
                foreach (Mail item in mail)
                {
                    var isEmail = Regex.IsMatch(item.To, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");

                    // 判断邮箱格式是否合法,如果合法则发送邮件
                    if (isEmail == true)
                    {
                        // 发送邮件
                        result &= emailUtil.SendEmail(item);

                        // 记录邮件
                        NoticeInfo notice = new NoticeInfo()
                        {
                            UserId     = item.UserId,
                            Title      = item.Title,
                            Content    = item.Body,
                            Time       = DateTime.Now,
                            NoticeType = NoticeType.邮件,
                            IsRead     = false
                        };

                        result &= NoticeMapper.Insert(notice) > 0;
                    }
                }

                if (result)
                {
                    scope.Complete();
                }
            }

            return(result);
        }
Beispiel #19
0
        public void DealHtml(IList list, string html, bool crawlAll)
        {
            Parser   parserDtl = new Parser(new Lexer(html));
            NodeList aNodes    = parserDtl.ExtractAllNodesThatMatch(new AndFilter(new TagNameFilter("table"), new HasAttributeFilter("id", "ctl00_Content_GridView1")));

            if (aNodes != null && aNodes.Count > 0)
            {
                Type     typs  = typeof(ATag);
                TableTag table = aNodes[0] as TableTag;
                for (int t = 1; t < table.RowCount - 1; t++)
                {
                    string   InfoTitle = string.Empty, InfoType = string.Empty, PublistTime = string.Empty, InfoCtx = string.Empty, InfoUrl = string.Empty, htmlTxt = string.Empty, prjCode = string.Empty;
                    TableRow tr = table.Rows[t] as TableRow;

                    prjCode     = table.Rows[t].Columns[1].ToNodePlainString();
                    InfoTitle   = table.Rows[t].Columns[3].ToPlainTextString().Trim();
                    InfoType    = "变更公示";
                    PublistTime = table.Rows[t].Columns[6].ToPlainTextString().Trim();
                    InfoUrl     = SiteUrl;
                    InfoCtx     = "工程编号:" + table.Rows[t].Columns[1].ToPlainTextString().Trim() + "\n";
                    InfoCtx    += "工程名称:" + table.Rows[t].Columns[2].ToPlainTextString().Trim() + "\n";
                    InfoCtx    += "变更标题:" + table.Rows[t].Columns[3].ToPlainTextString().Trim() + "\n";
                    InfoCtx    += "变更类型:" + table.Rows[t].Columns[4].ToPlainTextString().Trim() + "\n";
                    InfoCtx    += "变更内容:" + table.Rows[t].Columns[5].ToPlainTextString().Trim() + "\n";
                    InfoCtx    += "发布时间:" + table.Rows[t].Columns[6].ToPlainTextString().Trim() + "\n";


                    htmlTxt = InfoCtx;
                    NoticeInfo info = ToolDb.GenNoticeInfo("广东省", "深圳市工程", string.Empty, string.Empty, InfoTitle, InfoType, InfoCtx, PublistTime, string.Empty, "深圳市建设工程交易中心", InfoUrl, prjCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, htmlTxt);


                    list.Add(info);

                    if (!crawlAll && list.Count >= this.MaxCount)
                    {
                        return;
                    }
                }
            }
        }
Beispiel #20
0
        protected void PageInit()
        {
            int noticeid = Convert.ToInt32(Request["NoticeId"].ToString());

            if (noticeid == 0)
            {
                hTitle.InnerText = "";
                lblContent.Text  = "";
                sName.InnerText  = "";
                sTime.InnerText  = "";
            }
            else
            {
                NoticeInfo notice = new NoticeInfo(noticeid);
                hTitle.InnerText = notice.NoticeTitle.ToString();
                lblContent.Text  = notice.NoticeContent.ToString();
                lblContent.Text  = lblContent.Text.Replace(" ", "&nbsp;");
                lblContent.Text  = lblContent.Text.Replace("\r\n", "<br>");
                sName.InnerText  = notice.SignName.ToString();
                sTime.InnerText  = notice.NoticeTime.ToString();
            }
        }
Beispiel #21
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            NoticeInfo entity = new NoticeInfo();
            int        id     = GetInt("id");

            if (id > 0)
            {
                entity = Notices.Instance.GetModel(id, true);
                FillData(entity);
                Notices.Instance.Update(entity);
            }
            else
            {
                FillData(entity);
                entity.DataLevel = GetInt("corpid") == 0 ? 0 : 1;
                Notices.Instance.Add(entity);
            }

            Notices.Instance.ReloadNoticeListCache();

            Response.Redirect(string.IsNullOrEmpty(FromUrl) ? "noticemg.aspx" : FromUrl);
        }
        private void addNotice()
        {
            NoticeInfo notice = new NoticeInfo();

            notice.title       = txtTitle.Text;
            notice.description = txtDesciption.Text;

            if (fileImage.HasFile)
            {
                var    current      = fileImage.PostedFile;
                string exttension   = System.IO.Path.GetExtension(current.FileName);
                string newNameImage = Guid.NewGuid().ToString();
                current.SaveAs(System.IO.Path.Combine(Server.MapPath("~/Images/"), newNameImage + exttension));
                listofuploadedfiles.Text += String.Format("{0}<br />", newNameImage + exttension);

                notice.image = newNameImage + exttension;
            }

            //notice.url = txtUrl.Text;
            int display;

            int.TryParse(txtDisplaySort.Text, out display);
            notice.display_sort  = display;
            notice.create_by     = (SessionApp.user_info == null) ? "No Login" : SessionApp.user_info.user_name;
            notice.lastupdate_by = (SessionApp.user_info == null) ? "No Login" : SessionApp.user_info.user_name;
            //notice.link_page = int.Parse(ddlLinkPage.SelectedValue);
            //notice.link_param = txtLinkParam.Text;

            var result = NoticeController.AddNotice(notice);

            if (result == null)
            {
                ShowMessage(Page, "ชื่อประกาศนี้มีอยู่ในระบบแล้ว");
            }
            else
            {
                ShowMessage(Page, "เพิ่มสำเร็จ");
            }
        }
Beispiel #23
0
        }   // O

        private void NoticeSend_Click(object sender, EventArgs e)
        {
            MySqlConnection myConnection = null;

            try
            {
                NoticeInfo item = new NoticeInfo();
                item.공지사항 = NoticeNote.Text;
                item.날짜   = DateTime.Now;
                item.작성ID = User.Text;

                myConnection = new MySqlConnection(connectionString);

                myConnection.Open();

                NoticeInfoDAC dac = new NoticeInfoDAC(myConnection);
                dac.Insert(item);

                NoticeGrid.DataSource = dac.SelectTimeASC().Tables["Notice"];
                NoticeGrid.Columns[0].MinimumWidth = 80;
                NoticeGrid.Columns[1].MinimumWidth = 180;
                NoticeGrid.Columns[2].MinimumWidth = NoticeGrid.Width - 345;

                myConnection.Close();
            }
            catch (MySqlException)
            {
                MessageBox.Show("공지사항을 입력해주세요.");
            }
            finally
            {
                if (myConnection != null && myConnection.State == System.Data.ConnectionState.Open)
                {
                    myConnection.Close();
                }
            }
            NoticeNote.Clear();
        }                                                              // O
Beispiel #24
0
        public IList <NoticeInfo> GetList(int pageIndex, int pageSize, string sqlWhere, params SqlParameter[] cmdParms)
        {
            int startIndex = (pageIndex - 1) * pageSize + 1;
            int endIndex   = pageIndex * pageSize;

            string cmdText = @"select * from(select row_number() over(order by LastUpdatedDate desc) as RowNumber,
			                 Id,ContentTypeId,Title,Descr,ContentText,LastUpdatedDate
							 from Notice"                            ;

            if (!string.IsNullOrEmpty(sqlWhere))
            {
                cmdText += " where 1=1 " + sqlWhere;
            }
            cmdText += ")as objTable where RowNumber between " + startIndex + " and " + endIndex + " ";

            IList <NoticeInfo> list = new List <NoticeInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.SqlProviderConnString, CommandType.Text, cmdText, cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        NoticeInfo model = new NoticeInfo();
                        model.Id              = reader.GetGuid(1);
                        model.ContentTypeId   = reader.GetGuid(2);
                        model.Title           = reader.GetString(3);
                        model.Descr           = reader.GetString(4);
                        model.ContentText     = reader.GetString(5);
                        model.LastUpdatedDate = reader.GetDateTime(6);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
Beispiel #25
0
        public IList <NoticeInfo> GetList(int pageIndex, int pageSize, string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb         = new StringBuilder(250);
            int           startIndex = (pageIndex - 1) * pageSize + 1;
            int           endIndex   = pageIndex * pageSize;

            sb.Append(@"select * from(select row_number() over(order by LastUpdatedDate desc) as RowNumber,
			           Id,ContentTypeId,Title,Descr,ContentText,LastUpdatedDate
					   from Notice "                    );
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex);

            IList <NoticeInfo> list = new List <NoticeInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.GzxySiteDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        NoticeInfo model = new NoticeInfo();
                        model.Id              = reader.GetGuid(1);
                        model.ContentTypeId   = reader.GetGuid(2);
                        model.Title           = reader.GetString(3);
                        model.Descr           = reader.GetString(4);
                        model.ContentText     = reader.GetString(5);
                        model.LastUpdatedDate = reader.GetDateTime(6);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
Beispiel #26
0
        public JsonResult SaveNotice(NoticeInfo info)
        {
            if (CheckSession() == false)
            {
                return(Json(ResultModelBase.CreateTimeoutModel(), JsonRequestBehavior.AllowGet));
            }
            if (CheckSessionID() == false)
            {
                return(Json(ResultModelBase.CreateLogoutModel(), JsonRequestBehavior.AllowGet));
            }
            ResultModelBase result = new ResultModelBase();

            try
            {
                this.noticeManager.SaveNotice(info);
            }
            catch (Exception ex)
            {
                NLog.LogManager.GetCurrentClassLogger().Error(ex, ex.Message);
                result.SetFailed(ResultCodes.SystemError, ControlManager.GetSettingInfo().ErrorMessage);
            }
            return(JsonResult(result));
        }
Beispiel #27
0
        public int Update(NoticeInfo model)
        {
            string cmdText = @"update Notice set ContentTypeId = @ContentTypeId,Title = @Title,Descr = @Descr,ContentText = @ContentText,LastUpdatedDate = @LastUpdatedDate 
			                 where Id = @Id"            ;

            SqlParameter[] parms =
            {
                new SqlParameter("@Id",              SqlDbType.UniqueIdentifier),
                new SqlParameter("@ContentTypeId",   SqlDbType.UniqueIdentifier),
                new SqlParameter("@Title",           SqlDbType.NVarChar,                 100),
                new SqlParameter("@Descr",           SqlDbType.NVarChar,                 300),
                new SqlParameter("@ContentText",     SqlDbType.NText,             1073741823),
                new SqlParameter("@LastUpdatedDate", SqlDbType.DateTime)
            };
            parms[0].Value = model.Id;
            parms[1].Value = model.ContentTypeId;
            parms[2].Value = model.Title;
            parms[3].Value = model.Descr;
            parms[4].Value = model.ContentText;
            parms[5].Value = model.LastUpdatedDate;

            return(SqlHelper.ExecuteNonQuery(SqlHelper.SqlProviderConnString, CommandType.Text, cmdText, parms));
        }
Beispiel #28
0
        /// <summary>
        /// 日志评论通知
        /// </summary>
        /// <param name="commentinfo">日志评论信息</param>
        public void SendSpaceCommentNotice(SpaceCommentInfo commentinfo)
        {
            //要回复的用户id
            int replyuserid = DNTRequest.GetInt("userid", 0);

            //当日志有效时
            if (commentinfo.PostID > 0)
            {
                SpacePostInfo __spacepostsinfo = BlogProvider.GetSpacepostsInfo(Space.Data.DbProvider.GetInstance().GetSpacePost(commentinfo.PostID));
                //当日志有效时
                if (__spacepostsinfo != null)
                {
                    NoticeInfo __noticeinfo = new NoticeInfo();
                    __noticeinfo.Type         = NoticeType.SpaceCommentNotice;
                    __noticeinfo.New          = 1;
                    __noticeinfo.Posterid     = commentinfo.Uid;
                    __noticeinfo.Poster       = commentinfo.Author;
                    __noticeinfo.Postdatetime = Utils.GetDateTime();

                    //当回复人与评论作者不是同一人时,则向评论作者发送通知
                    if (__noticeinfo.Posterid != replyuserid && replyuserid > 0)
                    {
                        __noticeinfo.Note = Utils.HtmlEncode(string.Format("<a href=\"userinfo.aspx?userid={0}\">{1}</a> 回复了您的日志信息 <a href =\"viewspacepost.aspx?postid={3}\">{4}</a>.", commentinfo.Uid, commentinfo.Author, config.Spacename, commentinfo.PostID, __spacepostsinfo.Title));
                        __noticeinfo.Uid  = replyuserid;
                        Notices.CreateNoticeInfo(__noticeinfo);
                    }

                    //当上面通知的用户与该空间日志作者不同,则还要向主题作者发通知
                    if (__noticeinfo.Posterid != __spacepostsinfo.Uid && __spacepostsinfo.Uid > 0)
                    {
                        __noticeinfo.Note = Utils.HtmlEncode(string.Format("<a href=\"userinfo.aspx?userid={0}\">{1}</a> 评论了您的{2}日志 <a href =\"viewspacepost.aspx?postid={3}\">{4}</a>.", commentinfo.Uid, commentinfo.Author, config.Spacename, commentinfo.PostID, __spacepostsinfo.Title));
                        __noticeinfo.Uid  = __spacepostsinfo.Uid;
                        Notices.CreateNoticeInfo(__noticeinfo);
                    }
                }
            }
        }
Beispiel #29
0
 public static IList <NoticeInfo> XmlToNoticeList(string xml)
 {
     if (xml == "")
     {
         return(null);
     }
     try
     {
         XmlDocument document = new XmlDocument();
         document.LoadXml(xml);
         XmlElement         documentElement = document.DocumentElement;
         IList <NoticeInfo> list2           = new List <NoticeInfo>();
         foreach (XmlNode node in documentElement.ChildNodes)
         {
             NoticeInfo item  = new NoticeInfo();
             XmlNode    node2 = node.SelectSingleNode("NoticeId");
             item.NoticeId      = int.Parse(node2.InnerText);
             node2              = node.SelectSingleNode("NoticeType");
             item.NoticeType    = int.Parse(node2.InnerText);
             node2              = node.SelectSingleNode("NoticeTitle");
             item.NoticeTitle   = node2.InnerText;
             node2              = node.SelectSingleNode("NoticeContent");
             item.NoticeContent = node2.InnerText;
             node2              = node.SelectSingleNode("PublishDate");
             item.PublishDate   = DateTime.ParseExact(node2.InnerText, "yyyyMMddHHmmss", CultureInfo.CurrentCulture);
             node2              = node.SelectSingleNode("PID");
             item.PID           = int.Parse(node2.InnerText);
             list2.Add(item);
         }
         return(list2);
     }
     catch (Exception exception)
     {
         ilog_0.Info("XmlToNoticeList" + exception.Message);
         return(null);
     }
 }
Beispiel #30
0
        public async Task <ApiResult> Create([FromForm(Name = "title")] string title, [FromForm(Name = "category")] string category, [FromForm(Name = "file")] IFormFile file)
        {
            string webRootPath = _webHostEnvironment.WebRootPath; // wwwroot 文件夹
            string uploadPath  = Path.Combine("uploads", DateTime.Now.ToString("yyyyMMdd"));
            string dirPath     = Path.Combine(webRootPath, uploadPath);

            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }
            string fileExt     = Path.GetExtension(file.FileName).Trim('.');                 //文件扩展名,不含“.”
            string newFileName = Guid.NewGuid().ToString().Replace("-", "") + "." + fileExt; //随机生成新的文件名
            var    fileFolder  = Path.Combine(dirPath, newFileName);

            using (var stream = new FileStream(fileFolder, FileMode.Create))
            {
                await file.CopyToAsync(stream);
            }
            string url = $@"\{uploadPath}\{newFileName}";

            NoticeInfo noticeinfo = new NoticeInfo
            {
                Title    = title,
                Time     = DateTime.Now,
                Category = category,
                Path     = "localhost:5000" + url,
                AdminId  = 1 /*Convert.ToInt32(this.User.FindFirst("Id").Value)*/
            };
            bool b = await _iNoticeInfoService.CreateAsync(noticeinfo);

            if (!b)
            {
                return(ApiResultHelper.Error("添加失败,服务器发生错误"));
            }
            return(ApiResultHelper.Success(noticeinfo));
        }
Beispiel #31
0
        /// <summary>
        /// 判断公告标题是否存在
        /// </summary>
        /// <param name="info">信息</param>
        /// <returns>true@已存在;fasel@不存在。</returns>
        public bool ExistsNotice(NoticeInfo notice)
        {
            string noticeID = "";
            int    count    = 0;
            string sql      = null;

            try
            {
                if (string.IsNullOrEmpty(notice.NoticeID) == false)
                {
                    noticeID = notice.NoticeID;
                }

                sql = "SELECT COUNT(*) FROM T_QM_NOTICE WHERE NOTICEID <> @NOTICEID AND NOTICETITLE=@NOTICETITLE";

                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    count = Convert.ToInt32(session.ExecuteSqlScalar(sql, new DataParameter("NOTICEID", noticeID), new DataParameter {
                        ParameterName = "NOTICETITLE", Value = notice.NoticeTitle
                    }));
                }

                if (count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        /// <summary>
        ///根据SQL语句获取实体
        /// </summary>
        public static NoticeInfo getNoticeInfoBySql(string sql)
        {
            NoticeInfo noticeinfo = null;
            DataTable  dt         = DBHelper.GetDataSet(sql);

            if (dt.Rows.Count > 0)
            {
                noticeinfo = new NoticeInfo();
                foreach (DataRow dr in dt.Rows)
                {
                    noticeinfo.Noticeid   = Convert.ToInt32(dr["noticeid"]);
                    noticeinfo.Title      = Convert.ToString(dr["title"]);
                    noticeinfo.Sortid     = SortInfoService.getSortInfoById((int)dr["sortid"]);
                    noticeinfo.Ifpublic   = Convert.ToInt32(dr["ifpublic"]);
                    noticeinfo.Fromuser   = Convert.ToString(dr["fromuser"]);
                    noticeinfo.Begintime  = Convert.ToDateTime(dr["begintime"]);
                    noticeinfo.Endtime    = Convert.ToDateTime(dr["endtime"]);
                    noticeinfo.Attribute  = Convert.ToInt32(dr["attribute"]);
                    noticeinfo.Accressory = Convert.ToString(dr["accressory"]);
                    noticeinfo.Context    = Convert.ToString(dr["context"]);
                }
            }
            return(noticeinfo);
        }
Beispiel #33
0
 /// <summary>
 /// 修改数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int Update(NoticeInfo model)
 {
     return(dal.Update(model));
 }
 private void BindNoticeInfo(NoticeInfo noticeInfo)
 {
     txtName.Text = noticeInfo.Name;
     txtTitle.Text = noticeInfo.Title;
     txtContent.Text = noticeInfo.Message;
     txtStartTime.Text = noticeInfo.StartTime.ToString("yyyy-MM-dd HH:mm:ss");
     txtEndTime.Text = noticeInfo.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
     cbHasDetail.Checked = noticeInfo.IsHasDetail;
     cbIsForeBold.Checked = noticeInfo.IsForeBold;
     cbIsForeRed.Checked = noticeInfo.IsForeRed;
     cbIsEnd.Checked = noticeInfo.IsEnd;
 }