コード例 #1
0
        public static Interessent Create(string id , string deviceLanguage ,ref BusinessLayer.User user)
        {
            // das Objekt wird mit einem vorhandenen Interessenten initializiert
            DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent ();
            var interessent = dal_Interessent.GetInteressent (id, deviceLanguage, ref user);
            return interessent;

        } 
コード例 #2
0
        public static async System.Threading.Tasks.Task<List<Interessent>>   GetInteressentenAsync( string Name , string deviceLanguage , BusinessLayer.User User)
        {

            DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent ();
            var interessenten =await dal_Interessent.GetInteressentenAsync (Name,  deviceLanguage,User);
            return interessenten;

        }
コード例 #3
0
        public static List<Interessent> GetInteressenten ( string name ,string deviceLanguage ,BusinessLayer.User user)
        {

            // Alle Interessenten, die in dem Namen den Begriff <name> enthalten
            DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent ();
            var interessenten  = dal_Interessent.GetInteressenten (name , deviceLanguage,ref user);
            return interessenten;

        }
コード例 #4
0
        public static List<Interessent> GetInteressenten( string Name , string deviceLanguage , BusinessLayer.User User, bool offline)
        {
            if (offline == false)
                return GetInteressenten (Name, deviceLanguage,  User);

            // Alle Interessenten, die in dem Namen den Begriff <name> enthalten
            DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent();
            var interessenten = dal_Interessent.GetInteressenten (Name, deviceLanguage, ref User, true);
            return interessenten;

        }
コード例 #5
0
        public override string GetUmsatz ( BusinessLayer.User user)
        {
            DataAccessLayer.DAL_Interessent dal_interessent = new DataAccessLayer.DAL_Interessent();

            if(ID == null)
                return "";

            Umsatz = dal_interessent.GetUmsatz (ID, ref user);

            if (Umsatz == "")
                Umsatz = "€0";
            else
                Umsatz = "€" + Umsatz;

            return Umsatz;
        }
コード例 #6
0
        override async public void FillAddressenAsync(string deviceLanguage, BusinessLayer.User user)
        {
            // First we get the Rechnungsanschrift
            // if there is noone, the Rechnungsaddresse is the Interessentenaddresse
            DataAccessLayer.DAL_Interessent dal_interessent = new DataAccessLayer.DAL_Interessent();
            this.RechnungsAnschriften = await dal_interessent.GetRechnungsAnschriftenAsync(this, deviceLanguage,  user);
            if (RechnungsAnschriften == null)
                return;
            
            if (UtilityClasses.IsNullOrEmpty(this.RechnungsAnschriften))
            {
                Anschrift temp = new Anschrift();
                temp.Name = this.Name;
                temp.ID = this.ID;
                temp.Land = this.Land;
                temp.LandNummer = this.LandNummer;
                temp.PLZ = this.PLZ;
                temp.Ort = this.Ort;
                this.RechnungsAnschriften.Add(temp);
            }

            // Then we get the Lieferanschrift
            // if there is no one, the Lieferaddresse is the Interessentenaddresse
            this.LieferAnschriften = await dal_interessent.GetLieferAnschriftenAsync(this, deviceLanguage,  user);
            if (UtilityClasses.IsNullOrEmpty(this.LieferAnschriften))
            {
                Anschrift temp = new Anschrift();
                temp.Name = this.Name;
                temp.ID = this.ID;
                temp.Land = this.Land;
                temp.LandNummer = this.LandNummer;
                temp.PLZ = this.PLZ;
                temp.Ort = this.Ort;
                this.LieferAnschriften.Add(temp);
            }
        }
コード例 #7
0
        public override DataAccessLayer.SOAResult Delete (ref BusinessLayer.User user)
        {
            DataAccessLayer.DAL_Interessent dal_interessent = new DataAccessLayer.DAL_Interessent ();

            // There must be an ID to delete the Interessent
            if (ID == null)
                return  DataAccessLayer.SOAResult.FALSE;

            if (dal_interessent.DeleteInteressent(this, ref user) == DataAccessLayer.SOAResult.TRUE)
            {
                // clear the values of the Interessent

                ID = "";
                Name = "";
                Nummer = "";
                Strasse = "";
                PLZ = "";
                Ort = "";
                Land = "";
                Telefon = "";
                Email = "";
                Geburtsdatum = "";

                return  DataAccessLayer.SOAResult.TRUE;

            }
            else
            {
                return  DataAccessLayer.SOAResult.FALSE;
            }
        }
