Пример #1
0
 void bindBunks(Pagination pagination)
 {
     try
     {
         var condition  = GetCondition();
         var totalDatas = FoundationService.QueryBunkListView(condition, pagination).Select(GetListBunk);
         this.gvDiscount.DataSource = totalDatas;
         this.gvDiscount.DataBind();
         if (totalDatas.Count() > 0)
         {
             this.pagerl.Visible = true;
             if (pagination.GetRowCount)
             {
                 this.pagerl.RowCount = pagination.RowCount;
             }
         }
         else
         {
             this.pagerl.Visible = false;
         }
     }
     catch (Exception ex)
     {
         ShowExceptionMessage(ex, "查询");
     }
 }
        public PurchaseOrder ReadPurchaseOrderByTrackingNumber(string confirmationNumber)
        {
            Guid?userId = GetSoldToIdForPurchaseOrderByInvoice(confirmationNumber);

            if (userId.HasValue)
            {
                var queryBaskets = new CommerceQuery <CommerceEntity, CommerceModelSearch <CommerceEntity>, CommerceBasketQueryOptionsBuilder>("Basket");

                queryBaskets.SearchCriteria.Model.Properties["UserId"]      = userId.Value.ToString("B");
                queryBaskets.SearchCriteria.Model.Properties["BasketType"]  = 1;
                queryBaskets.SearchCriteria.Model.Properties["OrderNumber"] = confirmationNumber;

                queryBaskets.QueryOptions.RefreshBasket = false;

                var queryLineItems = new CommerceQueryRelatedItem <CommerceEntity>("LineItems", "LineItem");
                queryBaskets.RelatedOperations.Add(queryLineItems);

                var response = FoundationService.ExecuteRequest(queryBaskets.ToRequest());

                if (response.OperationResponses.Count == 0)
                {
                    return(null);
                }

                CommerceQueryOperationResponse basketResponse = response.OperationResponses[0] as CommerceQueryOperationResponse;

                return(basketResponse.CommerceEntities.Cast <CommerceEntity>().Select(p => (PurchaseOrder)p).First());
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["action"] != null)
     {
         ChildOrderableBunkView childOrderableBunkView = new ChildOrderableBunkView()
         {
             Airline  = this.dropairlinecode.SelectedValue,
             Bunk     = this.iptClass.Value.Trim(),
             Discount = Convert.ToDecimal(this.txtDiscount.Value.Trim()) / 100
         };
         if (Request.QueryString["action"].ToString() == "add")
         {
             try
             {
                 FoundationService.AddChildrenOrderableBunk(childOrderableBunkView, CurrentUser.UserName);
                 ClientScript.RegisterStartupScript(this.GetType(), this.UniqueID, "alert('添加成功!');window.location.href='ChildTicketMaintain.aspx';", true);
             } catch (Exception ex) {
                 ShowExceptionMessage(ex, "添加");
             }
         }
         else
         {
             try
             {
                 FoundationService.UpdateChildrenOrderableBunk(new Guid(Request.QueryString["Id"].ToString()), childOrderableBunkView, CurrentUser.UserName);
                 ClientScript.RegisterStartupScript(this.GetType(), this.UniqueID, "alert('修改成功!'); window.location.href='ChildTicketMaintain.aspx'", true);
             } catch (Exception ex) {
                 ShowExceptionMessage(ex, "修改");
             }
         }
     }
 }
Пример #4
0
        protected void gvDiscount_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            LinkButton linkButton = this.gvDiscount.Rows[e.RowIndex].FindControl("linkDel") as LinkButton;

            if (linkButton != null)
            {
                try
                {
                    FoundationService.DeleteBunk(new Guid(linkButton.CommandArgument), CurrentUser.UserName);
                    RegisterScript("alert('删除成功!');");
                }
                catch (Exception ex)
                {
                    ShowExceptionMessage(ex, "删除");
                    return;
                }
                var pagination = new Pagination()
                {
                    PageSize    = m_pageSize,
                    PageIndex   = 1,
                    GetRowCount = true
                };
                bindBunks(pagination);
            }
        }
