コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string requestID = Request["id"].ToString();
            string sub = requestID.Substring(0,1);
            string query = requestID.Substring(1, requestID.Length-1);
            if (sub== "1") { 
                lbltitle.Text = "ข่าวสาขา";

                Entity.BranchNewsInfo branch = new Entity.BranchNewsInfo();
                branch = BLL.BranchNews.selectBranchNewsShowDetailNewsPage(query);
                lblheader.Text = branch.BranchNews_Name;
                detail.InnerHtml = branch.Branch_Detail;
                //imgPic.ImageUrl = branch.Branch_Path;
                imgPic.ImageUrl = "../../image/slideshow/11.png";
                lbltime.Text = branch.Update_date;

            }
            else if (sub == "2") { 
                lbltitle.Text = "ข่าวฝึกอบรม";
                Entity.TrainingNewsInfo train = new Entity.TrainingNewsInfo();
                train = BLL.TrainingNews.selectTrainingNewsShowDetailNewsPage(query);
                lblheader.Text = train.Training_Name;
                detail.InnerHtml = train.Training_Detail;
                imgPic.ImageUrl = train.Training_Path;
                lbltime.Text = train.Update_date;

            }
            else if (sub == "3") { 
                lbltitle.Text = "ผลงานสาขา";
                Entity.WorkBranchNewsInfo workbranch = new Entity.WorkBranchNewsInfo();
                workbranch = BLL.WorkBranchNews.selectTrainingNewsShowDetailNewsPage(query);
                lblheader.Text = workbranch.WorkBranchNews_Name;
                detail.InnerHtml = workbranch.WorkBranchNews_Detail;
                imgPic.ImageUrl = workbranch.WorkBranchNews_Path;
                lbltime.Text = workbranch.Update_date;
            }
            else if (sub == "4") {
                lbltitle.Text = "กิจกรรมนักศึกษา";
                lblheader.Text = query;
                Entity.StudentNewsInfo stdNews = new Entity.StudentNewsInfo();
                stdNews = BLL.StudentNews.selectTrainingNewsShowDetailNewsPage(query);
                lblheader.Text = stdNews.StudentNews_Name;
                detail.InnerHtml = stdNews.StudentNews_Detail;
                imgPic.ImageUrl = stdNews.StudentNews_Path;
                lbltime.Text = stdNews.Update_date;
            }
            else if (sub == "5")
            {
                lbltitle.Text = "ข่าวประกาศ";
                lblheader.Text = query;
                Entity.SlideShow slide = new Entity.SlideShow();
                slide = BLL.SlideShow.selectBranchNewsShowDetailNewsPage(query);
                lblheader.Text = slide.SlideShow_Name;
                detail.InnerHtml = slide.SlideShow_Detail;
                imgPic.ImageUrl = slide.SlideShow_Path;
                lbltime.Text = slide.Update_date;
            }



        }
コード例 #2
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            Entity.TrainingNewsInfo update = new Entity.TrainingNewsInfo();
            update.Create_user = Session["userid"].ToString();
            update.Update_user = Session["userid"].ToString();

            update.Training_ID = trainNews_ID.ToString();
            update.Training_Name = txtPoPtitle.Text.ToString();
            update.Training_Detail = editorPopup.Content.ToString();
            update.Date_End = txtPopdate.Text.ToString();

            if (FUCPic.FileBytes.Length > 0)
            {
                uploadPic();
                update.Training_Path = picturPath;

            }
            else update.Training_Path = imgID.ToString();


            if (ddlStatus.SelectedIndex == 0) { update.Training_status = "A"; }
            else { update.Training_status = "U"; }

            bool checkStatusUpdate = BLL.TrainingNews.UpdateTrainingNews(update);
            if (checkStatusUpdate)
            {
                if (FUCPic.FileBytes.Length > 0 && imgID.ToString().Length > 0)
                {
                    System.IO.File.Delete(Server.MapPath(imgID.ToString()));
                }
                ShowMessageWeb("บันทึกข้อมูลเรียบร้อย ! ");
            }
            else
            {
                ShowMessageWeb("บันทึกข้อมูลล้มเหลว ! ");
                System.IO.File.Delete(Server.MapPath(picturPath));
            }
            this.butImgSearch_Click(null, null);

        }
