当前位置: 首页>>代码示例>>C#>>正文


C# List.Find方法代码示例

本文整理汇总了C#中Common.List.Find方法的典型用法代码示例。如果您正苦于以下问题:C# List.Find方法的具体用法?C# List.Find怎么用?C# List.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Common.List的用法示例。


在下文中一共展示了List.Find方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getConsumeMealType

        /// <summary>
        /// 获取消费记录的餐类型
        /// </summary>
        /// <param name="listTimeSpan"></param>
        /// <param name="dtConsumeTime"></param>
        /// <returns></returns>
        string getConsumeMealType(List<CodeMaster_cmt_Info> listTimeSpan, DateTime dtConsumeTime)
        {
            string strLunch = listTimeSpan.Find(x => x.cmt_cKey2 == Common.DefineConstantValue.MealType.Lunch.ToString()).cmt_cRemark;
            string strSupper = listTimeSpan.Find(x => x.cmt_cKey2 == Common.DefineConstantValue.MealType.Supper.ToString()).cmt_cRemark;

            TimeSpan tsLunch = TimeSpan.Parse(strLunch);
            TimeSpan tsSupper = TimeSpan.Parse(strSupper);
            TimeSpan tsConsume = TimeSpan.Parse(dtConsumeTime.ToString("HH:mm:ss"));

            if (tsConsume < tsLunch)
            {
                return Common.DefineConstantValue.MealType.Breakfast.ToString();
            }
            else if (tsConsume >= tsLunch && tsConsume < tsSupper)
            {
                return Common.DefineConstantValue.MealType.Lunch.ToString();
            }
            else
            {
                return Common.DefineConstantValue.MealType.Supper.ToString();
            }
        }
开发者ID:Klutzdon,项目名称:SIOTS_HHZX,代码行数:28,代码来源:UserAccountFundSyncService.cs

示例2: DecodeCommand

        public static bool DecodeCommand(Player Plr,ref List<string> Values, List<GmCommandHandler> Handlers,List<GmCommandHandler> BaseHandlers)
        {
            string Command = GetString(ref Values);

            //Log.Success("DecodeCommand", "Command = " + Command);

            GmCommandHandler Handler = Handlers.Find(com => com != null && com.Name.StartsWith(Command));

            if(Handler == null) // Si la commande n'existe pas , on affiche la liste des commandes
            {
                List<GmCommandHandler> Base = Handlers == null ? BaseHandlers : Handlers;
                PrintCommands(Plr,Base);
                return true;
            }
            else // Le Handler Existe
            {
                if(Handler.GmLevel > Plr.GmLevel) // GmLevel insuffisant
                {
                    Plr.SendMessage(0, "", "Invalid GM Level : < " + Handler.GmLevel, SystemData.ChatLogFilters.CHATLOGFILTERS_SHOUT);
                    return false;
                }

                if(Handler.ValueCount > Values.Count) // Nombre d'arguments insuffisant
                {
                    Plr.SendMessage(0, "", "Invalid Arguments Count : " + Handler.Description, SystemData.ChatLogFilters.CHATLOGFILTERS_SHOUT);
                    return true;
                }

                if(Handler.Handlers != null && Handler.Handlers.Count > 0)
                {
                    return DecodeCommand(Plr,ref Values,Handler.Handlers,Handlers);
                }

                if(Handler.Handler != null)
                {
                    return Handler.Handler.Invoke(Plr,ref Values);
                }
            }

            return false;
        }
开发者ID:nalgol,项目名称:WarEmu,代码行数:41,代码来源:GmCommand.cs

示例3: cosumeRecordAnalysis


