Ejemplo n.º 1
0
        private void addntcBtnClk(object sender, EventArgs e)
        {
            string text = richTextBox1.Text;
            string date = dttextBox.Text;
            string sub  = noticesubjecttextBox.Text;

            bool flag = false;

            if (text.Equals(""))
            {
                MessageBox.Show("Please Write Something");
            }
            else
            {
                bool m = NoticeController.AddNotice(text, date, sub);
                if (m)
                {
                    flag = true;
                }
                else
                {
                    flag = false;
                }
            }

            if (flag)
            {
                MessageBox.Show("Notice Posted Successfully");
            }
            else
            {
                flag = false;
            }
        }
Ejemplo n.º 2
0
        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, "เพิ่มสำเร็จ");
            }
        }