//发放渠道
    private void BindPartnerListGrid()
    {
        _partnerEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _partnerEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _partnerEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _partnerEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _partnerEntity.PartnerDBEntity = new List<PartnerDBEntity>();
        PartnerDBEntity partnerDBEntity = new PartnerDBEntity();

        partnerDBEntity.PartnerID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["PartnerID"].ToString())) ? null : ViewState["PartnerID"].ToString();
        partnerDBEntity.StartDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["StartDTime"].ToString())) ? null : ViewState["StartDTime"].ToString();
        partnerDBEntity.EndDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["EndDTime"].ToString())) ? null : ViewState["EndDTime"].ToString();
        partnerDBEntity.WapLink = String.IsNullOrEmpty(ConfigurationManager.AppSettings["WapLink"]) ? "" : ConfigurationManager.AppSettings["WapLink"].ToString();
        _partnerEntity.PartnerDBEntity.Add(partnerDBEntity);
        DataSet dsResult = PartnerBP.Select(_partnerEntity).QueryResult;

        gridViewCSPartnerList.DataSource = dsResult.Tables[0].DefaultView;
        gridViewCSPartnerList.DataKeyNames = new string[] { "ID" };//主键
        gridViewCSPartnerList.DataBind();
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        detailMessageContent.InnerHtml = "";
        if (String.IsNullOrEmpty(txtDelPartnerID.Value.ToString().Trim()) || String.IsNullOrEmpty(txtDelPartnerLink.Value.ToString().Trim()))
        {

            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "AddNewlist('" + hidSysID.Value + "','" + txtDelPartnerID.Value.ToString() + "','" + txtDelPartnerLink.Value.ToString() + "','" + txtDelRemark.Text.ToString().Trim() + "','" + txtDelPartnerTitle.Value.ToString().Trim() + "','" + txtDelCost.Value.ToString().Trim() + "','" + hidPartnerct.Value.ToString().Trim() + "','" + hidAvgpt.Value.Trim() + "','" + hidWapLink.Value.Trim() + "');", true);
            detailMessageContent.InnerHtml = GetLocalResourceObject("Error3").ToString();
            return;
        }

        if (!String.IsNullOrEmpty(txtDelRemark.Text.ToString().Trim()) && txtDelRemark.Text.ToString().Trim().Length > 500)
        {

            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "AddNewlist('" + hidSysID.Value + "','" + txtDelPartnerID.Value.ToString() + "','" + txtDelPartnerLink.Value.ToString() + "','" + txtDelRemark.Text.ToString().Trim() + "','" + txtDelPartnerTitle.Value.ToString().Trim() + "','" + txtDelCost.Value.ToString().Trim() + "','" + hidPartnerct.Value.ToString().Trim() + "','" + hidAvgpt.Value.Trim() + "','" + hidWapLink.Value.Trim() + "');", true);
            detailMessageContent.InnerHtml = GetLocalResourceObject("Error6").ToString();
            return;
        }

        if (!String.IsNullOrEmpty(txtDelCost.Value.ToString().Trim()) && !checkNum(txtDelCost.Value.ToString().Trim()))
        {

            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "AddNewlist('" + hidSysID.Value + "','" + txtDelPartnerID.Value.ToString() + "','" + txtDelPartnerLink.Value.ToString() + "','" + txtDelRemark.Text.ToString().Trim() + "','" + txtDelPartnerTitle.Value.ToString().Trim() + "','" + txtDelCost.Value.ToString().Trim() + "','" + hidPartnerct.Value.ToString().Trim() + "','" + hidAvgpt.Value.Trim() + "','" + hidWapLink.Value.Trim() + "');", true);
            detailMessageContent.InnerHtml = GetLocalResourceObject("Error8").ToString();
            return;
        }

        _partnerEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _partnerEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _partnerEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _partnerEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _partnerEntity.PartnerDBEntity = new List<PartnerDBEntity>();
        PartnerDBEntity partnerDBEntity = new PartnerDBEntity();
        partnerDBEntity.SysID = hidSysID.Value;
        partnerDBEntity.PartnerID = txtDelPartnerID.Value.Trim();
        partnerDBEntity.PartnerLink = txtDelPartnerLink.Value.Trim();
        partnerDBEntity.Remark = txtDelRemark.Text.Trim().Replace("\r\n", "");
        partnerDBEntity.PartnerTitle = txtDelPartnerTitle.Value.Trim();
        partnerDBEntity.PartnerCost = txtDelCost.Value.Trim();
        _partnerEntity.PartnerDBEntity.Add(partnerDBEntity);
        int iResult = PartnerBP.Update(_partnerEntity);

        _commonEntity.LogMessages = _partnerEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "合作渠道链接管理-修改";
        commonDBEntity.Event_ID = txtDelPartnerID.Value.Trim();
        string conTent = GetLocalResourceObject("EventUpdateMessage").ToString();
        conTent = string.Format(conTent, txtSelPartnerID.Value, txtPartnerLink.Value);
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateSuccess").ToString();
            detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateSuccess").ToString();
        }
        else if (iResult == 2)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError2").ToString();
            detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateError2").ToString();
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError").ToString();
            detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateError").ToString();
        }

        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);

        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "AddNewlist('" + hidSysID.Value + "','" + txtDelPartnerID.Value.ToString() + "','" + txtDelPartnerLink.Value.ToString() + "','" + txtDelRemark.Text.ToString().Trim() + "','" + txtDelPartnerTitle.Value.ToString().Trim() + "','" + txtDelCost.Value.ToString().Trim() + "','" + hidPartnerct.Value.ToString().Trim() + "','" + hidAvgpt.Value.Trim() + "','" + hidWapLink.Value.Trim() + "');", true);
    }
    public void btnAddPartner()
    {
        messageContent.InnerHtml = "";

        if (String.IsNullOrEmpty(txtPartnerID.Value.ToString().Trim()) || String.IsNullOrEmpty(txtPartnerLink.Value.ToString().Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error3").ToString();
            return;
        }

        if (!String.IsNullOrEmpty(txtRemark.Text.ToString().Trim()) && txtRemark.Text.ToString().Trim().Length > 500)
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error5").ToString();
            return;
        }

        if (!String.IsNullOrEmpty(txtCost.Value.ToString().Trim()) && !checkNum(txtCost.Value.ToString().Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error7").ToString();
            return;
        }

        _partnerEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _partnerEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _partnerEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _partnerEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _partnerEntity.PartnerDBEntity = new List<PartnerDBEntity>();
        PartnerDBEntity partnerDBEntity = new PartnerDBEntity();
        partnerDBEntity.PartnerID = txtPartnerID.Value.Trim();
        partnerDBEntity.PartnerTitle = txtPartnerTitle.Value.Trim();
        partnerDBEntity.PartnerCost = txtCost.Value.Trim();
        partnerDBEntity.PartnerLink = txtPartnerLink.Value.Trim();
        partnerDBEntity.Remark = txtRemark.Text.Trim().Replace("\r\n", "");
        _partnerEntity.PartnerDBEntity.Add(partnerDBEntity);
        int iResult = PartnerBP.Insert(_partnerEntity);

        _commonEntity.LogMessages = _partnerEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "合作渠道链接管理-添加";
        commonDBEntity.Event_ID = txtPartnerID.Value.Trim();
        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        conTent = string.Format(conTent, txtSelPartnerID.Value, txtPartnerLink.Value);
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("InsertSuccess").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("InsertSuccess").ToString();
        }
        else if (iResult == 2)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error1").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error1").ToString();
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error2").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error2").ToString();
        }

        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
    }
    protected void btnChart_Click(object sender, EventArgs e)
    {
        _partnerEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _partnerEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _partnerEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _partnerEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _partnerEntity.PartnerDBEntity = new List<PartnerDBEntity>();
        PartnerDBEntity partnerDBEntity = new PartnerDBEntity();

        partnerDBEntity.SysID = hidSysID.Value.ToString().Trim();
        partnerDBEntity.StartDTime = dpChartStart.Value;
        partnerDBEntity.EndDTime = dpChartEnd.Value;
        _partnerEntity.PartnerDBEntity.Add(partnerDBEntity);
        DataSet dsResult = PartnerBP.ChartSelect(_partnerEntity).QueryResult;
        DataTable dtResult = GetChartDataTable(dsResult);

        //Chart1.ChartAreas["ChartArea1"].AxisX.IntervalType = DateTimeIntervalType.Hours; //按小时
        //Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1.0; //间隔定为 1

        //设置图表的数据源
        Chart1.DataSource = dtResult;

        //设置图表Y轴对应项
        Chart1.Series[0].YValueMembers = "Volume";

        //设置图表X轴对应项
        Chart1.Series[0].XValueMember = "Date";
        //Chart1.Series[0].ChartType = SeriesChartType.SplineArea;
        //Chart1.Series[0].IsValueShownAsLabel = true;

        ////Chart1.Series[0].ChartType = SeriesChartType.Bubble;
        ////Chart1.Series[0].MarkerStyle = MarkerStyle.Square;

        //Chart1.ChartAreas[0].AxisX.IsLogarithmic = false;
        ////Chart1.ChartAreas[0].AxisX.MajorGrid.Interval = 2;
        ////Chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.Gray;
        ////Chart1.ChartAreas[0].AxisX.MajorGrid.LineWidth = 1;

        Chart1.ChartAreas[0].AxisX.Interval = 1;
        Chart1.ChartAreas[0].AxisX.IntervalOffset = 1;
        //Chart1.ChartAreas[0].AxisX.LabelStyle.IsStaggered = true;

        //Chart1.Series[0].ChartType = SeriesChartType.Bar;
        // Set series point width
        Chart1.Series[0]["PointWidth"] = "0.6";

        // Show data points labels
        Chart1.Series[0].IsValueShownAsLabel = true;

        // Set data points label style
        Chart1.Series[0]["BarLabelStyle"] = "Center";

        // Show as 3D
        Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = false;

        // Draw as 3D Cylinder
        //Chart1.Series[0]["DrawingStyle"] = "Cylinder";

        //Chart1.BackColor = System.Drawing.Color.LemonChiffon;

        //绑定数据
        Chart1.DataBind();

        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "AddNewlist('" + hidSysID.Value + "','" + txtDelPartnerID.Value.ToString() + "','" + txtDelPartnerLink.Value.ToString() + "','" + txtDelRemark.Text.ToString().Trim() + "','" + txtDelPartnerTitle.Value.ToString().Trim() + "','" + txtDelCost.Value.ToString().Trim() + "','" + hidPartnerct.Value.ToString().Trim() + "','" + hidAvgpt.Value.Trim() + "','" + hidWapLink.Value.Trim() + "');", true);
    }