Пример #1
0
        private void FilterTreeNames()
        {
            populateIndividuals();
            IndividualType type = (IndividualType)FilterIndividualType.SelectedItem;
            string         name = FilterIndividualName.Text.Trim().ToUpper();

            List <TreeNode> removeableNodes = new List <TreeNode>();

            foreach (TreeNode node in individualTreeView.Nodes)
            {
                Individual individual = (Individual)node.Tag;

                if (!String.IsNullOrEmpty(name) && individual.FullName.ToString().Trim().ToUpper().IndexOf(name) == -1)
                {
                    removeableNodes.Add(node);
                }
                else if (type != null && individual.IndividualTypeID != type.IndividualTypeID)
                {
                    removeableNodes.Add(node);
                }
            }

            if (removeableNodes.Count > 0)
            {
                foreach (TreeNode node in removeableNodes)
                {
                    node.Remove();
                }
            }
        }
Пример #2
0
        private void populateAssigneeTree()
        {
            string errorMessage = String.Empty;

            assigneeTree.Nodes.Clear();

            IndividualType type = (IndividualType)IndividualTypeFilter.SelectedItem;

            if (type != null)
            {
                List <Individual> peeps = Controller.GetIndividualList(type, out errorMessage);

                if (String.IsNullOrEmpty(errorMessage))
                {
                    TreeNode node = new TreeNode();
                    foreach (Individual indiv in peeps)
                    {
                        node      = new TreeNode();
                        node.Text = indiv.FullName;
                        node.Tag  = indiv;

                        assigneeTree.Nodes.Add(node);
                    }
                }
                else
                {
                    MessageBox.Show(errorMessage);
                }
            }
        }
