예제 #1
0
        private void Save()
        {
            EyouSoft.BLL.TourStructure.LineInquireQuoteInfo tsBLL = new EyouSoft.BLL.TourStructure.LineInquireQuoteInfo();
            tsModel = new LineInquireQuoteInfo();          //初始化model

            tid = Utils.GetInt(Utils.GetFormValue("tid")); //获取表操作值
            bool res;

            if (tid > 0)
            {
                tsModel = tsBLL.GetQuoteModel(tid, 0, SiteUserInfo.TourCompany.TourCompanyId, true);
                xcModel = tsModel.XingCheng;
            }
            /////////////////////////////////////普通数据

            tsModel.CustomerName = SiteUserInfo.TourCompany.CompanyName;      //询价单位=当前单位名称??编号??
            tsModel.ContactName  = SiteUserInfo.ContactInfo.ContactName;      //联系人姓名
            tsModel.CustomerId   = SiteUserInfo.TourCompany.TourCompanyId;    //询价单位编号
            tsModel.CompanyId    = SiteUserInfo.CompanyID;                    //专线公司编号

            tsModel.ContactTel = Utils.GetFormValue("vontactTel").ToString(); //联系人电话

            tsModel.RouteName = xianluWindow1.Name;                           //线路名称
            tsModel.RouteId   = Utils.GetInt(xianluWindow1.Id);               //线路ID
            tsModel.LeaveDate = Convert.ToDateTime(this.txtLDate.Text);       //预计出团日期
            tsModel.PeopleNum = Utils.GetInt(Utils.GetFormValue("number"));   //人数??总人数??成人数??儿童数??



            /////////////////////////////////////行程要求////////上传验证

            if (string.IsNullOrEmpty(xcModel.PlanAccessory))
            {
                string[] allowExtensions = new string[] { ".jpeg", ".jpg", ".bmp", ".gif", ".pdf", ".xls", ".xlsx", ".doc", ".docx" };
                string   msg             = string.Empty;
                bool     nameForm        = EyouSoft.Common.Function.UploadFile.CheckFileType(Request.Files, "workAgree", allowExtensions, null, out msg);
                if (!nameForm)
                {
                    lstMsg.Text = msg;
                }
            }
            ////////////////////////////////////行程要求////////上传文件


            if (Request.Files.Count > 0)//上传
            {
                string filepath    = string.Empty;
                string oldfilename = string.Empty;
                bool   result      = EyouSoft.Common.Function.UploadFile.FileUpLoad(Request.Files["workAgree"], "SupplierControlFile", out filepath, out oldfilename);
                if (result)
                {
                    xcModel.PlanAccessoryName = oldfilename;//协议名
                    xcModel.PlanAccessory     = filepath;
                }
            }

            /////////////////////////////////////////行程要求////文本输入
            xcModel.QuotePlan = Utils.EditInputText(txt_xinchen.Text);


            tsModel.XingCheng = xcModel;                             //行程要求=输入框+附件

            tsModel.Requirements = ConProjectControl1.GetDataList(); //客人要求


            tsModel.SpecialClaim = Utils.GetFormValue("quotePlan");; //特殊要求说明

            ///////////////////////////////////////游客信息

            int cusLength = Utils.GetFormValues("cusName").Length;

            tsModel.Traveller            = new TourEverydayApplyTravellerInfo();
            tsModel.Traveller.Travellers = new List <EyouSoft.Model.TourStructure.TourOrderCustomer>();
            for (int i = 0; i < cusLength; i++)
            {
                //游客id
                string cusID = Utils.GetFormValues("cusID")[i];
                EyouSoft.Model.TourStructure.TourOrderCustomer toc = new TourOrderCustomer();
                toc.VisitorName = Utils.GetFormValues("cusName")[i];
                toc.VisitorType = (EyouSoft.Model.EnumType.TourStructure.VisitorType)(Utils.GetInt(Utils.GetFormValues("cusType")[i]));
                toc.CradType    = (EyouSoft.Model.EnumType.TourStructure.CradType)(Utils.GetInt(Utils.GetFormValues("cusCardType")[i]));
                toc.CradNumber  = Utils.GetFormValues("cusCardNo")[i];

                //游客性别
                int cusSex = Utils.GetInt(Utils.GetFormValues("cusSex")[i]);
                toc.Sex = (EyouSoft.Model.EnumType.CompanyStructure.Sex)cusSex;
                #region 性别
                //if (cusSex == 1)
                //{
                //    toc.Sex = EyouSoft.Model.EnumType.CompanyStructure.Sex.男;
                //}
                //else if (cusSex == 2)
                //{
                //    toc.Sex = EyouSoft.Model.EnumType.CompanyStructure.Sex.女;
                //}
                //else
                //{
                //    toc.Sex = EyouSoft.Model.EnumType.CompanyStructure.Sex.未知;
                //}
                #endregion

                toc.ContactTel = Utils.GetFormValues("cusPhone")[i];

                toc.IssueTime = DateTime.Now;
                EyouSoft.Model.TourStructure.CustomerSpecialService specModel = new EyouSoft.Model.TourStructure.CustomerSpecialService();
                if (string.IsNullOrEmpty(cusID))
                {
                    toc.ID = System.Guid.NewGuid().ToString();
                }
                else
                {
                    toc.ID = cusID;
                }

                if (Utils.GetFormValues("cusState")[i] == "DEL")
                {
                    toc.IsDelete = true;
                }
                else
                {
                    toc.IsDelete = false;
                }
                //特服
                string specive = Utils.GetFormValues("specive")[i];
                if (!string.IsNullOrEmpty(specive))
                {
                    if (specive.LastIndexOf(',') + 1 == specive.Length)
                    {
                        specive = specive.Substring(0, specive.Length - 1);
                    }
                    specModel.CustormerId   = toc.ID;
                    specModel.ProjectName   = Server.UrlDecode(Utils.GetFromQueryStringByKey(specive, "txtItem"));
                    specModel.ServiceDetail = Server.UrlDecode(Utils.GetFromQueryStringByKey(specive, "txtServiceContent"));
                    specModel.IsAdd         = Utils.GetFromQueryStringByKey(specive, "ddlOperate") == "0" ? true : false;
                    specModel.Fee           = Utils.GetDecimal(Utils.GetFromQueryStringByKey(specive,
                                                                                             "txtCost"));
                    specModel.IssueTime = DateTime.Now;
                    //特服项目名不能为空,否则不添加该条特服信息
                    if (!string.IsNullOrEmpty(specModel.ProjectName))
                    {
                        toc.SpecialServiceInfo = specModel;
                    }
                }
                tsModel.Traveller.Travellers.Add(toc);
            }
            ///
            if (tid > 0 && lstMsg.Text == "")
            {
                tsModel.Id = tid;

                res = tsBLL.UpdateInquire(tsModel);
            }
            else
            {
                res = tsBLL.AddInquire(tsModel);
            }


            if (res)
            {
                EyouSoft.Common.Function.MessageBox.ResponseScript(this, ";alert('保存成功!');location.href='SelectMoney.aspx';</script>");
            }
            else
            {
                EyouSoft.Common.Function.MessageBox.ResponseScript(this, ";alert('保存失败!');");
            }
        }