Пример #5
0
        public static string GetGeneralBunkRegulation(Bunk bunk)
        {
            var           pattern           = new Regex("^[a-zA-Z\\d/]+$");
            var           refundDetail      = FoundationService.QueryDetailList(bunk.Owner.Airline, bunk.Code).Where(item => pattern.IsMatch(item.Bunks));
            StringBuilder result            = new StringBuilder();
            string        refundRegulation  = string.Empty;
            string        changeRegulation  = string.Empty;
            string        endorseRegulation = string.Empty;

            foreach (var item in refundDetail)
            {
                refundRegulation  += ("航班起飞前:" + item.ScrapBefore + ";航班起飞后:" + item.ScrapAfter).Replace("<br/>", "").Replace("\r", "").Replace("\n", "").Replace("\t", "");
                changeRegulation  += ("航班起飞前:" + item.ChangeBefore + ";航班起飞后:" + item.ChangeAfter).Replace("<br/>", "").Replace("\r", "").Replace("\n", "").Replace("\t", "");
                endorseRegulation += item.Endorse.Replace("<br/>", "").Replace("\r", "").Replace("\n", "").Replace("\t", "");
            }
            if (string.IsNullOrWhiteSpace(refundRegulation))
            {
                refundRegulation = "以航司具体规定为准";
            }
            if (string.IsNullOrWhiteSpace(changeRegulation))
            {
                changeRegulation = "以航司具体规定为准";
            }
            result.AppendFormat("<p><span class=b>退票规定:</span>{0}</p>", refundRegulation);
            result.AppendFormat("<p><span class=b>更改规定:</span>{0}</p>", changeRegulation);
            result.AppendFormat("<p><span class=b>签转规定:</span>{0}</p>", endorseRegulation);
            return(result.ToString());
            //return (bunk as Service.FlightQuery.Domain.GeneralBunk).EI;
        }
Пример #6
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["action"] != null)
     {
         AirlineView airlineView = new AirlineView()
         {
             Code       = this.txtErCode.Text.Trim(),
             Name       = this.txtAirlineName.Text.Trim(),
             SettleCode = this.txtJsCode.Text.Trim(),
             ShortName  = this.txtAirlineShortName.Text.Trim(),
             Valid      = this.ddlAirlineStatus.SelectedValue == "T" ? true : false
         };
         if (Request.QueryString["action"].ToString() == "add")
         {
             try
             {
                 FoundationService.AddAirline(airlineView, CurrentUser.UserName);
                 RegisterScript("alert('添加成功!'); window.location.href='Airline.aspx'");
             } catch (Exception ex) {
                 ShowExceptionMessage(ex, "添加");
             }
         }
         else
         {
             try
             {
                 FoundationService.UpdateAirline(airlineView, CurrentUser.UserName);
                 RegisterScript("alert('修改成功!'); window.location.href='Airline.aspx?Search=Back'");
             } catch (Exception ex) {
                 ShowExceptionMessage(ex, "修改");
             }
         }
     }
 }
Пример #7
0
        public object QueryAirlinesByAirlineCodeNew(string code)
        {
            var airline = FoundationService.QueryRefundAndReschedulingNewBase(code);
            var detail  = new List <RefundAndReschedulingDetail> {
                new RefundAndReschedulingDetail {
                    ChangeAfter  = string.Empty,
                    ChangeBefore = string.Empty,
                    Endorse      = string.Empty,
                    ScrapAfter   = string.Empty,
                    ScrapBefore  = string.Empty,
                    Bunks        = string.Empty
                }
            };

            return(new
            {
                ShortName = ReplaceName(airline.Airline.Name),
                Scrap = string.IsNullOrEmpty(airline.Scrap) ? string.Empty : airline.Scrap,
                AirlineTel = string.IsNullOrEmpty(airline.AirlineTel) ? string.Empty : airline.AirlineTel,
                Remark = string.IsNullOrEmpty(airline.Remark) ? string.Empty : airline.Remark,
                Condition = string.IsNullOrEmpty(airline.Condition) ? string.Empty : airline.Condition,
                RefundAndReschedulingDetail = from item in airline.RefundAndReschedulingDetail ?? detail
                                              select new
                {
                    ChangeAfter = string.IsNullOrEmpty(item.ChangeAfter) ? string.Empty : item.ChangeAfter,
                    ChangeBefore = string.IsNullOrEmpty(item.ChangeBefore) ? string.Empty : item.ChangeBefore,
                    Endorse = string.IsNullOrEmpty(item.Endorse) ? string.Empty : item.Endorse,
                    ScrapAfter = string.IsNullOrEmpty(item.ScrapAfter) ? string.Empty : item.ScrapAfter,
                    ScrapBefore = string.IsNullOrEmpty(item.ScrapBefore) ? string.Empty : item.ScrapBefore,
                    Bunks = string.IsNullOrEmpty(item.Bunks) ? string.Empty : item.Bunks,
                }
            });
        }
