Example #1
0
        private void TransferToObj(DataTable dt)
        {
            errorPolicy = dt.Clone();
            errorPolicy.Columns.Add("错误信息");
            normalPolicys = new List <NormalPolicy>();
            error         = 0;
            success       = 0;
            var officeNumbers   = CompanyService.QueryOfficeNumbers(this.CurrentCompany.CompanyId).ToList();
            var workSetting     = CompanyService.GetWorkingSetting(this.CurrentCompany.CompanyId);
            var customerCodes   = CompanyService.GetCustomNumberByEmployee(this.CurrentUser.Id);
            var airlines        = PolicySetService.QueryAirlines(this.CurrentCompany.CompanyId);
            var companyParmeter = CompanyService.GetCompanyParameter(this.CurrentCompany.CompanyId);

            foreach (DataRow item in dt.Rows)
            {
                string errorInfo = BasePolicy.valiate(item, officeNumbers, workSetting, customerCodes, airlines, companyParmeter, GetAirport(this.CurrentCompany.CompanyId));
                if (string.IsNullOrWhiteSpace(errorInfo))
                {
                    success++;
                    NormalPolicy normalPolicy = BasePolicy.saveInfo(item, officeNumbers, workSetting, customerCodes, airlines, companyParmeter, GetAirport(this.CurrentCompany.CompanyId));
                    normalPolicys.Add(normalPolicy);
                }
                else
                {
                    error++;
                    DataRow dr = errorPolicy.NewRow();
                    for (var i = 0; i < dt.Columns.Count; i++)
                    {
                        dr[i] = item[i];
                    }

                    dr["错误信息"] = errorInfo;
                    errorPolicy.Rows.Add(dr);
                }
            }
        }
Example #2
0
        void QueryPolicy(Pagination pagination)
        {
            try
            {
                var list_query = PolicyMatchServcie.GetRoundTripPolicies(this.CurrentCompany.CompanyId, GetCondition(pagination), item => item.OriginalPolicy.CreateTime, OrderMode.Descending);

                var list = from item in list_query
                           let item_round = item.OriginalPolicy as RoundTripPolicyInfo
                                            select new
                {
                    //政策编号
                    id = item_round.Id,
                    //航空公司
                    Airline = item_round.Airline,
                    //出发城市
                    Departure = item_round.Departure,
                    //到达城市
                    Arrival = item_round.Arrival,
                    //票证行程
                    TicketType = item_round.TicketType + "<br />" + item_round.VoyageType.GetDescription(),
                    //适用班期
                    // DepartureDatesFilter = item_round.DepartureDatesFilterType == DateMode.Date ? (item_round.DepartureDatesFilter) : (StringOperation.TransferToChinese(item_round.DepartureDatesFilter)),
                    //适用航班
                    Include = item_round.DepartureFlightsFilterType == LimitType.None ? "所有" : (item_round.DepartureFlightsFilterType == LimitType.Include ? (item_round.DepartureFlightsFilter) : "&nbsp;"),
                    //排除航班
                    Exclude = item_round.DepartureFlightsFilterType == LimitType.Exclude ? (item_round.DepartureFlightsFilter) : "&nbsp;",
                    //适用舱位
                    Berths = item_round.Berths,
                    //价格
                    Price     = item_round.Price.TrimInvaidZero(),
                    PriceInfo = item_round.Price.TrimInvaidZero(),
                    //返佣信息
                    Commission = item_round.Owner == this.CurrentCompany.CompanyId ? (
                        BasePolicy.CanHaveSubordinate(CurrentCompany.CompanyId) ? "内部: " + (item_round.InternalCommission * 100).TrimInvaidZero()
                        + "%<br />下级: " + (item_round.SubordinateCommission * 100).TrimInvaidZero()
                        + "%<br />同行: " + (item_round.ProfessionCommission * 100).TrimInvaidZero() + "%" : "下级: " + (item_round.SubordinateCommission * 100).TrimInvaidZero()
                        + "%<br />同行: " + (item_round.ProfessionCommission * 100).TrimInvaidZero() + "%") : "同行: " + (item.Commission * 100).TrimInvaidZero() + "%",
                    InternalCommission    = (item_round.InternalCommission * 100).TrimInvaidZero(),
                    SubordinateCommission = (item_round.SubordinateCommission * 100).TrimInvaidZero(),
                    ProfessionCommission  = (item_round.ProfessionCommission * 100).TrimInvaidZero(),
                    DepartureDates        = item_round.DepartureDateStart.ToString("yyyy-MM-dd") + "<br />" + item_round.DepartureDateEnd.ToString("yyyy-MM-dd"),
                    //回程日期
                    ReturnDates     = item_round.VoyageType == VoyageType.OneWay ? "" : (item_round.ReturnDateStart.Value.ToString("yyyy-MM-dd") + "<br />" + item_round.ReturnDateEnd.Value.ToString("yyyy-MM-dd")),
                    Commission_link = item_round.Owner == this.CurrentCompany.CompanyId ? "<a href=\"javascript:ModifyCommissionBack('" + item_round.Id + "','" + (item_round.InternalCommission * 100).TrimInvaidZero() + "','" + (item_round.SubordinateCommission * 100).TrimInvaidZero() + "','" + (item_round.ProfessionCommission * 100).TrimInvaidZero() + "','" + item_round.Price.TrimInvaidZero() + "','" + BasePolicy.CanHaveSubordinate(CurrentCompany.CompanyId) + "');\">修改返佣</a>" : "异地政策",
                    Policy_link     = item_round.Owner == this.CurrentCompany.CompanyId ? "<a href='back_to_policy_edit.aspx?Id=" + item_round.Id + "&Type=Update&Check=view'>修改详细</a>" : "&nbsp;",
                    //操作人
                    Opearor = item_round.Owner == this.CurrentCompany.CompanyId ? item_round.Creator : "&nbsp;",
                };
                this.grv_back.DataSource = list;
                this.grv_back.DataBind();
                if (list.Count() > 0)
                {
                    this.pager.Visible = true;
                    if (pagination.GetRowCount)
                    {
                        this.pager.RowCount = list_query.RowCount;
                    }
                    showempty.Visible = false;
                }
                else
                {
                    this.pager.Visible = false;
                    showempty.Visible  = true;
                }
            }
            catch (Exception ex)
            {
                ShowExceptionMessage(ex, "查询");
            }
        }