コード例 #8
0
        async public override Task<DataAccessLayer.SOAResult> SaveAsync ( BusinessLayer.User user, bool Offline)
        {
            if (Offline == false)
                return await SaveAsync ( user);

            // First check if this is an Insert or Update Statement
            DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent ();
            if (ID == null)
            {
                // This is an Insert statement
                return await dal_Interessent.InsertInteressentAsync (this,  user,true);
            }
            else
            {
                // This is an Update statement
                return await dal_Interessent.InsertInteressentAsync(this, user,true);
            }
        }
コード例 #9
0
        public override async System.Threading.Tasks.Task<DataAccessLayer.SOAResult> DownloadLocalAsync(User user, string deviceLanguage)
        {

            Console.WriteLine("__________________________________ START ___________________________________________________");
            DataAccessLayer.SOAResult result = DataAccessLayer.SOAResult.FALSE;
            try
            {
                // In this progress we increase the progress status, too
                // Main step: Interessentn Data
                ResetProgressStatus();

                ProgressStatusWish = 1;
                DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent();
    
                // first check permission
                if (!user.HasPermission(DAC_Object.Interessent,BusinessLayer.DAC_Permission.DOWN_UPLOAD))
                    return DataAccessLayer.SOAResult.TRUE;

                using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                    result = await dal_Interessent.InsertInteressentAsync(this,  user,true);
                }
                ProgressStatus = 1;

                // Then the related data
                // 1. Ansprechpartner
                // We don't check permission for Ansprechpartner, cause Tasks and other modules will use it 
                if (result == DataAccessLayer.SOAResult.TRUE )
                {
                    ProgressStatusWish += 2;
                    List<Ansprechpartner> ansprechpartnern = await Ansprechpartner.GetAnsprechpartnernAsync(this.ID, deviceLanguage, user);
                    ProgressStatus += 2;
                    ProgressStatusWish += 1;
                    DataAccessLayer.DAL_Ansprechpartner dal_ansprechpartner = new DataAccessLayer.DAL_Ansprechpartner();
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() =>dal_ansprechpartner.InsertAnsprechpartnernAsync(ansprechpartnern,user,true));
                    }
                    ProgressStatus += 1;
                }

                // 2. PersonUmsatz for Charts
                if (result == DataAccessLayer.SOAResult.TRUE && user.HasPermission(DAC_Object.Interessent_Chart,DAC_Permission.DOWN_UPLOAD))
                {
                    ProgressStatusWish += 3;
                    List<BusinessLayer.PersonUmsatz> PersonUmsatzList =  await GetPersonTimeUmsatzAsync ("36",   user);
                    ProgressStatus += 3;
                    ProgressStatusWish += 2;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() =>dal_Interessent.InsertPersonUmsatzAsync(PersonUmsatzList ,this, user, true));
                    }
                    ProgressStatus += 2;
                }

                // 3. Tasks and related data
                // I. Tasks
                DataAccessLayer.DAL_Task dal_task = new DataAccessLayer.DAL_Task();
                if (result == DataAccessLayer.SOAResult.TRUE && user.HasPermission(DAC_Object.Interessent_Task,DAC_Permission.DOWN_UPLOAD))
                {
                    ProgressStatusWish += 11;
                    List<Task> tasks = await dal_task.GetTasksAsync(ID,  user);
                    ProgressStatus += 11;
                    ProgressStatusWish += 32;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() =>dal_task.InsertTasksAsync(tasks, user, true));
                    }

                    //result = await dal_task.InsertTasksAsync(tasks, user, true);
                    ProgressStatus += 32;

                }

                // II. TaskArt
                // These are help data, so permission checking is not needed
                if (result == DataAccessLayer.SOAResult.TRUE )
                {
                    ProgressStatusWish += 2;
                    List<TaskArt> taskArts = await DataAccessLayer.DAL_Task.GetTaskArtsAsync(user);
                    ProgressStatus += 2;
                    ProgressStatusWish += 1;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() =>dal_task.InsertTaskArtsAsync(taskArts, user, true));
                    }
                    ProgressStatus += 1;
                }

                // III. TaskTyp
                // These are help data, so permission checking is not needed
                if (result == DataAccessLayer.SOAResult.TRUE )
                {
                    ProgressStatusWish += 3;
                    List<TaskTyp> taskTyps = await DataAccessLayer.DAL_Task.GetTaskTypsAsync(user);
                    ProgressStatus += 3;
                    ProgressStatusWish += 1;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() =>dal_task.InsertTaskTypsAsync(taskTyps, user, true));
                    }
                    ProgressStatus += 1;
                }

                // IV. Mitarbeiter
                // These are help data, so permission checking is not needed
                if (result == DataAccessLayer.SOAResult.TRUE )
                {
                    ProgressStatusWish += 2;
                    List<Mitarbeiter> mitarbeitern = await DataAccessLayer.DAL_Task.GetTaskMitarbeiternAsync(user);
                    ProgressStatus += 2;
                    ProgressStatusWish += 1;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() =>dal_task.InsertMitarbeiternAsync(mitarbeitern, user, true));
                    }
                    ProgressStatus += 1;
                }

                // V. Abteilung
                // These are help data, so permission checking is not needed
                if (result == DataAccessLayer.SOAResult.TRUE )
                {
                    ProgressStatusWish += 2;
                    List<Abteilung> abteilungen = await DataAccessLayer.DAL_Task.GetTaskAbteilungenAsync(user);
                    ProgressStatus += 2;
                    ProgressStatusWish += 1;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() => dal_task.InsertAbteilungenAsync(abteilungen, user, true));
                    }
                    ProgressStatus += 1;
                }

                // VI. Angebote
                DataAccessLayer.DAL_Angebot dal_angebot = new DataAccessLayer.DAL_Angebot();
                DataAccessLayer.DAL_Position dal_position = new DataAccessLayer.DAL_Position();
                if (result == DataAccessLayer.SOAResult.TRUE && user.HasPermission(DAC_Object.Interessent_Angebot,DAC_Permission.DOWN_UPLOAD))
                {
                    ProgressStatusWish += 7;
                    List<Angebot> angebote = await dal_angebot.GetAngeboteAsync(ID, deviceLanguage, user);
                    ProgressStatus += 7;
                    foreach (var angebot in angebote)
                    {
                        List<Position> positionen = await dal_position.GetPositionenAsync(angebot.ID, angebot.Waehrung, deviceLanguage, user);
                        result = await System.Threading.Tasks.Task.Run(() => dal_position.InsertPositionenAsync(positionen, user, true));
                    }
                    ProgressStatusWish += 11;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                                           result =  await System.Threading.Tasks.Task.Run(() => dal_angebot.InsertAngeboteAsync(angebote, user, true));
                    }
                    ProgressStatus += 11;

                }

            }
            catch (Exception ex)
            {
                DataAccessLayer.ExceptionWriter.WriteLogFile(ex);
            }

            return result;
        }
