예제 #1
0
        protected string GetLimit(ListParam listParam)
        {
            var sb    = new StringBuilder();
            var index = listParam.PageIndex >= 1 ? listParam.PageIndex - 1 : 0;
            var count = listParam.PageSize > 20 ? 20 : listParam.PageSize;

            sb.Append($" limit {index},{count} ");

            return(sb.ToString());
        }
예제 #2
0
        public OperationResult GetAll(ListParam listParam)
        {
            var result = _repository
                         .GetAll <Permission>()
                         .Select(PermissionDto.ProjectionExpression)
                         .FormData(listParam);

            return(result == null
                ? new OperationResult(false, "No permissions found")
                : new OperationResult(true, result));
        }
예제 #3
0
        protected string GetWhere(ListParam listParam)
        {
            var sb = new StringBuilder();

            sb.Append(" Where 1=1 ");
            var i = 0;

            listParam?.Filter?.ForEach(ea =>
            {
                sb.Append($" {ea.Connector} {ea.DbField} {ea.Operator} " + "{" + i++ + "}");
            });
            return(sb.ToString());
        }
예제 #4
0
        public void Initialize()
        {
            _inputParameters    = new Parameter[5];
            _inputParameters[0] = new FileParam("Select the Hydrodesktop database");
            _inputParameters[1] = new ListParam("Select the Site");
            _inputParameters[2] = new ListParam("Select the Variable");
            _inputParameters[3] = new DateTimeParam("Start Date");
            _inputParameters[4] = new DateTimeParam("End Date");


            _outputParameters    = new Parameter[1];
            _outputParameters[0] = new FileParam("Save Data");
        }
예제 #5
0
 protected List <IConditionalModel> GetWhere(ListParam listParam)
 {
     var where = new List <IConditionalModel>();
     listParam.Filter?.ForEach(ea =>
     {
         where.Add(new ConditionalModel()
         {
             FieldName       = ea.DbField,
             FieldValue      = ea.Value,
             ConditionalType = ToConditionalType(ea.Operator)
         });
     });
     return(where);
 }
예제 #6
0
        public virtual PageResultModel <T1> GetPageResult <T1>(ListParam listParam) where T1 : class, new()
        {
            int totalCount = 0;

            List <IConditionalModel> where = GetWhere(listParam);
            string select = GetSelect(listParam);
            string sort   = GetSort(listParam, ref select);
            var    result = new PageResultModel <T1>();

            result.TModel      = _db.CurrentDb.AsQueryable().Where(where).OrderBy(sort).Select <T1>(select).ToPageList(listParam.PageIndex, listParam.PageSize, ref totalCount);
            result.RecordCount = totalCount;
            result.PageCount   = (int)Math.Ceiling(((decimal)totalCount / listParam.PageSize));
            return(result);
        }
