/// <summary> /// 将游轮价格实体 /// </summary> /// <param name="ShipPriceXml">游轮价格XML</param> /// <returns></returns> private IList <EyouSoft.Model.PlanStructure.MPlanShipPrice> GetShipPriceList(string ShipPriceXml) { IList <EyouSoft.Model.PlanStructure.MPlanShipPrice> list = new List <EyouSoft.Model.PlanStructure.MPlanShipPrice>(); if (!string.IsNullOrEmpty(ShipPriceXml)) { XElement xem = XElement.Parse(ShipPriceXml); var row = xem.Elements("row"); foreach (var item in row) { EyouSoft.Model.PlanStructure.MPlanShipPrice model = new EyouSoft.Model.PlanStructure.MPlanShipPrice(); model.Grade = (EyouSoft.Model.EnumType.PlanStructure.PlanShipGrade)Utils.GetInt(item.Element("Grade").Value); model.AdultNumber = Utils.GetInt(item.Element("AdultNumber").Value); model.AdultPrice = Utils.GetDecimal(item.Element("AdultPrice").Value); model.ChildNumber = Utils.GetInt(item.Element("ChildNumber").Value); model.ChildPrice = Utils.GetDecimal(item.Element("ChildPrice").Value); model.PriceType = (EyouSoft.Model.EnumType.PlanStructure.PlanShipPriceType)Utils.GetInt(item.Element("PriceType").Value); list.Add(model); model = null; } } return(list); }
/// <summary> /// 保存 /// </summary> /// <returns></returns> protected string PageSaveC() { #region 表单取值 string msg = string.Empty; string seterrormsg = string.Empty; //游船公司id name string shipIdC = Utils.GetFormValue(this.SupplierControl2.ClientValue); string shipNameC = Utils.GetFormValue(this.SupplierControl2.ClientText); //联系人 电话 传真 string contectName = Utils.GetFormValue(this.txtContectNameC.UniqueID); string contectPhone = Utils.GetFormValue(this.txtContectPhoneC.UniqueID); string contectFax = Utils.GetFormValue(this.txtContectFaxC.UniqueID); //船名 线路 string shipId = string.Empty; string shipname = string.Empty; if (!string.IsNullOrEmpty(Utils.GetFormValue("SelShipNameC"))) { shipId = Utils.GetFormValue("SelShipNameC").Split(',')[0]; shipname = Utils.GetFormValue("SelShipNameC").Split(',')[1]; } string route = Utils.GetFormValue(this.txtRouteC.UniqueID); //登船日期 时间 登船码头 停靠景点 DateTime?boardDate = Utils.GetDateTimeNullable(Utils.GetFormValue(this.txtBoardDateC.UniqueID)); string boardtime = Utils.GetFormValue(this.txtBoardTimeC.UniqueID); string boardWhilfC = Utils.GetFormValue(this.txtBoardWhilfC.UniqueID); string stopAttr = Utils.GetFormValue(this.txtStopAttrC.UniqueID); //价格组成 string[] AircraftType = Utils.GetFormValues("selAircraft"); string[] adultNums = Utils.GetFormValues("AdultNumsC"); string[] adultPrices = Utils.GetFormValues("adultPricesC"); //string[] childNums = Utils.GetFormValues("childrenNumC"); //string[] childPrices = Utils.GetFormValues("childrenpricesC"); //自费项目 //string ownCost = Utils.GetFormValue(this.txtOwnCostC.UniqueID); //string ownPeopleNums = Utils.GetFormValue(this.txtOwnCostNumsC.UniqueID); //decimal ownUnitPrices = Utils.GetDecimal(Utils.GetFormValue(this.txtOwnUnitPricesC.UniqueID)); //结算费用 decimal totalPrices = Utils.GetDecimal(Utils.GetFormValue(this.txttotalPricesC.UniqueID)); //费用明细 string costDetail = Utils.GetFormValue(this.txtCostDetailC.UniqueID); //导游需知 其它备注 string guidNotes = Utils.GetFormValue(this.txtGuidNotesC.UniqueID); string otherRemrk = Utils.GetFormValue(this.txtOtherMarkC.UniqueID); string[] txtGuoNeiXiaoJi = Utils.GetFormValues("txtGuoNeiXiaoJi"); string[] txtGuoNeiBeiZhu = Utils.GetFormValues("txtGuoNeiBeiZhu"); #endregion #region 后台验证 if (string.IsNullOrEmpty(shipIdC) && string.IsNullOrEmpty(shipNameC)) { msg += "请选择游轮公司!<br/>"; } if (string.IsNullOrEmpty(route)) { msg += "请输入线路!<br/>"; } if (string.IsNullOrEmpty(boardWhilfC)) { msg += "请输入登船码头!<br/>"; } if (totalPrices <= 0) { msg += "请输入结算价格!<br/>"; } if (string.IsNullOrEmpty(Utils.GetFormValue("SelPanyMentC"))) { msg += "请选择支付方式!<br/>"; } if (string.IsNullOrEmpty(Utils.GetFormValue("SelStateC"))) { msg += "请选择状态!<br/>"; } if (string.IsNullOrEmpty(Utils.GetFormValue(this.ddlprofit2.UniqueID))) { msg += "请选择是否返利!<br/>"; } if (AircraftType.Length > 0) { for (int i = 0; i < AircraftType.Length; i++) { if (string.IsNullOrEmpty(AircraftType[i])) { msg += "请选择舱位类型!<br/>"; } } } if (adultNums.Length > 0) { for (int i = 0; i < adultNums.Length; i++) { if (string.IsNullOrEmpty(adultNums[i]) || Utils.GetInt(adultNums[i]) < 0) { msg += "请输入人数!<br/>"; } } } if (adultPrices.Length > 0) { for (int i = 0; i < adultPrices.Length; i++) { if (Utils.GetDecimal(adultPrices[i]) < 0) { msg += "请输入单价格!<br/>"; } } } if (msg != "") { seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); return(seterrormsg); } #endregion #region 实体赋值 EyouSoft.Model.PlanStructure.MPlanBaseInfo baseinfo = new EyouSoft.Model.PlanStructure.MPlanBaseInfo(); baseinfo.AddStatus = EyouSoft.Model.EnumType.PlanStructure.PlanAddStatus.计调安排时添加; baseinfo.CompanyId = this.SiteUserInfo.CompanyId; baseinfo.Confirmation = totalPrices; baseinfo.PlanCost = totalPrices; baseinfo.ContactFax = contectFax; baseinfo.ContactName = contectName; baseinfo.ContactPhone = contectPhone; baseinfo.CostDetail = costDetail; baseinfo.GuideNotes = guidNotes; baseinfo.IsRebate = Utils.GetFormValue(this.ddlprofit2.UniqueID) == "0" ? true : false; baseinfo.IssueTime = System.DateTime.Now; baseinfo.PaymentType = (EyouSoft.Model.EnumType.PlanStructure.Payment)Utils.GetInt(Utils.GetFormValue("SelPanyMentC")); baseinfo.PlanShip = new EyouSoft.Model.PlanStructure.MPlanShip(); baseinfo.PlanShip.Line = route; baseinfo.PlanShip.LoadDock = boardWhilfC; baseinfo.PlanShip.Sight = stopAttr; baseinfo.PlanShip.SubId = shipId; baseinfo.PlanShip.ShipName = shipname; decimal nums = 0; baseinfo.PlanShip.PlanShipPriceList = new List <EyouSoft.Model.PlanStructure.MPlanShipPrice>(); for (int i = 0; i < AircraftType.Length; i++) { EyouSoft.Model.PlanStructure.MPlanShipPrice prices = new EyouSoft.Model.PlanStructure.MPlanShipPrice(); prices.RoomType = (EyouSoft.Model.EnumType.PlanStructure.PlanShipRoomType)Enum.Parse(typeof(EyouSoft.Model.EnumType.PlanStructure.PlanShipRoomType), AircraftType[i]); prices.DNum = Utils.GetDecimal(adultNums[i]); prices.AdultNumber = Utils.GetInt(adultNums[i]); prices.AdultNumber = Convert.ToInt32(prices.DNum); prices.AdultPrice = Utils.GetDecimal(adultPrices[i]); //prices.ChildNumber = Utils.GetInt(childNums[i]); //prices.ChildPrice = Utils.GetDecimal(childPrices[i]); prices.SumPrice = Utils.GetDecimal(txtGuoNeiXiaoJi[i]); prices.BeiZhu = txtGuoNeiBeiZhu[i]; baseinfo.PlanShip.PlanShipPriceList.Add(prices); //nums += Utils.GetInt(adultNums[i]) + Utils.GetInt(childNums[i]); nums += Utils.GetDecimal(adultNums[i]); } baseinfo.PlanShip.PlanShipOwnCostList = new List <EyouSoft.Model.PlanStructure.MPlanShipOwnCost>(); //EyouSoft.Model.PlanStructure.MPlanShipOwnCost ownCostObj = new EyouSoft.Model.PlanStructure.MPlanShipOwnCost(); //ownCostObj.IsFloor = false; //ownCostObj.OwnItem = ownCost; //ownCostObj.PeopleNum = Utils.GetInt(ownPeopleNums); //ownCostObj.Price = ownUnitPrices; //baseinfo.PlanShip.PlanShipOwnCostList.Add(ownCostObj); baseinfo.Num = Convert.ToInt32(nums); baseinfo.DNum = nums; baseinfo.Remarks = otherRemrk; baseinfo.SourceId = shipIdC; baseinfo.SourceName = shipNameC; baseinfo.StartDate = boardDate; baseinfo.StartTime = boardtime; baseinfo.Status = (EyouSoft.Model.EnumType.PlanStructure.PlanState)Utils.GetInt(Utils.GetFormValue("SelStateC")); if (Utils.GetFormValue(this.SupplierControl2.ClientIsyukong) == "1") { baseinfo.SueId = Utils.GetFormValue(this.SupplierControl2.ClientzyykValue); } baseinfo.TourId = Utils.GetQueryStringValue("tourId"); baseinfo.Type = EyouSoft.Model.EnumType.PlanStructure.PlanProject.国内游轮; baseinfo.OperatorId = this.SiteUserInfo.UserId; baseinfo.OperatorName = this.SiteUserInfo.Name; #endregion #region 表单提交 if (Utils.GetQueryStringValue("action") == "saveC") { string planID = Utils.GetQueryStringValue("planId"); //修改 if (!string.IsNullOrEmpty(planID)) { baseinfo.PlanId = planID; baseinfo.PlanShip.PlanId = planID; if (new EyouSoft.BLL.PlanStructure.BPlan().UpdPlan(baseinfo) > 0) { msg += "修改成功!"; seterrormsg = UtilsCommons.AjaxReturnJson("1", "" + msg + ""); } else { msg += "修改失败!"; seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); } } else //添加 { if (new EyouSoft.BLL.PlanStructure.BPlan().AddPlan(baseinfo) > 0) { msg += "添加成功!"; seterrormsg = UtilsCommons.AjaxReturnJson("1", "" + msg + ""); } else { msg += "添加失败!"; seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); } } } #endregion return(seterrormsg); }
protected string PageSaveForeign() { #region 表单取值 string msg = string.Empty; string seterrormsg = string.Empty; //游船公司 string shipComName = Utils.GetFormValue(this.SupplierControl1.ClientText); string shipComID = Utils.GetFormValue(this.SupplierControl1.ClientValue); //联系人 电话 传真 string contectName = Utils.GetFormValue(this.txtContectName.UniqueID); string contectPhone = Utils.GetFormValue(this.txtContectPhone.UniqueID); string contectFax = Utils.GetFormValue(this.txtContectFax.UniqueID); //船名 船载电话 string shipName = Utils.GetFormValue("ddlShipNameList").Split(',')[1]; string shipPhone = Utils.GetFormValue(this.txtShipPhone.UniqueID); //登船日期 时间 船载码头 DateTime?boardDate = Utils.GetDateTimeNullable(Utils.GetFormValue(this.txtBoardDate.UniqueID)); string boardTime = Utils.GetFormValue(this.txtBoardTime.UniqueID); string boardWharif = Utils.GetFormValue(this.txtBoardWharif.UniqueID); //登船号 航线 string boardCode = Utils.GetFormValue(this.txtBoardCode.UniqueID); string route = Utils.GetFormValue(this.txtRoute.UniqueID); //停靠景点 string stopAttr = Utils.GetFormValue(this.txtStopAttr.UniqueID); //价格组成 string[] roomTypes = Utils.GetFormValues("selRoomTypeList"); string[] CrowdTypes = Utils.GetFormValues("selCrowdType"); string[] adultNums = Utils.GetFormValues("txtAdultNum"); string[] adultPrices = Utils.GetFormValues("txtAdultPrice"); //string[] childNums = Utils.GetFormValues("txtChildNum"); //string[] childPrices = Utils.GetFormValues("txtChildPrice"); //string[] childNoNums = Utils.GetFormValues("txtChildNoNum"); //string[] childNoPrices = Utils.GetFormValues("txtChildNoPrice"); //string[] bobyNums = Utils.GetFormValues("txtBobyNum"); //string[] bobyPrices = Utils.GetFormValues("txtBobyPrice"); string[] totalPrices = Utils.GetFormValues("txtTotalPrice"); //楼层 string[] floors = Utils.GetFormValues("selFloorList"); string[] peopleNums = Utils.GetFormValues("txtPeopleNum"); string[] unitPrices = Utils.GetFormValues("txtUnitPrice"); //自费项目 //string ownCost = Utils.GetFormValue(this.txtOwnCost.UniqueID); //string ownPrices = Utils.GetFormValue(this.txtOwnCostPrice.UniqueID); //string ownNums = Utils.GetFormValue(this.txtOwnCostNums.UniqueID); //结算费用 decimal totalCost = Utils.GetDecimal(Utils.GetFormValue(this.txtTotalPrices.UniqueID)); //游客资料 string customerInfo = Utils.GetFormValue(this.txtCustomerInfo.UniqueID); //费用明细 string costDetail = Utils.GetFormValue(this.txtCostDetail.UniqueID); //导游需知 其它备注 string guidNotes = Utils.GetFormValue(this.txtGuidNOtes.UniqueID); string otherMarks = Utils.GetFormValue(this.txtOtherRemarks.UniqueID); string[] txtSheWaiBeiZhu = Utils.GetFormValues("txtSheWaiBeiZhu"); #endregion #region 后台验证 if (string.IsNullOrEmpty(shipComID) && string.IsNullOrEmpty(shipComName)) { msg += "请选择游船公司!<br/>"; } if (string.IsNullOrEmpty(shipName)) { msg += "请输入船名!<br/>"; } if (string.IsNullOrEmpty(boardWharif)) { msg += "请输入登船码头!<br/>"; } if (roomTypes.Length > 0) { for (int i = 0; i < roomTypes.Length; i++) { if (string.IsNullOrEmpty(roomTypes[i])) { msg += "请选择房型!<br/>"; } } } if (CrowdTypes.Length > 0) { for (int i = 0; i < CrowdTypes.Length; i++) { if (string.IsNullOrEmpty(CrowdTypes[i])) { msg += "请选择人群类型!<br/>"; } } } if (adultNums.Length > 0) { for (int i = 0; i < adultNums.Length; i++) { if (string.IsNullOrEmpty(adultNums[i]) || Utils.GetInt(adultNums[i]) < 0) { msg += "请输入人数!<br/>"; } } } if (adultPrices.Length > 0) { for (int i = 0; i < adultPrices.Length; i++) { if (Utils.GetDecimal(adultPrices[i]) < 0 || string.IsNullOrEmpty(adultPrices[i])) { msg += "请输入单价!<br/>"; } } } if (totalCost < 0) { msg += "请输入结算费用!<br/>"; } if (string.IsNullOrEmpty(Utils.GetFormValue("SelPanyMent"))) { msg += "请选择支付方式!<br/>"; } if (string.IsNullOrEmpty(Utils.GetFormValue("SelStatus"))) { msg += "请选择状态!<br/>"; } if (string.IsNullOrEmpty(Utils.GetFormValue(this.ddlprofit1.UniqueID))) { msg += "请选择是否返利!<br/>"; } if (msg != "") { seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); return(seterrormsg); } #endregion #region 实体赋值 EyouSoft.Model.PlanStructure.MPlanBaseInfo baseinfo = new EyouSoft.Model.PlanStructure.MPlanBaseInfo(); baseinfo.AddStatus = EyouSoft.Model.EnumType.PlanStructure.PlanAddStatus.计调安排时添加; baseinfo.CompanyId = this.SiteUserInfo.CompanyId; baseinfo.Confirmation = totalCost; baseinfo.PlanCost = totalCost; baseinfo.ContactFax = contectFax; baseinfo.ContactName = contectName; baseinfo.ContactPhone = contectPhone; baseinfo.CostDetail = costDetail; baseinfo.CustomerInfo = customerInfo; baseinfo.GuideNotes = guidNotes; baseinfo.IsRebate = Utils.GetFormValue(this.ddlprofit1.UniqueID) == "0" ? true : false; baseinfo.IssueTime = System.DateTime.Now; baseinfo.PaymentType = (EyouSoft.Model.EnumType.PlanStructure.Payment)Utils.GetInt(Utils.GetFormValue("SelPanyMent")); baseinfo.PlanShip = new EyouSoft.Model.PlanStructure.MPlanShip(); baseinfo.PlanShip.Line = route; baseinfo.PlanShip.LoadCode = boardCode; baseinfo.PlanShip.LoadDock = boardWharif; baseinfo.PlanShip.ShipCalls = shipPhone; baseinfo.PlanShip.ShipName = shipName; baseinfo.PlanShip.SubId = Utils.GetFormValue("ddlShipNameList").Split(',')[0]; baseinfo.PlanShip.Sight = stopAttr; //自费项目 //baseinfo.PlanShip.PlanShipOwnCostList = new List<EyouSoft.Model.PlanStructure.MPlanShipOwnCost>(); //EyouSoft.Model.PlanStructure.MPlanShipOwnCost OwnCostM = new EyouSoft.Model.PlanStructure.MPlanShipOwnCost(); //OwnCostM.OwnItem = ownCost; //OwnCostM.PeopleNum = Utils.GetInt(ownNums); //OwnCostM.Price = Utils.GetDecimal(ownPrices); //OwnCostM.IsFloor = false; //baseinfo.PlanShip.PlanShipOwnCostList.Add(OwnCostM); //楼层 //for (int i = 0; i < floors.Length; i++) //{ // EyouSoft.Model.PlanStructure.MPlanShipOwnCost OwnCostF = new EyouSoft.Model.PlanStructure.MPlanShipOwnCost(); // OwnCostF.IsFloor = true; // OwnCostF.OwnItem = floors[i]; // OwnCostF.PeopleNum = Utils.GetInt(peopleNums[i]); // OwnCostF.Price = Utils.GetDecimal(unitPrices[i]); // baseinfo.PlanShip.PlanShipOwnCostList.Add(OwnCostF); //} decimal nums = 0; //价格组成 baseinfo.PlanShip.PlanShipPriceList = new List <EyouSoft.Model.PlanStructure.MPlanShipPrice>(); for (int i = 0; i < roomTypes.Length; i++) { EyouSoft.Model.PlanStructure.MPlanShipPrice pricesM = new EyouSoft.Model.PlanStructure.MPlanShipPrice(); pricesM.DNum = Utils.GetDecimal(adultNums[i]); pricesM.AdultNumber = Utils.GetInt(adultNums[i]); pricesM.AdultNumber = Convert.ToInt32(pricesM.DNum); pricesM.AdultPrice = Utils.GetDecimal(adultPrices[i]); //pricesM.BabyNumber = Utils.GetInt(bobyNums[i]); //pricesM.BabyNumberPrice = Utils.GetDecimal(bobyPrices[i]); //pricesM.ChildNoOccupancy = Utils.GetInt(childNoNums[i]); //pricesM.ChildNoOccupancyPrice = Utils.GetDecimal(childNoPrices[i]); //pricesM.ChildNumber = Utils.GetInt(childNums[i]); //pricesM.ChildPrice = Utils.GetDecimal(childPrices[i]); pricesM.SumPrice = Utils.GetDecimal(totalPrices[i]);; //nums += Utils.GetInt(adultNums[i]) + Utils.GetInt(bobyNums[i]) + Utils.GetInt(childNoNums[i]) + Utils.GetInt(childNums[i]); nums += Utils.GetDecimal(adultNums[i]); pricesM.CrowdType = (EyouSoft.Model.EnumType.PlanStructure.PlanShipCrowdType)Enum.Parse(typeof(EyouSoft.Model.EnumType.PlanStructure.PlanShipCrowdType), CrowdTypes[i]); pricesM.RoomType = (EyouSoft.Model.EnumType.PlanStructure.PlanShipRoomType)Enum.Parse(typeof(EyouSoft.Model.EnumType.PlanStructure.PlanShipRoomType), roomTypes[i]); pricesM.BeiZhu = txtSheWaiBeiZhu[i]; //小计 baseinfo.PlanShip.PlanShipPriceList.Add(pricesM); } baseinfo.Num = Convert.ToInt32(nums); baseinfo.DNum = nums; baseinfo.Remarks = otherMarks; baseinfo.SourceId = shipComID; baseinfo.SourceName = shipComName; baseinfo.StartDate = boardDate; baseinfo.StartTime = boardTime; baseinfo.Status = (EyouSoft.Model.EnumType.PlanStructure.PlanState)Utils.GetInt(Utils.GetFormValue("SelStatus")); if (Utils.GetFormValue(this.SupplierControl1.ClientIsyukong) == "1") { baseinfo.SueId = Utils.GetFormValue(this.SupplierControl1.ClientzyykValue); } baseinfo.TourId = Utils.GetQueryStringValue("tourId"); baseinfo.Type = EyouSoft.Model.EnumType.PlanStructure.PlanProject.涉外游轮; baseinfo.OperatorId = this.SiteUserInfo.UserId; baseinfo.OperatorName = this.SiteUserInfo.Name; #endregion #region 提交操作 int result = 0; EyouSoft.BLL.PlanStructure.BPlan bll = new EyouSoft.BLL.PlanStructure.BPlan(); if (Utils.GetQueryStringValue("action") == "save") { string editID = Utils.GetQueryStringValue("planId"); if (!string.IsNullOrEmpty(editID)) { baseinfo.PlanShip.PlanId = editID; baseinfo.PlanId = editID; result = bll.UpdPlan(baseinfo); if (result == 1) { msg += "修改成功!"; seterrormsg = UtilsCommons.AjaxReturnJson("1", "" + msg + ""); } else if (result == 0) { msg += "修改失败!"; seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); } else if (result == -2) { msg += "预控数量不足,修改失败!"; seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); } } else { result = bll.AddPlan(baseinfo); if (result == 1) { msg += "添加成功!"; seterrormsg = UtilsCommons.AjaxReturnJson("1", "" + msg + ""); } else if (result == 0) { msg += "添加失败!"; seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); } else if (result == -2) { msg += "预控数量不足,添加失败!"; seterrormsg = UtilsCommons.AjaxReturnJson("0", "" + msg + ""); } } } #endregion return(seterrormsg); }