コード例 #10
0
        async public override System.Threading.Tasks.Task<System.Collections.Generic.List<BusinessLayer.PersonUmsatz>> GetPersonTimeUmsatzAsync(string interval, BusinessLayer.User user)
        {
            DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent();

            if (ID == null)
                return null;

            System.Collections.Generic.List<BusinessLayer.PersonUmsatz> personUmsatzList;
            personUmsatzList = await dal_Interessent.GetInteressentTimeUmsatzAsync(ID, interval, user);

            return personUmsatzList;

        }
コード例 #11
0
 public override DataAccessLayer.SOAResult Save ( BusinessLayer.User user)
 {
     // First check if this is an Insert or Update Statement
     DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent ();
     if (ID == null)
     {
         // This is an Insert statement
         return dal_Interessent.InsertInteressent (this, ref user);
     }
     else
     {
         // This is an Update statement
         return dal_Interessent.UpdateInteressent (this,ref user);
     }
 }
コード例 #12
0
        public override System.Collections.Generic.List<BusinessLayer.PersonUmsatz>  GetPersonTimeUmsatz(string  interval ,  BusinessLayer.User user)
        {
            DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent ();

            if (ID == null)
                return null;

            System.Collections.Generic.List<BusinessLayer.PersonUmsatz> personUmsatzList;
            personUmsatzList = dal_Interessent.GetInteressentTimeUmsatz (ID, interval, ref user);

            return personUmsatzList;

        }
