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


C# List.Find方法代码示例

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


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

示例1: ThemMoi

        private int ThemMoi(BOXuLyKho item, List<BOXuLyKhoChiTiet> lsArray, Transit mTransit)
        {
            if (lsArray != null)
            {
                List<Data.TONKHOTONG> lsTonKhoTong = new List<TONKHOTONG>();
                List<Data.TONKHO> lsTonKho = new List<TONKHO>();
                foreach (BOXuLyKhoChiTiet line in lsArray)
                {
                    IQueryable<Data.TONKHO> lsArrayLine = null;
                    switch (item.XuLyKho.LoaiID)
                    {
                        case 1:
                            lsArrayLine = frmTonKho.Query().Where(s => s.DonViID == line.TonKho.DonViID && s.MonID == line.TonKho.MonID && s.KhoID == item.XuLyKho.KhoID && s.SoLuongTon > 0).OrderBy(s => s.NgayHetHan).ThenBy(s => s.TonKhoID);
                            if (lsArrayLine.Count() > 0 && line.TonKho.SoLuongNhap < lsArrayLine.Sum(s => s.SoLuongTon) && line.TonKho.SoLuongNhap > 0)
                            {
                                foreach (var l in lsArrayLine)
                                {
                                    if (line.TonKho.SoLuongNhap > 0)
                                    {
                                        Data.TONKHOTONG tonkhotong = null;
                                        if (lsTonKhoTong.Exists(s => s.KhoID == item.XuLyKho.KhoID && s.MonID == line.TonKho.MonID && s.DonViID == line.TonKho.DonViID))
                                        {
                                            tonkhotong = lsTonKhoTong.Find(s => s.KhoID == item.XuLyKho.KhoID && s.MonID == line.TonKho.MonID && s.DonViID == line.TonKho.DonViID);
                                        }
                                        else
                                        {
                                            tonkhotong = KiemTraTonKhoTong(frmTonKhoTong, (int)item.XuLyKho.KhoID, (int)line.TonKho.MonID, (int)line.TonKho.DonViID);
                                            lsTonKhoTong.Add(tonkhotong);
                                        }
                                        tonkhotong.SoLuongTon += line.TonKho.SoLuongNhap;
                                        tonkhotong.SoLuongDieuChinh += line.TonKho.SoLuongNhap;
                                        Data.TONKHO tonkho = null;
                                        if (lsTonKho.Exists(s => s.TonKhoID == l.TonKhoID))
                                        {
                                            tonkho = lsTonKho.Find(s => s.TonKhoID == l.TonKhoID);
                                        }
                                        else
                                        {
                                            tonkho = l;
                                            lsTonKho.Add(tonkho);
                                        }
                                        line.XuLyKhoChiTiet.TONKHO = new TONKHO();
                                        line.XuLyKhoChiTiet.TONKHO.PhatSinhTuTonKhoID = tonkho.TonKhoID;
                                        line.XuLyKhoChiTiet.TONKHO.LoaiPhatSinhID = (int)item.XuLyKho.LoaiID;
                                        CopyTonKho(line.XuLyKhoChiTiet.TONKHO, tonkho);

                                        if (tonkho.SoLuongTon > line.TonKho.SoLuongNhap)
                                        {
                                            line.XuLyKhoChiTiet.TONKHO.SoLuongPhatSinh = tonkho.SoLuongTon - line.TonKho.SoLuongNhap;
                                            tonkho.SoLuongTon += line.TonKho.SoLuongNhap;
                                            line.TonKho.SoLuongNhap = 0;
                                        }
                                        else
                                        {
                                            line.XuLyKhoChiTiet.TONKHO.SoLuongPhatSinh = line.TonKho.SoLuongNhap - tonkho.SoLuongTon;
                                            line.TonKho.SoLuongNhap += tonkho.SoLuongTon;
                                            tonkho.SoLuongTon = 0;
                                        }
                                    }
                                }
                            }
                            break;
                        case 2:
                        case 3:
                            lsArrayLine = frmTonKho.Query().Where(s => s.DonViID == line.TonKho.DonViID && s.MonID == line.TonKho.MonID && s.KhoID == item.XuLyKho.KhoID && s.SoLuongTon > 0).OrderBy(s => s.NgayHetHan).ThenBy(s => s.TonKhoID);
                            if (lsArrayLine.Count() > 0 && line.TonKho.SoLuongNhap < lsArrayLine.Sum(s => s.SoLuongTon) && line.TonKho.SoLuongNhap > 0)
                            {
                                foreach (var l in lsArrayLine)
                                {
                                    if (line.TonKho.SoLuongNhap > 0)
                                    {
                                        Data.TONKHOTONG tonkhotong = null;
                                        if (lsTonKhoTong.Exists(s => s.KhoID == item.XuLyKho.KhoID && s.MonID == line.TonKho.MonID && s.DonViID == line.TonKho.DonViID))
                                        {
                                            tonkhotong = lsTonKhoTong.Find(s => s.KhoID == item.XuLyKho.KhoID && s.MonID == line.TonKho.MonID && s.DonViID == line.TonKho.DonViID);
                                        }
                                        else
                                        {
                                            tonkhotong = KiemTraTonKhoTong(frmTonKhoTong, (int)item.XuLyKho.KhoID, (int)line.TonKho.MonID, (int)line.TonKho.DonViID);
                                            lsTonKhoTong.Add(tonkhotong);
                                        }
                                        tonkhotong.SoLuongTon -= line.TonKho.SoLuongNhap;
                                        if (item.XuLyKho.LoaiID == 2)
                                        {
                                            tonkhotong.SoLuongMat += line.TonKho.SoLuongNhap;
                                        }
                                        if (item.XuLyKho.LoaiID == 3)
                                        {
                                            tonkhotong.SoLuongHu += line.TonKho.SoLuongNhap;
                                        }

                                        Data.TONKHO tonkho = null;
                                        if (lsTonKho.Exists(s => s.TonKhoID == l.TonKhoID))
                                        {
                                            tonkho = lsTonKho.Find(s => s.TonKhoID == l.TonKhoID);
                                        }
                                        else
                                        {
                                            tonkho = l;
                                            lsTonKho.Add(tonkho);
//.........这里部分代码省略.........
开发者ID:MisterTobi,项目名称:restaurant-cafe,代码行数:101,代码来源:BOXuLyKho.cs

示例2: GroupTypes

        /*__________________________________________________________________________________________*/
        private bool GroupTypes(string group)
        {
            //GROUPS
            //TODO change this to some other logic
            List<Types> groupTypes = new List<Types>();
            groupTypes.Add(new Types { Key = "SUPPLIER"       , boolValue  = false});
            groupTypes.Add(new Types { Key = "FRANCHESEE"  , boolValue =  false });
            groupTypes.Add(new Types { Key = "EMPLOYEE"      , boolValue =  true });
            groupTypes.Add(new Types { Key = "CLIENT"          , boolValue =  true });
            groupTypes.Add(new Types { Key = "CUSTOMER"      , boolValue = true });
            groupTypes.Add(new Types { Key = "VISITOR"         , boolValue =  true });
            groupTypes.Add(new Types { Key = "BUYER"            , boolValue = true });
            groupTypes.Add(new Types { Key = "OWNER"         , boolValue =   true });

            var type = groupTypes.Find(keyItem => keyItem.Key == group);
            //PairType<string, bool> AddAddressToNames = new List<PairType<string, bool>>();
            //groupTypes.Add((new PairType<string, bool>("SUPPLIER", false)));
            //AddAddressToNames.Add("SUPPLIER",false);
            //AddAddressToNames.Add("FRANCHESEE",    false);
            //AddAddressToNames.Add("EMPLOYEE" ,      true  );
            ////AddAddressToNames.Add("CLIENT"   ,        true  );
            //AddAddressToNames.Add("CUSTOMER"  ,   true   );
            //AddAddressToNames.Add("VISITOR" ,         true );
            //AddAddressToNames.Add("BUYER"   ,        true  ) ;
            //AddAddressToNames.Add("OWNER" ,          true );

            return type.boolValue;
        }
开发者ID:WilliamClydeMoon,项目名称:Apps,代码行数:29,代码来源:Name.cs

示例3: znajdzDrogePowrotnaRek


//.........这里部分代码省略.........
                                    if (overalCost > temp[0])
                                    {
                                        overalCost = temp[0];
                                        firstStep = temp[1];
                                    }
                                }
                            }
                        nextStep = ZnanaMapa.znajdzPole(x, y + 1);
                        if (nextStep != null)
                            if (!((nextStep.getPrzeszkoda()) || (nextStep.getUnrechable())))
                            {
                                int nextKier = 2;
                                int[] temp = new int[2];
                                temp[0] = upCost;
                                if (!before.Exists(delegate(Wspolrzedne w)
                                {
                                    if ((w.x == x) && (w.y == y + 1))
                                        return true;
                                    else
                                        return false;
                                }))
                                {
                                    if (before.Count > 1)
                                    {
                                        ZbadanePole tuStoje = ZnanaMapa.znajdzPole(x, y);
                                        int nowaWysokosc = nextStep.getWysokosc();

                                        temp[0] += cennikSwiata.moveCost;
                                        temp[0] += Convert.ToInt32(Math.Ceiling(Convert.ToDouble
                                            (cennikSwiata.moveCost * (nowaWysokosc - tuStoje
                                            .getWysokosc())) / 100));
                                        if ((lastKier == 1) || (lastKier == 3))
                                            temp[0] += cennikSwiata.rotateCost;
                                        if (lastKier == 2)
                                            temp[0] += cennikSwiata.rotateCost * 2;
                                    }
                                    temp = znajdzDrogePowrotnaRek(x, y + 1, nextKier, before, temp[0], limit);

                                    if (overalCost > temp[0])
                                    {
                                        overalCost = temp[0];
                                        firstStep = temp[1];
                                    }
                                }
                            }
                    }
                    nextStep = ZnanaMapa.znajdzPole(x + 1, y);
                    if (nextStep != null)
                        if (!((nextStep.getPrzeszkoda()) || (nextStep.getUnrechable())))
                        {
                            int nextKier = 3;
                            int[] temp = new int[2];
                            temp[0] = upCost;
                            if (!before.Exists(delegate(Wspolrzedne w)
                            {
                                if ((w.x == x + 1) && (w.y == y))
                                    return true;
                                else
                                    return false;
                            }))
                            {
                                if (before.Count > 1)
                                {
                                    ZbadanePole tuStoje = ZnanaMapa.znajdzPole(x, y);
                                    int nowaWysokosc = nextStep.getWysokosc();

                                    temp[0] += cennikSwiata.moveCost;
                                    temp[0] += Convert.ToInt32(Math.Ceiling(Convert.ToDouble
                                        (cennikSwiata.moveCost * (nowaWysokosc - tuStoje
                                        .getWysokosc())) / 100));
                                    if ((lastKier == 0) || (lastKier == 2))
                                        temp[0] += cennikSwiata.rotateCost;
                                    if (lastKier == 1)
                                        temp[0] += cennikSwiata.rotateCost * 2;
                                }
                                temp = znajdzDrogePowrotnaRek(x + 1, y, nextKier, before, temp[0], limit);

                                if (overalCost > temp[0])
                                {
                                    overalCost = temp[0];
                                    firstStep = temp[1];
                                }
                            }
                        }
                }
                #endregion
                before.Remove(
                    before.Find(delegate(Wspolrzedne w)
                    {
                        if ((w.x == x) && (w.y == y))
                            return true;
                        else
                            return false;
                    })
                );
                int[] zwrot = new int[2];
                zwrot[0] = overalCost;
                zwrot[1] = firstStep;
                return zwrot;
            }
开发者ID:Hazardius,项目名称:HazVariousMaterials,代码行数:101,代码来源:Program.cs


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