当前位置: 首页>>代码示例>>C#>>正文


C# EntitySet.Add方法代码示例

本文整理汇总了C#中EntitySet.Add方法的典型用法代码示例。如果您正苦于以下问题:C# EntitySet.Add方法的具体用法?C# EntitySet.Add怎么用?C# EntitySet.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EntitySet的用法示例。


在下文中一共展示了EntitySet.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Add_IgnoreRepeats

 public void Add_IgnoreRepeats()
 {
     var people = new EntitySet<Person>();
     var p = new Person { FirstName = "A", LastName = "B" };
     people.Add(p);
     people.Add(p);
     Assert.AreEqual(1, people.Count);
 }
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:EntitySetTest.cs

示例2: LoadWithId

        public override EntitySet LoadWithId(string type, string[] id, string[] attributes)
        {
            EntitySet result = new EntitySet();

            foreach (string itemId in id)
            {
                string strQuote = itemId.IndexOf("'") > 0 ? "\"" : "'"; // if id contains ' limiter is " else '

                ArrayList subQueries = new ArrayList();

                // Creates a query for each sub-type, and concatenates them using and OR expression
                foreach (string subtype in Factory.Model.GetTreeAsArray(type))
                    subQueries.Add(String.Concat("id(", strQuote, _CommandProcessor.GetKey(subtype, itemId), strQuote, ")"));

                if (subQueries.Count == 0)
                    throw new ModelElementNotFoundException("No such types in metadata: " + type);

                EntitySet es = LoadWithXPath(String.Join(" | ", (string[])subQueries.ToArray(typeof(string))));

                if (es.Count > 0)
                    result.Add(es[0]);
            }

            if (result.Count > 0)
                LoadAttribute(result, attributes);

            return result;
        }
开发者ID:npenin,项目名称:uss,代码行数:28,代码来源:XmlPersistenceEngine.cs

示例3: GetTerritories

 public EntitySet<Territory> GetTerritories()
 {
     var entities = new EntitySet<Territory>();
     foreach (var territory in this.Territories)
     {
         entities.Add(territory);
     }
     return entities;
 }
开发者ID:radenkovn,项目名称:Telerik-Homework,代码行数:9,代码来源:ExtendedEmployee.cs

示例4: Add_ThenSetSourceIsInvalid

 public void Add_ThenSetSourceIsInvalid()
 {
     var people = new EntitySet<Person>();
     Assert.IsFalse(people.HasLoadedOrAssignedValues);
     people.Add(new Person { FirstName = "A", LastName = "B" });
     Assert.IsTrue(people.HasLoadedOrAssignedValues);
     people.SetSource(new[]{
         new Person { FirstName = "1", LastName = "2" }
     });
 }
开发者ID:nlhepler,项目名称:mono,代码行数:10,代码来源:EntitySetTest.cs

示例5: GetPointsList

        public void GetPointsList(Action<Microsoft.Windows.Data.DomainServices.EntityList<Point>> getPointsCallback, int pageSize)
        {
            EntitySet<Point> es = new EntitySet<Point>();
            DesignPoints designPoints = new DesignPoints();
            foreach (var dp in designPoints)
            {
                es.Add(dp);
            }

            var pointsEntityList = new EntityList<Point>(es);
            getPointsCallback(pointsEntityList);
        }
开发者ID:tbmihailov,项目名称:fishing-point-sl,代码行数:12,代码来源:DesignPointDataService.cs

示例6: Clear_DoesNotResetSource

 public void Clear_DoesNotResetSource()
 {
     var people = new EntitySet<Person>();
     Assert.IsFalse(people.HasLoadedOrAssignedValues);
     people.Add(new Person { FirstName = "A", LastName = "B" });
     Assert.IsTrue(people.HasLoadedOrAssignedValues);
     people.Clear();
     Assert.IsTrue(people.HasLoadedOrAssignedValues);
     people.SetSource(new[]{
         new Person { FirstName = "1", LastName = "2" },
     });
 }
开发者ID:nlhepler,项目名称:mono,代码行数:12,代码来源:EntitySetTest.cs

