Esempio n. 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;
            }



        }
Esempio n. 2
0
        protected void btnok_Click(object sender, EventArgs e)
        {

          
            if (checkNull())
            {
                if (FUCPic.FileBytes.Length > 0)
                {
                    uploadPic();
                }
                Entity.SlideShow branch = new Entity.SlideShow();
                branch.SlideShow_Name = txttitle.Text.ToString();
                branch.Date_End = txtdate.Text.ToString();
                branch.SlideShow_Detail = editor.Content.ToString();
                branch.SlideShow_Path = picturPath;
                branch.Create_user = Session["userid"].ToString();
                branch.Update_user = Session["userid"].ToString();

                bool insert = BLL.SlideShow.insertBranchNews(branch);
                if (insert)
                {
                    ShowMessageWeb("บันทึกข้อมูลสมบูรณ์ ! ");
                    clearValue();
                }
                else
                {
                    ShowMessageWeb("บันทึกข้อมูลล้มเหลว ! ");
                    if (FUCPic.FileBytes.Length > 0)
                    {
                        try
                        {
                            string a = picturPath;
                            string currentpath = "~" + a.Substring(5, a.Length - 5);

                            System.IO.File.Delete(Server.MapPath(currentpath));
                        }
                        catch (Exception) { }
                    }
                }

            }


        }
Esempio n. 3
0
        protected void gvBranchNews_RowCommand(object sender, GridViewCommandEventArgs e)
        {

            try
            {

                if (e.CommandName == "updateBranch")
                {
                    SlideShowID = e.CommandArgument.ToString();


                    Entity.SlideShow branchIn = new Entity.SlideShow();
                    branchIn = BLL.SlideShow.selectShowPopup(SlideShowID.ToString());


                    txtPoPtitle.Text = branchIn.SlideShow_Name;
                    editorPopup.Content = branchIn.SlideShow_Detail;


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

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

                    mdlpopup.Show();
                }
                else if (e.CommandName == "deleteBranch")
                {
                    pnlprogress.Visible = true;
                    setBranchIDdelete = e.CommandArgument.ToString();
                    mdlpopupmsg.Show();
                }


            }
            catch (Exception ex)
            {

                ShowMessageWeb("เกิดข้อผิดพลาด : " + ex);
            }
        }
Esempio n. 4
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
            try
            {
                Entity.SlideShow update = new Entity.SlideShow();

                update.Create_user = Session["userid"].ToString();
                update.Update_user = Session["userid"].ToString();

                update.SlideShow_ID = SlideShowID.ToString();
                update.SlideShow_Name = txtPoPtitle.Text.ToString();
                update.SlideShow_Detail = editorPopup.Content.ToString();
                update.Date_End = txtPopdate.Text.ToString();

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

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


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

                bool checkStatusUpdate = BLL.SlideShow.UpdateBranch(update);
                if (checkStatusUpdate)
                {
                    if (FUCPic.FileBytes.Length > 0 && imgID.ToString().Length > 0)
                    {
                        System.IO.File.Delete(Server.MapPath(imgID.ToString()));
                    }
                    ShowMessageWeb("บันทึกข้อมูลสมบูรณ์! ");
                }
                else
                {
                    ShowMessageWeb("บันทึกข้อมูลล้มเหลว ! ");
                    try
                    {
                        string a = picturPath;
                        string currentpath = "~" + a.Substring(5, a.Length - 5);
                        System.IO.File.Delete(Server.MapPath(currentpath));
                    }
                    catch (Exception) { }
                }
                this.ImageButton1_Click(null, null);
            }
            catch (Exception) { }

        }
Esempio n. 5
0
        public static Entity.SlideShow selectShowPopup(string id)
        {
            try
            {
                SqlDataReader dtReader;
                Entity.SlideShow branch = new Entity.SlideShow();
                string sqlString = "SELECT  SlideShow_Name, SlideShow_Detail, SlideShow_Path,SlideShow_Status, convert(datetime, Date_End, 103) as date FROM SlideShow where SlideShow_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())
                {
                    branch.SlideShow_Name = dtReader["SlideShow_Name"].ToString();
                    branch.SlideShow_Detail = dtReader["SlideShow_Detail"].ToString();
                    branch.SlideShow_Path = dtReader["SlideShow_Path"].ToString();
                    branch.SlideShow_status = dtReader["SlideShow_Status"].ToString();
                    branch.Date_End = dtReader["date"].ToString();

                }
                dtReader.Close();
                objConn.Close();
                return branch;
            }
            catch (Exception)
            {
                return null;
            }
        }
Esempio n. 6
0
        public static Entity.SlideShow selectBranchNewsShowDetailNewsPage(string query)
        {
            ClassConnectDB conn = new ClassConnectDB();
            Entity.SlideShow branchnews = new Entity.SlideShow();
            try
            {
                string sql = "SELECT * FROM SlideShow WHERE  SlideShow_ID=@id";
                string Addvalue = "@id";
                string value = query;

                SqlDataReader drrShow = conn.SelectWhereSqlDataReader(sql, Addvalue, value);
                if (drrShow.Read())
                {
                    branchnews.SlideShow_Name = drrShow["SlideShow_Name"].ToString();
                    branchnews.SlideShow_Detail = drrShow["SlideShow_Detail"].ToString();
                    branchnews.Update_date = drrShow["Update_date"].ToString();
                    branchnews.SlideShow_Path = drrShow["SlideShow_Path"].ToString();
                }
                conn.Close();
                return branchnews;
            }
            catch (Exception)
            {

                return null;
            }
        }