예제 #7
0
        //...
        public CommonParam DeliveryTicketList(CommonParam param)
        {
            DeliveryServiceItem deliveryServiceItem;
            //... 

            var listParam = new ListParam<DeliveryTicketItem>();
            var rtnParam = new CommonParam();
            rtnParam.Add("listParam", listParam);
            rtnParam.Add("writeDateStart", DateTime.Parse.(deliveryServiceItem.writeDateStart.Trim().GetDayStartValue());
            rtnParam.Add("writeDateEnd", DateTime.Parse.(deliveryServiceItem.writeDateEnd.Trim().GetDayStartValue());
            rtnParam.Add("unitSum", DeliveryInfoDao.GetDeliveryTicketUnitSum(whereConditons));

            return rtnParam;
        }
예제 #8
0
        public override PageResultModel <T1> GetPageResult <T1>(ListParam listParam)
        {
            int totalCount = 0;

            List <IConditionalModel> where = GetWhere(listParam);
            string select = GetSelect(listParam);
            string sort   = GetSort(listParam, ref select);
            var    result = new PageResultModel <T1>();

            result.TModel      = _multipleDb.Queryable <Photo, PhotoAlbum>((a, b) => new object[] { JoinType.Left, a.AlbumId == b.Id }).Where(where).OrderBy(sort).Select <T1>(select).ToPageList(listParam.PageIndex, listParam.PageSize, ref totalCount);
            result.RecordCount = totalCount;
            result.PageCount   = (int)Math.Ceiling(((decimal)totalCount / listParam.PageSize));
            return(result);
        }
예제 #9
0
        /// <summary>
        /// Creates an instance of the dialog
        /// </summary>
        /// <param name="param">The parameter this element represents</param>
        public ListElement(ListParam param)
        {
            //Needed by the designer
            InitializeComponent();
            GroupBox.Text = param.Name;

            //We save the parameters passed in
            Param = param;

            DoRefresh();

            //Update the state of the status light
            ComboBox1SelectedValueChanged(null, null);
        }
예제 #10
0
        //异步请求
        public bool AsyncRequest(string Url, string HttpMethod, Parameter u_key, List <Parameter> ListParam, List <Parameter> ListFile, AsyncRequestCallback Callback, out int CallbackKey)
        {
            if (ListParam == null)
            {
                ListParam = new List <Parameter>();
            }

            if (u_key != null)
            {
                ListParam.Add(u_key);
            }
            string QueryString = HttpUtility.NormalizeRequestParameters(ListParam);


            AsyncHttp AHttp = new AsyncHttp();

            CallbackKey = GetKey();
            CallBackInfo CBInfo = new CallBackInfo();

            CBInfo.key         = CallbackKey;
            CBInfo.AsyncReqCCB = Callback;

            AsyncRequestMap.Add(AHttp, CBInfo);

            bool BResult = false;

            if (HttpMethod.Equals("GET"))
            {
                BResult = AHttp.HttpGet(Url, QueryString, new AsyncHttpCallBack(HttpCallback));
            }
            else if (ListFile == null || ListFile.Count == 0)
            {
                BResult = AHttp.HttpPost(Url, QueryString, new AsyncHttpCallBack(HttpCallback));
            }
            else
            {
                BResult = AHttp.HttpPostFile(Url, QueryString, ListFile, new AsyncHttpCallBack(HttpCallback));
            }

            if (!BResult)
            {
                AsyncRequestMap.Remove(AHttp);
            }
            return(BResult);
        }
예제 #11
0
        /// <summary>
        /// Fires when one of the paramters value has beend changed, usually when a user changes a input or output Parameter value, this can be used to populate other Parameter default values.
        /// </summary>
        public override void ParameterChanged(Parameter sender)
        {
            if (sender == _inputParam[0])
            {
                FeatureSet fs = _inputParam[0].Value as FeatureSet;
                ListParam  lp = _inputParam[1] as ListParam;
                if (fs != null && lp != null)
                {
                    lp.ValueList.Clear();
                    for (int i = 0; i < fs.DataTable.Columns.Count; i++)
                    {
                        lp.ValueList.Add(fs.DataTable.Columns[i].ColumnName);
                    }

                    lp.Value = -1;
                }
            }
        }
예제 #12
0
        protected static string GetSelect(ListParam listParam)
        {
            var select = " * ";

            if (listParam.Select != null && listParam.Select.Count > 0)
            {
                select = "";
                for (int i = 0; i < listParam.Select.Count; i++)
                {
                    select += $" {listParam.Select[i].Key} as {listParam.Select[i].Value} ";
                    if (i != listParam.Select.Count - 1)
                    {
                        select += ",";
                    }
                }
            }

            return(select);
        }
예제 #13
0
        protected static string GetSort(ListParam listParam, ref string select)
        {
            var sort = "null";

            if (listParam.Sort != null && listParam.Sort.Count > 0)
            {
                sort = "";
                for (int i = 0; i < listParam.Sort.Count; i++)
                {
                    sort += $"{listParam.Sort[i].DbField} {listParam.Sort[i].Value}";
                    if (i != listParam.Sort.Count - 1)
                    {
                        sort += ",";
                    }
                }
            }

            return(sort);
        }
예제 #14
0
        public PagedData <TResult> GetViewPager <TResult>(ListParam param) where TResult : class, new()
        {
            var result = new PagedData <TResult>()
            {
                PageIndex = param.PageIndex, PageSize = param.PageSize
            };
            var sb   = new StringBuilder();
            var from = $" From {GetTableName()} ";

            sb.Append(GetSelect(param, out var selecter));
            sb.Append(from);
            sb.Append(GetWhere(param));
            sb.Append(GetOrderBy(param));
            sb.Append(GetLimit(param));
            var expression = CreateSelecter <T, TResult>(param.Select);

            result.TModel      = _baseDbContext.Set <T>().FromSql(sb.ToString(), GetParameters(param)).Select(expression)?.ToList();
            result.RecordCount = GetRecordCount(param, from);
            return(result);
        }
예제 #15
0
 /// <summary>
 /// The Parameter array should be populated with default values here
 /// </summary>
 public override void Initialize()
 {
     _inputParam    = new Parameter[4];
     _inputParam[0] = new FeatureSetParam(TextStrings.input1polygontoRaster)
     {
         HelpText = TextStrings.InputPolygontochange
     };
     _inputParam[2] = new DoubleParam(TextStrings.DesiredCellSize)
     {
         HelpText = TextStrings.Themaximumnumber
     };
     _inputParam[1] = new ListParam(TextStrings.stringnameoffield)
     {
         HelpText = TextStrings.Thevalueofeachcell
     };
     _outputParam    = new Parameter[1];
     _outputParam[0] = new RasterParam(TextStrings.OutputRaster)
     {
         HelpText = TextStrings.Resultofaverageslope
     };
 }
예제 #16
0
        /// <summary>
        /// Once the Parameter have been configured the Execute command can be called, it returns true if successful.
        /// </summary>
        /// <param name="cancelProgressHandler">A progress handler for receiving progress messages</param>
        /// <returns>A boolean, true if the IDW process worked correctly</returns>
        public override bool Execute(ICancelProgressHandler cancelProgressHandler)
        {
            IFeatureSet input = _inputParam[0].Value as IFeatureSet;
            ListParam   lp    = _inputParam[1] as ListParam;

            if (input == null || lp == null)
            {
                return(false);
            }

            input.FillAttributes();

            string           zField       = lp.ValueList[lp.Value];
            double           cellSize     = (double)_inputParam[2].Value;
            double           power        = (double)_inputParam[3].Value;
            NeighborhoodType neighborType = _inputParam[4].Value as string == TextStrings.FixedDistance ? NeighborhoodType.FixedDistance : NeighborhoodType.FixedCount;
            int     pointCount            = (int)_inputParam[5].Value;
            double  distance = (double)_inputParam[6].Value;
            IRaster output   = _outputParam[0].Value as IRaster;

            return(Execute(input, zField, cellSize, power, neighborType, pointCount, distance, output, cancelProgressHandler));
        }
예제 #17
0
        protected string GetOrderBy(ListParam listParam)
        {
            var sb = new StringBuilder();

            if (listParam == null || listParam.Sort == null || listParam.Sort.Count == 0)
            {
                return(string.Empty);
            }
            sb.Append(" Order By ");
            for (var i = 0; i < listParam.Sort.Count; i++)
            {
                if (i == 0)
                {
                    sb.Append($"{listParam.Sort[i].DbField} {listParam.Sort[i].Value}");
                }
                else
                {
                    sb.Append($", {listParam.Sort[i].DbField} {listParam.Sort[i].Value}");
                }
            }
            return(sb.ToString());
        }
예제 #18
0
        /// <summary>
        /// The Parameter array should be populated with default values here.
        /// </summary>
        public override void Initialize()
        {
            _inputParam    = new Parameter[7];
            _inputParam[0] = new PointFeatureSetParam(TextStrings.PointFeatureSet);
            _inputParam[1] = new ListParam(TextStrings.Zvalue)
            {
                HelpText = TextStrings.layercontainsvalues
            };
            _inputParam[2] = new DoubleParam(TextStrings.CellSize, 0, 0, double.MaxValue)
            {
                HelpText = TextStrings.Thecellsizeingeographicunits
            };
            _inputParam[3] = new DoubleParam(TextStrings.Power, 2, 1, double.MaxValue)
            {
                HelpText = TextStrings.Theinfluenceofdistance
            };
            _neighborhoodType = new List <string>
            {
                TextStrings.FixedDistance,
                TextStrings.FixedCount
            };
            _inputParam[4] = new ListParam(TextStrings.NeighborhoodType, _neighborhoodType, 0)
            {
                HelpText = TextStrings.Selectthetypeofneighborhood
            };
            _inputParam[5] = new IntParam(TextStrings.MinMaxnumberofpoints, 12, 0, int.MaxValue)
            {
                HelpText = TextStrings.FixedDistanceHelpText
            };
            _inputParam[6] = new DoubleParam(TextStrings.MinMaxdistance, 0, 0, double.MaxValue)
            {
                HelpText = TextStrings.FixedDistanceHelpText
            };

            _outputParam    = new Parameter[2];
            _outputParam[0] = new RasterParam(TextStrings.Raster);
            _outputParam[1] = new BooleanParam(TextStrings.OutputParameter_AddToMap, TextStrings.OutputParameter_AddToMap_CheckboxText, true);
        }
예제 #19
0
        void ITool.ParameterChanged(Parameter sender)
        {
            if (sender == _inputParameters[0])
            {
                if (BuildConnection() == true)
                {
                    //This is used to get the sites
                    Sites = Getsites();
                    //This is used to get the variables
                    Variables = GetVariables();

                    ListParam lp1 = (_inputParameters[1] as ListParam);

                    ListParam lp2 = (_inputParameters[2] as ListParam);

                    if (lp1 != null)
                    {
                        lp1.ValueList.Clear();
                        for (int i = 0; i < Sites.Rows.Count; i++)
                        {
                            lp1.ValueList.Add(Sites.Rows[i][0].ToString() + "," + Sites.Rows[i][2].ToString());
                        }
                        lp1.Value = -1;
                    }

                    if (lp2 != null)
                    {
                        lp2.ValueList.Clear();
                        for (int i = 0; i < Variables.Rows.Count; i++)
                        {
                            lp2.ValueList.Add(Variables.Rows[i][0].ToString() + "," + Variables.Rows[i][2].ToString() + "/" + "ValueType" + Variables.Rows[i][6].ToString());
                        }
                        lp2.Value = -1;
                    }
                }
            }
            return;
        }
예제 #20
0
        /// <summary>
        /// Fires when one of the paramters value has beend changed, usually when a user changes a input or output Parameter value, this can be used to populate input2 Parameter default values.
        /// </summary>
        public override void ParameterChanged(Parameter sender)
        {
            if (sender != _inputParam[0])
            {
                return;
            }

            List <string> fields = new List <string>();
            IFeatureSet   fs     = _inputParam[0].Value as IFeatureSet;

            if (fs == null)
            {
                return;
            }

            DataTable dt = fs.DataTable;

            if (dt == null)
            {
                return;
            }

            fields.Add("FID [Integer]");
            foreach (DataColumn column in dt.Columns)
            {
                fields.Add(column.ColumnName + " [" + column.DataType.Name + "]");
            }

            ListParam lp = _inputParam[1] as ListParam;

            if (lp == null)
            {
                return;
            }

            lp.ValueList = fields;
            lp.Value     = 0;
        }
        public IndicatorParam()
        {
            SlotNumber = 0;
            IsDefined = false;
            SlotType = SlotTypes.NotDefined;
            IndicatorName = String.Empty;
            IndicatorType = TypeOfIndicator.Indicator;
            ExecutionTime = ExecutionTime.DuringTheBar;
            IsDeafultGroupAll = false;
            IsAllowLTF = true;
            ListParam = new ListParam[5];
            NumParam = new NumericParam[6];
            CheckParam = new CheckParam[2];

            for (int i = 0; i < 5; i++)
                ListParam[i] = new ListParam();

            for (int i = 0; i < 6; i++)
                NumParam[i] = new NumericParam();

            for (int i = 0; i < 2; i++)
                CheckParam[i] = new CheckParam();
        }
예제 #22
0
 public PagedData <SimpleVipVO> GetViewPager(ListParam param)
 {
     return(_vipRepository.GetViewPager <SimpleVipVO>(param));
 }
예제 #23
0
 public IActionResult GetAll([FromBody] ListParam listParam) =>
 HandleRequest(() => _permissionService.GetAll(listParam));
예제 #24
0
파일: Show.cs 프로젝트: chn-gd-st-zp/Spear
        public ResultBasic <List <ODTOTestDemo> > List(ListParam input)
        {
            var dataList = new List <ODTOTestDemo>();

            return(dataList.ResultBasic_Success());
        }
        public async Task <IHttpActionResult> getReceiptList([FromUri] ListParam q)
        {
            #region 連接BusinessLogicLibary資料庫並取得資料
            try
            {
                if (LoginUserFlag != "Y")
                {
                    return(Ok(new
                    {
                        result = false,
                        message = Resources.Res.Log_Err_NoLogin
                    }));
                }
                using (var db0 = getDB0())
                {
                    var predicate = PredicateBuilder.True <PurchaseDetail>();
                    //只顯示該會員資料
                    int c_id = int.Parse(this.UserId);
                    predicate = predicate.And(x => x.Purchase.customer_id == c_id);

                    if (q.state != null)
                    {
                        if (q.state == 1)
                        {//pay_state
                            predicate = predicate.And(x => x.Purchase.pay_state == q.state_val);
                        }
                        else if (q.state == 2)
                        {//ship_state
                            predicate = predicate.And(x => x.Purchase.ship_state == q.state_val);
                        }
                        else if (q.state == 3)
                        {//完成訂單 已付款、已出貨
                            predicate = predicate.And(x => x.Purchase.pay_state == (int)IPayState.paid &
                                                      x.Purchase.ship_state == (int)IShipState.shipped);
                        }
                    }

                    var result      = db0.PurchaseDetail.AsExpandable().Where(predicate);
                    var resultItems = await result
                                      .OrderByDescending(x => x.Purchase.order_date)
                                      .Select(x => new
                    {
                        x.purchase_no,
                        x.purchase_detail_id,
                        x.Purchase.order_date,
                        x.p_d_pack_name,
                        x.p_name,
                        x.qty,
                        x.Purchase.pay_type,
                        x.Purchase.pay_state,
                        x.Purchase.ship_state
                    })
                                      .ToListAsync();

                    return(Ok(new
                    {
                        result = true,
                        data = resultItems
                    }));
                }
            }
            catch (Exception ex)
            {
                return(Ok(new
                {
                    result = false,
                    message = ex.ToString()
                }));
            }
            #endregion
        }
예제 #26
0
 public PageResultModel <T1> GetPageResult <T1>(ListParam listParam) where T1 : class, new()
 {
     throw new NotImplementedException();
 }
예제 #27
0
        public async Task <ResultWebApi <List <ODTOTestDemo> > > List(ListParam input)
        {
            var result = _displayer.List(input);

            return(result.ToResultWebApi());
        }
예제 #28
0
        //自动取消处理线程
        public static void XEPNRProcess()
        {
            string SendIns  = string.Empty;
            string RecvData = string.Empty;
            string Office   = string.Empty;
            string ErrMsg   = string.Empty;
            string Pnr      = string.Empty;
            string OrderId  = string.Empty;

            PnrAnalysis.FormatPNR pnrFormat = new FormatPNR();
            while (true)
            {
                try
                {
                    SendIns  = string.Empty;
                    RecvData = string.Empty;
                    Office   = string.Empty;
                    ErrMsg   = string.Empty;
                    Pnr      = string.Empty;
                    OrderId  = string.Empty;

                    //组织订单过滤条件
                    //订单来源:白屏预订PNR
                    string tmpSQL = " OrderSourceType=1 " +
                                    //订单状态:新订单,等待支付
                                    "and OrderStatusCode=1 " +
                                    //支付状态:未付
                                    "and PayStatus=0 " +
                                    //预订公司编号(归属的落地运营商编号范围)
                                    "and left(OwnerCpyNo,12) in (" + string.Join(",", m_XePNRInfo.CompanyNoList.ToArray()) + ") " +
                                    //预定时间超过设置取消时间值
                                    " and DateDiff(minute,CreateTime,getdate())>" + m_XePNRInfo.XEMinutes.ToString() +
                                    //3天内的预定订单
                                    " and DateDiff(day,CreateTime,getdate())<" + XePNR.m_XePNRInfo.day.ToString();

                    //取消订单表
                    List <Tb_Ticket_Order> list = Manage.CallMethod("Tb_Ticket_Order", "GetList", null, new object[] { tmpSQL }) as List <Tb_Ticket_Order>;
                    //滤过的PNR
                    List <string> tempPntList = new List <string>();
                    for (int i = 0; i < list.Count; i++)
                    {
                        //停止服务,则退出处理
                        if (m_XePNRInfo.EndFlag || XeLog == null)
                        {
                            return;
                        }
                        Tb_Ticket_Order tmpTicketOrder = list[i];
                        ///控制权限
                        string KonZhiXT = GetGYParameters(tmpTicketOrder.OwnerCpyNo);
                        //是否关闭后台自动取消编码功能
                        if (KonZhiXT != null && KonZhiXT.Contains("|98|"))
                        {
                            continue;
                        }
                        #region 过滤掉已经处理的PNR
                        if (tempPntList.Contains("'" + tmpTicketOrder.PNR + "'"))
                        {
                            continue;
                        }
                        #endregion

                        #region 检查同一编码、同一预订公司下是否存在已付款的订单
                        //包括收银
                        string tmpSQL3 = "  PNR='" + tmpTicketOrder.PNR + "'"
                                         + " and CreateTime>='" + tmpTicketOrder.CreateTime.ToString("yyyy-MM-dd") + "' and ( (OrderStatusCode in(3,4) and  PayStatus=0)  or   PayStatus=1 or OrderStatusCode=4 )";
                        bool flag1 = (bool)Manage.CallMethod("Tb_Ticket_Order", "IsExist", null, new object[] { tmpSQL3 });
                        if (flag1)
                        {
                            if (tmpTicketOrder.PNR != "")
                            {
                                tempPntList.Add("'" + tmpTicketOrder.PNR + "'");
                            }
                            //存在已经支付的订单,略过
                            //记录日志
                            Log.Record("XePnr.log", "订单号:" + tmpTicketOrder.OrderId + ",PNR编号:" + tmpTicketOrder.PNR + "存在已经付款订单,略过该PNR...");
                            continue;
                        }
                        #endregion 检查同一编码、同一预订公司下是否存在已付款的订单

                        #region 提取并检查PNR是否已经出票或RR状态,如果是则略过
                        string GYCpyNo = tmpTicketOrder.OwnerCpyNo;
                        if (GYCpyNo.Length >= 12)
                        {
                            GYCpyNo = GYCpyNo.Substring(0, 12);
                        }
                        List <Bd_Base_Parameters> baseParamList = Manage.CallMethod("Bd_Base_Parameters", "GetList", null, new Object[] { "CpyNo='" + GYCpyNo + "'" }) as List <Bd_Base_Parameters>;
                        ConfigParam config = Bd_Base_ParametersBLL.GetConfigParam(baseParamList);
                        if (config == null)
                        {
                            XeLog(1, string.Format("订单号{0},落地运营商未设置使用配置信息,请设置!", tmpTicketOrder.OrderId));
                            //移除该落地运营商 该落地运营商未设置配置参数
                            if (m_XePNRInfo.CompanyNoList.Contains("'" + GYCpyNo + "'"))
                            {
                                m_XePNRInfo.CompanyNoList.Remove("'" + GYCpyNo + "'");
                            }
                            continue;
                        }
                        OrderId = tmpTicketOrder.OrderId;
                        Office  = string.IsNullOrEmpty(tmpTicketOrder.Office) ? config.Office.Split('^')[0] : tmpTicketOrder.Office;
                        if (string.IsNullOrEmpty(Office))
                        {
                            XeLog(1, string.Format("订单号{0}中没有Office或者落地运营商没有设置Office,请检查!", OrderId));
                            //移除该落地运营商 该落地运营商未设置配置参数
                            if (m_XePNRInfo.CompanyNoList.Contains("'" + GYCpyNo + "'"))
                            {
                                m_XePNRInfo.CompanyNoList.Remove("'" + GYCpyNo + "'");
                            }
                            continue;
                        }
                        Pnr = tmpTicketOrder.PNR;
                        if (string.IsNullOrEmpty(tmpTicketOrder.PNR) || (tmpTicketOrder.PNR.Trim() == ""))
                        {
                            XeLog(1, string.Format("订单号{0}中没有PNR,更改为已取消订单!", OrderId));

                            //更改订单状态为已经取消订单
                            string tempSql = "update Tb_Ticket_Order set OrderStatusCode=2,TicketStatus=6  where id='" + tmpTicketOrder.id + "'";
                            Manage.ExecuteNonQuerySQLInfo(tempSql);
                            continue;
                        }

                        Tb_SendInsData SendModel = new Tb_SendInsData();
                        ParamObject    PM        = new ParamObject();
                        PM.ServerIP   = config.WhiteScreenIP;
                        PM.ServerPort = int.Parse(config.WhiteScreenPort);
                        PM.Office     = Office;
                        //发送指令
                        SendIns = "RT" + Pnr;
                        PM.code = SendIns;
                        PM.IsPn = true;

                        SendModel.SendIns         = SendIns;             //发送指令
                        SendModel.SendInsType     = 13;                  //扫描程序发送的指令
                        SendModel.SendTime        = System.DateTime.Now; //发送时间
                        SendModel.Office          = Office;
                        SendModel.ServerIPAndPort = PM.ServerIP + ":" + PM.ServerPort;
                        SendModel.UserAccount     = "扫描程序";
                        SendModel.CpyNo           = GYCpyNo;
                        //返回数据
                        RecvData           = SendNewPID.SendCommand(PM);
                        SendModel.RecvData = RecvData;
                        SendModel.RecvTime = System.DateTime.Now;
                        //记录指令到数据库
                        LogData(SendModel);

                        //指令日志
                        XeLog(1, string.Format("\r\n【编码:{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n订单号:{3}\r\n", Pnr, SendIns, RecvData, tmpTicketOrder.OrderId));
                        if (RecvData.Contains("授权"))
                        {
                            //更改订单状态为已经取消订单
                            string tempSql = "update Tb_Ticket_Order set OrderStatusCode=2,TicketStatus=6  where id='" + tmpTicketOrder.id + "'";
                            Manage.ExecuteNonQuerySQLInfo(tempSql);
                            if (tmpTicketOrder.PNR != "")
                            {
                                tempPntList.Add("'" + tmpTicketOrder.PNR + "'");
                            }
                            XeLog(1, string.Format("订单号{0}中{1} {2},只取消订单不取消编码!", OrderId, Pnr, RecvData));
                            continue;
                        }
                        string PnrStatus = pnrFormat.GetPnrStatus(RecvData, out ErrMsg);
                        if (!PnrStatus.ToUpper().Contains("HK") && !PnrStatus.ToUpper().Contains("HL") && !PnrStatus.ToUpper().Contains("NO"))//(PnrStatus.Contains("RR") || PnrStatus.Contains("XX"))
                        {
                            if (tmpTicketOrder.PNR != "")
                            {
                                tempPntList.Add("'" + tmpTicketOrder.PNR + "'");
                            }
                            XeLog(1, string.Format("订单号{0}中{1}状态为{2},只取消订单,不处理PNR!", OrderId, Pnr, PnrStatus));

                            //更改订单状态为已经取消订单
                            string tempSql = "update Tb_Ticket_Order set OrderStatusCode=2,TicketStatus=6  where id='" + tmpTicketOrder.id + "'";
                            Manage.ExecuteNonQuerySQLInfo(tempSql);
                            continue;
                        }
                        #endregion 提取并检查PNR是否已经出票或RR状态,如果是则略过

                        #region 发送取消PNR指令并检查结果

                        if (PnrStatus.ToUpper().Contains("HK") || PnrStatus.ToUpper().Contains("HL") || PnrStatus.ToUpper().Contains("NO"))
                        {
                            //取消编码
                            SendIns = "RT" + Pnr + "|XEPNR@" + Pnr;
                            PM.code = SendIns;
                            PM.IsPn = false;

                            SendModel                 = new Tb_SendInsData();
                            SendModel.SendIns         = SendIns;             //发送指令
                            SendModel.SendInsType     = 13;                  //扫描程序发送的指令
                            SendModel.SendTime        = System.DateTime.Now; //发送时间
                            SendModel.Office          = Office;
                            SendModel.ServerIPAndPort = PM.ServerIP + ":" + PM.ServerPort;
                            SendModel.UserAccount     = "扫描程序";
                            SendModel.CpyNo           = GYCpyNo;
                            //返回数据
                            RecvData           = SendNewPID.SendCommand(PM);
                            SendModel.RecvData = RecvData;
                            SendModel.RecvTime = System.DateTime.Now;
                            //记录指令到数据库
                            LogData(SendModel);

                            //指令日志
                            XeLog(1, string.Format("\r\n【订单号{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", OrderId, SendIns, RecvData));

                            if (RecvData.ToUpper().Contains("CANCELLED"))
                            {
                                //加入不需要取消的列表
                                tempPntList.Add("'" + tmpTicketOrder.PNR + "'");
                                //取消编码成功后 取消订单
                                List <string> ListSQL = new List <string>();
                                //修改订单数据
                                string tempSql = "update Tb_Ticket_Order set OrderStatusCode=2,TicketStatus=6  where id='" + tmpTicketOrder.id + "'";
                                ListSQL.Add(tempSql);//
                                //修改乘客数据
                                tempSql = "update Tb_Ticket_Passenger set TicketStatus=6  where OrderId='" + OrderId + "'";
                                ListSQL.Add(tempSql);//1.添加订单日志

                                //取消编码 订单日志
                                Log_Tb_AirOrder OrderLog = new Log_Tb_AirOrder();
                                OrderLog.id            = Guid.NewGuid();
                                OrderLog.OperContent   = "订单超过" + m_XePNRInfo.XEMinutes.ToString() + "分钟未能成功支付,系统于" + System.DateTime.Now + "订单自动取消";;
                                OrderLog.OperLoginName = "管理员";
                                OrderLog.OperTime      = DateTime.Now;
                                OrderLog.OperType      = "修改";
                                OrderLog.OperUserName  = "******";
                                OrderLog.OrderId       = OrderId;
                                OrderLog.WatchType     = 1;
                                //订单出票公司信息
                                ListParam TicketLP = LPList.Find(delegate(ListParam _tempLP)
                                {
                                    return(tmpTicketOrder.OwnerCpyNo.Contains(_tempLP.CpyNo));
                                });
                                if (TicketLP != null)
                                {
                                    OrderLog.CpyName = TicketLP.UninAllName;
                                    OrderLog.CpyNo   = TicketLP.CpyNo;
                                    OrderLog.CpyType = 1;
                                }
                                else
                                {
                                    OrderLog.CpyName = tmpTicketOrder.OwnerCpyName;
                                    OrderLog.CpyNo   = tmpTicketOrder.OwnerCpyNo;
                                    OrderLog.CpyType = 1;
                                }
                                tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Tb_AirOrder> .CreateInsertModelSql(OrderLog);

                                ListSQL.Add(tempSql);
                                //取消订单
                                if (Manage.ExecuteSqlTran(ListSQL, out ErrMsg))
                                {
                                    XeLog(1, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " 订单号:" + OrderId + " 订单已取消");
                                }
                            }
                        }
                        #endregion 发送取消PNR指令并检查结果
                    }

                    #region //修改滤过的PNR状态
                    if (tempPntList.Count > 0)
                    {
                        string sqlWhere = " update Log_Pnr set  Flag=1 where   Pnr in(" + string.Join(",", tempPntList.ToArray()) + ")";
                        Manage.ExecuteNonQuerySQLInfo(sqlWhere);
                    }

                    #endregion

                    #region    //生成了编码 没有生成订单的编码
                    string tmpSQL2 = " left(CpyNo,12) in (" + string.Join(",", m_XePNRInfo.CompanyNoList.ToArray()) + ") and DateDiff(minute,OperTime,getdate())>" + m_XePNRInfo.XEMinutes.ToString() + " and OrderFlag=0 and Flag=0 and RetryCount<" + m_XePNRInfo.ReTryCount;
                    //过滤掉没有连接成功的PNR
                    List <string> lstRepeat = new List <string>();
                    //取消PNR表 没有写入订单的数据
                    List <Log_Pnr> list2 = Manage.CallMethod("Log_Pnr", "GetList", null, new object[] { tmpSQL2 }) as List <Log_Pnr>;
                    for (int j = 0; j < list2.Count; j++)
                    {
                        //停止服务,则退出处理
                        if (m_XePNRInfo.EndFlag)
                        {
                            return;
                        }
                        Log_Pnr tmpLogPnr = list2[j];
                        ///控制权限
                        string KonZhiXT = GetGYParameters(tmpLogPnr.CpyNo);
                        //是否关闭后台自动取消编码功能
                        if (KonZhiXT != null && KonZhiXT.Contains("|98|"))
                        {
                            continue;
                        }
                        string GYCpyNo = tmpLogPnr.CpyNo.Length >= 12 ? tmpLogPnr.CpyNo.Substring(0, 12) : tmpLogPnr.CpyNo;
                        //勾选了该落地运营商的才取消编码
                        if (!m_XePNRInfo.CompanyNoList.Contains("'" + GYCpyNo + "'"))
                        {
                            continue;
                        }
                        //不取消滤过的PNR
                        if (tmpLogPnr.PNR != "" && tempPntList.Contains("'" + tmpLogPnr.PNR + "'"))
                        {
                            tmpLogPnr.Flag = true;
                            string tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Pnr> .CreateUpdateModelSql(tmpLogPnr, "id");

                            Manage.ExecuteNonQuerySQLInfo(tempSql);
                            continue;
                        }

                        #region 取消PNR
                        string pnr = tmpLogPnr.PNR;
                        //pnr为空不处理  //Office为空不处理
                        if (string.IsNullOrEmpty(pnr) || string.IsNullOrEmpty(tmpLogPnr.OfficeCode))
                        {
                            tmpLogPnr.Flag = true;
                            string tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Pnr> .CreateUpdateModelSql(tmpLogPnr, "id");

                            Manage.ExecuteNonQuerySQLInfo(tempSql);
                            continue;
                        }
                        ////IP端口为空不处理
                        string[] strIPPort = tmpLogPnr.A7.Split('|');
                        if (strIPPort.Length == 2)
                        {
                            if (pnr.Trim() == "")
                            {
                                tmpLogPnr.Flag = true;
                                string tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Pnr> .CreateUpdateModelSql(tmpLogPnr, "id");

                                Manage.ExecuteNonQuerySQLInfo(tempSql);
                                continue;
                            }


                            string ip   = strIPPort[0];
                            int    Port = 0;
                            int.TryParse(strIPPort[1], out Port);

                            Tb_SendInsData SendModel = new Tb_SendInsData();
                            ParamObject    PM        = new ParamObject();
                            PM.ServerIP   = ip;
                            PM.ServerPort = Port;
                            PM.Office     = tmpLogPnr.OfficeCode;

                            //发送指令
                            SendIns = "RT" + pnr;
                            PM.code = SendIns;

                            SendModel.SendIns         = SendIns;             //发送指令
                            SendModel.SendInsType     = 13;                  //扫描程序发送的指令
                            SendModel.SendTime        = System.DateTime.Now; //发送时间
                            SendModel.Office          = Office;
                            SendModel.ServerIPAndPort = PM.ServerIP + ":" + PM.ServerPort;
                            SendModel.UserAccount     = "扫描程序";
                            SendModel.CpyNo           = GYCpyNo;
                            //过滤连接不通的IP端口
                            if (lstRepeat.Contains(SendModel.ServerIPAndPort))
                            {
                                continue;
                            }
                            //返回数据
                            RecvData           = SendNewPID.SendCommand(PM);
                            SendModel.RecvData = RecvData;
                            SendModel.RecvTime = System.DateTime.Now;
                            //记录指令到数据库
                            LogData(SendModel);
                            //过滤连接不通的IP端口
                            if (RecvData.Contains("由于连接方在一段时间后没有正确答复或连接的主机没有反应") || RecvData.Contains("不知道这样的主机"))
                            {
                                lstRepeat.Add(SendModel.ServerIPAndPort);
                            }
                            //指令日志
                            XeLog(1, string.Format("\r\n【编码:{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", Pnr, SendIns, RecvData));
                            string PnrStatus = pnrFormat.GetPnrStatus(RecvData, out ErrMsg);
                            if (!PnrStatus.Contains("RR") && !PnrStatus.Contains("XX") && PnrStatus != "")
                            {
                                if (PnrStatus.ToUpper().Contains("HK") || PnrStatus.ToUpper().Contains("HL") || PnrStatus.ToUpper().Contains("NO"))
                                {
                                    //发送指令
                                    SendIns = "RT" + pnr + "|XePNR@" + pnr;
                                    PM.code = SendIns;

                                    SendModel                 = new Tb_SendInsData();
                                    SendModel.SendIns         = SendIns;             //发送指令
                                    SendModel.SendInsType     = 13;                  //扫描程序发送的指令
                                    SendModel.SendTime        = System.DateTime.Now; //发送时间
                                    SendModel.Office          = Office;
                                    SendModel.ServerIPAndPort = PM.ServerIP + ":" + PM.ServerPort;
                                    SendModel.UserAccount     = "扫描程序";
                                    SendModel.CpyNo           = GYCpyNo;
                                    //返回数据
                                    RecvData           = SendNewPID.SendCommand(PM);
                                    SendModel.RecvData = RecvData;
                                    SendModel.RecvTime = System.DateTime.Now;
                                    //记录指令到数据库
                                    LogData(SendModel);

                                    //指令日志
                                    XeLog(1, string.Format("\r\n【编码:{0}】发送指令>{1}\r\n接收数据:\r\n{2}\r\n", pnr, SendIns, RecvData));
                                    if (RecvData.ToUpper().Contains("CANCELLED"))
                                    {
                                        //取消成功
                                        tmpLogPnr.Flag = true;
                                    }
                                    else
                                    {
                                        //取消失败
                                        tmpLogPnr.Flag = false;
                                        tmpLogPnr.RetryCount++;
                                    }
                                    string tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Pnr> .CreateUpdateModelSql(tmpLogPnr, "id");

                                    Manage.ExecuteNonQuerySQLInfo(tempSql);
                                }
                            }
                            else
                            {
                                tmpLogPnr.Flag = true;
                                string tempSql = PbProject.Dal.Mapping.MappingHelper <Log_Pnr> .CreateUpdateModelSql(tmpLogPnr, "id");

                                Manage.ExecuteNonQuerySQLInfo(tempSql);
                            }
                        }
                        #endregion
                    }
                    //更新数据库
                    //if (UpdateSQL.Count > 0)
                    //{
                    //    Manage.ExecuteSqlTran(UpdateSQL, out ErrMsg);
                    //}
                    #endregion
                }
                catch (Exception ex)
                {
                    //记录错误日志
                    Log.Record("XePnrError.log", ex, "XEPNRProcess:自动取消PNR处理过程出错!");
                }
                //遍历时间间隔
                Thread.Sleep(m_XePNRInfo.InterMinutes * 1000);//分钟
            }
        }
예제 #29
0
 public ResultBasic <List <ODTOTestDemo> > List(ListParam input)
 {
     return(_show.List(input));
 }
예제 #30
0
 public UnaryResult <ResultMicServ <bool> > Test4(IDTO_GRPC <ListParam> input, ListParam input2)
 {
     return(true.ResultBasic_Success().ToMicServResult());
 }