Пример #8
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["action"] != null)
     {
         ProvinceView provinceView = new ProvinceView()
         {
             Code     = this.txtProvinceCode.Text.Trim(),
             Name     = this.txtProvinceName.Text.Trim(),
             AreaCode = this.ddlArea.SelectedValue
         };
         if (Request.QueryString["action"].ToString() == "add")
         {
             try
             {
                 FoundationService.AddProvince(provinceView, CurrentUser.UserName);
                 RegisterScript("alert('添加成功!'); window.location.href='Province.aspx'");
             } catch (Exception ex) {
                 ShowExceptionMessage(ex, "添加");
             }
         }
         else
         {
             try
             {
                 FoundationService.UpdateProvince(provinceView, CurrentUser.UserName);
                 RegisterScript("alert('修改成功!'); window.location.href='Province.aspx?Search=Back'");
             } catch (Exception ex) {
                 ShowExceptionMessage(ex, "修改");
             }
         }
     }
 }
Пример #9
0
 void bindDatas(Pagination pagination)
 {
     try {
         string airlineCode = null;
         if (!string.IsNullOrWhiteSpace(ddlAirline.SelectedValue))
         {
             airlineCode = ddlAirline.SelectedValue.Trim().ToUpper();
         }
         var totalDatas = FoundationService.QueryAllRefundAndReschedulings(airlineCode);
         var startRow   = pagination.PageSize * (pagination.PageIndex - 1);
         var endRow     = pagination.PageSize * pagination.PageIndex;
         this.gvChildTicketClassInfo.DataSource = totalDatas.Skip(startRow > 0?startRow:0).Take(pagination.PageSize).Select(r => new
         {
             Carrier     = r.AirlineCode,
             CarrierName = r.AirlineName,
             HasRules    = r.HasRules  ? "已添加" : "未添加",
             RulesCount  = r.RulesCount
         });
         this.gvChildTicketClassInfo.DataBind();
         if (totalDatas.Any())
         {
             this.Pager1.Visible = true;
             if (pagination.GetRowCount)
             {
                 this.Pager1.RowCount = totalDatas.Count();
             }
         }
         else
         {
             this.Pager1.Visible = false;
         }
     } catch (Exception ex) {
         ShowExceptionMessage(ex, "查询");
     }
 }
Пример #10
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["action"] != null)
     {
         AirCraftView airCraftView = new AirCraftView()
         {
             Code         = this.txtPlaneTypeCode.Text.Trim(),
             Name         = this.txtPlaneTypeName.Text.Trim(),
             AirportFee   = Convert.ToDecimal(this.txtAirportPrice.Text.Trim()),
             Manufacturer = this.txtMake.Text.Trim(),
             Description  = this.ttDescription.InnerText.Trim(),
             Valid        = this.ddlStatus.SelectedValue == "T" ? true : false
         };
         if (Request.QueryString["action"].ToString() == "add")
         {
             try
             {
                 FoundationService.AddAirCraft(airCraftView, CurrentUser.UserName);
                 RegisterScript("alert('添加成功!'); window.location.href='PlaneType.aspx'");
             } catch (Exception ex) {
                 ShowExceptionMessage(ex, "添加");
             }
         }
         else
         {
             try
             {
                 FoundationService.UpdateAirCraft(new Guid(Request.QueryString["Id"].ToString()), airCraftView, CurrentUser.UserName);
                 RegisterScript("alert('修改成功!'); window.location.href='PlaneType.aspx?Search=Back'");
             } catch (Exception ex) {
                 ShowExceptionMessage(ex, "修改");
             }
         }
     }
 }
