Exemplo n.º 1
0
Arquivo: Core.cs Projeto: AokiMiku/ACP
        public static void ResetCosplanNummern()
        {
            using (Cosplans cosplans = new Cosplans())
            {
                // read highest number
                cosplans.Where     = "Nummer is not null";
                cosplans.OrderBy   = "Nummer desc";
                cosplans.AnzahlTop = 1;

                cosplans.Read();
                int newNummer = cosplans.Nummer + 1;

                cosplans.OrderBy = "Franchise_Nr asc, Nummer asc";
                cosplans.Read();

                while (!cosplans.EoF)
                {
                    cosplans.Where  = "Nummer = " + cosplans.Nummer;
                    cosplans.Nummer = newNummer++;

                    cosplans.Save(ApS.Databases.SqlAction.Update);

                    cosplans.Skip();
                }
                // now reset all
                cosplans.Where = "Nummer is not null";
                cosplans.Read();
                newNummer = 1;
                while (!cosplans.EoF)
                {
                    cosplans.Where  = "Nummer = " + cosplans.Nummer;
                    cosplans.Nummer = newNummer++;

                    cosplans.Save(ApS.Databases.SqlAction.Update);

                    cosplans.Skip();
                }

                string stmt = "ALTER SEQUENCE GEN_COSPLANS_ID RESTART WITH " + --newNummer + ";";
                cosplans.Execute(stmt);
            }
        }
Exemplo n.º 2
0
Arquivo: Core.cs Projeto: AokiMiku/ACP
        public void DeleteCosplan(int nummer)
        {
            Cosplans cosplans = new Cosplans
            {
                Where = "Nummer = " + nummer
            };

            cosplans.Read();
            if (!cosplans.EoF)
            {
                cosplans.Delete();
            }
        }
Exemplo n.º 3
0
Arquivo: Core.cs Projeto: AokiMiku/ACP
        public Cosplans GetCosplans(int?franchise_nr = null)
        {
            Cosplans cosplans = new Cosplans();

            if (franchise_nr == null || franchise_nr == 0)
            {
                cosplans.Where = "Nummer is not null";
            }
            else
            {
                cosplans.Where = "Franchise_Nr = " + franchise_nr;
            }
            cosplans.OrderBy = this.CosplansOrderBy.ToString().Replace("_", " ");
            cosplans.Read();

            return(cosplans);
        }