Example #3
0
 void QueryPolicy(Pagination pagination)
 {
     try
     {
         var list_query = PolicyManageService.GetRoundTripPolicies(GetCondition(pagination), item => item.CreateTime, OrderMode.Descending);
         var list       = from item in list_query
                          select new
         {
             //政策编号
             id = item.Id,
             //航空公司
             Airline = item.Airline,
             //出发城市
             Departure = item.Departure,
             //到达城市
             Arrival = item.Arrival,
             //票证行程
             TicketType = item.TicketType + "<br />" + item.VoyageType.GetDescription(),
             //适用班期
             //  DepartureDatesFilter = item.DepartureDatesFilterType == DateMode.Date ? item.DepartureDatesFilter : StringOperation.TransferToChinese(item.DepartureDatesFilter),
             //适用航班
             Include = item.DepartureFlightsFilterType == LimitType.None ? "所有" : (item.DepartureFlightsFilterType == LimitType.Include ? item.DepartureFlightsFilter : "&nbsp;"),
             //排除航班
             Exclude = item.DepartureFlightsFilterType == LimitType.Exclude ? item.DepartureFlightsFilter : "&nbsp;",
             //适用舱位
             Berths = item.Berths,
             //价格
             Price = item.Price.TrimInvaidZero(),
             //返佣信息
             Commission = BasePolicy.CanHaveSubordinate(CurrentCompany.CompanyId) ?
                          "内部: " + (item.InternalCommission * 100).TrimInvaidZero()
                          + "%<br />下级: " + (item.SubordinateCommission * 100).TrimInvaidZero()
                          + "%<br />同行: " + (item.ProfessionCommission * 100).TrimInvaidZero() + "%" :
                          "下级: " + (item.SubordinateCommission * 100).TrimInvaidZero()
                          + "%<br />同行: " + (item.ProfessionCommission * 100).TrimInvaidZero() + "%",
             InternalCommission    = (item.InternalCommission * 100).TrimInvaidZero(),
             SubordinateCommission = (item.SubordinateCommission * 100).TrimInvaidZero(),
             ProfessionCommission  = (item.ProfessionCommission * 100).TrimInvaidZero(),
             //去程日期
             DepartureDates = item.DepartureDateStart.ToString("yyyy-MM-dd") + "<br />" + item.DepartureDateEnd.ToString("yyyy-MM-dd"),
             //回程日期
             ReturnDates = item.VoyageType == VoyageType.OneWay ? "" : (item.ReturnDateStart.Value.ToString("yyyy-MM-dd") + "<br />" + item.ReturnDateEnd.Value.ToString("yyyy-MM-dd")),
             //供应方
             Opearor            = item.Creator,
             Sudit              = item.Audited ? "已审" : "未审",
             SuditName          = item.Audited ? "UnAudited" : "Audited",
             SuditTip           = item.Audited ? "取消审核" : "确认审核",
             CanHaveSubordinate = BasePolicy.CanHaveSubordinate(CurrentCompany.CompanyId),
             Hang = item.Suspended ? BasePolicy.GetHungInfo(item.Airline, this.CurrentCompany.CompanyId) : "未挂"
         };
         this.grv_back.DataSource = list;
         this.grv_back.DataBind();
         if (list.Any())
         {
             this.pager.Visible = true;
             if (pagination.GetRowCount)
             {
                 this.pager.RowCount = list_query.RowCount;
             }
             showempty.Visible = false;
             grv_back.HeaderRow.TableSection = TableRowSection.TableHeader;
         }
         else
         {
             this.pager.Visible = false;
             showempty.Visible  = true;
         }
     }
     catch (Exception ex)
     {
         ShowExceptionMessage(ex, "查询");
     }
 }