예제 #2
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            IList <EyouSoft.Model.TourStructure.TourOrderCustomer> cus_list = new List <EyouSoft.Model.TourStructure.TourOrderCustomer>();

            string[] visitorNameArr = Utils.GetFormValues("txtVisitorName");
            string[] visitorIdArr   = Utils.GetFormValues("hidVisitorID");
            string[] visitorTypeArr = Utils.GetFormValues("ddlVisitorType");
            string[] cardTypeArr    = Utils.GetFormValues("ddlCardType");
            string[] cardNoArr      = Utils.GetFormValues("txtCardNo");
            string[] sexArr         = Utils.GetFormValues("ddlSex");
            string[] contactTelArr  = Utils.GetFormValues("txtContactTel");
            string[] uri            = Utils.GetFormValues("tefu");
            string[] isDeleteArr    = Utils.GetFormValues("isdelete");
            string   visitorName    = null;
            string   hidVisitorID   = null;
            bool     isDelete       = false;

            EyouSoft.Model.TourStructure.TourOrderCustomer      item = null;
            EyouSoft.Model.TourStructure.CustomerSpecialService css  = null;

            EyouSoft.BLL.TourStructure.TourOrder orderBll = new EyouSoft.BLL.TourStructure.TourOrder(SiteUserInfo);

            for (int k = 0; k < visitorNameArr.Length; k++)
            {
                item         = new EyouSoft.Model.TourStructure.TourOrderCustomer();
                visitorName  = visitorNameArr[k];
                hidVisitorID = visitorIdArr[k];
                isDelete     = isDeleteArr[k] == "1" ? true : false;
                //获取 游客ID ,判断当前游客信息操作是新增,修改,或者删除
                if (hidVisitorID != "")//修改
                {
                    item.ID = hidVisitorID;
                    if (isDelete == true)//删除
                    {
                        item.IsDelete = true;
                    }
                }
                else//新增
                {
                    item.ID = Guid.NewGuid().ToString();
                    //如果姓名为空,则忽略这条信息
                    if (visitorName == "")
                    {
                        continue;
                    }
                }

                item.VisitorName = visitorName;
                //switch (visitorTypeArr[k])
                //{
                //    case "1":
                //        item.VisitorType = EyouSoft.Model.EnumType.TourStructure.VisitorType.成人;
                //        break;
                //    case "2":
                //        item.VisitorType = EyouSoft.Model.EnumType.TourStructure.VisitorType.儿童;
                //        break;
                //    default:
                //        item.VisitorType = EyouSoft.Model.EnumType.TourStructure.VisitorType.未知;
                //        break;
                //}
                //switch (cardTypeArr[k])
                //{
                //    case "1":
                //        {
                //            item.CradType = EyouSoft.Model.EnumType.TourStructure.CradType.身份证;
                //        } break;
                //    case "2":
                //        {
                //            item.CradType = EyouSoft.Model.EnumType.TourStructure.CradType.护照;
                //        } break;
                //    case "3":
                //        {
                //            item.CradType = EyouSoft.Model.EnumType.TourStructure.CradType.军官证;
                //        } break;
                //    case "4":
                //        {
                //            item.CradType = EyouSoft.Model.EnumType.TourStructure.CradType.台胞证;
                //        } break;
                //    case "5":
                //        {
                //            item.CradType = EyouSoft.Model.EnumType.TourStructure.CradType.港澳通行证;
                //        } break;
                //    default:
                //        {
                //            item.CradType = EyouSoft.Model.EnumType.TourStructure.CradType.未知;
                //        } break;
                //}
                item.VisitorType = (EyouSoft.Model.EnumType.TourStructure.VisitorType)Utils.GetInt(visitorTypeArr[k]);
                item.CradType    = (EyouSoft.Model.EnumType.TourStructure.CradType)Utils.GetInt(cardTypeArr[k]);
                item.CradNumber  = cardNoArr[k];
                switch (sexArr[k])
                {
                case "2":
                {
                    item.Sex = EyouSoft.Model.EnumType.CompanyStructure.Sex.男;
                } break;

                case "1":
                {
                    item.Sex = EyouSoft.Model.EnumType.CompanyStructure.Sex.女;
                } break;

                default:
                {
                    item.Sex = EyouSoft.Model.EnumType.CompanyStructure.Sex.未知;
                } break;
                }
                item.ContactTel = contactTelArr[k];
                css             = new EyouSoft.Model.TourStructure.CustomerSpecialService();

                css.Fee                 = Utils.GetDecimal(Utils.GetFromQueryStringByKey(uri[k], "txtCost"));
                css.IsAdd               = Utils.GetFromQueryStringByKey(uri[k], "ddlOperate") == "0" ? true : false;
                css.IssueTime           = DateTime.Now;
                css.ProjectName         = Utils.GetFromQueryStringByKey(uri[k], "txtItem");
                css.ServiceDetail       = Utils.GetFromQueryStringByKey(uri[k], "txtServiceContent");
                css.CustormerId         = item.ID;
                item.SpecialServiceInfo = css;
                item.IssueTime          = DateTime.Now;
                item.CompanyID          = SiteUserInfo.CompanyID;
                cus_list.Add(item);
            }

            //保存游客信息
            if (orderBll.UpdateCustomerList(cus_list, this.hideOrderId.Value))
            {
                EyouSoft.Common.Function.MessageBox.ResponseScript(this, "javascript:alert('保存成功!');parent.Boxy.getIframeDialog('" + Request.QueryString["iframeid"] + "').hide();");
            }
        }