Пример #3
0
 public ConfidenceInterval this [int timeStep,
                                 IndividualType type]
 {
     get
     {
         if (Summary.Count < timeStep)
         {
             return(default);
Пример #4
0
 public ConfidenceInterval this [int generation,
                                 IndividualType type]
 {
     get
     {
         if (Summary.Count < generation)
         {
             return(default);
Пример #5
0
 public Individual(
     IndividualType type,
     int id,
     double quality
     ) : this(type, id)
 {
     Quality = quality;
 }
Пример #6
0
 public IndividualGroupBase this [IndividualType type]
 {
     get
     {
         if (type == IndividualType.Cooperator)
         {
             return(CooperatorGroup);
         }
         return(DefectorGroup);
     }
 }
Пример #7
0
 public Individual(
     IndividualType type,
     int id,
     double geneticQuality,
     double phenotypicQuality
     ) : base(type, id)
 {
     GeneticQuality    = geneticQuality;
     PhenotypicQuality = phenotypicQuality;
     S         = phenotypicQuality;
     Fecundity = phenotypicQuality;
 }
Пример #8
0
        public List <Individual> GetIndividualList(IndividualType type, out string errorMessage)
        {
            List <Individual>   returnList = new List <Individual>();
            List <SqlParameter> parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@IndividualTypeID", type.IndividualTypeID));

            SqlCommand cmd = new SqlCommand("dbo.IndividualGetByType");

            returnList = createConnection(cmd, out errorMessage, parameters);

            return(returnList);
        }
Пример #9
0
        public IndividualGroup(IndividualType type,
                               int count,
                               IVariables v) : base(type, count)
        {
            var geneticQualities = Utility.NextGaussianNonNegativeSymbols(10,
                                                                          v.SdQuality,
                                                                          count);

            for (var i = 0; i < count; i++)
            {
                var individual = new Individual(
                    type, i + 1,
                    geneticQualities[i],
                    Utility.NextGaussianNonNegative(geneticQualities[i], v.SdPheno)
                    );

                Individuals.Add(individual);
            }
        }
Пример #10
0
        public IndividualType GetIndividualType(IndividualType type, out string errorMessage)
        {
            List <IndividualType> returnList = new List <IndividualType>();
            List <SqlParameter>   parameters = new List <SqlParameter>();

            parameters.Add(new SqlParameter("@IndividualTypeID", type.IndividualTypeID));

            SqlCommand cmd = new SqlCommand("dbo.IndividualTypeGetByID");

            returnList = createConnection(cmd, out errorMessage, parameters);

            if (returnList.Count > 0)
            {
                return(returnList[0]);
            }
            else
            {
                return(new IndividualType());
            }
        }
Пример #11
0
        public Facturae AddIndividualParty(bool seller, ResidenceTypeCodeType residenceTypeCode, string taxIdentificationNumber, string name,
                                           string firstSureName, string address, string postalCode, string province, string town, CountryType country)
        {
            var individual = new IndividualType();

            individual.Name         = name;
            individual.FirstSurname = firstSureName;
            individual.Item         = _CreateAddress(residenceTypeCode, address, postalCode, province, town, country);

            var party = _CreateParty(PersonTypeCodeType.F, residenceTypeCode, taxIdentificationNumber, individual);

            if (seller)
            {
                this.Parties.SellerParty = party;
            }
            else
            {
                this.Parties.BuyerParty = party;
            }

            return(this);
        }
Пример #12
0
 protected IndividualGroupBase(IndividualType type)
 {
     Type = type;
 }
Пример #13
0
 public Individual(IndividualType type,
                   int id)
 {
     Type = type;
     Id   = id;
 }
Пример #14
0
 public Individual(IndividualType type,
                   int id) : base(type, id)
 {
 }
Пример #15
0
 protected IndividualBase(IndividualType type,
                          int id)
 {
     Type = type;
     Id   = id;
 }
Пример #16
0
 public List <Individual> GetIndividualList(IndividualType type, out string errorMessage)
 {
     return(IndividualData.GetIndividualList(type, out errorMessage));
 }
Пример #17
0
        static void Main(string[] args)
        {
            Console.WriteLine("\n\nAVECTRA-SALT ENPOINT TESTER\n\n");
            if (args.Length == 0 || args.Length < 4)
            {
                Console.WriteLine("Invalid call.\nFormat is {application name}.exe {avectra user id} {avectra password} {web service endpoint} {customer name} {customer key}");
                return;
            }


            xWebProxy.netForumXMLSoapClient client = GetClient(args[2]);

            AuthorizationToken token   = new AuthorizationToken();
            string             authKey = string.Empty;
            IndividualType     savedIndividual;

            #region Authenticate
            try
            {
                Console.WriteLine("Authenticating.....");
                token = client.Authenticate(args[0], args[1], out authKey);
                Console.WriteLine("Authenticated ... token = {0} ", token.Token);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Authentication failed check user id and password. \n\n{0} ", ex.Message);
                return;
            }
            #endregion

            #region Web Insert
            try
            {
                Console.WriteLine("Inserting new test user ....");
                IndividualType individual = new IndividualType()
                {
                    Individual = new Individual_Individual_DataObjectType
                    {
                        ind_first_name   = "AvectraPingTestUser",
                        ind_last_name    = "AvectraTestUser" + DateTime.Now.ToString("MMddyyHmmss"),
                        ind_int_code     = "student",
                        ind_ods_flag_ext = 1,
                        ind_token_ext    = Guid.NewGuid().ToString(),
                        ind_token_expiration_date_ext = DateTime.Today.AddYears(1).ToString("d"),
                        ind_access_code_ext           = Guid.NewGuid().ToString().Substring(0, 6)
                    }
                    ,
                    Customer = new Individual_Customer_DataObjectType
                    {
                        cst_org_name_dn = args[3]
                    }
                    ,
                    Organization_XRef = new Individual_Organization_XRef_DataObjectType
                    {
                    },
                    Organization = new Individual_Organization_DataObjectType
                    {
                        org_cst_key = args[4]
                    }
                };
                savedIndividual = client.WEBIndividualInsert(ref token, individual);
                Console.WriteLine("Inserted indiviual successfully .....");
                Console.WriteLine(string.Format("Inserted individual id: {0} last name: {1}", savedIndividual.Individual.ind_cst_key, savedIndividual.Individual.ind_last_name));
            }
            catch (Exception ex)
            {
                Console.WriteLine("WebInsert failed: \n\n{0} ", ex.Message);
                return;
            }

            #endregion

            #region Get Query
            try
            {
                Console.WriteLine("Get Query.....");
                XmlNode results;
                results = client.GetQuery(ref token, "Individual @TOP 1", "ind_add_date,cst_cxa_key,ad2__adr_line1,ad2__adr_city,ad2__adr_state,ad2__adr_zip,eml_address,co_address.adr_line_1,mbr_installment_frequency,mbr_installment_frequency_for_renewal,ixo_enrollment_status_a03_code_ext,ixo_grade_level_a04_code_ext,mbr_join_date,ind_cst_key, ind_token_ext, ind_token_ext,ind_token_expiration_date_ext,ind_first_name,ind_first_name,ind_last_name,ind_dob,ind_mid_name,cst_eml_address", string.Format("ind_cst_key='{0}'", savedIndividual.Individual.ind_cst_key), "");
                if (results.SelectSingleNode("./@recordReturn").Value == "1")
                {
                    Console.WriteLine("Get Query.....Success");
                }
                else
                {
                    Console.WriteLine("Get Query.....Failed");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Get Query failed: \n\n{0} ", ex.Message);
                return;
            }
            #endregion

            #region UpdateFacadeObject
            try
            {
                Console.WriteLine("UpdateFacadeObject.....");
                string      xmlUpdate = @"<IndividualObjects>
	            <IndividualObject>
		            <ind_mid_name>Test</ind_mid_name>
	            </IndividualObject>
            </IndividualObjects>";
                XmlNode     results;
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xmlUpdate);

                results = client.UpdateFacadeObject(ref token, "Individual", savedIndividual.Individual.ind_cst_key, doc.SelectSingleNode("/*"));
                if (results.SelectSingleNode("./@recordReturn").Value == "1")
                {
                    Console.WriteLine("UpdateFacadeObject.....Success");
                }
                else
                {
                    Console.WriteLine("UpdateFacadeObject.....Failed");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("UpdateFacadeObject failed: \n\n{0} ", ex.Message);
                return;
            }
            #endregion

            #region InsertFacadeObject
            try
            {
                Console.WriteLine("InsertFacadeObject.....");
                string xmlUpdate = string.Format(@"<ASAWebActivityObjects>
	            <ASAWebActivityObject>
                    <a13_ind_cst_key>{0}</a13_ind_cst_key>
                    <a13_a12_code>Welcome Email</a13_a12_code>                                                 
                    <a13_send_email_flag>0</a13_send_email_flag>
	            </ASAWebActivityObject>
            </ASAWebActivityObjects>", savedIndividual.Individual.ind_cst_key);

                XmlNode     results;
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xmlUpdate);

                results = client.InsertFacadeObject(ref token, "ASAWebActivity", doc.SelectSingleNode("/*"));

                if (results.SelectSingleNode("./@recordReturn").Value == "1")
                {
                    Console.WriteLine("InsertFacadeObject.....Success");
                }
                else
                {
                    Console.WriteLine("InsertFacadeObject.....Failed");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("InsertFacadeObject failed: \n\n{0} ", ex.Message);
                return;
            }
            #endregion

            #region SetTokenAndAccessCode
            try
            {
                Parameter[] parameters = new Parameter[1] {
                    new Parameter()
                    {
                        Name = "ind_cst_key", Value = savedIndividual.Individual.ind_cst_key
                    }
                };
                XmlNode results;
                Console.WriteLine("Set Token and Access Code.....");
                results = client.ExecuteMethod(ref token, "netForumASA", "SetTokenAndAccessCode", parameters);
                if (results.SelectSingleNode(".").Name == "NewUserTokenValid")
                {
                    //We've got a valid token. XML may have changed. Ignore schema change errors
                    try
                    {
                        Console.WriteLine("Token: {0} Access Code: {1}", results.SelectSingleNode("./Individual/@WebUserToken").Value, results.SelectSingleNode("./Individual/@WebUserAccessCode").Value);
                    }
                    catch (Exception ex)
                    {
                    }

                    Console.WriteLine("Set Token and Access Code.....Success");
                }
                else
                {
                    Console.WriteLine("Set Token and Access Code.....Failed");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("SetTokenAndAccessCode failed: \n\n{0} ", ex.Message);
                return;
            }
            #endregion


            Console.WriteLine("\n\nALL TESTS PASSED! ");
        }
Пример #18
0
 public IndividualType GetIndividualType(IndividualType type, out string errorMessage)
 {
     return(IndividualTypeData.GetIndividualType(type, out errorMessage));
 }
Пример #19
0
 protected IndividualGroupBase(IndividualType type,
                               int count)
 {
     Type        = type;
     Individuals = new List <TIndividual> (count);
 }