protected void btnSave_Click(object sender, EventArgs e)
    {
        string packageName = this.txtPackageName.Text.Replace("'", "");
        string allAmount = this.txtAllAmount.Value.Replace("'", ""); ;//总金额

        //string fromDate = this.FromDate.Text.Replace("'", "");
        //string endDate = this.EndDate.Text.Replace("'", "");

        string fromDate = this.FromDate.Value.Replace("'", "");
        string endDate = this.EndDate.Value.Replace("'", "");

        string userCount = this.txtUserCount.Text.Replace("'", ""); //可被用户领用数,如果为空,则记录为0
        if (string.IsNullOrEmpty(userCount))
        {
            userCount = "0";
        }

        string userRepCount = this.txtUserRepCount.Text.Replace("'", ""); //可被用户领用数,如果为空,则记录为1
        if (string.IsNullOrEmpty(userRepCount))
        {
            userRepCount = "1";
        }

        string saleChannel = ""; //发放渠道
        for (int i = 0; i < LBSaleChanel.Items.Count; i++)
        {
            if (LBSaleChanel.Items[i].Selected == true)
            {
                saleChannel = saleChannel + LBSaleChanel.Items[i].Value + ",";
            }
        }
        saleChannel = saleChannel.Trim().Trim(',').Replace("'", "");

        //string useClient = this.LBUseFlatForm.SelectedValue;//使用平台
        string userGroup = "";         //领用用户组
        for (int i = 0; i < LBUserGroup.Items.Count; i++)
        {
            if (LBUserGroup.Items[i].Selected == true)
            {
                userGroup = userGroup + LBUserGroup.Items[i].Value + ",";
            }
        }
        userGroup = userGroup.Trim().Trim(',').Replace("'", "");

        string useCode = "";//用户平台
        for (int i = 0; i < LBUsePlatForm.Items.Count; i++)
        {
            if (LBUsePlatForm.Items[i].Selected == true)
            {
                useCode = useCode + LBUsePlatForm.Items[i].Value + ",";
            }
        }
        useCode = useCode.Trim().Trim(',').Replace("'", "");

        string cityID = this.txtCityID.Value;//城市ID
        //通过变量的方式,加入数据表中
        StringBuilder sql = new StringBuilder();
        CommonFunction comFun = new CommonFunction();

        //string strPackageCode = comFun.GetRandNumString(10);//一个10位的随机数

        string strPackageCode = string.Empty;

        if (!chkCustomNumber.Checked)
        {
            strPackageCode = getPackageCode(10);//一个10位的随机数
            if (strPackageCode == "")
            {
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('领用券Code的位数已经使用完,不能生成新的Code了!');changeRemainValue();", true);
                return;
            }
        }
        else
        {
            if (!chkCustomIsNum(txtCustomNumber.Text.Trim()))
            {
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('自定义优惠券号码必须为10位数字!');changeRemainValue();", true);
                return;
            }

            if (!chkCutomerNum(txtCustomNumber.Text))
            {
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('礼包号码与历史重复,请返回修改!');changeRemainValue()", true);
                return;
            }
            else
            {
                strPackageCode = txtCustomNumber.Text.Trim();
            }
        }

        string packageType = this.hidPackageType.Value;//城市ID
        //=============主表=========================
        string status = "1";
        int packageID = comFun.getMaxIDfromSeq("T_LM_TICKET_PACKAGE_SEQ");

        sql.AppendLine("INSERT INTO T_LM_TICKET_PACKAGE(ID,STATUS,PACKAGENAME,PACKAGECODE,STARTDATE,ENDDATE,USERCNT,CREATETIME,AMOUNT,CLIENTCODE,USERGROUPID,USECODE,CITYID, SINGLE_USERCNT, PACKAGETYPE) VALUES  ");
        sql.AppendLine("(" + packageID + ",'" + status + "','" + packageName + "','" + strPackageCode + "','" + fromDate + "','" + endDate + "'," + userCount + ",to_date( '" + System.DateTime.Now + "' , 'YYYY-MM-DD HH24:MI:SS' )," + allAmount + ",'" + saleChannel + "','" + userGroup + "','" + useCode + "','" + cityID + "'," + userRepCount + ",'"+ packageType + "') ");

        //to_date ( '2007-12-20 18:31:34' , 'YYYY-MM-DD HH24:MI:SS' )
        //循环执行
        List<String> list = new List<string>();
        list.Add(sql.ToString());

        //==================把子表信息加入到表 T_LM_TICKET
        string[] lblNumber = Request.Form.GetValues("lblNumber");
        string[] lblAmount = Request.Form.GetValues("lblAmount");

        int ticketCodeFlag = 0;
        StringBuilder sql_ticket = new StringBuilder();
        for (int i = 0; i < lblNumber.Length; i++)
        {
            sql_ticket.AppendLine("INSERT INTO T_LM_TICKET(ID,STATUS,TICKETCODE,TICKETAMT,CREATETIME,PACKAGECODE,TICKETCNT) VALUES ");
            int intGetID = comFun.getMaxIDfromSeq("T_LM_TICKET_SEQ");//ID的值

            string strStatus = "1";
            //string strTicketCode = comFun.GetRandNumString(13);   //ticket的code,10位数的随机数
            string strTicketCode = getTicketCode(13);   //ticket的code,10位数的随机数
            if (strTicketCode == "")
            {

                ticketCodeFlag = 1;
                break;
            }

            DateTime CREATETIME = System.DateTime.Now;
            string IntTicketCnt = lblNumber[i].Trim().ToString();
            string IntTicketAmt = lblAmount[i].Trim().ToString();

            //加入值每个字段的值
            sql_ticket.AppendLine("( " + intGetID + ",'" + strStatus + "','" + strTicketCode + "'," + IntTicketAmt + ",to_date('" + CREATETIME + "' , 'YYYY-MM-DD HH24:MI:SS'),'" + strPackageCode + "'," + IntTicketCnt + ")");

            //add to list
            list.Add(sql_ticket.ToString());
            sql_ticket.Clear();
        }

        if (ticketCodeFlag == 1)//表示在产生Ticket code的时候,已经没法产生可用的Ticket Code了。
        {
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('内含Ticket Code的位数已经使用完,无法生成新的Code了!');changeRemainValue()", true);
            return;
        }
        //=================================================
        try
        {
            DbHelperOra.ExecuteSqlTran(list);
            //this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('领用券新增成功!');", true);

            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "invokeOpen();", true);
            //清除页面内容
            clearValue();
            //bind gridview
            BindGridView();

        }
        catch (Exception ex)
        {
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('领用券新增失败!');changeRemainValue()", true);
            //ex.ToString();
        }
    }
    //增加到数据库中
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        StringBuilder sql = new StringBuilder();
        //Oracle sql 语法
        sql.AppendLine("INSERT INTO T_LM_TICKET_RULE(ID,TICKETRULECODE,CREATETIME,ORDAMT,STARTTIME,ENDTIME,STARTDATE,ENDDATE,HOTELID,CITYID,USEFLG,TICKETRULEDESC,TICKETRULENAME,CLIENTCODE,USECODE,HOTELNAME,USERGROUPID,PRICE_CODE) VALUES ( ");
        sql.AppendLine(":ID,:TICKETRULECODE,:CREATETIME,:ORDAMT,:STARTTIME,:ENDTIME,:STARTDATE,:ENDDATE,:HOTELID,:CITYID,:USEFLG,:TICKETRULEDESC,:TICKETRULENAME,:CLIENTCODE,:USECODE,:HOTELNAME,:USERGROUPID,:PRICECODE) ");
        OracleParameter[] parm ={
                                    new OracleParameter("ID",OracleType.Int32),
                                    new OracleParameter("TICKETRULECODE",OracleType.VarChar),
                                    new OracleParameter("CREATETIME",OracleType.DateTime),
                                    new OracleParameter("ORDAMT",OracleType.Int32),
                                    new OracleParameter("STARTTIME",OracleType.VarChar),
                                    new OracleParameter("ENDTIME",OracleType.VarChar),
                                    new OracleParameter("STARTDATE",OracleType.VarChar),
                                    new OracleParameter("ENDDATE",OracleType.VarChar),
                                    new OracleParameter("HOTELID",OracleType.VarChar),
                                    new OracleParameter("CITYID",OracleType.VarChar),
                                    new OracleParameter("USEFLG",OracleType.VarChar),
                                    new OracleParameter("TICKETRULEDESC",OracleType.NVarChar),
                                    new OracleParameter("TICKETRULENAME",OracleType.NVarChar),
                                    new OracleParameter("CLIENTCODE",OracleType.NVarChar),//销售渠道
                                    new OracleParameter("USECODE",OracleType.NVarChar),
                                    new OracleParameter("HOTELNAME",OracleType.NVarChar),
                                    new OracleParameter("USERGROUPID",OracleType.VarChar),//用户组
                                    new OracleParameter("PRICECODE",OracleType.VarChar),
                                };

        string strTicketCode = "10000";
        string strTicketName = this.txtRuleName.Text;//规则名称
        string strFromDate = this.fromDate.Value;
        string strEndDate = this.endDate.Value;

        string strStartTime = this.txtStartTime.Text;
        string strEndTime = this.txtEndTime.Text;
        string strOrdAmt = this.txtOrdAmt.Text;
        if (strOrdAmt == "")
        {
            strOrdAmt = "0";
        }
        string strHotelID = this.txthotelid.Value;
        string strCityID = this.cityid.SelectedValue;
        string strRuleDesc = this.txtRuleDesc.Text;
        string strHotelName = this.txtHotelName.Value;

        string useGroup = "";     //使用用户组
        for (int i = 0; i < LBUserGroup.Items.Count; i++)
        {
            if (LBUserGroup.Items[i].Selected == true)
            {
                useGroup = useGroup + LBUserGroup.Items[i].Value + ",";
            }
        }
        useGroup = useGroup.Trim().Trim(',');

        string useCode = "";//使用平台
        for (int i = 0; i < LBUsePlatForm.Items.Count; i++)
        {
            if (LBUsePlatForm.Items[i].Selected == true)
            {
                useCode = useCode + LBUsePlatForm.Items[i].Value + ",";
            }
        }
        useCode = useCode.Trim().Trim(',');

        //销售渠道
        string saleChannel = "";//销售渠道
        for (int i = 0; i < LBSaleChannel.Items.Count; i++)
        {
            if (LBSaleChannel.Items[i].Selected == true)
            {
                saleChannel = saleChannel + LBSaleChannel.Items[i].Value + ",";
            }
        }
        saleChannel = saleChannel.Trim().Trim(',');

        //价格代码
        string priceCode = "";//价格代码
        for (int i = 0; i < LBPriceCode.Items.Count; i++)
        {
            if (LBPriceCode.Items[i].Selected == true)
            {
                priceCode = priceCode + LBPriceCode.Items[i].Value + ",";
            }
        }
        priceCode = priceCode.Trim().Trim(',');

        CommonFunction comFun = new CommonFunction();
        parm[0].Value = comFun.getMaxIDfromSeq("T_LM_TICKET_RULE_SEQ");
        int ticketrulecode = DbHelperOra.GetMaxID("TICKETRULECODE", "T_LM_TICKET_RULE", false);
        if (ticketrulecode == 1)
        {
            strTicketCode = "10000";
        }
        else
        {
            strTicketCode = ticketrulecode.ToString();
        }

        parm[1].Value = strTicketCode;
        parm[2].Value = System.DateTime.Now;
        parm[3].Value = strOrdAmt;
        parm[4].Value = strStartTime;
        parm[5].Value = strEndTime;
        parm[6].Value = strFromDate;
        parm[7].Value = strEndDate;
        parm[8].Value = strHotelID;
        parm[9].Value = strCityID;
        parm[10].Value = "1";
        parm[11].Value = strRuleDesc;
        parm[12].Value = strTicketName;
        parm[13].Value = saleChannel;
        parm[14].Value = useCode;
        parm[15].Value = strHotelName;
        parm[16].Value = useGroup;
        parm[17].Value = priceCode;
        try
        {
            DbHelperOra.ExecuteSql(sql.ToString(), parm);
            //clear the control value
            clearValue();
            //重新绑定Gridview
            BindGridView();
           // this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + AddRuleSuccess + "');", true);
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "invokeOpen();", true);

        }
        catch (Exception ex)
        {
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('" + AddRuleFaild + "');", true);
            //ex.ToString();
        }
    }
    //点击确定按钮
    protected void btnOk_Click(object sender, EventArgs e)
    {
        if (this.HidFlowBtn.Value == "1")
        {
            #region
            try
            {
                if (!chkCashStatus(ViewState["ID"].ToString()))
                {
                    this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('该提现申请状态已经更新,请刷新页面!');", true);
                    return;
                }

                if (StringUtility.Text_Length(txtRemark.Text.Trim()) > 180)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('处理备注最多60个中文字,请修改!');", true);
                    return;
                }

                List<string> list = new List<string>();
                //<asp:ListItem Value="0">已提交</asp:ListItem>
                //<asp:ListItem Value="1">已审核</asp:ListItem>
                //<asp:ListItem Value="2">已成功</asp:ListItem>
                //<asp:ListItem Value="3">已失败</asp:ListItem>
                //<asp:ListItem Value="4">已操作</asp:ListItem>

                //string process_status = this.ddlProcessStatus.SelectedValue;

                string process_status = this.hidProcessStatus.Value;   //点击按钮当前处理的状态
                string pickcashamount = this.lbl_pick_cash_amount_bank.Text;//提现金额

                string remark = this.txtRemark.Text;
                string userRemark = this.txtUserRemark.Text;
                string User_ID = this.lbl_User_ID_bank.Text;
                string isPush = (chkPush.Checked) ? "1" : "0";

                CommonFunction comFun = new CommonFunction();
                int id = comFun.getMaxIDfromSeq("T_LM_CASH_HIS_SEQ");//t_lm_cash_tocash_appl_detl_seq
                string cashWayCode = this.hidCashWayCode_bank.Value;

                string strNow = string.Format("{0:yyyy-MM-dd HH:mm:ss}", System.DateTime.Now);
                //修改主表信息,保留最新一次的备注信息
                //string sqlUpdate = "update T_LM_CASH_TOCASH_APPL set PROCESS_STATUS='" + process_status + "',PROCESS_REMARK='" + remark + "',PROCESS_TIME =to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff') ,PROCESS_USERID='" + UserSession.Current.UserAccount + "'  where id =" + ViewState["ID"].ToString();
                //list.Add(sqlUpdate);

                ////插入一条新信息到详情表中
                //string sqlInsert = "insert into T_LM_CASH_TOCASH_APPL_DETAIL(ID,REF_APPLICATION_ID,USER_ID,HANDLE_STATUS,HANDLE_REMARK,PAY_MODE,HANDLE_TIME,HANDLER) values  ";
                //sqlInsert += "(" + id + ",'" + ViewState["ID"].ToString() + "','" + User_ID + "'," + process_status + ",'" + remark + "','" + cashWayCode + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff'),'" + UserSession.Current.UserAccount + "' )";
                //list.Add(sqlInsert);

                string sqlUpdate = "update T_LM_CASH set STATUS='" + process_status + "',REMARK='" + userRemark + "',PROCESS_REMARK='" + remark + "',UPDATE_TIME =to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff') ,PROCESS_USERID='" + UserSession.Current.UserAccount + "',IS_PUSH='" + isPush + "'  where (STATUS <> 2 AND STATUS <> 3) AND SN =" + ViewState["ID"].ToString();
                list.Add(sqlUpdate);

                //插入一条新信息到详情表中
                if ("4".Equals(process_status))
                {
                    string sqlInserthis = "insert into t_lm_cash_his (id, sn, user_id, status, remark, process_userid, create_time, type, is_push) values  ";
                    sqlInserthis += "(" + id + ",'" + ViewState["ID"].ToString() + "','" + User_ID + "'," + "1" + ",'" + remark + "','" + UserSession.Current.UserAccount + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff')," + hidCashType.Value + ",'" + isPush + "')";
                    list.Add(sqlInserthis);
                    id = comFun.getMaxIDfromSeq("T_LM_CASH_HIS_SEQ");//t_lm_cash_tocash_appl_detl_seq
                }

                string sqlInsert = "insert into t_lm_cash_his (id, sn, user_id, status, remark, process_userid, create_time, type, is_push) values  ";
                sqlInsert += "(" + id + ",'" + ViewState["ID"].ToString() + "','" + User_ID + "'," + process_status + ",'" + remark + "','" + UserSession.Current.UserAccount + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff')," + hidCashType.Value + ",'" + isPush + "')";
                list.Add(sqlInsert);

                //点击“已审核”
                if (process_status == "3")
                {
                    string sqlCashUser = "******" + pickcashamount + " where USER_ID='" + User_ID + "'";
                    list.Add(sqlCashUser);
                }
                DbHelperOra.ExecuteSqlTran(list);
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('保存成功!');", true);
                BindLToCash();
                setLabelValue(ViewState["ID"].ToString());

                if ("1".Equals(isPush))
                {
                    PushEntity pushEntity = new PushEntity();
                    pushEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
                    pushEntity.LogMessages.Userid = UserSession.Current.UserAccount;
                    pushEntity.LogMessages.Username = UserSession.Current.UserDspName;
                    pushEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

                    pushEntity.PushDBEntity = new List<PushDBEntity>();
                    PushDBEntity pushDBEntity = new PushDBEntity();
                    pushDBEntity.ID = ViewState["ID"].ToString();
                    pushDBEntity.Content = userRemark;
                    pushDBEntity.Type = "6";
                    pushDBEntity.TelPhone = User_ID;
                    pushEntity.PushDBEntity.Add(pushDBEntity);
                    PushInfoSA.SendPush(pushEntity);
                }
            }
            catch
            {
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('保存失败!');", true);
            }
            #endregion
        }
        else
        {
            try
            {
                if (GetCashBackStatus(ViewState["ID"].ToString()) == "0")
                {

                    if (!string.IsNullOrEmpty(this.HidPort.Value))
                    {
                        if (HidPort.Value == "3")
                        {
                            MobilePort_Click(null, null);//手机
                        }
                        else
                        {
                            AlipayPort_Click(null, null);//支付宝
                        }
                    }
                }
                else
                {
                    if (GetCashBackStatus(ViewState["ID"].ToString()) == "2")
                    {
                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "fail", "alert('已失败!');", true);
                    }
                }
            }
            catch (Exception ex)
            {

            }
        }

        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "alertClose", "BtnCompleteStyle();", true);
        BindLToCash();
    }
    //点击保存后进行修改设置。
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            string startDate = this.dtStartDate.Value;//开始日期
            string endDate = this.dtEndDate.Value;    //结束日期

            List<string> list = new List<string>();
            // List<string> listEvent = new List<string>();
            // List<string> listEventHistory = new List<string>();

            string sql = string.Empty;
            string sqlEvent = string.Empty;
            string sqlEventHistory = string.Empty;
            string sqlPlanHistory = string.Empty;
            DropDownList ddl;
            CommonFunction comFun = new CommonFunction();
            // getMaxIDfromSeq
            for (int i = 0; i < gridViewHotelPlan.Rows.Count; i++)
            {
                string id = gridViewHotelPlan.Rows[i].Cells[0].Text.ToString().Trim();
                string hotelid = gridViewHotelPlan.Rows[i].Cells[1].Text.ToString().Trim();
                string hotelname = gridViewHotelPlan.Rows[i].Cells[2].Text.ToString().Trim();
                string roomtypename = gridViewHotelPlan.Rows[i].Cells[3].Text.ToString().Trim();
                string roomtypecode = gridViewHotelPlan.Rows[i].Cells[4].Text.ToString().Trim();
                string twoprice = gridViewHotelPlan.Rows[i].Cells[5].Text.ToString().Trim();
                string autotrust = ((Label)gridViewHotelPlan.Rows[i].FindControl("lblAutoTrust")).Text.Trim();//是,否
                if (autotrust == "是")
                {
                    autotrust = "1";
                }
                else
                {
                    autotrust = "0";
                }

                string status = ((Label)gridViewHotelPlan.Rows[i].FindControl("lblStatus")).Text.Trim();//上线,下线
                if (status == "上线")
                {
                    status = "1";
                }
                else
                {
                    status = "0";
                }
                string HotelVPStatus = ((DropDownList)gridViewHotelPlan.Rows[i].FindControl("ddlHotelVPStatus")).SelectedValue;

                //string appstatus = ((DropDownList)gridViewHotelPlan.Rows[i].FindControl("ddlAPPStatus")).SelectedValue;//上线,下线
                string appstatus = ((Label)gridViewHotelPlan.Rows[i].FindControl("lblAppStatus")).Text.Trim();//上线,下线
                if (appstatus == "上线")
                {
                    appstatus = "1";
                }
                else
                {
                    appstatus = "0";
                }

                string ratecode = gridViewHotelPlan.Rows[i].Cells[10].Text.ToString().Trim();

                //(1)update t_lm_plan中的hotelvpstatus的值。

                string strNow = string.Format("{0:yyyy-MM-dd HH:mm:ss}", System.DateTime.Now);

                sql = "update t_lm_plan set hotelvp_status ='" + HotelVPStatus + "',CREATOR='" + UserSession.Current.UserAccount + "' ,GMT_CREATED= to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff')  where (EFFECT_DATE between to_date('" + startDate + "','yyyy-MM-dd') and to_date('" + endDate + "','yyyy-MM-dd')) and hotel_id='" + hotelid + "' and Rate_Code = '" + ratecode + "' and ROOM_TYPE_CODE='" + roomtypecode + "'";
                list.Add(sql);

                //(2)把动作表中的信息移动到t_lm_plan_events_history表中。

                //int newHistoryID = comFun.getMaxIDfromSeq("T_LM_PLAN_EVENTS_HISTORY_SEQ");
                //sqlEventHistory = "insert into t_lm_plan_events_history(ID,REFID,PROP,PROP_NAME_ZH,ROOM_TYPE_NAME,ROOM_TYPE_CODE,RATE_CODE,EFFECT_DATE,STATUS,HOTELVPSTATUS,APPSTATUS,CREATE_TIME,UPDATE_TIME,OPERATOR) select " + newHistoryID + " ,REFID,PROP,PROP_NAME_ZH,ROOM_TYPE_NAME,ROOM_TYPE_CODE,RATE_CODE,EFFECT_DATE,STATUS,HOTELVPSTATUS,APPSTATUS,CREATE_TIME,UPDATE_TIME,OPERATOR from  t_lm_plan_events where REFID=" + id;

                //list.Add(sqlEventHistory);

                //(3) 插入信息到t_lm_plan_events表中,先删除,后新增。
                //sqlEvent = "delete from t_lm_plan_events where REFID=" + id;
                //list.Add(sqlEvent);
                //int newid = comFun.getMaxIDfromSeq("T_LM_PLAN_EVENTS_SEQ");
                //string dtNewEffectDate = ViewState["effectDate"].ToString();
                //sqlEvent = "insert into t_lm_plan_events(ID,REFID,PROP,PROP_NAME_ZH,ROOM_TYPE_NAME,ROOM_TYPE_CODE,RATE_CODE,EFFECT_DATE,STATUS,HOTELVPSTATUS,APPSTATUS,OPERATOR) ";
                //sqlEvent += " values (" + newid + "," + id + ",'" + hotelid + "','" + hotelname + "','" + roomtypename + "','" + roomtypecode + "','" + ratecode + "',to_date('" + dtNewEffectDate + "','yyyy-MM-dd'),'" + status + "','" + HotelVPStatus + "','" + appstatus + "','" + UserSession.Current.UserAccount + "')";

                //list.Add(sqlEvent);
                //插入数据到
                int h_id = comFun.getMaxIDfromSeq("t_lm_plan_history_seq");//history表中的ID值最大
                sqlPlanHistory = "insert into t_lm_plan_history(ID,REFID,EFFECT_DATE,SEASON,MONEY_TYPE,HOTEL_ID,ROOM_TYPE_NAME,ROOM_TYPE_CODE,STATUS,ROOM_NUM,GMT_CREATED,CREATOR,ONE_PRICE,TWO_PRICE,THREE_PRICE,FOUR_PRICE,ATTN_PRICE,BREAKFAST_NUM,EACH_BREAKFAST_PRICE,IS_NETWORK,GMT_MODIFIED,MODIFIER,IS_DELETED,HOLD_ROOM_NUM,RATE_CODE,GUAID,CXLID,OFFSETVAL,OFFSETUNIT,LMPRICE,THIRDPRICE,LMSTATUS,IS_RESERVE,HOTELVP_STATUS,APP_STATUS,OPERATOR)";
                sqlPlanHistory += " select " + h_id + " ,ID,EFFECT_DATE,SEASON,MONEY_TYPE,HOTEL_ID,ROOM_TYPE_NAME,ROOM_TYPE_CODE,STATUS,ROOM_NUM,GMT_CREATED,CREATOR,ONE_PRICE,TWO_PRICE,THREE_PRICE,FOUR_PRICE,ATTN_PRICE,BREAKFAST_NUM,EACH_BREAKFAST_PRICE,IS_NETWORK,GMT_MODIFIED,MODIFIER,IS_DELETED,HOLD_ROOM_NUM,RATE_CODE,GUAID,CXLID,OFFSETVAL,OFFSETUNIT,LMPRICE,THIRDPRICE,LMSTATUS,IS_RESERVE,'" + HotelVPStatus + "',APP_STATUS,'" + UserSession.Current.UserAccount + "' from  t_lm_plan where ID=" + id;
                list.Add(sqlPlanHistory);
            }

            DbHelperOra.ExecuteSqlTran(list);
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('保存成功!');", true);
            BindListHotel();

            this.divSave.Style.Add("display", "none");
            this.divEdit.Style.Add("display", "block");

            this.dtStartDate.Disabled = true;
            this.dtEndDate.Disabled = true;
        }
        catch
        {
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('设置失败!');", true);
        }
    }
    private void btnOkClick(string strID, string pickcashamount, string remark, string userRemark, string User_ID, string cashType)
    {
        try
        {
            if (!chkCashStatus(strID))
            {
                return;
            }

            List<string> list = new List<string>();
            //<asp:ListItem Value="0">已提交</asp:ListItem>
            //<asp:ListItem Value="1">已审核</asp:ListItem>
            //<asp:ListItem Value="2">已成功</asp:ListItem>
            //<asp:ListItem Value="3">已失败</asp:ListItem>
            //<asp:ListItem Value="4">已操作</asp:ListItem>

            //string process_status = this.ddlProcessStatus.SelectedValue;

            string process_status = "3";   //点击按钮当前处理的状态
            //string pickcashamount = this.lbl_pick_cash_amount.Text;//提现金额

            //string remark = this.txtRemark.Text;
            //string userRemark = this.txtUserRemark.Text;
            //string User_ID = this.lbl_User_ID.Text;
            CommonFunction comFun = new CommonFunction();
            int id = comFun.getMaxIDfromSeq("T_LM_CASH_HIS_SEQ");//t_lm_cash_tocash_appl_detl_seq
            //string cashWayCode = this.hidCashWayCode.Value;

            string strNow = string.Format("{0:yyyy-MM-dd HH:mm:ss}", System.DateTime.Now);
            //修改主表信息,保留最新一次的备注信息
            //string sqlUpdate = "update T_LM_CASH_TOCASH_APPL set PROCESS_STATUS='" + process_status + "',PROCESS_REMARK='" + remark + "',PROCESS_TIME =to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff') ,PROCESS_USERID='" + UserSession.Current.UserAccount + "'  where id =" + ViewState["ID"].ToString();
            //list.Add(sqlUpdate);

            ////插入一条新信息到详情表中
            //string sqlInsert = "insert into T_LM_CASH_TOCASH_APPL_DETAIL(ID,REF_APPLICATION_ID,USER_ID,HANDLE_STATUS,HANDLE_REMARK,PAY_MODE,HANDLE_TIME,HANDLER) values  ";
            //sqlInsert += "(" + id + ",'" + ViewState["ID"].ToString() + "','" + User_ID + "'," + process_status + ",'" + remark + "','" + cashWayCode + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff'),'" + UserSession.Current.UserAccount + "' )";
            //list.Add(sqlInsert);

            // king Modify
            string sqlUpdate = "update T_LM_CASH set STATUS='" + process_status + "',REMARK='" + userRemark + "',PROCESS_REMARK='" + remark + "',UPDATE_TIME =to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff') ,PROCESS_USERID='" + UserSession.Current.UserAccount + "'  where STATUS = 4 AND SN =" + strID;
            //string sqlUpdate = "update T_LM_CASH set STATUS='" + process_status + "',REMARK='" + userRemark + "',PROCESS_REMARK='" + remark + "',UPDATE_TIME =to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff') ,PROCESS_USERID='" + UserSession.Current.UserAccount + "'  where SN =" + strID;
            list.Add(sqlUpdate);

            string sqlInsert = "insert into t_lm_cash_his (id, sn, user_id, status, remark, process_userid, create_time, type) values  ";
            sqlInsert += "(" + id + ",'" + strID + "','" + User_ID + "'," + process_status + ",'" + remark + "','" + UserSession.Current.UserAccount + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff')," + cashType + ")";
            list.Add(sqlInsert);

            //点击“已审核”
            if (process_status == "3")
            {
                string sqlCashUser = "******" + pickcashamount + " where USER_ID='" + User_ID + "'";
                list.Add(sqlCashUser);
            }

            DbHelperOra.ExecuteSqlTran(list);
            //MessageContent.InnerHtml = GetLocalResourceObject("UpdateSuccess").ToString();
        }
        catch
        {
            //MessageContent.InnerHtml = GetLocalResourceObject("UpdateError").ToString();
        }
    }
    private void btnModiClick(string strID, string pickcashamount, string remark, string userRemark, string User_ID, string cashType)
    {
        try
        {
            if (!chkModiCashStatus(strID))
            {
                return;
            }

            List<string> list = new List<string>();
            string process_status = "4";   //点击按钮"已失败"
            //string pickcashamount = this.lbl_pick_cash_amount.Text;//提现金额
            //string remark = this.txtRemark.Text;
            //string userRemark = this.txtUserRemark.Text;
            //string User_ID = this.lbl_User_ID.Text;//手机号码
            CommonFunction comFun = new CommonFunction();
            int id = comFun.getMaxIDfromSeq("T_LM_CASH_HIS_SEQ");//t_lm_cash_tocash_appl_detl_seq
            //string cashWayCode = this.hidCashWayCode.Value;

            string strNow = string.Format("{0:yyyy-MM-dd HH:mm:ss}", System.DateTime.Now);

            // king Modify
            string sqlUpdate = "update T_LM_CASH set STATUS='" + process_status + "',REMARK='" + userRemark + "',PROCESS_REMARK='" + remark + "',UPDATE_TIME =to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff') ,PROCESS_USERID='" + UserSession.Current.UserAccount + "'  where STATUS = 0 AND SN =" + strID;
            //string sqlUpdate = "update T_LM_CASH set STATUS='" + process_status + "',REMARK='" + userRemark + "',PROCESS_REMARK='" + remark + "',UPDATE_TIME =to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff') ,PROCESS_USERID='" + UserSession.Current.UserAccount + "'  where SN =" + strID;
            list.Add(sqlUpdate);

            //if ("4".Equals(process_status))
            //{
            string sqlInserthis = "insert into t_lm_cash_his (id, sn, user_id, status, remark, process_userid, create_time, type) values  ";
            sqlInserthis += "(" + id + ",'" + strID + "','" + User_ID + "'," + "1" + ",'" + remark + "','" + UserSession.Current.UserAccount + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff')," + cashType + ")";
            list.Add(sqlInserthis);
            id = comFun.getMaxIDfromSeq("T_LM_CASH_HIS_SEQ");//t_lm_cash_tocash_appl_detl_seq
            //}

            //插入一条新信息到详情表中
            string sqlInsert = "insert into t_lm_cash_his (id, sn, user_id, status, remark, process_userid, create_time, type) values  ";
            sqlInsert += "(" + id + ",'" + strID + "','" + User_ID + "'," + process_status + ",'" + remark + "','" + UserSession.Current.UserAccount + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff')," + cashType + ")";
            list.Add(sqlInsert);

            ////点击“已失败”
            //if (process_status == "2")
            //{
            //    string sqlCashUser = "******" + pickcashamount + ",CAN_APPLICTAION_AMOUNT=CAN_APPLICTAION_AMOUNT+" + pickcashamount + " where USER_ID='" + User_ID + "'";
            //    list.Add(sqlCashUser);
            //}

            DbHelperOra.ExecuteSqlTran(list);
            //MessageContent.InnerHtml = GetLocalResourceObject("UpdateSuccess").ToString();
        }
        catch (Exception ex)
        {
            MessageContent.InnerHtml = ex.Message;
            //MessageContent.InnerHtml = GetLocalResourceObject("UpdateError").ToString();
        }
    }