Пример #11
0
        public Basket ReadBasket(Guid userId, Guid cartId, bool runPipelines = false)
        {
            var queryBaskets = new CommerceQuery <CommerceEntity, CommerceModelSearch <CommerceEntity>, CommerceBasketQueryOptionsBuilder>("Basket");

            queryBaskets.SearchCriteria.Model.Properties["UserId"]     = userId.ToCommerceServerFormat();
            queryBaskets.SearchCriteria.Model.Properties["BasketType"] = 0;
            queryBaskets.SearchCriteria.Model.Id    = cartId.ToCommerceServerFormat();
            queryBaskets.QueryOptions.RefreshBasket = runPipelines;

            var queryLineItems = new CommerceQueryRelatedItem <CommerceEntity>("LineItems", "LineItem");

            queryBaskets.RelatedOperations.Add(queryLineItems);

            var response = FoundationService.ExecuteRequest(queryBaskets.ToRequest());

            if (response.OperationResponses.Count == 0)
            {
                return(null);
            }

            CommerceQueryOperationResponse basketResponse = response.OperationResponses[0] as CommerceQueryOperationResponse;

            if (basketResponse.CommerceEntities.Count == 0)
            {
                return(null);
            }

            return((Basket)basketResponse.CommerceEntities[0]);
        }
        public List <PurchaseOrder> ReadPurchaseOrderHeadersInDateRange(Guid customerId, string customerNumber, DateTime startDate, DateTime endDate)
        {
            var queryBaskets = new CommerceQuery <CommerceEntity, CommerceModelSearch <CommerceEntity>, CommerceBasketQueryOptionsBuilder>("Basket");

            queryBaskets.SearchCriteria.Model.Properties["UserId"]           = customerId.ToCommerceServerFormat();
            queryBaskets.SearchCriteria.Model.Properties["BasketType"]       = 1;
            queryBaskets.SearchCriteria.Model.Properties["CustomerId"]       = customerNumber;
            queryBaskets.SearchCriteria.Model.Properties["CreatedDateStart"] = startDate;
            queryBaskets.SearchCriteria.Model.Properties["CreatedDateEnd"]   = endDate;


            queryBaskets.QueryOptions.RefreshBasket = false;

            var response = FoundationService.ExecuteRequest(queryBaskets.ToRequest());

            if (response.OperationResponses.Count == 0)
            {
                return(null);
            }

            CommerceQueryOperationResponse basketResponse = response.OperationResponses[0] as CommerceQueryOperationResponse;

            return(basketResponse.CommerceEntities.Cast <CommerceEntity>().Where(c => c.Properties["CustomerId"] != null &&
                                                                                 c.Properties["CustomerId"].ToString().Equals(customerNumber) &&
                                                                                 c.Properties["RequestedShipDate"].ToString().ToDateTime().Value >= startDate && c.Properties["RequestedShipDate"].ToString().ToDateTime().Value <= endDate
                                                                                 ).Select(p => (PurchaseOrder)p).ToList());
            //return basketResponse.CommerceEntities.Cast<CommerceEntity>().Select(p => (PurchaseOrder)p).ToList();
        }
        public PurchaseOrder ReadPurchaseOrder(Guid customerId, string orderNumber)
        {
            var queryBaskets = new CommerceQuery <CommerceEntity, CommerceModelSearch <CommerceEntity>, CommerceBasketQueryOptionsBuilder>("Basket");

            queryBaskets.SearchCriteria.Model.Properties["UserId"]      = customerId.ToCommerceServerFormat();
            queryBaskets.SearchCriteria.Model.Properties["BasketType"]  = 1;
            queryBaskets.SearchCriteria.Model.Properties["OrderNumber"] = orderNumber;

            queryBaskets.QueryOptions.RefreshBasket = false;

            var queryLineItems = new CommerceQueryRelatedItem <CommerceEntity>("LineItems", "LineItem");

            queryBaskets.RelatedOperations.Add(queryLineItems);

            var response = FoundationService.ExecuteRequest(queryBaskets.ToRequest());

            if (response.OperationResponses.Count == 0)
            {
                return(null);
            }

            CommerceQueryOperationResponse basketResponse = response.OperationResponses[0] as CommerceQueryOperationResponse;

            return((PurchaseOrder)basketResponse.CommerceEntities[0]);
        }