示例7: AllowModifications_Set

        public void AllowModifications_Set()
        {
            posts = new EntitySet<Post>(
                delegate(Post p)
                {
                    using (posts.AllowModifications)
                    {
                        posts.Add(new Post("Duplicate"));
                    }
                }, null);

            posts.Add(new Post("Original"));

            Assert.AreEqual(2, posts.Count);
        }
开发者ID:rcarrillopadron,项目名称:nhibernategenerics,代码行数:15,代码来源:AllowModifications.cs

示例8: getCountryCostOfEducation

        public EntitySet<countrycostofeducation> getCountryCostOfEducation()
        {
            EntitySet<countrycostofeducation> cced = new EntitySet<countrycostofeducation>();

            try
            {
                dbDataContext ct = new dbDataContext();
                var queryCountry = from sg in ct.countrycostofeducations
                                   select sg;

                foreach (countrycostofeducation cc in queryCountry)
                {
                    cced.Add(cc);
                }

            }
            catch (Exception e)
            {
                string str = e.Message;
            }

            return cced;
        }
开发者ID:pmehra1,项目名称:wen-zurich,代码行数:23,代码来源:EducationGoalsDAO.cs

示例9: updateEducationGoals

        public educationgoal updateEducationGoals(educationgoal goals, int egid)
        {
            educationgoal retrievedGoal = null;

            try
            {
                dbDataContext ct = new dbDataContext();

                //retrieve existing education goal
                var queryEducationGoals = from sg in ct.educationgoals
                                       where sg.caseid == goals.caseid && sg.id == egid
                                       select sg;
                foreach (educationgoal sgoals in queryEducationGoals)
                {
                    retrievedGoal = sgoals;
                }

                //update education goal attributes
                retrievedGoal.agefundsneeded = goals.agefundsneeded;
                retrievedGoal.currentage = goals.currentage;
                retrievedGoal.maturityvalue = goals.maturityvalue;
                retrievedGoal.nameofchild = goals.nameofchild;
                retrievedGoal.noofyrstosave = goals.noofyrstosave;
                retrievedGoal.total = goals.total;
                retrievedGoal.existingassetstotal = goals.existingassetstotal;
                retrievedGoal.futurecost = goals.futurecost;
                retrievedGoal.presentcost = goals.presentcost;
                retrievedGoal.inflationrate = goals.inflationrate;
                retrievedGoal.educationGoalNeeded = goals.educationGoalNeeded;

                retrievedGoal.countryofstudyid = goals.countryofstudyid;

                //delete existing assets for the education goal
                var queryExistingAssets = from easg in ct.existingassetegs
                                          where easg.educationgoalsid == retrievedGoal.id
                                          select easg;
                foreach (existingasseteg easgoals in queryExistingAssets)
                {
                    ct.existingassetegs.DeleteOnSubmit(easgoals);
                    //ct.SubmitChanges();
                }

                //update existing assets list for the education goal
                if (goals.existingassetegs != null && goals.existingassetegs.Count > 0)
                {
                    EntitySet<existingasseteg> easgList = new EntitySet<existingasseteg>();
                    foreach (existingasseteg sgea in goals.existingassetegs)
                    {
                        easgList.Add(sgea);
                    }
                    retrievedGoal.existingassetegs = easgList;
                }

                if (retrievedGoal.educationGoalNeeded == 1 || retrievedGoal.educationGoalNeeded == 0)
                {
                    var eduGoalRecords = from edug in ct.educationgoals
                                         where edug.caseid == goals.caseid
                                         select edug;
                    int[] arrRecordIds = null;

                    if (eduGoalRecords != null)
                    {
                        int size = eduGoalRecords.ToArray().Length;
                        arrRecordIds = new int[size];
                    }
                    int index = 0;
                    foreach (educationgoal egl in eduGoalRecords)
                    {
                        arrRecordIds[index] = egl.id;
                        index++;
                    }

                    var todelExistingAssets = from easg in ct.existingassetegs
                                              where arrRecordIds.Contains(easg.educationgoalsid)
                                              select easg;
                    foreach (existingasseteg easgoals in todelExistingAssets)
                    {
                        ct.existingassetegs.DeleteOnSubmit(easgoals);
                    }

                    var toDelEducationGoals = from sg in ct.educationgoals
                                              where sg.caseid == goals.caseid && sg.id != egid
                                              select sg;
                    foreach (educationgoal s in toDelEducationGoals)
                    {
                        ct.educationgoals.DeleteOnSubmit(s);
                    }
                }

                ct.SubmitChanges();

            }
            catch (Exception e)
            {
                string str = e.Message;
            }

            return retrievedGoal;
        }
