Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Button1.Attributes.Add("onclick", "return conf();");
            CheckLogin.checkAll();

            if (!IsPostBack)
            {
                string sql = "select * from t_3th where id=";
                string tit = "";
                switch (UID)
                {
                case "interface":
                    tit  = "地图API管理";
                    sql += "1";
                    break;

                case "use":
                    tit  = "应用管理";
                    sql += "2";
                    break;

                case "source":
                    tit  = "资源管理";
                    sql += "3";
                    break;
                }
                this.Label1.Text = tit;
                DataTable dt = AccessDb.Execute(sql).Tables[0];
                this.txt_url.Text = dt.Rows[0]["purl"].ToString();
            }
        }
Пример #2
0
        private void editIni()
        {
            string    sql = "select * from t_sample where id=" + UID;
            DataTable dt  = AccessDb.Execute(sql).Tables[0];

            if (dt.Rows.Count == 0)
            {
                JS.Alert("读数据失败");
                Response.End();
            }
            else
            {
                _dr = dt.Rows[0];
            }

            this.txt_title.Text         = DR["ptitle"].ToString();
            this.txt_Url.Text           = DR["purl"].ToString();
            this.content2.Value         = DR["pcontent"].ToString();
            this.HyperLink1.NavigateUrl = DR["ppic"].ToString();
            this.HyperLink1.Target      = "_blank";
            this.txt_DateTime.Value     = DR["pdate"].ToString();

            if (DR["ppic"].ToString().Trim() != "")
            {
                this.HyperLink1.Text = "点击查看";
            }
            else
            {
                this.HyperLink1.Text = "---";
            }
        }
Пример #3
0
 private void ini()
 {
     if (UID != null && !UID.Equals(String.Empty))
     {
         string    sql = "select * from t_lunpic where id=" + UID;
         DataTable dt  = AccessDb.Execute(sql).Tables[0];
         if (dt != null)
         {
             this.link1.NavigateUrl = dt.Rows[0]["ppic"].ToString();
             this.link1.Target      = "_blank";
             this.txt_title.Text    = dt.Rows[0]["ptitle"].ToString();
             this.txt_url.Text      = dt.Rows[0]["purl"].ToString();
             this.txt_sort.Text     = dt.Rows[0]["psort"].ToString();
             string isShow = dt.Rows[0]["PIsShow"].ToString();
             if (isShow.ToLower() == "false")
             {
                 this.drp_isUse.SelectedIndex = 1;
             }
             else
             {
                 this.drp_isUse.SelectedIndex = 0;
             }
         }
     }
 }
Пример #4
0
        private void showgrid(object sender, System.EventArgs e)
        {
            DataTable mydt = null;

            mydt = AccessDb.Execute("select * from t_news where ptype='" + typ + "' order by id desc").Tables[0];

            DGList.DataSource = mydt;

            DataTable dt = new DataTable();

            try
            {
                DGList.DataBind();
                MyPage1.init(mydt.Rows.Count);
            }
            catch
            {
                if ((DGList.CurrentPageIndex - 1) >= 0)
                {
                    DGList.CurrentPageIndex = DGList.CurrentPageIndex - 1;
                }
                DGList.DataBind();
                MyPage1.init(mydt.Rows.Count);
            }
        }
Пример #5
0
        private void ini()
        {
            string    sql = "select * from t_about where pname='padv'";
            DataTable dt  = AccessDb.Execute(sql).Tables[0];

            if (dt.Rows.Count == 0)
            {
                JS.Alert("发生错误");
                Response.End();
            }
            this.content2.Value = dt.Rows[0]["pcontent"].ToString();
        }
Пример #6
0
        private void ini()
        {
            string    sql = "select * from t_const where pname='zhitong'";
            DataTable dt  = AccessDb.Execute(sql).Tables[0];

            if (dt.Rows.Count == 0)
            {
                Response.Write("请先填写");
            }
            else
            {
                this.content2.Value = dt.Rows[0]["pcontent"].ToString();
            }
        }
Пример #7
0
        private void editIni()
        {
            string    sql = "select * from t_interface where id=" + UID;
            DataTable dt  = AccessDb.Execute(sql).Tables[0];

            if (dt.Rows.Count == 0)
            {
                JS.Alert("读数据失败");
                Response.End();
            }
            else
            {
                _dr = dt.Rows[0];
            }
            this.txt_title.Text = DR["ptitle"].ToString();
            this.content2.Value = DR["pcontent"].ToString();
        }