コード例 #13
0
        public override async System.Threading.Tasks.Task<string> GetUmsatzAsync ( BusinessLayer.User user)
        {
            DataAccessLayer.DAL_Interessent dal_interessent = new DataAccessLayer.DAL_Interessent();

            if(ID == null)
                return "";

            Umsatz = await dal_interessent.GetUmsatzAsync (ID,  user);

            if (Umsatz == "")
                Umsatz = "€0";
            else
                Umsatz = "€" + Umsatz;

            return Umsatz;
        }
コード例 #14
0
        public override async System.Threading.Tasks.Task<DataAccessLayer.SOAResult> DownloadLocalAsync(User user, string deviceLanguage)
        {

            Console.WriteLine("__________________________________ START ___________________________________________________");
            DataAccessLayer.SOAResult result = DataAccessLayer.SOAResult.FALSE;
            try
            {
                           // In this progress we increase the progress status, too
                // Main step: Interessentn Data
                DataAccessLayer.PerformanceWatch stopWatch = new DataAccessLayer.PerformanceWatch();
                stopWatch.Start();
                ResetProgressStatus();

                ProgressStatusWish = 1;
                DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent();
                using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                    result = await dal_Interessent.InsertInteressentAsync(this,  user,true);
                }
                ProgressStatus = 1;
                stopWatch.Stop();
                stopWatch.PrintConsole ("InsertInteressentAsync");

                // Then the related data
                // 1. Ansprechpartner

                if (result == DataAccessLayer.SOAResult.TRUE)
                {
                    stopWatch.Start();
                    ProgressStatusWish += 2;
                    List<Ansprechpartner> ansprechpartnern = await Ansprechpartner.GetAnsprechpartnernAsync(this.ID, deviceLanguage, user);
                    ProgressStatus += 2;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("GetAnsprechpartnernAsync");
                    stopWatch.Start();
                    ProgressStatusWish += 1;
                    DataAccessLayer.DAL_Ansprechpartner dal_ansprechpartner = new DataAccessLayer.DAL_Ansprechpartner();
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() =>dal_ansprechpartner.InsertAnsprechpartnernAsync(ansprechpartnern,user,true));
                    }
                    ProgressStatus += 1;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("InsertAnsprechpartnernAsync");
                }

                // 2. PersonUmsatz for Charts
                if (result == DataAccessLayer.SOAResult.TRUE)
                {
                    stopWatch.Start();
                    ProgressStatusWish += 3;
                    List<BusinessLayer.PersonUmsatz> PersonUmsatzList =  await GetPersonTimeUmsatzAsync ("36",   user);
                    ProgressStatus += 3;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("GetPersonTimeUmsatzAsync");
                    stopWatch.Start();
                    ProgressStatusWish += 2;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() =>dal_Interessent.InsertPersonUmsatzAsync(PersonUmsatzList ,this, user, true));
                    }
                    ProgressStatus += 2;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("InsertPersonUmsatzAsync");
                }

                // 3. Tasks and related data
                // I. Tasks
                DataAccessLayer.DAL_Task dal_task = new DataAccessLayer.DAL_Task();
                if (result == DataAccessLayer.SOAResult.TRUE)
                {
                    stopWatch.Start();
                    ProgressStatusWish += 11;
                    List<Task> tasks = await dal_task.GetTasksAsync(ID,  user);
                    ProgressStatus += 11;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("GetTasksAsync");
                    stopWatch.Start();
                    ProgressStatusWish += 32;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() =>dal_task.InsertTasksAsync(tasks, user, true));
                    }

                    //result = await dal_task.InsertTasksAsync(tasks, user, true);
                    ProgressStatus += 32;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("InsertTasksAsync");

                }

                // II. TaskArt
                if (result == DataAccessLayer.SOAResult.TRUE)
                {
                    stopWatch.Start();
                    ProgressStatusWish += 2;
                    List<TaskArt> taskArts = await DataAccessLayer.DAL_Task.GetTaskArtsAsync(user);
                    ProgressStatus += 2;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("GetTaskArtsAsync");
                    stopWatch.Start();
                    ProgressStatusWish += 1;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() =>dal_task.InsertTaskArtsAsync(taskArts, user, true));
                    }
                    ProgressStatus += 1;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("InsertTaskArtsAsync");
                }

                // III. TaskTyp
                if (result == DataAccessLayer.SOAResult.TRUE)
                {
                    stopWatch.Start();
                    ProgressStatusWish += 3;
                    List<TaskTyp> taskTyps = await DataAccessLayer.DAL_Task.GetTaskTypsAsync(user);
                    ProgressStatus += 3;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("GetTaskTypsAsync");
                    stopWatch.Start();
                    ProgressStatusWish += 1;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() =>dal_task.InsertTaskTypsAsync(taskTyps, user, true));
                    }
                    ProgressStatus += 1;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("InsertTaskTypsAsync");
                }

                // IV. Mitarbeiter
                if (result == DataAccessLayer.SOAResult.TRUE)
                {
                    stopWatch.Start();
                    ProgressStatusWish += 2;
                    List<Mitarbeiter> mitarbeitern = await DataAccessLayer.DAL_Task.GetTaskMitarbeiternAsync(user);
                    ProgressStatus += 2;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("GetTaskMitarbeiternAsync");
                    stopWatch.Start();
                    ProgressStatusWish += 1;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() =>dal_task.InsertMitarbeiternAsync(mitarbeitern, user, true));
                    }
                    ProgressStatus += 1;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("InsertMitarbeiternAsync");
                }

                // V. Abteilung
                if (result == DataAccessLayer.SOAResult.TRUE)
                {
                    stopWatch.Start();
                    ProgressStatusWish += 2;
                    List<Abteilung> abteilungen = await DataAccessLayer.DAL_Task.GetTaskAbteilungenAsync(user);
                    ProgressStatus += 2;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("GetTaskAbteilungenAsync");
                    stopWatch.Start();
                    ProgressStatusWish += 1;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                        result =  await System.Threading.Tasks.Task.Run(() => dal_task.InsertAbteilungenAsync(abteilungen, user, true));
                    }
                    ProgressStatus += 1;
                    stopWatch.Stop();
                    stopWatch.PrintConsole ("InsertAbteilungenAsync");
                }

                // VI. Angebote
                DataAccessLayer.DAL_Angebot dal_angebot = new DataAccessLayer.DAL_Angebot();
                DataAccessLayer.DAL_Position dal_position = new DataAccessLayer.DAL_Position();
                if(result == DataAccessLayer.SOAResult.TRUE)
                {
                    stopWatch.Start();
                    ProgressStatusWish += 7;
                    List<Angebot> angebote = await dal_angebot.GetAngeboteAsync(ID, deviceLanguage, user);
                    ProgressStatus += 7;
                    stopWatch.PrintConsole ("GetAngeboteAsync");
                    foreach (var angebot in angebote)
                    {
                        List<Position> positionen = await dal_position.GetPositionenAsync(angebot.ID, angebot.Waehrung, deviceLanguage, user);
                        result = await System.Threading.Tasks.Task.Run(() => dal_position.InsertPositionenAsync(positionen, user, true));
                    }
                    ProgressStatusWish += 11;
                    using (await DataAccessLayer.SQLiteUtilities.Mutex.LockAsync ().ConfigureAwait (false)) { 
                                           result =  await System.Threading.Tasks.Task.Run(() => dal_angebot.InsertAngeboteAsync(angebote, user, true));
                    }
                    ProgressStatus += 11;

                }

            }
            catch (Exception ex)
            {
                DataAccessLayer.ExceptionWriter.WriteLogFile(ex);
            }

            return result;
        }