Пример #14
0
 protected void gvAirline_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "opdate")
     {
         string code = e.CommandArgument.ToString();
         ChinaPay.B3B.Service.Foundation.Domain.Airline air = FoundationService.QueryAirline(code);
         if (air == null)
         {
             return;
         }
         AirlineView airlineView = new AirlineView()
         {
             Code       = code.Trim(),
             Valid      = !air.Valid,
             Name       = air.Name,
             ShortName  = air.ShortName,
             SettleCode = air.SettleCode
         };
         try {
             FoundationService.UpdateAirline(airlineView, CurrentUser.UserName);
             if (air.Valid)
             {
                 RegisterScript("alert('禁用成功!'); window.location.href='Airline.aspx?Search=Back';");
             }
             else
             {
                 RegisterScript("alert('启用成功!'); window.location.href='Airline.aspx?Search=Back';");
             }
         } catch (Exception ex) {
             ShowExceptionMessage(ex, air.Valid ? "禁用" : "启用");
             return;
         }
         refresh();
     }
 }
Пример #15
0
        public static Flight GetFlight(Command.Domain.FlightQuery.Flight originalFlight, System.DateTime?reviseFlightDate = null)
        {
            if (originalFlight == null)
            {
                return(null);
            }
            Flight result  = null;
            var    airline = FoundationService.QueryAirline(originalFlight.Airline);

            if (null != airline)
            {
                var flightDate = reviseFlightDate ?? originalFlight.FlightDate;
                var basicPrice = FoundationService.QueryBasicPrice(originalFlight.Airline, originalFlight.Departure, originalFlight.Arrival, flightDate);
                if (null != basicPrice)
                {
                    result = new Flight(originalFlight.Airline, originalFlight.FlightNo)
                    {
                        AirlineName   = airline.ShortName,
                        Departure     = getAirport(originalFlight.Departure, originalFlight.TerminalOfDeparture),
                        Arrival       = getAirport(originalFlight.Arrival, originalFlight.TerminalOfArrival),
                        FlightDate    = flightDate,
                        TakeoffTime   = originalFlight.TakeoffTime,
                        LandingTime   = originalFlight.LandingTime,
                        StandardPrice = basicPrice.Price,
                        AirCraft      = originalFlight.AirCraft,
                        IsStop        = originalFlight.IsStop,
                        DaysInterval  = originalFlight.AddDays,
                        AirportFee    = FoundationService.QueryAirportFee(originalFlight.AirCraft),
                        BAF           = FoundationService.QueryBAF(originalFlight.Airline, basicPrice.Mileage)
                    };
                }
            }
            return(result);
        }
