/// <summary>
 /// 初始化界面
 /// </summary>
 public void InitPage()
 {
     if (Request.QueryString["merID"] != null)
     {
         DAL.OveralManaDAL.MerchantManaDAL mc = new DAL.OveralManaDAL.MerchantManaDAL();
         int     merID = Convert.ToInt32(Request.QueryString["merID"]);
         DataSet merDs = mc.getMerDetailByID(merID);
         MerDetailRpt.DataSource = merDs;
         MerDetailRpt.DataBind();
         if (merDs.Tables[0].Rows.Count > 0)
         {
             string recState = merDs.Tables[0].Rows[0]["rec_mer_state"].ToString();
             RcmBtn.CommandArgument     = merDs.Tables[0].Rows[0]["mer_id"].ToString();
             SendMsgBtn.CommandArgument = merDs.Tables[0].Rows[0]["mer_id"].ToString();
             merPicPath = merDs.Tables[0].Rows[0]["mer_pic"].ToString();
             if (recState.Equals("是"))
             {
                 RcmBtn.CommandName = "CancelMerRcm";
                 RcmBtn.Text        = "取消商家推荐";
             }
             else
             {
                 RcmBtn.CommandName = "SetMerRcm";
                 RcmBtn.Text        = "推荐该商家";
             }
         }
         DAL.OveralManaDAL.PrdManaDAL pd = new DAL.OveralManaDAL.PrdManaDAL();
         PrdRpt.DataSource = pd.GetAllPrdList("", merID, -1);
         PrdRpt.DataBind();
     }
 }
    protected void SearchBtn_Click(object sender, EventArgs e)
    {
        if (PrdRb.Checked)
        {
            int cityID, merID;
            DAL.OveralManaDAL.PrdManaDAL pd = new DAL.OveralManaDAL.PrdManaDAL();
            if (MerDpl.SelectedValue.Equals("AllMer"))
            {
                merID = -1;
            }
            else
            {
                merID = Convert.ToInt32(MerDpl.SelectedValue);
            }
            if (CityDpl.SelectedValue.Equals("AllCity"))
            {
                cityID = -1;
            }
            else
            {
                cityID = Convert.ToInt32(CityDpl.SelectedValue);
            }
            PrdGrd.DataSource = pd.GetAllPrdList(txtSearch.Value, merID, cityID);
            PrdGrd.DataBind();
            dvPrd.Style.Add("display", "block");
            dvMer.Style.Add("display", "none");
        }
        if (MerRb.Checked)
        {
            BLL.OveralMana.MerchantMana.MerchantManaBLL mc = new BLL.OveralMana.MerchantMana.MerchantManaBLL();
            int cityID, stateID;
            if (CityDpl.SelectedValue.Equals("AllCity"))
            {
                cityID = -1;
            }
            else
            {
                cityID = Convert.ToInt32(CityDpl.SelectedValue);
            }
            if (StateDpl.SelectedValue.Equals("-1"))
            {
                stateID = -1;
            }
            else
            {
                stateID = Convert.ToInt32(StateDpl.SelectedValue);
            }
            MerListGrd.DataSource = mc.GetAllMerList(txtSearch.Value, stateID, cityID);
            MerListGrd.DataBind();

            dvMer.Style.Add("display", "block");
            dvPrd.Style.Add("display", "none");
        }
    }
    protected void LookPrdBtn_Command(object sender, CommandEventArgs e)
    {
        int prdID = Convert.ToInt32(e.CommandArgument);

        DAL.OveralManaDAL.PrdManaDAL pd = new DAL.OveralManaDAL.PrdManaDAL();
        if (pd.setPrdInvalid(prdID) > 0)
        {
            Response.Write("alertMessage('设置成功!')");
        }
        else
        {
            Response.Write("alertMessage('设置失败!')");
        }
    }
    protected void SearchBtn_Click(object sender, EventArgs e)
    {
        int cityID, merID;

        DAL.OveralManaDAL.PrdManaDAL pd = new DAL.OveralManaDAL.PrdManaDAL();
        if (MerDpl.SelectedValue.Equals("AllMer"))
        {
            merID = -1;
        }
        else
        {
            merID = Convert.ToInt32(MerDpl.SelectedValue);
        }
        if (CityDpl.SelectedValue.Equals("AllCity"))
        {
            cityID = -1;
        }
        else
        {
            cityID = Convert.ToInt32(CityDpl.SelectedValue);
        }
        PrdGrd.DataSource = pd.GetAllPrdList(SrchTextbox.Text, merID, cityID);
        PrdGrd.DataBind();
    }