开发者ID:pmehra1,项目名称:wen-zurich,代码行数:99,代码来源:EducationGoalsDAO.cs

示例10: Add_EntityNull

 public void Add_EntityNull()
 {
     var people = new EntitySet<Person>();
     people.Add(null);
 }
开发者ID:nlhepler,项目名称:mono,代码行数:5,代码来源:EntitySetTest.cs

示例11: SetSource_ThenAddIsFine

        public void SetSource_ThenAddIsFine()
        {
            var people = new EntitySet<Person>();

            Assert.IsFalse(people.HasLoadedOrAssignedValues);
            
            people.SetSource(new[]{
                new Person { FirstName = "1", LastName = "2" }
            });
            Assert.IsTrue(people.IsDeferred);
            Assert.IsFalse(people.HasLoadedOrAssignedValues);
            people.Add(new Person { FirstName = "A", LastName = "B" });
            Assert.IsTrue(people.HasLoadedOrAssignedValues);
            Assert.IsTrue(people.IsDeferred);
            Assert.AreEqual(2, people.Count);
        }
开发者ID:nlhepler,项目名称:mono,代码行数:16,代码来源:EntitySetTest.cs

示例12: saveAssetLiabilitiesDetails

        protected void saveAssetLiabilitiesDetails(object sender, EventArgs e)
        {
            string caseId = "";
            if (ViewState["caseId"] != null)
            {
                caseId = ViewState["caseId"].ToString();
            }

            if (Session["fnacaseid"] != null)
            {
                caseId = Session["fnacaseid"].ToString();
            }

            string actv = "";
            if (ViewState["activity"] != null)
            {
                actv = ViewState["activity"].ToString();
            }

            AssetAndLiabilityDAO assetAndLiabilityDAO = new AssetAndLiabilityDAO();
            assetAndLiability assetAndLiability = assetAndLiabilityDAO.getAssetLiabilityForCase(caseId);

            string status = "new";

            if (assetAndLiability != null)
            {
                copyAssetBaseClass(assetAndLiability);
                status = "update";
            }
            else
            {
                assetAndLiability = new assetAndLiability();
                copyAssetBaseClass(assetAndLiability);
            }

            int noofmemberOfInvestedAssets = 0;
            int noOfLiabilitiesNumber = 0;
            int noPersonalUsedAssetsNumber = 0;

            if (otherInvestedAssetsNumber.Value != "")
            {
                noofmemberOfInvestedAssets = Int16.Parse(otherInvestedAssetsNumber.Value) + 1;
            }

            if (otherPersonalUsedAssetsNumber.Value != "")
            {
                noPersonalUsedAssetsNumber = Int16.Parse(otherPersonalUsedAssetsNumber.Value) + 1;
            }

            if (otherLiabilitiesNumber.Value != "")
            {
                noOfLiabilitiesNumber = Int16.Parse(otherLiabilitiesNumber.Value) + 1;
            }

            EntitySet<personalUseAssetsOther> personalUseAssets = new EntitySet<personalUseAssetsOther>();
            EntitySet<liabilityOther> liabilityOthers = new EntitySet<liabilityOther>();
            EntitySet<investedAssetOther> investedAssetOther = new EntitySet<investedAssetOther>();

            if (noofmemberOfInvestedAssets > 0)
            {
                for (int i = 0; i < noofmemberOfInvestedAssets; i++)
                {

                    if (Request.Form["priothers-" + i] != null)
                    {
                        investedAssetOther asset = new investedAssetOther();
                        asset.cash = Request.Form["priotherscash-" + i];
                        asset.cpf = Request.Form["priotherscpf-" + i];
                        asset.date = DateTime.Today;
                        asset.assetDesc = Request.Form["priothers-" + i];
                        investedAssetOther.Add(asset);
                    }
                }
            }
            assetAndLiability.investedAssetOthers = investedAssetOther;
            if (noPersonalUsedAssetsNumber > 0)
            {
                for (int i = 0; i < noPersonalUsedAssetsNumber; i++)
                {

                    if (Request.Form["priotherspu-" + i] != null)
                    {
                        personalUseAssetsOther asset = new personalUseAssetsOther();
                        asset.cash = Request.Form["priotherspucash-" + i];
                        asset.cpf = Request.Form["priotherspucpf-" + i];
                        asset.date = DateTime.Today;
                        asset.assetDesc = Request.Form["priotherspu-" + i];
                        personalUseAssets.Add(asset);

                    }
                }
            }
            assetAndLiability.personalUseAssetsOthers = personalUseAssets;
            if (noOfLiabilitiesNumber > 0)
            {
                for (int i = 0; i < noOfLiabilitiesNumber; i++)
                {

                    if (Request.Form["priotherslb-" + i] != null)
                    {
//.........这里部分代码省略.........
开发者ID:pmehra1,项目名称:wen-zurich,代码行数:101,代码来源:AssetAndLiabilities.aspx.cs

示例13: saveFamilyNeeds

        private bool saveFamilyNeeds()
        {
            familyNeed familyNeeds = new familyNeed();

            familyNeeds.familyIncPrNeeded = Convert.ToInt32(familyIncPrNeeded.SelectedValue);
            familyNeeds.mortgageNeeded = Convert.ToInt32(mortgagePrNeeded.SelectedValue);

            if (familyNeeds.familyIncPrNeeded == 2)
            {
                familyNeeds.replacementIncomeRequired = txtReplacementIncome.Text;
                familyNeeds.yearsOfSupportRequired = txtYrsOfSupport.Text;
                familyNeeds.inflationAdjustedReturns = txtInflationAdjustedReturns.Text;
                familyNeeds.lumpSumRequired = txtLumpSumRequired.Text;
                familyNeeds.otherLiabilities = txtOtherLiabilities.Text;
                familyNeeds.emergencyFundsNeeded = txtEmergencyFundsNeeded.Text;
                familyNeeds.finalExpenses = txtFinalExpenses.Text;
                familyNeeds.otherFundingNeeds = txtOtherFundingNeeds.Text;
                //familyNeeds.otherComments = txtotherComments.Text;
                familyNeeds.totalRequired = txtTotalRequired.Text;
                familyNeeds.existingLifeInsurance = txtExistingLifeInsurance.Text;
                familyNeeds.existingAssetsFamilyneeds = txtExistingAssetsFamilyneeds.Text;
                //familyNeeds.totalShortfallSurplus = txtTotalShortfallSurplus.Text;
                familyNeeds.totalShortfallSurplus = hiddenTotalShortfallSurplus.Value;
            }
            else if (familyNeeds.familyIncPrNeeded == 1 || familyNeeds.familyIncPrNeeded == 0)
            {
                familyNeeds.replacementIncomeRequired = "0";
                familyNeeds.yearsOfSupportRequired = "0";
                familyNeeds.inflationAdjustedReturns = "0";
                familyNeeds.lumpSumRequired = "0";
                familyNeeds.otherLiabilities = "0";
                familyNeeds.emergencyFundsNeeded = "0";
                familyNeeds.finalExpenses = "0";
                familyNeeds.otherFundingNeeds = "0";
                //familyNeeds.otherComments = txtotherComments.Text;
                familyNeeds.totalRequired = "0";
                familyNeeds.existingLifeInsurance = "0";
                familyNeeds.existingAssetsFamilyneeds = "0";
                //familyNeeds.totalShortfallSurplus = txtTotalShortfallSurplus.Text;
                familyNeeds.totalShortfallSurplus = "0";
            }

            if (familyNeeds.mortgageNeeded == 2)
            {
                familyNeeds.mortgageProtectionOutstanding = txtMortgageProtectionOutstanding.Text;
                familyNeeds.mortgageProtectionInsurances = txtMortgageProtectionInsurances.Text;
                familyNeeds.mortgageProtectionTotal = hiddentxtMortgageProtectionTotal.Value;
            }
            else if (familyNeeds.mortgageNeeded == 1 || familyNeeds.mortgageNeeded == 0)
            {
                familyNeeds.mortgageProtectionOutstanding = "0";
                familyNeeds.mortgageProtectionInsurances = "0";
                familyNeeds.mortgageProtectionTotal = "0";
            }

            familyNeeds.caseId = ViewState["caseId"].ToString();

            int noofea = 0;
            if (familyNeeds.familyIncPrNeeded == 2)
            {
                if (noofmembers.Value != "")
                {
                    noofea = Int16.Parse(noofmembers.Value);
                }
            }

            EntitySet<familyNeedsAsset> eaFNeedsList = new EntitySet<familyNeedsAsset>();
            if (noofea > 0)
            {
                for (int i = 1; i <= noofea; i++)
                {
                    familyNeedsAsset eafn = new familyNeedsAsset();
                    eafn.asset = Request.Form["prifamily-" + i];
                    eafn.presentValue = Request.Form["prifamilyneeds_" + i];

                    if ((Request.Form["prifamily-" + i] != null) && (Request.Form["prifamilyneeds_" + i] != null))
                    {
                        eaFNeedsList.Add(eafn);
                    }

                }
                familyNeeds.familyNeedsAssets = eaFNeedsList;
            }

            if (ViewState["casetypefamily"] != null && ViewState["casetypefamily"].ToString() == "new")
            {
                familyNeeds = familyNeedsDAO.saveFamilyNeeds(familyNeeds);
            }
            else if (ViewState["casetypefamily"] != null && ViewState["casetypefamily"].ToString() == "update")
            {
                familyNeeds = familyNeedsDAO.updateFamilyNeeds(familyNeeds);
            }

            string actv = "";
            if (ViewState["activity"] != null)
            {
                actv = ViewState["activity"].ToString();
            }

            string status = activityStatusCheck.getProtectionGoalFamilyStatus(familyNeeds);
//.........这里部分代码省略.........
开发者ID:pmehra1,项目名称:wen-zurich,代码行数:101,代码来源:ShowProtectionGoals.aspx.cs

示例14: updateMyNeeds

        public myNeed updateMyNeeds(myNeed needs)
        {
            myNeed retrievedNeed = null;

            try
            {
                dbDataContext ct = new dbDataContext();

                //retrieve existing my need
                var queryMyNeeds = from myneed in ct.myNeeds
                                       where myneed.caseId == needs.caseId
                                       select myneed;
                foreach (myNeed myNeeds in queryMyNeeds)
                {
                    retrievedNeed = myNeeds;
                }

                //update my need attributes
                retrievedNeed.lumpSumRequiredForTreatment = needs.lumpSumRequiredForTreatment;
                retrievedNeed.totalRequired = needs.totalRequired;
                retrievedNeed.criticalIllnessInsurance = needs.criticalIllnessInsurance;
                retrievedNeed.existingAssetsMyneeds = needs.existingAssetsMyneeds;
                retrievedNeed.totalShortfallSurplusMyNeeds = needs.totalShortfallSurplusMyNeeds;
                retrievedNeed.lumpSumMyNeeds = needs.lumpSumMyNeeds;
                retrievedNeed.existingSumMyNeeds = needs.existingSumMyNeeds;
                retrievedNeed.shortfallSumMyNeeds = needs.shortfallSumMyNeeds;
                retrievedNeed.monthlyIncomeDisabilityIncome = needs.monthlyIncomeDisabilityIncome;
                retrievedNeed.percentOfIncomeCoverageRequired = needs.percentOfIncomeCoverageRequired;
                retrievedNeed.monthlyCoverageRequired = needs.monthlyCoverageRequired;
                retrievedNeed.disabilityInsuranceMyNeeds = needs.disabilityInsuranceMyNeeds;
                retrievedNeed.existingAssetsMyneedsDisability = needs.existingAssetsMyneedsDisability;
                retrievedNeed.shortfallSurplusMyNeeds = needs.shortfallSurplusMyNeeds;
                retrievedNeed.monthlyAmountMyNeeds = needs.monthlyAmountMyNeeds;
                retrievedNeed.existingMyNeeds = needs.existingMyNeeds;
                retrievedNeed.shortfallMyNeeds = needs.shortfallMyNeeds;
                retrievedNeed.typeOfHospitalCoverage = needs.typeOfHospitalCoverage;
                retrievedNeed.anyExistingPlans = needs.anyExistingPlans;
                retrievedNeed.typeOfRoomCoverage = needs.typeOfRoomCoverage;
                retrievedNeed.coverageOldageYesNo = needs.coverageOldageYesNo;
                retrievedNeed.epOldageYesNo = needs.epOldageYesNo;
                retrievedNeed.coverageIncomeYesNo = needs.coverageIncomeYesNo;
                retrievedNeed.epIncomeYesNo = needs.epIncomeYesNo;
                retrievedNeed.coverageOutpatientYesNo = needs.coverageOutpatientYesNo;
                retrievedNeed.epOutpatientYesNo = needs.epOutpatientYesNo;
                retrievedNeed.coverageDentalYesNo = needs.coverageDentalYesNo;
                retrievedNeed.epDentalYesNo = needs.epDentalYesNo;
                retrievedNeed.coveragePersonalYesNo = needs.coveragePersonalYesNo;
                retrievedNeed.epPersonalYesNo = needs.epPersonalYesNo;
                retrievedNeed.criticalIllnessPrNeeded = needs.criticalIllnessPrNeeded;
                retrievedNeed.disabilityPrNeeded = needs.disabilityPrNeeded;
                retrievedNeed.hospitalmedCoverNeeded = needs.hospitalmedCoverNeeded;
                retrievedNeed.accidentalhealthCoverNeeded = needs.accidentalhealthCoverNeeded;
                retrievedNeed.coverageOutpatientMedExp = needs.coverageOutpatientMedExp;
                retrievedNeed.epOutpatientMedExp = needs.epOutpatientMedExp;
                retrievedNeed.coverageLossOfIncome = needs.coverageLossOfIncome;
                retrievedNeed.epLossOfIncome = needs.epLossOfIncome;
                retrievedNeed.coverageOldageDisabilities = needs.coverageOldageDisabilities;
                retrievedNeed.epOldageDisabilities = needs.epOldageDisabilities;
                retrievedNeed.coverageDentalExp = needs.coverageDentalExp;
                retrievedNeed.epDentalExp = needs.epDentalExp;

                if ((needs.anyExistingPlans == true) || (needs.epOldageYesNo == true) || (needs.epPersonalYesNo == true) || (needs.epOutpatientMedExp == true) || (needs.epLossOfIncome == true) || (needs.epOldageDisabilities == true) || (needs.epDentalExp == true))
                {
                    retrievedNeed.existingPlansDetail = needs.existingPlansDetail;
                }
                else
                    retrievedNeed.existingPlansDetail = "";

               // retrievedNeed.existingPlansDetail = needs.existingPlansDetail;

                retrievedNeed.disabilityProtectionReplacementIncomeRequired = needs.disabilityProtectionReplacementIncomeRequired;
                retrievedNeed.disabilityProtectionReplacementIncomeRequiredPercentage =needs.disabilityProtectionReplacementIncomeRequiredPercentage;
                retrievedNeed.replacementIncomeRequired = needs.replacementIncomeRequired;
                retrievedNeed.yearsOfSupportRequired = needs.yearsOfSupportRequired;
                retrievedNeed.disabilityYearsOfSupport = needs.disabilityYearsOfSupport;
                retrievedNeed.inflatedAdjustedReturns = needs.inflatedAdjustedReturns;
                retrievedNeed.replacementAmountRequired = needs.replacementAmountRequired;
                retrievedNeed.disabilityReplacementAmountRequired = needs.disabilityReplacementAmountRequired;
                retrievedNeed.disabilityInsurance = needs.disabilityInsurance;
                retrievedNeed.inflationAdjustedReturns = needs.inflationAdjustedReturns;

                //delete existing assets for my needs critical illness
                var queryExistingCriticalAssets = from eamyneed in ct.myNeedsCriticalAssets
                                          where eamyneed.myNeedId == retrievedNeed.id
                                          select eamyneed;
                foreach (myNeedsCriticalAsset eamyneeds in queryExistingCriticalAssets)
                {
                    ct.myNeedsCriticalAssets.DeleteOnSubmit(eamyneeds);
                    //ct.SubmitChanges();
                }

                //update existing assets list for my needs critical illness
                if (needs.myNeedsCriticalAssets != null && needs.myNeedsCriticalAssets.Count > 0)
                {
                    EntitySet<myNeedsCriticalAsset> eaMNCriticalList = new EntitySet<myNeedsCriticalAsset>();
                    foreach (myNeedsCriticalAsset mnea in needs.myNeedsCriticalAssets)
                    {
                        eaMNCriticalList.Add(mnea);
                    }
                    retrievedNeed.myNeedsCriticalAssets = eaMNCriticalList;
//.........这里部分代码省略.........
开发者ID:pmehra1,项目名称:wen-zurich,代码行数:101,代码来源:MyNeedsDAO.cs

示例15: submitEducationGoals

        protected void submitEducationGoals(object sender, EventArgs e)
        {
            educationgoal goals = new educationgoal();

            goals.educationGoalNeeded = Convert.ToInt16(educationGoalNeeded.SelectedValue);

            if (goals.educationGoalNeeded == 2)
            {
                goals.agefundsneeded = ageWhenFundsNeeded.Text;
                goals.currentage = currentAge.Text;
                goals.maturityvalue = maturityValue.Text;
                goals.nameofchild = nameofChild.Text;
                goals.noofyrstosave = yrsToSave.Text;

                if (totalShortfallSurplus.Text != null && totalShortfallSurplus.Text != "")
                {
                    double ttl = double.Parse(totalShortfallSurplus.Text);
                    if (ttl < 0)
                    {
                        totalShortfallSurplus.Text = Math.Abs(ttl).ToString();
                    }
                }
                goals.total = totalShortfallSurplus.Text;

                goals.existingassetstotal = existingAssetsEducationGoals.Text;
                goals.futurecost = futureValue.Text;
                goals.presentcost = costEducation.Text;
                goals.inflationrate = inflationRate.Text;
            }
            else if (goals.educationGoalNeeded == 1 || goals.educationGoalNeeded == 0)
            {
                goals.agefundsneeded = "0";
                goals.currentage = "0";
                goals.maturityvalue = "0";
                goals.nameofchild = "";
                goals.noofyrstosave = "0";
                goals.total = "0";
                goals.existingassetstotal = "0";
                goals.futurecost = "0";
                goals.presentcost = "0";
                goals.inflationrate = "0";
            }

            goals.deleted = false;

            string caseid = "";
            if (ViewState["caseid"]!=null)
            {
                caseid = ViewState["caseid"].ToString();
                goals.caseid = caseid;
            }

            goals.countryofstudyid = Int16.Parse(countryList.SelectedValue);

            int noofea = 0;
            if (goals.educationGoalNeeded == 2)
            {
                if (noofmembers.Value != "")
                {
                    noofea = Int16.Parse(noofmembers.Value);
                }
            }

            EntitySet<existingasseteg> easgList = new EntitySet<existingasseteg>();
            if (noofea > 0)
            {
                for (int i = 1; i <= noofea; i++)
                {
                    existingasseteg easg = new existingasseteg();
                    easg.asset = Request.Form["pri-" + i];
                    easg.presentvalue = Request.Form["pri_" + i];
                    easg.percentpa = Request.Form["sec_" + i];

                    if ((Request.Form["pri-" + i] != null) && (Request.Form["pri_" + i] != null) && (Request.Form["sec_" + i] != null))
                    {
                        easgList.Add(easg);
                    }

                }
                goals.existingassetegs = easgList;
            }

            int egid = 0;
            if (ViewState["egid"] != null)
            {
                egid = Int32.Parse(ViewState["egid"].ToString());
            }

            if (ViewState["casetype"] != null && ViewState["casetype"].ToString() == "new")
            {
                goals = educationGoalsDao.saveEducationGoals(goals);
            }
            else if (ViewState["casetype"] != null && ViewState["casetype"].ToString() == "update")
            {
                goals = educationGoalsDao.updateEducationGoals(goals, egid);
            }

            string actv = "";
            if (ViewState["activity"] != null)
            {
//.........这里部分代码省略.........
开发者ID:pmehra1,项目名称:wen-zurich,代码行数:101,代码来源:ShowEducationGoals.aspx.cs


注:本文中的EntitySet.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。