Пример #8
0
        private void show()
        {
            string    sql = "select * from t_news where id=" + UID;
            DataTable dt  = AccessDb.Execute(sql).Tables[0];

            dr = dt.Rows[0];

            if (dr["purl"] != null && dr["purl"].ToString().Length > 0)
            {
                string FilePath = dr["purl"].ToString();
                FilePath = FilePath.Substring(FilePath.LastIndexOf('\\') + 1);
                this.SpFile.InnerHtml = "附件:  <a href=\"" + dr["purl"].ToString() + "\" title=\"" + FilePath + "\">" + FilePath + " </a>";
            }
            else
            {
                this.SpFile.InnerHtml = "";
            }
        }
Пример #9
0
 private void but_save_Click(object sender, System.EventArgs e)
 {
     //add
     if (ViewState["pk"] != null)
     {//edit
         txt_user.Enabled = true;
         try
         {
             string pass = this.txt_pass.Text;
             AccessDb.ExecuteNonQuery("update  t_user set pass='******' where id=" + ViewState["pk"].ToString());
             JS.Alert("修改成功");
             ViewState["pk"] = null;
         }
         catch (Exception ex)
         {
             JS.Alert("修改失败:" + ex);
         }
     }
     else
     {
         if (AccessDb.Execute("select * from t_user where Uname='" + this.txt_user.Text.Trim().Replace("'", "''") + "'").Tables[0].Rows.Count != 0)
         {
             JS.Alert("存在同名用户");
             return;
         }
         try
         {
             string pass  = this.txt_pass.Text;
             string uname = this.txt_user.Text;
             string sql   = "insert into t_user (uname,pass) values('{0}','{1}')";
             sql = string.Format(sql, uname, pass);
             AccessDb.ExecuteNonQuery(sql);
             JS.Alert("添加成功");
             ViewState["pk"] = null;
         }
         catch (Exception ex)
         {
             JS.Alert("添加失败:" + ex);
         }
     }
     showgrid(null, null);
     this.txt_user.Text = "";
     this.txt_pass.Text = "";
 }
Пример #10
0
        private void showgrid(object sender, System.EventArgs e)
        {
            DataTable mydt = null;

            mydt = AccessDb.Execute("select * from t_user").Tables[0];

            DGList.DataSource = mydt;
            try
            {
                DGList.DataBind();
            }
            catch
            {
                if ((DGList.CurrentPageIndex - 1) >= 0)
                {
                    DGList.CurrentPageIndex = DGList.CurrentPageIndex - 1;
                }
                DGList.DataBind();
            }
        }
Пример #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region//新闻2
            string strCount = ConfigurationManager.AppSettings.Get("NewsDetailCount");
            if (strCount != null || strCount.Length > 0)
            {
                try
                {
                    this.Count = Convert.ToInt32(strCount);
                }
                catch (System.Exception ex)
                {
                }
            }

            DataTable mydt = null;
            mydt = AccessDb.Execute("select top " + Count.ToString() + " * from t_news   order by id desc").Tables[0];
            this.rpleft2.DataSource = mydt;
            this.rpleft2.DataBind();
            #endregion
        }
Пример #12
0
        private void showgrid(object sender, System.EventArgs e)
        {
            DataTable mydt = null;

            mydt = AccessDb.Execute("select * from t_question  order by pAnswered ,pdate desc").Tables[0];

            DGList.DataSource = mydt;
            try
            {
                DGList.DataBind();
                MyPage1.init(mydt.Rows.Count);
            }
            catch
            {
                if ((DGList.CurrentPageIndex - 1) >= 0)
                {
                    DGList.CurrentPageIndex = DGList.CurrentPageIndex - 1;
                }
                DGList.DataBind();
                MyPage1.init(mydt.Rows.Count);
            }
        }
Пример #13
0
        protected void but_login_Click(object sender, EventArgs e)
        {
            if (this.txt_pass.Text == "" || this.txt_user.Text == "")
            {
                JS.Alert("请输入用户,密码");
                return;
            }
            string user = this.txt_user.Text.Replace("'", "");
            string pass = this.txt_pass.Text.Replace("'", "");
            string sql  = "select * from t_user where uname='{0}' and pass='******'";

            sql = string.Format(sql, user, pass);
            if (AccessDb.Execute(sql).Tables[0].Rows.Count == 0)
            {
                JS.Alert("用户,密码错误.");
                return;
            }
            else
            {
                Session["user"] = user;
                Response.Redirect("main.htm");
            }
        }