Пример #16
0
        /// <summary>
        /// 查询舱位信息
        /// </summary>
        /// <param name="airline">航空公司</param>
        /// <param name="departure">出发</param>
        /// <param name="arrival">到达</param>
        /// <param name="flightDate">航班日期</param>
        /// <param name="code">舱位代码</param>
        public IEnumerable <Bunk> QueryBunk(UpperString airline, UpperString departure, UpperString arrival, DateTime flightDate, UpperString code)
        {
            // 获取到 航空公司、出发、到达、航班日期 和 舱位都匹配的所有舱位信息
            // 根据 级别、航班日期 和 修改时间 排序
            // 根据舱位类型分组,并取每组的第一个
            var bunks = (from bunk in QueryValidBunk(airline, departure, arrival, flightDate)
                         where containsBunk(bunk, code)
                         orderby bunk.Level descending, bunk.FlightBeginDate descending, bunk.ModifyTime descending
                         group bunk by bunk.Type into bunkGroup
                         select bunkGroup.First()).ToList();



            //更改EI项
            var    pattern           = new Regex("^[a-zA-Z\\d/]+$");
            var    details           = FoundationService.QueryDetailList(airline.Value, code.Value).Where(item => pattern.IsMatch(item.Bunks));
            string refundRegulation  = string.Empty;
            string changeRegulation  = string.Empty;
            string endorseRegulation = string.Empty;

            foreach (var item in details)
            {
                refundRegulation  += ("航班起飞前:" + item.ScrapBefore + ";航班起飞后:" + item.ScrapAfter).Replace("<br/>", "").Replace("\r", "").Replace("\n", "").Replace("\t", "");
                changeRegulation  += ("航班起飞前:" + item.ChangeBefore + ";航班起飞后:" + item.ChangeAfter).Replace("<br/>", "").Replace("\r", "").Replace("\n", "").Replace("\t", "");
                endorseRegulation += item.Endorse.Replace("<br/>", "").Replace("\r", "").Replace("\n", "").Replace("\t", "");
            }
            if (string.IsNullOrWhiteSpace(refundRegulation))
            {
                refundRegulation = "以航司具体规定为准";
            }
            if (string.IsNullOrWhiteSpace(changeRegulation))
            {
                changeRegulation = "以航司具体规定为准";
            }
            foreach (var item in bunks)
            {
                item.ChangeRegulation  = changeRegulation;
                item.EndorseRegulation = endorseRegulation;
                item.RefundRegulation  = refundRegulation;
            }


            var result = new List <Bunk>();

            if (bunks.Count > 0)
            {
                // 如果有多个明折明扣舱位,则只取一个
                var generalBunk = filterGeneralBunk(bunks);
                if (generalBunk != null)
                {
                    result.Add(generalBunk);
                }
                var nonGeneralBunks = bunks.Where(item => !(item is GeneralBunk)).ToList();
                result.AddRange(nonGeneralBunks);
            }
            return(result);
        }
Пример #17
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         setButton();
         var data = FoundationService.QueryDetailList(Request.QueryString["airline"]);
         this.gvRefundChangeTecket.DataSource = data;
         this.gvRefundChangeTecket.DataBind();
         if (data.Any())
         {
             dataList.Visible = true;
         }
         else
         {
             dataList.Visible = false;
         }
         var detailId = Request.QueryString["Id"];
         if (!string.IsNullOrWhiteSpace(detailId))
         {
             var detail = FoundationService.QueryRefundAndReschedulingNewDetail(Guid.Parse(detailId));
             if (detail != null)
             {
                 if (!string.IsNullOrWhiteSpace(detail.Bunks))
                 {
                     this.txtBunks.Text = detail.Bunks;
                 }
                 if (!string.IsNullOrWhiteSpace(detail.Endorse))
                 {
                     this.txtEndorse.InnerText = detail.Endorse;
                 }
                 if (detail.ScrapAfter == detail.ScrapBefore)
                 {
                     this.hfdScrap.Value     = "merge";
                     this.txtScrap.InnerText = detail.ScrapBefore;
                 }
                 else
                 {
                     this.hfdScrap.Value           = "split";
                     this.txtScrapBefore.InnerText = detail.ScrapBefore;
                     this.txtScrapAfter.InnerText  = detail.ScrapAfter;
                 }
                 if (detail.ChangeBefore == detail.ChangeAfter)
                 {
                     this.hfdChange.Value     = "merge";
                     this.txtChange.InnerText = detail.ChangeBefore;
                 }
                 else
                 {
                     this.hfdChange.Value           = "split";
                     this.txtChangeBefore.InnerText = detail.ChangeBefore;
                     this.txtChangeAfter.InnerText  = detail.ChangeAfter;
                 }
             }
         }
     }
 }
