Esempio n. 1
0
        public void Save()
        {
            CETX cetx = null;

            int nSngIdx = SngIdxCheck();
            int nDblIdx = DblIdxCheck();

            Hata = "";

            if (nSngIdx != SngMacSay || nDblIdx != DblMacSay)
            {
                Hata = "Sng/Dbl Sıralama Hatası";
            }

            Db.TransactAsync(() =>
            {
                int i  = 1;
                var Xs = CETXs.OrderBy(x => x.Idx);
                foreach (var x in Xs)
                {
                    if (x.SngIdx != 0)
                    {
                        x.Idx2 = i++;
                    }
                    else
                    {
                        x.Idx2 = 0;
                    }
                }

                foreach (var org in CETXs)
                {
                    cetx        = Db.FromId <CETX>((ulong)org.CETXoNo);
                    cetx.Idx2   = (int)org.Idx2;
                    cetx.SngIdx = (int)org.SngIdx;
                    cetx.DblIdx = (int)org.DblIdx;
                }
            });
        }
Esempio n. 2
0
        private void Read()
        {
            // Okusun ama islem yapamasin
            //if (!IsYetkili)
            //    return;

            CET cet = Db.FromId <CET>((ulong)CEToNo);

            if (H_G == "H")
            {
                CToNo = (long)cet.HCToNo;
                IsOS  = cet.IsHOS;
            }
            else if (H_G == "G")
            {
                CToNo = (long)cet.GCToNo;
                IsOS  = cet.IsGOS;
            }
            else
            {
                return;
            }

            //IsML = cet.IsHOS && cet.IsGOS && !cet.IsMLY;
            IsML = true;
            if (cet.IsHOS && cet.IsGOS)
            {
                IsML = cet.IsMLY;
            }

            CT ct = Db.FromId <CT>((ulong)CToNo);

            // Lig Takim Event/Musabaka Sng/Dbl Mac sayilari
            SngMacSay = cet.CC.TNSM;
            DblMacSay = cet.CC.TNDM;

            //var cetxs = Db.SQL<CETX>("SELECT r FROM CETX r WHERE r.CET = ? and r.CT = ? order by r.SngIdx, r.Idx", cet, ct)

            IOrderedEnumerable <CETX> cetxs = null;

            if (SortFld == "Ad")
            {
                cetxs = Db.SQL <CETX>("SELECT r FROM CETX r WHERE r.CET = ? and r.CT = ?", cet, ct)
                        .OrderBy(x => { if (x.PPoNo == H.dskPPoNo)
                                        {
                                            return("zzzz");
                                        }
                                        return(x.PPAd); });
            }
            else if (SortFld == "Idx")
            {
                cetxs = Db.SQL <CETX>("SELECT r FROM CETX r WHERE r.CET = ? and r.CT = ?", cet, ct)
                        .OrderBy(x => { int i = x.Idx; if (i == 0)
                                        {
                                            i = 99;
                                        }
                                        return(i); });
            }
            else if (SortFld == "Idx2")
            {
                cetxs = Db.SQL <CETX>("SELECT r FROM CETX r WHERE r.CET = ? and r.CT = ?", cet, ct)
                        .OrderBy(x => { int i = x.Idx2; if (i == 0)
                                        {
                                            i = 99;
                                        }
                                        return(i); });
            }
            else if (SortFld == "SngIdx")
            {
                cetxs = Db.SQL <CETX>("SELECT r FROM CETX r WHERE r.CET = ? and r.CT = ?", cet, ct)
                        .OrderBy(x => { int i = x.SngIdx; if (i == 0)
                                        {
                                            i = 99;
                                        }
                                        return(i); });
            }
            else if (SortFld == "DblIdx")
            {
                cetxs = Db.SQL <CETX>("SELECT r FROM CETX r WHERE r.CET = ? and r.CT = ?", cet, ct)
                        .OrderBy(x => { int i = x.DblIdx; if (i == 0)
                                        {
                                            i = 99;
                                        }
                                        return(i); });
            }


            CETXs.Clear();
            foreach (var cetx in cetxs)
            {
                CETXsElementJson abc = new CETXsElementJson
                {
                    CETXoNo = (long)cetx.CETXoNo,
                    CToNo   = (long)cetx.CToNo,
                    Idx     = cetx.Idx,
                    Idx2    = cetx.Idx2,
                    SH      = "H",
                    PPoNo   = (long)cetx.PPoNo,
                    PPAd    = cetx.PPAd,
                    SngIdx  = cetx.SngIdx,
                    DblIdx  = cetx.DblIdx,
                    SngIdxS = cetx.SngIdx.ToString("#"),
                    DblIdxS = cetx.DblIdx.ToString("#"),
                };
                if (abc.SngIdx != 0)
                {
                    if ((abc.Idx2 - 2) > abc.SngIdx || (abc.Idx2 + 2) < abc.SngIdx)
                    {
                        abc.SH = "E";   // SiralamaHatasi bildirim
                    }
                }
                CETXs.Add(abc);
            }
        }