using System;
          using System.Data;
          using System.Configuration;
          using System.Collections;
          using System.Web;
          using System.Web.Security;
          using System.Web.UI;
          using System.Web.UI.WebControls;
          using System.Web.UI.WebControls.WebParts;
          using System.Web.UI.HtmlControls;

          namespace zj123.UI.images.Expro
          {
              public partial class SortEdit: zj123.BLL.AdminPage
              {
                     protected void Page_Load(object sender, EventArgs e)
                     {
                      this.BtDel.Attributes["onclick"] = "window.close()";
                      if (!Page.IsPostBack)
                      {  
                          BindUpdate();  
                      }
                  }
                
                  public void BindUpdate()
                  {
                      string action = this.GetRequest("action");
                      if (action == "upd")
                      {
                          string sql = string.Format("select * from [Expro_NewsType] where column_id='{0}'", this.GetRequest("id"));
                          DataTable dt = this.Db.GetTable(sql);
                          if (dt != null)
                          {
                              this.TbName.Text = Convert.ToString(dt.Rows[0]["column_name"]);
                              this.TbIntro.Text = Convert.ToString(dt.Rows[0]["column_intro"]);
                          }
                      }
                  }
                  protected void BtVerfly_Click(object sender, EventArgs e)
                  {
                      string action = this.GetRequest("action");
                      string name = this.TbName.Text.Trim();
                      string intro = this.TbIntro.Text.Trim();
                      string parentid = this.GetRequest("parentid");
                      parentid = parentid.Length<1?("0"):(parentid);
                      string depth = this.GetRequest("depth");
                      
                   
                      string message = "";
                      string sql = "";
                      switch (action)
                      {
                          case "add":
                              message = "添加";
                              int depthint = Convert.ToInt32(depth) + 1;
                           
                              sql = string.Format("insert into Expro_NewsType([column_id],[column_name],[parent_id],[column_depth],[column_intro]) values( '{0}','{1}','{2}',{3},'{4}')", System.Guid.NewGuid().ToString().Replace("-", "").ToUpper().Substring(1, 6), name, parentid, depthint, intro);
                              break;
                          case "upd":
                              message = "修改";
                              sql = string.Format("update [Expro_NewsType] set Column_Name='{0}',Column_Intro='{1}' where [column_ID]='{2}'", name, intro, this.GetRequest("id"));
                              break;
                          default:
                              break;
                      }
                      if (this.Db.GetState(sql))
                      {
                          this.ShowMessage("成功" + message, "window.opener.location.reload()");
                      }
                      else
                      {
                          this.ShowMessage("操作失敗請聯系管理員!!!","");
                      }

                  }

                  protected void BtDel_Click(object sender, EventArgs e)
                  {
                     // Response.Write(this.Script());
                  }
              }
          }

          posted on 2009-03-13 18:14 sanmao 閱讀(63) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 浮梁县| 卢氏县| 什邡市| 湟源县| 苍山县| 江孜县| 镶黄旗| 蓬莱市| 松潘县| 同德县| SHOW| 石家庄市| 济宁市| 乐业县| 张家界市| 黄石市| 淅川县| 东台市| 东光县| 工布江达县| 潢川县| 乌什县| 通海县| 胶南市| 偏关县| 合阳县| 清丰县| 竹北市| 万安县| 高清| 闽清县| 比如县| 古交市| 孟津县| 河源市| 个旧市| 酒泉市| 赫章县| 合水县| 洛隆县| 申扎县|