Пример #18
0
        List <Catalog> IDivisionRepository.GetDivisions()
        {
            var queryCatalog = new CommerceQuery <CommerceEntity, CommerceModelSearch <CommerceEntity> >("Catalog");
            var response     = FoundationService.ExecuteRequest(queryCatalog.ToRequest());


            CommerceQueryOperationResponse basketResponse = response.OperationResponses[0] as CommerceQueryOperationResponse;

            return(basketResponse.CommerceEntities.Cast <CommerceEntity>().Select(i => (Catalog)i).ToList());
        }
Пример #19
0
        private string getAddress(string cityCode)
        {
            if (string.IsNullOrWhiteSpace(cityCode))
            {
                return(string.Empty);
            }
            City city = FoundationService.QueryCity(cityCode);

            return(city == null ? cityCode : city.Name);
        }
Пример #20
0
        private void initFoundationDatas()
        {
            var airline = FoundationService.QueryAirline(this.Code);

            if (airline != null)
            {
                this._name       = airline.ShortName;
                this._settleCode = airline.SettleCode;
            }
        }
Пример #21
0
        public void DeleteBasket(Guid userId, string basketName)
        {
            var deleteBasket = new CommerceDelete <Basket>();

            deleteBasket.SearchCriteria.Model.Properties["UserId"]     = userId.ToCommerceServerFormat();
            deleteBasket.SearchCriteria.Model.Properties["BasketType"] = 0;
            deleteBasket.SearchCriteria.Model.Properties["Name"]       = basketName;

            FoundationService.ExecuteRequest(deleteBasket.ToRequest());
        }
Пример #22
0
 /// <summary>
 /// 根据省份代码绑定
 /// </summary>
 /// <param name="code">省份代码</param>
 private void bindProvince(string code)
 {
     ChinaPay.B3B.Service.Foundation.Domain.Province province = FoundationService.QueryProvice(code.Trim());
     if (province != null)
     {
         this.txtProvinceCode.Text  = province.Code;
         this.txtProvinceName.Text  = province.Name;
         this.ddlArea.SelectedValue = province.AreaCode;
     }
 }
Пример #23
0
        private decimal getGeneralBunkDiscount(FlightView flightView)
        {
            var bunks       = FoundationService.QueryBunk(flightView.Airline, flightView.Departure, flightView.Arrival, flightView.TakeoffTime, flightView.Bunk);
            var generalBunk = bunks.FirstOrDefault(item => item is Foundation.Domain.GeneralBunk);

            if (generalBunk != null)
            {
                return((generalBunk as Foundation.Domain.GeneralBunk).GetDiscount(flightView.Bunk));
            }
            throw new CustomException("无明折明扣相关数据");
        }
Пример #24
0
        public void AddCustomerToAccount(string addedBy, Guid accountId, Guid customerId)
        {
            var updateQuery = new CommerceUpdate <KeithLink.Svc.Core.Models.Generated.Organization>("Organization");

            updateQuery.SearchCriteria.Model.Properties["Id"] = customerId.ToCommerceServerFormat();

            updateQuery.Model.ParentOrganizationId = accountId.ToCommerceServerFormat();

            var response = FoundationService.ExecuteRequest(updateQuery.ToRequest());

            _auditLog.WriteToAuditLog(Common.Core.Enumerations.AuditType.CustomerAddedToCustomerGroup, addedBy, string.Format("Customer: {0}, Account: {1}", customerId, accountId));
        }
Пример #25
0
 private void BindDefaultAirportInfo(string code, HtmlInputHidden valueControl, HtmlInputText textControl)
 {
     if (!string.IsNullOrWhiteSpace(code))
     {
         Airport airport = FoundationService.QueryAirport(code);
         if (airport != null && airport.Location != null)
         {
             valueControl.Value = airport.Code.Value;
             textControl.Value  = airport.Location.Name + "[" + airport.Code + "]";
         }
     }
 }