Пример #14
0
        protected void DGList_EditCommand(object source, DataGridCommandEventArgs e)
        {
            ViewState["pk"] = e.Item.Cells[0].Text;
            string    sql = "select * from t_programs where id=" + ViewState["pk"].ToString();
            DataTable dt  = AccessDb.Execute(sql).Tables[0];


            this.txt_title.Text = dt.Rows[0]["ptitle"].ToString();
            this.txt_url.Text   = dt.Rows[0]["purl"].ToString();
            string isShow = dt.Rows[0]["pstate"].ToString();
            string sort   = dt.Rows[0]["psort"].ToString();

            this.txt_sort.Text = sort;

            if (isShow.ToLower() == "false")
            {
                this.drp_isUse.SelectedIndex = 1;
            }
            else
            {
                this.drp_isUse.SelectedIndex = 0;
            }
            //this.txt_title.Enabled = false;
        }
Пример #15
0
        private void showleft2()
        {
            string strCount = ConfigurationManager.AppSettings.Get("NewsCount");

            if (strCount != null || strCount.Length > 0)
            {
                try
                {
                    this.count = Convert.ToInt32(strCount);
                }
                catch (System.Exception ex)
                {
                }
            }
            string _TemSelfName = Request.Url.AbsolutePath;

            _SelfPageName = Server.UrlEncode(_TemSelfName);

            DataTable mydt = null;

            mydt = AccessDb.Execute("select    * from t_news     order by id desc").Tables[0];

            //   数据源
            PagedDataSource Pgds = new PagedDataSource();

            Pgds.DataSource = mydt.DefaultView;

            //        设置允许分页
            Pgds.AllowPaging = true;
            //        每页显示为6行
            Pgds.PageSize = count;
            //        显示总共页数
            //
            lblTotalPage.Text = Pgds.PageCount.ToString();
            //        当前页
            int CurrentPage;

            //        请求页码为不为null设置当前页,否则为第一页
            if (Request.QueryString["Page"] != null)
            {
                CurrentPage = Convert.ToInt32(Request.QueryString["Page"]);
            }
            else
            {
                CurrentPage = 1;
            }
            //   当前页所引为页码-1
            Pgds.CurrentPageIndex = CurrentPage - 1;
            //   显示当前页码
            lblCurrentPage.Text = CurrentPage.ToString();
            //   如果不是第一页,通过参数Page设置上一页为当前页-1,否则不显示连接
            lnkFirst.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1";
            lnkLast.NavigateUrl  = Request.CurrentExecutionFilePath + "?Page=" + Pgds.PageCount;
            if (!Pgds.IsFirstPage)
            {
                //  Request.CurrentExecutionFilePath为当前请求虚拟路径
                lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurrentPage - 1);
            }
            //        End If
            //   如果不是最后一页,通过参数Page设置下一页为当前页+1,否则不显示连接
            if (!Pgds.IsLastPage)
            {
                //    Request.CurrentExecutionFilePath为当前请求虚拟路径
                lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurrentPage + 1);
            }
            //   模板绑定数据源
            rpleft2.DataSource = Pgds;
            rpleft2.DataBind();
        }
Пример #16
0
        /// <summary>
        /// 记录初始化
        /// </summary>
        private void editIni()
        {
            string    sql = "select * from t_service where id=" + UID;
            DataTable dt  = AccessDb.Execute(sql).Tables[0];

            if (dt.Rows.Count == 0)
            {
                JS.Alert("读数据失败");
                Response.End();
            }
            else
            {
                _dr = dt.Rows[0];
            }

            if (DR["ptitle"] != null)
            {
                this.txt_title.Text = DR["ptitle"].ToString();
            }
            else
            {
                this.txt_title.Text = "";
            }

            if (DR["surl"] != null)
            {
                this.txt_url.Text = DR["surl"].ToString();;
            }
            else
            {
                this.txt_url.Text = "";
            }


            if (DR["unit"] != null)
            {
                this.txt_unit.Text = DR["unit"].ToString();
            }
            else
            {
                this.txt_title.Text = "";
            }
            if (DR["servicetype"] != null)
            {
                this.txt_servicetype.Text = DR["servicetype"].ToString();
            }
            else
            {
                this.txt_servicetype.Text = "";
            }

            if (DR["remark"] != null)
            {
                this.txt_remark.Text = DR["remark"].ToString();
            }
            else
            {
                this.txt_remark.Text = "";
            }
            if (DR["redu"] != null)
            {
                this.txt_redu.Text = DR["redu"].ToString();
            }
            else
            {
                this.txt_redu.Text = "";
            }
            if (DR["setdate"] != null)
            {
                this.txt_DateTime.Value = DR["setdate"].ToString();
            }
            else
            {
                this.txt_DateTime.Value = DateTime.Now.ToUniversalTime().ToString();
            }
        }