コード例 #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 gvBranchNews_RowCommand(object sender, GridViewCommandEventArgs e)
        {

            try
            {

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


                    Entity.BranchNewsInfo branchIn = new Entity.BranchNewsInfo();
                    branchIn = BLL.BranchNews.selectShowPopup(Branch_ID.ToString());


                    txtPoPtitle.Text = branchIn.BranchNews_Name;
                    editorPopup.Content = branchIn.Branch_Detail;


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

                    string status = branchIn.Branch_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);
            }
        }
コード例 #3
0
        protected void btnsave_Click(object sender, EventArgs e)
        {
           
            Entity.BranchNewsInfo update = new Entity.BranchNewsInfo();
            
            update.Create_user=Session["userid"].ToString();
            update.Update_user = Session["userid"].ToString();

            update.BranchNews_ID = Branch_ID.ToString();
            update.BranchNews_Name = txtPoPtitle.Text.ToString();
            update.Branch_Detail = editorPopup.Content.ToString();
            update.Date_End = txtPopdate.Text.ToString();

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

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

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

            bool checkStatusUpdate =BLL.BranchNews.UpdateBranch(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.ImageButton1_Click(null, null);
  
        }
コード例 #4
0
ファイル: BranchNews.cs プロジェクト: AppCPC/WebComSci
        public static Entity.BranchNewsInfo selectShowPopup(string id)
        {
            try
            {
                SqlDataReader dtReader;
                Entity.BranchNewsInfo branch = new Entity.BranchNewsInfo();
                string sqlString = "SELECT  BranchNews_Name, BranchNews_Detail, BranchNews_Path, BranchNews_Status, convert(datetime, Date_End, 103) as date FROM BranchNews where BranchNews_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.BranchNews_Name = dtReader["BranchNews_Name"].ToString();
                    branch.Branch_Detail = dtReader["BranchNews_Detail"].ToString();
                    branch.Branch_Path = dtReader["BranchNews_Path"].ToString();
                    branch.Branch_status = dtReader["BranchNews_Status"].ToString();
                    branch.Date_End = dtReader["date"].ToString();

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

                SqlDataReader drrShow = conn.SelectWhereSqlDataReader(sql, Addvalue, value);
                if (drrShow.Read())
                {
                    branchnews.BranchNews_Name = drrShow["BranchNews_Name"].ToString();
                    branchnews.Branch_Detail = drrShow["BranchNews_Detail"].ToString();
                    branchnews.Update_date = drrShow["Update_date"].ToString();
                    branchnews.Branch_Path = drrShow["BranchNews_Path"].ToString();
                }
                conn.Close();
                return branchnews;
            }
            catch (Exception)
            {

                return null;
            }
        }
コード例 #6
0
        protected void btnok_Click(object sender, EventArgs e)
        {

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

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

            }
           
           
        }