コード例 #1
0
 public static void DeleteAll(ulong ccId)
 {
     if (Db.FromId(ccId) is CC cc)
     {
         Db.Transact(() =>
         {
             foreach (var pp in Db.SQL <PP>("select r from PP r where r.CC = ?", cc))
             {
                 PP.DeleteAll(pp.GetObjectNo());
             }
             cc.HHroot.Delete();
             cc.Delete();
         });
     }
 }
コード例 #2
0
        public static CC InsertRec(string Email, string Pwd, string newToken, bool isConfirmed = false)
        {
            CC ccNew = null;

            Db.Transact(() =>
            {
                ccNew = new CC
                {
                    Email       = Email,
                    Pwd         = Pwd,
                    Token       = newToken,
                    InsTS       = DateTime.Now,
                    IsConfirmed = isConfirmed,
                };

                int i = Email.IndexOf('@');
                if (i >= 0)
                {
                    ccNew.Ad = Email.Remove(i);
                }
                else
                {
                    ccNew.Ad = Email;
                }
            });
            Db.Transact(() =>
            {
                HH hh = new HH
                {
                    Ad = ccNew.Ad,
                };
                ccNew.HHroot = hh;
            });

            PP ppNew = PP.InsertRec((long)ccNew.GetObjectNo(), "Örnek", null, null);

            Hlp.SablondanEkle(ppNew.GetObjectNo(), "HHSablon1");
            TT.InsertRec((long)ppNew.Id, "Aile", null, null, null);
            TT.InsertRec((long)ppNew.Id, "Baba", null, null, null);
            TT.InsertRec((long)ppNew.Id, "Anne", null, null, null);
            TT.InsertRec((long)ppNew.Id, "Çocuk1", null, null, null);
            TT.InsertRec((long)ppNew.Id, "Çocuk2", null, null, null);
            TT.InsertRec((long)ppNew.Id, "Araç1", null, null, null);
            TT.InsertRec((long)ppNew.Id, "Araç2", null, null, null);

            return(ccNew);
        }
コード例 #3
0
ファイル: Hlp.cs プロジェクト: SenerDemiral/MM0
        public static void SablondanEkle(ulong ppId, string sablon)
        {
            PP dpp = Db.FromId((ulong)ppId) as PP;

            if (dpp == null)
            {
                return;
            }

            using (StreamReader sr = new StreamReader($@"C:\Starcounter\MM0Data\{sablon}.txt", System.Text.Encoding.UTF8))
            {
                string line;
                HH[]   dhh = new HH[9];
                dhh[0] = dpp.HHroot;

                int not = 0;
                Db.Transact(() =>
                {
                    while ((line = sr.ReadLine()) != null)
                    {
                        if (!string.IsNullOrWhiteSpace(line) && !line.StartsWith("#"))
                        {
                            not = 1;
                            foreach (var c in line)
                            {
                                if (c == '\t')
                                {
                                    not++;
                                }
                            }
                            dhh[not] = new HH
                            {
                                PP  = dpp,
                                Prn = dhh[not - 1],
                                Ad  = line.TrimStart('\t'),
                            };
                            HH.PostIns(dhh[not]);
                        }
                    }
                });
            }
        }
コード例 #4
0
 public static PP InsertRec(long ccId, string Ad, string BasTrh, string BitTrh)
 {
     if (Db.FromId((ulong)ccId) is CC cc)
     {
         PP       ppNew  = null;
         HH       hhNew  = null;
         DateTime?nullDT = null;
         Db.Transact(() =>
         {
             ppNew = new PP()
             {
                 Ad     = Ad,
                 BasTrh = string.IsNullOrEmpty(BasTrh) ? nullDT : DateTime.Parse(BasTrh),  //Convert.ToDateTime(BasTrh),
                 BitTrh = string.IsNullOrEmpty(BitTrh) ? nullDT : Convert.ToDateTime(BitTrh),
                 CC     = cc,
             };
         });
         Db.Transact(() =>
         {
             hhNew = new HH()
             {
                 PP  = ppNew,
                 Prn = cc.HHroot,
                 Ad  = ppNew.Ad,
                 Lvl = 1,
                 Skl = 1,
             };
         });
         Db.Transact(() =>
         {
             ppNew.HHroot = hhNew;
         });
         return(ppNew);
     }
     return(null);
 }