protected void Page_Load(object sender, System.EventArgs e)
        {
            //权限检查
            if (Session["adminName"] == null || Session["adminName"].ToString() == String.Empty)
            {
                Response.Write("<font color=#ff0000 style='FONT-SIZE: 12px'>对不起,您没足够权限访问此页!!</font><br>");
                Response.Write("<a href=index.aspx target=_top style='FONT-SIZE: 12px'>重新登陆</a><br>");
                Response.End();
                return;
            }

            if (!IsPostBack)
            {
                getCategory();//绑定类别下拉列表


                if (Request.QueryString["id"] == null)
                {
                    Response.Write("没有这个鲜花");
                    Response.End();
                }
                string strID = Request.QueryString["id"].ToString().Trim();

                //获取ID对应的鲜花信息
                DBConn        myDB1 = new DBConn();
                string        sqlP  = "select * from Products where PID=" + strID;
                SqlDataReader dr    = myDB1.getDataReader(sqlP);

                if (dr.Read())
                {
                    myimg.Src        = "../showPP.aspx?id=" + dr["PID"].ToString();
                    ViewState["PID"] = dr["PID"].ToString();
                    txtName.Text     = CleanString.htmlOutputText(dr["PName"].ToString());
                    txtCPrice.Text   = double.Parse(dr["PCPrice"].ToString()).ToString("f2");//小数点后面的位数2位
                    txtFPrice.Text   = double.Parse(dr["PFPrice"].ToString()).ToString("f2");
                    txtNPrice.Text   = double.Parse(dr["PNPrice"].ToString()).ToString("f2");
                    txtBewrite.Text  = CleanString.htmlOutputText(dr["PBewrite"].ToString());
                    txtUseMode.Text  = CleanString.htmlOutputText(dr["PUseMode"].ToString());
                    txtValidity.Text = CleanString.htmlOutputText(dr["PValidity"].ToString());

                    try//分类
                    {
                        ddlCategory.SelectedValue = dr["CID"].ToString();
                    }
                    catch
                    {
                        ddlCategory.SelectedIndex = 0;
                    }
                }

                dr.Close();
                myDB1.Close();
            }
        }
Exemplo n.º 2
0
        private void getAnnounce()
        {
            string mySql = "select * from append where id='3'";

            DBConn        myDB = new DBConn();
            SqlDataReader mydr = myDB.getDataReader(mySql);

            if (mydr.Read())
            {
                txtAnnounce.Text = CleanString.htmlOutputText(mydr["text"].ToString());
            }
            mydr.Close();
            myDB.Close();
        }
Exemplo n.º 3
0
        private void getData(string strID)
        {
            string        mySql = "select * from message where MID=" + strID;
            DBConn        myDB  = new DBConn();
            SqlDataReader mydr  = myDB.getDataReader(mySql);

            if (mydr.Read())
            {
                lblUName.Text  = mydr["UName"].ToString();
                lblUPhone.Text = mydr["UPhone"].ToString();
                string strUEmail = mydr["UEmail"].ToString();
                lblUEmail.Text   = "<a href='mailto:" + strUEmail + "'>" + strUEmail + "</a>";
                lblMTitle.Text   = mydr["MTitle"].ToString();
                txtMContent.Text = CleanString.htmlOutputText(mydr["MContent"].ToString());
                lblDate.Text     = mydr["Pubdate"].ToString();
            }

            mydr.Close();
            myDB.Close();
        }
Exemplo n.º 4
0
 private void adminDataGrid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         //刉壺
         LinkButton delBttn = (LinkButton)e.Item.Cells[0].Controls[0];
         if (Session["adminName"].ToString().ToUpper() == e.Item.Cells[1].Text.ToUpper())
         {
             e.Item.Cells[0].Controls[0].Visible = false;//祥珆尨※刉壺§偌聽
         }
         delBttn.Attributes.Add("onclick", "javascript:return confirm('确定删除[ " + CleanString.htmlOutputText(e.Item.Cells[1].Text) + " ]?');");
     }
 }
Exemplo n.º 5
0
 private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) //判断是否是列表中的项,判断列表中的项是否是与数据绑定的
     {
         //删除确认
         LinkButton delBttn = (LinkButton)e.Item.Cells[3].Controls[0];
         delBttn.Attributes.Add("onclick", "javascript:return confirm('确定删除[ " + CleanString.htmlOutputText(e.Item.Cells[1].Text) + " ]?');");
     }
 }