public void Get()
        {
            var name     = "ApiBuilder.MethodAlreadyCalled";
            var resource = ServiceResources.Get(name, nameof(Get));

            Assert.AreEqual("This method was already called: 'Get'", resource);
        }
        public void GetWithArgs()
        {
            var name     = "The {0} database couldn´t be deleted!";
            var args     = "ChuckNorrisFacts";
            var resource = ServiceResources.Get(name, args);

            Assert.AreEqual("The ChuckNorrisFacts database couldn´t be deleted!", resource);
        }
        internal override void updateReferencesAfterDeserialize(SFRefereceResolver i_ReferenceResolver, bool i_ShouldAddToRelatedLists = true)
        {
            JToken objectJson = removeObjectJTokenFromAdditionalDictionary("WorkType");

            WorkType = DeserializationUtils.GetSingleObjectReference <WorkType>(WorkTypeId, objectJson, i_ReferenceResolver);

            objectJson       = removeObjectJTokenFromAdditionalDictionary("ServiceTerritory");
            ServiceTerritory = DeserializationUtils.GetSingleObjectReference <ServiceTerritory>(ServiceTerritoryId, objectJson, i_ReferenceResolver);

            objectJson = removeObjectJTokenFromAdditionalDictionary("ParentRecord");
            switch (ParentRecordType)
            {
            case "WorkOrder":
                ParentRecord = DeserializationUtils.GetSingleObjectReference <WorkOrder>(ParentRecordId, objectJson, i_ReferenceResolver);
                break;

            case "WorkOrderLineItem":
                ParentRecord = DeserializationUtils.GetSingleObjectReference <WorkOrderLineItem>(ParentRecordId, objectJson, i_ReferenceResolver);
                break;
            }

            DeserializationUtils.ProcessRelatedObjectsCollection(assignedResourcesCollection, i_ReferenceResolver);
            assignedResourcesCollection = null;

            Type myType = GetType();

            string propertyName = "Scheduling_Policy_Used__r";

            propertyName = DeserializationUtils.GetPropertyName(myType.GetProperty(propertyName), propertyName);
            objectJson   = removeObjectJTokenFromAdditionalDictionary(propertyName);
            Scheduling_Policy_Used__r = DeserializationUtils.GetSingleObjectReference <Scheduling_Policy__c>(Scheduling_Policy_Used__c, objectJson, i_ReferenceResolver);

            propertyName = "Related_Service__r";
            propertyName = DeserializationUtils.GetPropertyName(myType.GetProperty(propertyName), propertyName);

            objectJson         = removeObjectJTokenFromAdditionalDictionary(propertyName);
            Related_Service__r = DeserializationUtils.GetSingleObjectReference <ServiceAppointment>(Related_Service__c, objectJson, i_ReferenceResolver);

            if (IsScheduled)
            {
                ScheduledSTM = ServiceResources.First().ServiceResource.GetServiceTerritoryMemberByDateTime(SchedStartTime.Value);
            }

            base.updateReferencesAfterDeserialize(i_ReferenceResolver);
        }
        public static void Main(string[] args)
        {
            IServiceSkill     servskill    = new ServiceSkill();
            IServiceResources servresource = new ServiceResources();
            IProjectService   servproj     = new ServiceProject();
            IServiceProfile   servprofil   = new ServiceProfil();
            IServiceMandate   servman      = new ServiceMandate();
            List <Profil>     lsprofil     = new List <Profil>();
            List <Resource>   lsresource   = new List <Resource>();
            List <Skills>     lsskills     = new List <Skills>();
            Project           p            = servproj.Get(a => a.projectId == 1);
            IServiceUser      servuser     = new ServiceUser();

            lsprofil   = servprofil.GetAll().Where(e => e.projectId == p.projectId).ToList();
            lsresource = servresource.GetAll().ToList();
            lsskills   = servskill.GetAll().ToList();
            DateTime today = DateTime.Now;

            foreach (var item in servman.GetAll())
            {
                System.DateTime dTime     = new System.DateTime(today.Year, today.Month, today.Day);
                System.TimeSpan tSpan     = new System.TimeSpan(3, 0, 0, 0);
                DateTime        finprojet = dTime + tSpan;
                //if (item.endDate.Equals(finprojet))
                //{

                //send mail
                MailMessage message = new MailMessage();



                message.To.Add("*****@*****.**");
                message.From    = new MailAddress("*****@*****.**");
                message.Subject = "Alerte Fin Mandat";
                message.Body    = "Bonjour, Plus que 40 jours avant la fin de ce mandat!==>" + item.project.description;


                SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
                client.EnableSsl   = true;
                client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "somethinglikethis");
                client.Send(message);
            }
        }