Ejemplo n.º 1
0
        protected void DGList_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            int nowRow = int.Parse(e.Item.Cells[0].Text);

            try
            {
                string sql = "delete from t_plat where id=" + nowRow.ToString();
                AccessDb.ExecuteNonQuery(sql);
                if (e.Item.Cells[6] != null && e.Item.Cells[6].Text.Length > 0)
                {
                    string filePath = Page.Server.MapPath(@"~\" + e.Item.Cells[6].Text);
                    if (File.Exists(filePath))
                    {
                        File.Delete(filePath);
                    }
                }
                JS.Alert("删除成功");
            }
            catch (Exception ex)
            {
                JS.Alert("删除失败:" + ex);
            }

            showgrid(source, e);
        }
Ejemplo n.º 2
0
        protected void DGList_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            int    nowRow = int.Parse(e.Item.Cells[0].Text);
            string sql    = "delete from t_programs where id=" + nowRow.ToString();

            AccessDb.ExecuteNonQuery(sql);

            JS.Alert("删除成功");


            showgrid(source, e);
        }
Ejemplo n.º 3
0
        private void DGList_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
                AccessDb.ExecuteNonQuery("delete from t_user where id=" + int.Parse(e.Item.Cells[0].Text));
                JS.Alert("删除成功");
            }
            catch (Exception ex)
            {
                JS.Alert("删除失败:" + ex);
            }

            showgrid(source, e);
        }
Ejemplo n.º 4
0
        protected void DGList_DeleteCommand(object source, DataGridCommandEventArgs e)
        {
            int    nowRow = int.Parse(e.Item.Cells[0].Text);
            string sql    = "delete from t_frind where id=" + nowRow.ToString();

            AccessDb.ExecuteNonQuery(sql);
            try
            {
                JS.Alert("删除成功");
            }
            catch (Exception ex)
            {
                JS.Alert("删除失败:" + ex);
            }

            showgrid(source, e);
        }
Ejemplo n.º 5
0
        protected void but_save_Click(object sender, EventArgs e)
        {
            string sql   = "insert into t_frind(ptitle,purl,ptype) values('{0}','{1}','{2}')";
            string title = this.txt_title.Text;
            string type  = this.DropDownList1.SelectedValue;
            string url   = this.txt_url.Text;

            sql = string.Format(sql, title, url, type);
            AccessDb.ExecuteNonQuery(sql);
            JS.Alert("添加成功");

            this.txt_title.Text = "";
            this.txt_url.Text   = "";


            showgrid(null, null);
        }
Ejemplo n.º 6
0
        protected void but_save_Click(object sender, EventArgs e)
        {
            int sort = 0;

            try
            {
                sort = int.Parse(this.txt_sort.Text);
            }
            catch
            {
                JS.Alert("请输入整数!");
                return;
            }
            if (this.txt_title.Text.Length >= 255)
            {
                JS.Alert("栏目名称过长,请重新输入!");
                return;
            }

            if (ViewState["pk"] != null)
            {
                //edit
                string sql = "update t_programs set ptitle='{0}' ,purl='{1}',pstate={2}, picurl='{3}',psort={4} where id=" + ViewState["pk"].ToString();

                sql = string.Format(sql, this.txt_title.Text, this.txt_url.Text, this.drp_isUse.SelectedValue == "是" ? "True" : "False", "", sort.ToString());
                AccessDb.ExecuteNonQuery(sql);
                JS.Alert("修改成功");
                ViewState["pk"] = null;
                //this.txt_title.Enabled = true;
            }
            else
            {
                //tianjia
                string sql = "insert into t_programs(ptitle,purl,pstate,picurl,psort) values('{0}','{1}',{2},'{3}',{4})";
                sql = string.Format(sql, this.txt_title.Text, this.txt_url.Text, this.drp_isUse.SelectedValue == "是" ? "True" : "False", "", sort);
                AccessDb.ExecuteNonQuery(sql);
                JS.Alert("添加成功");
            }

            this.txt_title.Text          = "";
            this.txt_url.Text            = "";
            txt_sort.Text                = "";
            this.drp_isUse.SelectedIndex = 0;
            showgrid(null, null);
        }
Ejemplo n.º 7
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 = "";
 }
Ejemplo n.º 8
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string sql = "update t_3th set purl='" + this.txt_url.Text.Trim() + "' where id=";

            switch (UID)
            {
            case "interface":
                sql += "1";
                break;

            case "use":
                sql += "2";
                break;

            case "source":
                sql += "3";
                break;
            }
            AccessDb.ExecuteNonQuery(sql);
            JS.Alert("成功.");
        }