Пример #26
0
        private static Airport getAirport(string code, string terminal)
        {
            var airportData = FoundationService.QueryAirport(code);

            return(new Airport(code)
            {
                Terminal = terminal,
                Name = null == airportData ? string.Empty : airportData.Name,
                City = null == airportData ? string.Empty : airportData.Location.Name,
                AbbrivateName = null == airportData ? string.Empty : airportData.ShortName
            });
        }
Пример #27
0
        internal Airport(string code)
        {
            this.Code = code;
            var airportModel = FoundationService.QueryAirport(code);

            if (airportModel == null)
            {
                throw new CustomException("机场不存在");
            }
            this.Name = airportModel.ShortName;
            this.City = airportModel.Location == null ? string.Empty : airportModel.Location.Name;
        }
Пример #28
0
        public Guid CreateOrUpdateBasket(Guid userId, string branchId, Basket basket, List <LineItem> items, bool runPipelines = false)
        {
            var updateOrder = new CommerceUpdate <Basket,
                                                  CommerceModelSearch <Basket>,
                                                  CommerceBasketUpdateOptionsBuilder>();

            updateOrder.SearchCriteria.Model.UserId     = userId.ToString();
            updateOrder.SearchCriteria.Model.BasketType = 0;

            if (!string.IsNullOrEmpty(basket.Id))
            {
                updateOrder.SearchCriteria.Model.Id = basket.Id;
            }
            else
            {
                updateOrder.SearchCriteria.Model.Name = basket.Name;
            }
            updateOrder.Model = basket;
            updateOrder.UpdateOptions.ToOptions().ReturnModel = (new Basket()).ToCommerceEntity();
            updateOrder.UpdateOptions.RefreshBasket = runPipelines;


            if (items != null)
            {
                foreach (var item in items)
                {
                    if (string.IsNullOrEmpty(item.Id) || item.Id == Guid.Empty.ToCommerceServerFormat())
                    {
                        var lineItemCreate = new CommerceCreateRelatedItem <LineItem>(Basket.RelationshipName.LineItems);
                        lineItemCreate.Model = item;
                        updateOrder.RelatedOperations.Add(lineItemCreate);
                    }
                    else
                    {
                        var lineItemUpdate = new CommerceUpdateRelatedItem <LineItem>(Basket.RelationshipName.LineItems);
                        lineItemUpdate.SearchCriteria.Model.Id = item.Id;
                        lineItemUpdate.Model = item;
                        updateOrder.RelatedOperations.Add(lineItemUpdate);
                    }
                }
            }

            // create the request
            var response = FoundationService.ExecuteRequest(updateOrder.ToRequest());

            if (response.OperationResponses.Count != 1)
            {
                return(Guid.Empty);
            }

            return(((CommerceUpdateOperationResponse)response.OperationResponses[0]).CommerceEntities[0].Id.ToGuid());
        }
Пример #29
0
 private void Refresh(string code)
 {
     ChinaPay.B3B.Service.Foundation.Domain.Airline airLine = FoundationService.QueryAirline(code);
     if (airLine == null)
     {
         return;
     }
     this.txtErCode.Text                 = airLine.Code.Value;
     this.txtAirlineName.Text            = airLine.Name;
     this.txtAirlineShortName.Text       = airLine.ShortName;
     this.txtJsCode.Text                 = airLine.SettleCode;
     this.ddlAirlineStatus.SelectedValue = airLine.Valid == true ? "T" : "F";
 }
Пример #30
0
        public void RemoveCustomerFromAccount(string removedBy, Guid accountId, Guid customerId)
        {
            var updateQuery = new CommerceUpdate <KeithLink.Svc.Core.Models.Generated.Organization>("Organization");

            updateQuery.SearchCriteria.Model.Properties["Id"] = customerId.ToCommerceServerFormat();

            updateQuery.Model.ParentOrganizationId = string.Empty;

            var response = FoundationService.ExecuteRequest(updateQuery.ToRequest());

            _auditLog.WriteToAuditLog(Common.Core.Enumerations.AuditType.CustomerRemovedFromCustomerGroup, removedBy, string.Format("Customer: {0}, Account: {1}", customerId, accountId));
            // TODO: remove all users associated directly to the customer
        }