//.........这里部分代码省略.........
                        if (consumeItem.csr_cConsumeType == DefineConstantValue.ConsumeMachineType.StuSetmeal.ToString())
                        {
                            #region 处理定餐消费记录

                            //判断为定餐消费记录,用于消除未确定消费记录
                            List<PreConsumeRecord_pcs_Info> listResPreCost = listUnSettlePreCost.Where(x =>
                                  x.pcs_cUserID == consumeItem.csr_cCardUserID//需为消费用户对应ID
                                  && x.MealType == consumeItem.csr_cMealType//餐类型需要相同
                                      //&& x.pcs_dConsumeDate.Date == consumeItem.csr_dConsumeDate.Date
                                  && x.pcs_dAddDate.Date == consumeItem.csr_dConsumeDate.Date//以添加时间为准,找出
                                  && Math.Abs(x.pcs_fCost) == Math.Abs(consumeItem.csr_fConsumeMoney)//消费金额需一致
                                  ).ToList();
                            if (listResPreCost != null && listResPreCost.Count > 0)//!要注意这里会不会搜索出两条记录出来
                            {
                                if (listResPreCost.Count > 1)
                                {
                                    bool lSign = true;//标识特殊case:同一条打卡消费记录对应两条定餐未结算记录
                                }
                                //消费数据符合该条未确认数据记录的条件,更新该条消费记录的状态为已结,并更新对应的未确定扣费定餐记录置为已结状态
                                consumeItem.csr_lIsSettled = true;
                                consumeItem.csr_dSettleTime = DateTime.Now;
                                listUpdate_Consume.Add(consumeItem);

                                //按升序排序多条待付款预扣费记录
                                List<PreConsumeRecord_pcs_Info> listPreTmp = listResPreCost.OrderBy(x => x.pcs_dAddDate).ToList();
                                for (int i = 0; i < listPreTmp.Count; i++)
                                {
                                    PreConsumeRecord_pcs_Info preCost = listPreTmp[i];
                                    preCost.pcs_cSourceID = consumeItem.csr_cRecordID;//转换预付款记录的源记录ID,原为定餐记录,现为消费记录
                                    preCost.pcs_lIsSettled = true;
                                    preCost.pcs_dSettleTime = DateTime.Now;
                                    preCost.pcs_cConsumeType = Common.DefineConstantValue.ConsumeMoneyFlowType.SetMealCost.ToString();
                                    preCost.pcs_dConsumeDate = consumeItem.csr_dConsumeDate;
                                    PreConsumeRecord_pcs_Info resCompUp = listUpdate_PreCost.Find(x => x.pcs_cRecordID == preCost.pcs_cRecordID);
                                    PreConsumeRecord_pcs_Info resCompDel = listDelete_PreCost.Find(x => x.pcs_cRecordID == preCost.pcs_cRecordID);
                                    if (resCompUp == null && resCompDel == null)
                                    {
                                        if (i == 0)
                                        {
                                            listUpdate_PreCost.Add(preCost);
                                        }
                                        else
                                        {
                                            listDelete_PreCost.Add(preCost);
                                        }
                                    }
                                    else
                                    {
                                        bool lSign = true;//异常数据标识
                                    }
                                }
                            }
                            else
                            {
                                //无符合该消费记录的待付款记录
                                listUpdate_UnMealConsume.Add(consumeItem);
                            }

                            #endregion
                        }
                        else
                        {
                            //判断为非定餐消费记录,用于消减冲数记录
                            consumeItem.csr_lIsSettled = true;
                            consumeItem.csr_dSettleTime = DateTime.Now;
                            listUpdate_Consume.Add(consumeItem);
开发者ID:Klutzdon,项目名称:SIOTS_HHZX,代码行数:67,代码来源:UserAccountFundSyncService.cs

示例4: UpdateRechargeRecord

        public ReturnValueInfo UpdateRechargeRecord(List<PreRechargeRecord_prr_Info> listRecord, List<RechargeRecord_rcr_Info> listRecharges, decimal fPreCostRecharge)
        {
            ReturnValueInfo rvInfo = new ReturnValueInfo();
            #region 检查条件合法性

            if (listRecord == null)
            {
                rvInfo.isError = true;
                rvInfo.messageText = Common.DefineConstantValue.SystemMessageText.strMessageText_E_ObjectNull + Environment.NewLine + "预充值记录。";
                return rvInfo;
            }
            if (listRecharges == null)
            {
                rvInfo.isError = true;
                rvInfo.messageText = Common.DefineConstantValue.SystemMessageText.strMessageText_E_ObjectNull + Environment.NewLine + "实际充值记录。";
                return rvInfo;
            }
            if (listRecharges != null && listRecharges.Count < 1)
            {
                rvInfo.isError = true;
                rvInfo.messageText = "需要录入的充值记录不能为空。";
                return rvInfo;
            }
            if (listRecord != null && listRecord.Count < 1)
            {
                rvInfo.isError = true;
                rvInfo.messageText = "需要更新的充值记录不能为空。";
                return rvInfo;
            }

            #endregion

            try
            {
                using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
                {
                    //用于批量统一插数
                    List<PreConsumeRecord_pcs> listToInsertPreCost = new List<PreConsumeRecord_pcs>();
                    List<CardUserAccountDetail_cuad> listToInsertAccountDetail = new List<CardUserAccountDetail_cuad>();
                    List<SystemAccountDetail_sad> listToInsertSysDetail = new List<SystemAccountDetail_sad>();
                    List<RechargeRecord_rcr> listToInsertRecharge = new List<RechargeRecord_rcr>();

                    //获取账户信息
                    CardUserAccount_cua account = db.CardUserAccount_cua.Where(x => x.cua_cCUSID == listRecharges[0].rcr_cUserID).FirstOrDefault();
                    #region 账户信息丢失时,自动创建账户信息

                    if (account == null)
                    {
                        account = new CardUserAccount_cua();
                        account.cua_cRecordID = Guid.NewGuid();
                        account.cua_cCUSID = listRecharges[0].rcr_cUserID;
                        account.cua_cAdd = listRecharges[0].rcr_cLast;
                        account.cua_dAddDate = DateTime.Now;
                        account.cua_dLastSyncTime = DateTime.Now;
                        account.cua_lIsActive = true;
                        account.cua_fCurrentBalance = decimal.Zero;
                        account.cua_fOriginalBalance = decimal.Zero;
                        db.CardUserAccount_cua.InsertOnSubmit(account);
                        db.SubmitChanges();
                    }

                    #endregion

                    //充值总额
                    decimal fSumRecharge = decimal.Zero;

                    //待添加的实际充值记录
                    List<RechargeRecord_rcr> listRechargeInserts = new List<RechargeRecord_rcr>();
                    //待添加的的用户账户数据
                    List<CardUserAccountDetail_cuad> listUserAccountInfos = new List<CardUserAccountDetail_cuad>();
                    //待添加的系统账户数据
                    List<SystemAccountDetail_sad> listSysAccountInfos = new List<SystemAccountDetail_sad>();
                    //更新已经使用的转账充值记录
                    #region 更新已被使用的预充值记录状态为已完成,并插入实际充值记录并记录账户收入记录

                    foreach (PreRechargeRecord_prr_Info preRechargeItem in listRecord)
                    {
                        if (preRechargeItem == null)
                        {
                            continue;
                        }

                        PreRechargeRecord_prr preRecord = db.PreRechargeRecord_prr.Where(x => x.prr_cRecordID == preRechargeItem.prr_cRecordID).FirstOrDefault();
                        if (preRecord != null)
                        {
                            //添加实际消费记录
                            RechargeRecord_rcr_Info rechargeInfo = listRecharges.Find(x => x.rcr_cRecordID == preRechargeItem.prr_cRCRID);
                            if (rechargeInfo != null)
                            {
                                RechargeRecord_rcr recharge = Common.General.CopyObjectValue<RechargeRecord_rcr_Info, RechargeRecord_rcr>(rechargeInfo);
                                if (recharge != null)
                                {
                                    rechargeInfo.rcr_dRechargeTime = DateTime.Now;
                                    rechargeInfo.rcr_dLastDate = DateTime.Now;
                                    listRechargeInserts.Add(recharge);
                                }
                            }

                            preRecord.prr_cRCRID = rechargeInfo.rcr_cRecordID;
                            preRecord.prr_cStatus = Common.DefineConstantValue.ConsumeMoneyFlowStatus.Finished.ToString();
//.........这里部分代码省略.........
开发者ID:Klutzdon,项目名称:SIOTS_HHZX,代码行数:101,代码来源:RechargeRecordDA.cs

示例5: DecodeCommand

        public static bool DecodeCommand(Player Plr,ref List<string> Values, List<GmCommandHandler> Handlers,List<GmCommandHandler> BaseHandlers)
        {
            string Command = GetString(ref Values);

            Log.Success("DecodeCommand", "Command = " + Command);

            GmCommandHandler Handler = Handlers.Find(com => com != null && com.Name.StartsWith(Command));

            if(Handler == null) // Si la commande n'existe pas , on affiche la liste des commandes
            {
                List<GmCommandHandler> Base = Handlers == null ? BaseHandlers : Handlers;
                PrintCommands(Plr,Base);
                return true;
            }
            else // Le Handler Existe
            {
                if(Handler.GmLevel > Plr.GmLevel) // GmLevel insuffisant
                {

                    return false;
                }

                if(Handler.ValuCount > Values.Count) // Nombre d'arguments insuffisant
                {

                    return true;
                }

                if(Handler.Handlers != null && Handler.Handlers.Count > 0)
                {
                    return DecodeCommand(Plr,ref Values,Handler.Handlers,Handlers);
                }

                if(Handler.Handler != null)
                {
                    return Handler.Handler.Invoke(Plr,ref Values);
                }
            }

            return false;
        }
开发者ID:JeFawk,项目名称:WarEmu,代码行数:41,代码来源:GmCommand.cs

示例6: ResetMealPlanning

        /// <summary>
        /// 重设被欠费停餐的人员开餐情况
        /// </summary>
        /// <param name="userInfo"></param>
        private void ResetMealPlanning(CardUserMaster_cus_Info userInfo, DateTime dtSysNow, List<MealBookingHistory_mbh_Info> listMeaslHistory)
        {
            try
            {
                ICodeMasterBL bll = BLL.Factory.SysMaster.MasterBLLFactory.GetBLL<ICodeMasterBL>(BLL.Factory.SysMaster.MasterBLLFactory.CodeMaster_cmt);
                List<CodeMaster_cmt_Info> listMealTimeSpans = bll.SearchRecords(new CodeMaster_cmt_Info() { cmt_cKey1 = Common.DefineConstantValue.CodeMasterDefine.KEY1_MealTimeSpan });
                List<CodeMaster_cmt_Info> listBlacklistTImeSpans = bll.SearchRecords(new CodeMaster_cmt_Info() { cmt_cKey1 = Common.DefineConstantValue.CodeMasterDefine.KEY1_BWListUploadInterval });
                TimeSpan tsBLLunch = TimeSpan.Parse(listBlacklistTImeSpans.Find(x => x.cmt_cValue == Common.DefineConstantValue.MealType.Lunch.ToString()).cmt_cRemark);
                TimeSpan tsMealLunch = TimeSpan.Parse(listMealTimeSpans.Find(x => x.cmt_cKey2 == Common.DefineConstantValue.MealType.Lunch.ToString()).cmt_cRemark2);
                TimeSpan tsBLSupper = TimeSpan.Parse(listBlacklistTImeSpans.Find(x => x.cmt_cValue == Common.DefineConstantValue.MealType.Supper.ToString()).cmt_cRemark);
                TimeSpan tsMealSupper = TimeSpan.Parse(listMealTimeSpans.Find(x => x.cmt_cKey2 == Common.DefineConstantValue.MealType.Supper.ToString()).cmt_cRemark2);

                TimeSpan tsNow = TimeSpan.Parse(dtSysNow.ToString("HH:mm"));

                string strMealType = string.Empty;
                if (tsNow >= tsBLLunch && tsNow <= tsMealLunch)
                {
                    strMealType = Common.DefineConstantValue.MealType.Lunch.ToString();
                    MealBookingHistory_mbh_Info mealInfo = listMeaslHistory.Find(x => x.mbh_cMealType == strMealType);
                    if (mealInfo != null)
                    {
                        localLog.WriteLog("找到午餐计划。" + dtSysNow.ToString(), string.Empty, SystemLog.SystemLog.LogType.Trace);
                        UpdateMealPlanning(strMealType, userInfo, mealInfo);
                    }
                    else
                    {
                        localLog.WriteLog("找不到午餐计划。" + dtSysNow.ToString(), string.Empty, SystemLog.SystemLog.LogType.Trace);
                    }
                }
                else if (tsNow >= tsBLSupper && tsNow <= tsMealSupper)
                {
                    strMealType = Common.DefineConstantValue.MealType.Supper.ToString();
                    MealBookingHistory_mbh_Info mealInfo = listMeaslHistory.Find(x => x.mbh_cMealType == strMealType);
                    if (mealInfo != null)
                    {
                        localLog.WriteLog("找到晚餐计划。" + dtSysNow.ToString(), string.Empty, SystemLog.SystemLog.LogType.Trace);
                        UpdateMealPlanning(strMealType, userInfo, mealInfo);
                    }
                    else
                    {
                        localLog.WriteLog("找不到晚餐计划。" + dtSysNow.ToString(), string.Empty, SystemLog.SystemLog.LogType.Trace);
                    }
                }
                else
                {
                    localLog.WriteLog(userInfo.cus_cChaName + ",不在就餐时间内。" + dtSysNow.ToString(), string.Empty, SystemLog.SystemLog.LogType.Trace);
                }

                ReturnValueInfo rvInfo = AddOldCardList(int.Parse(_CardInfo.CardNo), DefineConstantValue.EnumCardUploadListOpt.AddWhiteList);
                if (rvInfo.boolValue && !rvInfo.isError)
                {
                    localLog.WriteLog(userInfo.cus_cChaName + "清除名单成功。" + dtSysNow.ToString(), string.Empty, SystemLog.SystemLog.LogType.Trace);
                }
                else
                {
                    localLog.WriteLog(userInfo.cus_cChaName + "清除名单失败。" + rvInfo.messageText + " " + dtSysNow.ToString(), string.Empty, SystemLog.SystemLog.LogType.Error);
                }
            }
            catch (Exception ex)
            {
                localLog.WriteLog(ex.Message, string.Empty, SystemLog.SystemLog.LogType.Error);
            }
        }
开发者ID:Klutzdon,项目名称:SIOTS_HHZX,代码行数:67,代码来源:frmCardRecharge.cs

示例7: BindMenuItems

        /// <summary>
        /// 綁定菜單欄
        /// </summary>
        void BindMenuItems()
        {
            Sys_FormMaster_fom_Info info = new Sys_FormMaster_fom_Info();
            info.fom_cSysCode = Common.DefineConstantValue.SysFormCodeEnum.HBManager.ToString();
            ISysFormMasterBL _ISysFormMasterBL = MasterBLLFactory.GetBLL<ISysFormMasterBL>(MasterBLLFactory.SysFormMaster);
            Sys_UserMaster_usm_Info user = this.UserInformation;
            List<Sys_FormMaster_fom_Info> listObjForms = _ISysFormMasterBL.GetUserMenu(info, user);
            List<Sys_FormMaster_fom_Info> listForms = new List<Sys_FormMaster_fom_Info>();
            foreach (Sys_FormMaster_fom_Info item in listObjForms)
            {
                if (item != null)
                {
                    listForms.Add(item);
                }
            }

            Sys_FormMaster_fom_Info ParentFormInfo = listForms.Find(x => x.fom_iParentID == -1);
            if (ParentFormInfo == null)
            {
                return;
            }

            ClearMenuItem();

            GetMenuItems(TopMenu.MenuItems, listForms, ParentFormInfo.fom_iRecordID);
        }
开发者ID:Klutzdon,项目名称:PBIMSN,代码行数:29,代码来源:MainForm.cs

示例8: BindMenuItems

        /// <summary>
        /// 绑定菜单栏
        /// </summary>
        void BindMenuItems()
        {
            Sys_FormMaster_fom_Info info = new Sys_FormMaster_fom_Info();
            ISysFormMasterBL _ISysFormMasterBL = MasterBLLFactory.GetBLL<ISysFormMasterBL>(MasterBLLFactory.SysFormMaster);
            Sys_UserMaster_usm_Info user = this.UserInformation;
            List<Sys_FormMaster_fom_Info> listObjForms = _ISysFormMasterBL.GetUserMenu(info, user);
            List<Sys_FormMaster_fom_Info> listForms = new List<Sys_FormMaster_fom_Info>();
            foreach (Sys_FormMaster_fom_Info item in listObjForms)
            {
                if (item != null)
                {
                    listForms.Add(item);
                }
            }

            Sys_FormMaster_fom_Info ParentFormInfo = listForms.Find(x => x.fom_iParentID == -1);
            if (ParentFormInfo == null)
            {
                return;
            }

            ClearMenuItem();

            bool isException = false;
            if (this.UserInformation != null)
            {
                if (this.UserInformation.usm_cUserLoginID == "sa")
                {
                    isException = true;
                }
            }
            GetMenuItems(TopMenu.MenuItems, listForms, ParentFormInfo.fom_iRecordID, isException);

            SetSystemMenu();
        }
开发者ID:Klutzdon,项目名称:SIOTS_HHZX,代码行数:38,代码来源:MainForm.cs

示例9: GetConnectionStringFromCommandLineArguments

		private static string GetConnectionStringFromCommandLineArguments()
		{
			List<string> args = new List<string>(Environment.GetCommandLineArgs());
			if (args.Find(s => s.StartsWith("/cs:")) != null)
			{
				return args.Find(s => s.StartsWith("/cs:")).Substring(4);
			}
			if (connectionString == null && args.Find(s => s.StartsWith("/s:")) != null && args.Find(s => s.StartsWith("/d:")) != null)
			{
				return BuildConnectionString(args.Find(s => s.StartsWith("/s:")).Substring(3), args.Find(s => s.StartsWith("/d:")).Substring(3));
			}
			return null;
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:13,代码来源:Properties.cs

示例10: UpdateMemberships

        private void UpdateMemberships(List<FuzzyVariable> sourceVariables, VariableMFParam parameterToUpdate, BoundType boundType)
        {
            switch (parameterToUpdate)
            {
                case VariableMFParam.Mean:
                case VariableMFParam.Deviation:
                    foreach (var variable in inputVariables)
                    {
                        foreach (var type2term in variable.Terms)
                        {
                            var sourceTerm = sourceVariables.Find(v => v.Name == variable.Name).Terms.Find(t => t.Name == type2term.Name);
                            var mf = sourceTerm.MembershipFunction as NormalMembershipFunction;
                            if (boundType == BoundType.Lower)
                            {
                                type2term.LowerMembershipFunction = new NormalMembershipFunction(mf.B, mf.Sigma);
                            }
                            else
                            {
                                type2term.UpperMembershipFunction = new NormalMembershipFunction(mf.B, mf.Sigma);
                            }
                        }
                    }

                    break;
                case VariableMFParam.RuleWeight:
                    // todo
                    break;
            }
        }
开发者ID:osnihur,项目名称:fuzzycheck,代码行数:29,代码来源:DecisionMakerType2.cs


注:本文中的Common.List.Find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。