Exemplo n.º 1
0
        protected void lkBtnSave_Click(object sender, EventArgs e)
        {
            #region 判断是否提交财务
            EyouSoft.Model.TourStructure.TourBaseInfo m = new EyouSoft.BLL.TourStructure.Tour().GetTourInfo(Utils.GetQueryStringValue("tourid"));
            if (m != null)
            {
                if (!Utils.PlanIsUpdateOrDelete(m.Status.ToString()))
                {
                    Response.Write("<script>alert('该团已提交财务,不能对它操作!');location.href=location.href;</script>");
                    return;
                }
            }
            #endregion
            //取得页面上选择的航段集合
            string[] strs = this.planIds.Value.Split('|');
            //游客ID
            string cusID = EyouSoft.Common.Utils.GetQueryStringValue("cusID");
            //退票编号
            string RefundId = EyouSoft.Common.Utils.GetQueryStringValue("RefundId");
            if (!string.IsNullOrEmpty(cusID))
            {
                //退票后重新出票
                bool isChuPiao = false;//this.chkBox.Checked;
                //退票须知
                string must = this.txtTuiPiaoMust.Text;
                EyouSoft.Model.TourStructure.CustomerRefund TuiPiaoModel = new EyouSoft.Model.TourStructure.CustomerRefund();
                EyouSoft.BLL.TourStructure.TourOrder        TourOrderBll = new EyouSoft.BLL.TourStructure.TourOrder();

                //添加退票记录
                if (!string.IsNullOrEmpty(cusID))
                {
                    EyouSoft.Model.TourStructure.CustomerRefund model = TourOrderBll.GetCustomerRefund(RefundId);
                    //编号
                    TuiPiaoModel.Id = System.Guid.NewGuid().ToString();
                    //操作员ID
                    TuiPiaoModel.OperatorID = SiteUserInfo.ID;
                    //操作员名字
                    if (SiteUserInfo.ContactInfo != null)
                    {
                        TuiPiaoModel.OperatorName = SiteUserInfo.ContactInfo.ContactName;
                    }
                    //游客编号
                    TuiPiaoModel.CustormerId = cusID;
                    //退票时间
                    TuiPiaoModel.IssueTime = DateTime.Now;
                    //退票需知
                    TuiPiaoModel.RefundNote = must;
                    //退票状态
                    TuiPiaoModel.IsRefund = EyouSoft.Model.EnumType.PlanStructure.TicketRefundSate.已退票;
                    //已退航段集合_遍历IDS取出
                    IList <EyouSoft.Model.TourStructure.MCustomerRefundFlight> list = new List <EyouSoft.Model.TourStructure.MCustomerRefundFlight>();
                    for (int i = 0; i < strs.Length - 1; i++)
                    {
                        EyouSoft.Model.TourStructure.MCustomerRefundFlight fight = new EyouSoft.Model.TourStructure.MCustomerRefundFlight();
                        fight.FlightId = Utils.GetInt(strs[i]);
                        list.Add(fight);
                    }
                    //游客已退航段信息
                    TuiPiaoModel.CustomerRefundFlights = list;
                    string tourID = "";
                    if (TourOrderBll.AddCustomerRefund(TuiPiaoModel, ref tourID))
                    {
                        if (isChuPiao)
                        {
                            //跳转到申请机票页面
                            EyouSoft.Common.Function.MessageBox.ResponseScript(this.Page, string.Format(";alert('退票成功,系统将转入机票审请页面');window.parent.location='/sanping/SanPing_JiPiaoAdd.aspx?tourid={1}&cusId={2}';window.parent.Boxy.getIframeDialog('{0}').hide();", EyouSoft.Common.Utils.GetQueryStringValue("iframeId"), tourID, cusID));
                        }
                        printSuccMsg("退票保存成功,待审核!");
                    }
                    else
                    {
                        printFaiMsg("退票保存失败!");
                    }
                }
                TuiPiaoModel = null;
                TourOrderBll = null;
            }
        }