コード例 #3
0
        protected void gvSearchTrainning_RowCommand(object sender, GridViewCommandEventArgs e)
        {

            if (e.CommandName == "Select")
            {
                trainNews_ID = gvSearchTrainning.DataKeys[Convert.ToInt32(e.CommandArgument)].Value.ToString();


                Entity.TrainingNewsInfo trainNews = new Entity.TrainingNewsInfo();
                trainNews = BLL.TrainingNews.selectShowPopup(trainNews_ID.ToString());


                txtPoPtitle.Text = trainNews.Training_Name;
                editorPopup.Content = trainNews.Training_Detail;



                pathImage = trainNews.Training_Path.ToString();
                imgID = pathImage;
                if (pathImage.Length > 0)
                {
                    imgPopPic.ImageUrl = pathImage;
                    imgPopPic.Visible = true;
                }
                else imgPopPic.Visible = false;

                string status = trainNews.Training_status;
                if (status == "A") { ddlStatus.SelectedIndex = 0; }
                else { ddlStatus.SelectedIndex = 1; }
                txtPopdate.Text = trainNews.Date_End;

                mdlpopup.Show();

            }

        }
コード例 #4
0
ファイル: TrainingNews.cs プロジェクト: AppCPC/WebComSci
        public static Entity.TrainingNewsInfo selectShowPopup(string id)
        {
            try
            {
                SqlDataReader dtReader;
                Entity.TrainingNewsInfo train = new Entity.TrainingNewsInfo();
                string sqlString = "SELECT Training_Name,Training_Detail,Training_Path, Training_Status, convert(datetime, Date_End, 103) as date FROM TrainingNews where Training_ID=@id";
                ConnectDB connpath = new ConnectDB();
                objConn = new SqlConnection();
                objConn.ConnectionString = connpath.connectPath();
                objConn.Open();
                objCmd = new SqlCommand(sqlString, objConn);
                objCmd.Parameters.Add("@id", SqlDbType.Int).Value = Convert.ToInt32(id);
                dtReader = objCmd.ExecuteReader();
                if (dtReader.Read())
                {
                    train.Training_Name = dtReader["Training_Name"].ToString();
                    train.Training_Detail = dtReader["Training_Detail"].ToString();
                    train.Training_Path = dtReader["Training_Path"].ToString();
                    train.Training_status = dtReader["Training_Status"].ToString();
                    train.Date_End = dtReader["date"].ToString();

                }
                dtReader.Close();
                objConn.Close();
                return train;
            }
            catch (Exception)
            {
                return null;
            }
        }
コード例 #5
0
ファイル: TrainingNews.cs プロジェクト: AppCPC/WebComSci
        public static Entity.TrainingNewsInfo selectTrainingNewsShowDetailNewsPage(string query)
        {
            ClassConnectDB conn = new ClassConnectDB();
            Entity.TrainingNewsInfo train = new Entity.TrainingNewsInfo();
            try
            {
                string sql = "SELECT * FROM TrainingNews WHERE  Training_ID=@id";
                string Addvalue = "@id";
                string value = query;

                SqlDataReader drrShow = conn.SelectWhereSqlDataReader(sql, Addvalue, value);
                if (drrShow.Read())
                {
                    train.Training_Name = drrShow["Training_Name"].ToString();
                    train.Training_Detail = drrShow["Training_Detail"].ToString();
                    train.Update_date = drrShow["Update_date"].ToString();
                    train.Training_Path = drrShow["Training_Path"].ToString();
                }
                conn.Close();
                return train;
            }
            catch (Exception)
            {

                return null;
            }
        }
コード例 #6
0
ファイル: AddTrainning.aspx.cs プロジェクト: AppCPC/WebComSci
        protected void btnok_Click(object sender, EventArgs e)
        {

            if (checkNull())
            {
                if (FUCPic.FileBytes.Length > 0)
                {
                    uploadPic();
                }
                Entity.TrainingNewsInfo train = new Entity.TrainingNewsInfo();
                train.Training_Name = txttitle.Text.ToString();
                train.Date_End = txtdate.Text.ToString();
                train.Training_Detail = editor.Content.ToString();
                train.Training_Path = picturPath;
                train.Create_user = Session["userid"].ToString();
                train.Update_user = Session["userid"].ToString();

                bool insert = BLL.TrainingNews.insertTrainingNews(train);
                if (insert)
                {
                    ShowMessageWeb("บันทึกข้อมูลเรียบร้อย! ");
                    clearValue();
                }
                else
                {
                    ShowMessageWeb("บันทึกข้อมูลล้มเหลว ! ");
                    if (FUCPic.FileBytes.Length > 0)
                    {
                        System.IO.File.Delete(Server.MapPath(picturPath));
                    }
                }

            }

        }