コード例 #15
0
        public override DataAccessLayer.SOAResult DownloadLocal( string deviceLanguage ,ref User user)
        {
            // First we have to save the Interessent data
            DataAccessLayer.SOAResult result;
            DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent();
            result = dal_Interessent.InsertInteressent(this, ref user,true);

            // Then the related data
            // 1. Ansprechpartner
            if (result == DataAccessLayer.SOAResult.TRUE)
            {
                ProgressStatusWish += 3;
                List<Ansprechpartner> ansprechpartnern = Ansprechpartner.GetAnsprechpartnern(this.ID, deviceLanguage, ref user);
                ProgressStatus += 3;
                ProgressStatusWish += 1;
                DataAccessLayer.DAL_Ansprechpartner dal_ansprechpartner = new DataAccessLayer.DAL_Ansprechpartner();
                result = dal_ansprechpartner.InsertAnsprechpartnern(ansprechpartnern,user,true);
                ProgressStatus += 1;
            }

            if (result == DataAccessLayer.SOAResult.TRUE)
            {
                ProgressStatusWish += 3;
                List<BusinessLayer.PersonUmsatz> PersonUmsatzList = GetPersonTimeUmsatz("36", ref user);
                ProgressStatus += 3;
                ProgressStatusWish += 4;
                result = dal_Interessent.InsertPersonUmsatz(PersonUmsatzList, this, user, true);
                ProgressStatus += 4;

            }

            DataAccessLayer.DAL_Task dal_task = new DataAccessLayer.DAL_Task();
            if (result == DataAccessLayer.SOAResult.TRUE)
            {
                ProgressStatusWish += 11;
                List<Task> tasks = dal_task.GetTasks(ID, ref user);
                ProgressStatus += 11;
                ProgressStatusWish += 51;
                result = dal_task.InsertTasks(tasks, user, true);
                ProgressStatus += 51;
            }

            if (result == DataAccessLayer.SOAResult.TRUE)
            {
                ProgressStatusWish += 4;
                List<TaskArt> taskArts =  DataAccessLayer.DAL_Task.GetTaskArts(ref user);
                ProgressStatusWish += 1;
                result = dal_task.InsertTaskArts(taskArts, user, true);
                ProgressStatus += 1;
            }

            // III. TaskTyp
            if (result == DataAccessLayer.SOAResult.TRUE)
            {
                ProgressStatusWish += 4;
                List<TaskTyp> taskTyps = DataAccessLayer.DAL_Task.GetTaskTyps(ref user);
                ProgressStatus += 4;
                ProgressStatusWish += 1;
                result = dal_task.InsertTaskTyps(taskTyps, user, true);
                ProgressStatus += 1;
            }

            // IV. Mitarbeiter
            if (result == DataAccessLayer.SOAResult.TRUE)
            {
                ProgressStatusWish += 6;
                List<Mitarbeiter> mitarbeitern = DataAccessLayer.DAL_Task.GetTaskMitarbeitern(ref user);
                ProgressStatus += 6;
                ProgressStatusWish += 3;
                result = dal_task.InsertMitarbeitern(mitarbeitern, user, true);
                ProgressStatus += 3;
            }
                
            // V. Abteilung
            if (result == DataAccessLayer.SOAResult.TRUE)
            {
                ProgressStatusWish += 6;
                List<Abteilung> abteilungen =  DataAccessLayer.DAL_Task.GetTaskAbteilungen(ref user);
                ProgressStatus += 6;
                ProgressStatusWish += 1;
                result =  dal_task.InsertAbteilungen(abteilungen, user, true);
                ProgressStatus += 1;
            }
    
            return result;
        }
コード例 #16
0
        public override DataAccessLayer.SOAResult Save (ref BusinessLayer.User user, bool Offline)
        {
            if (Offline == false)
                return Save (ref user);

            // First check if this is an Insert or Update Statement
            DataAccessLayer.DAL_Interessent dal_Interessent = new DataAccessLayer.DAL_Interessent ();
            if (ID == null)
            {
                // This is an Insert statement
                return dal_Interessent.InsertInteressent (this, ref user,true);
            }
            else
            {
                // This is an Update statement
                return dal_Interessent.InsertInteressent(this,ref user,true);
            }
        }