public void updatePriorityDetails(priorityDetail priorityDetails)
        {
            try
            {
                dbDataContext ct = new dbDataContext();
                priorityDetail detail = null;
                //retrieve existing saving goal
                var queryPriorityDetails = from al in ct.priorityDetails
                                           where al.caseid == priorityDetails.caseid
                                           select al;
                foreach (priorityDetail priorityDetailObject in queryPriorityDetails)
                {
                    detail = priorityDetailObject;
                }

                detail.protection1 = priorityDetails.protection1;
                detail.protection2 = priorityDetails.protection2;
                detail.protection3 = priorityDetails.protection3;
                detail.protection4 = priorityDetails.protection4;
                detail.protection5 = priorityDetails.protection5;
                detail.savings1 = priorityDetails.savings1;
                detail.savings2 = priorityDetails.savings2;
                detail.savings3 = priorityDetails.savings3;

                ct.SubmitChanges();
            }
            catch (Exception e)
            {
                string str = e.Message;
            }
        }
        public List<myzurichadviser> saveMza(List<myzurichadviser> mzaoptions)
        {
            int status = 1;

            try
            {
                dbDataContext ct = new dbDataContext();
                if (mzaoptions != null && mzaoptions.Count > 0)
                {
                    ct.myzurichadvisers.InsertAllOnSubmit(mzaoptions);
                    ct.SubmitChanges();
                }
            }
            catch (Exception e)
            {
                status = 0;
                string str = e.Message;
            }

            if (status == 0)
            {
                mzaoptions = null;
            }

            return mzaoptions;
        }
        public int deleteEducationGoal(int egid)
        {
            int status = 1;
            educationgoal retrievedGoal = null;

            try
            {
                dbDataContext ct = new dbDataContext();

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

                //update education goal attributes
                retrievedGoal.deleted = true;

                ct.SubmitChanges();

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

            return status;
        }
Beispiel #4
0
 public void saveNewCkaProfile(CkaAssessment ckaAssessment)
 {
     try
     {
         dbDataContext ct = new dbDataContext();
         ct.CkaAssessments.InsertOnSubmit(ckaAssessment);
         ct.SubmitChanges();
     }
     catch (Exception e)
     {
         string str = e.Message;
     }
 }
 public void savePriorityDetails(priorityDetail priorityDetails)
 {
     try
     {
         dbDataContext ct = new dbDataContext();
         ct.priorityDetails.InsertOnSubmit(priorityDetails);
         ct.SubmitChanges();
     }
     catch (Exception e)
     {
         string str = e.Message;
     }
 }
Beispiel #6
0
 public incomeExpense insertNewIncomeExpenseDetails(incomeExpense incomeExpenseDetail)
 {
     try
     {
         dbDataContext ct = new dbDataContext();
         ct.incomeExpenses.InsertOnSubmit(incomeExpenseDetail);
         ct.SubmitChanges();
     }
     catch (Exception e)
     {
         string str = e.Message;
     }
     return incomeExpenseDetail;
 }
        public Boolean insertNewAssetLiabilityDetails(assetAndLiability assetAndLiability)
        {
            Boolean status = true;
            try
            {
                dbDataContext ct = new dbDataContext();
                ct.assetAndLiabilities.InsertOnSubmit(assetAndLiability);
                ct.SubmitChanges();
            }
            catch (Exception e)
            {
                status = false;
                string str = e.Message;
            }

            return status;
        }
        public int savePersonalDetails(personaldetail personalDetails)
        {
            int noOfRows = 0;

            try
            {

                dbDataContext ct = new dbDataContext();
                ct.personaldetails.InsertOnSubmit(personalDetails);
                ct.SubmitChanges();
            }
            catch (Exception e)
            {
                string str = e.Message;
            }

            return noOfRows;
        }
Beispiel #9
0
        public myNeed saveMyNeeds(myNeed myNeeds)
        {
            int status = 1;

            try
            {
                dbDataContext ct = new dbDataContext();
                ct.myNeeds.InsertOnSubmit(myNeeds);
                ct.SubmitChanges();
            }
            catch (Exception ex)
            {
                logException(ex);
                throw ex;
            }

            if (status == 0)
            {
                myNeeds = null;
            }

            return myNeeds;
        }
        public retirementgoal saveRetirementGoals(retirementgoal goals)
        {
            int status = 1;

            try
            {
                dbDataContext ct = new dbDataContext();
                ct.retirementgoals.InsertOnSubmit(goals);
                ct.SubmitChanges();
            }
            catch (Exception e)
            {
                status = 0;
                string str = e.Message;
            }

            if (status == 0)
            {
                goals = null;
            }

            return goals;
        }
        public List<myzurichadviser> updateMza(List<myzurichadviser> mzaoptions, string caseid)
        {
            int status = 1;

            try
            {
                dbDataContext ct = new dbDataContext();

                //delete existing my zurich adviser
                var queryExistingMza = from emza in ct.myzurichadvisers
                                          where emza.caseid == caseid
                                          select emza;
                foreach (myzurichadviser mza in queryExistingMza)
                {
                    ct.myzurichadvisers.DeleteOnSubmit(mza);
                }

                if (mzaoptions != null && mzaoptions.Count > 0)
                {
                    ct.myzurichadvisers.InsertAllOnSubmit(mzaoptions);
                }
                ct.SubmitChanges();
            }
            catch (Exception e)
            {
                status = 0;
                string str = e.Message;
            }

            if (status == 0)
            {
                mzaoptions = null;
            }

            return mzaoptions;
        }
Beispiel #12
0
        public incomeExpense updateIncomeExpenseDetails(incomeExpense incomeExpenseDetail)
        {
            incomeExpense incomeExpense = null;
            try
            {
                dbDataContext ct = new dbDataContext();

                //retrieve existing saving goal
                var queryIncomeExpenseDetails = from al in ct.incomeExpenses
                                                  where al.caseId == incomeExpenseDetail.caseId
                                                  select al;
                foreach (incomeExpense incomeExpenseDetails in queryIncomeExpenseDetails)
                {
                    incomeExpense = incomeExpenseDetails;
                }

                incomeExpense.emergencyFundsNeeded = incomeExpenseDetail.emergencyFundsNeeded;
                incomeExpense.shortTermGoals = incomeExpenseDetail.shortTermGoals;
                incomeExpense.extraDetails = incomeExpenseDetail.extraDetails;
                incomeExpense.netMonthlyIncomeAfterCpf = incomeExpenseDetail.netMonthlyIncomeAfterCpf;
                incomeExpense.netMonthlyExpenses = incomeExpenseDetail.netMonthlyExpenses;
                incomeExpense.monthlySavings = incomeExpenseDetail.monthlySavings;
                incomeExpense.lifeInsuranceSA = incomeExpenseDetail.lifeInsuranceSA;
                incomeExpense.lifeInsuranceMV = incomeExpenseDetail.lifeInsuranceMV;
                incomeExpense.expiry1 = incomeExpenseDetail.expiry1;
                incomeExpense.lifeInsurancePremium = incomeExpenseDetail.lifeInsurancePremium;
                incomeExpense.lifeInsuranceRemarks = incomeExpenseDetail.lifeInsuranceRemarks;
                incomeExpense.tpdcSA = incomeExpenseDetail.tpdcSA;
                incomeExpense.tpdcMV = incomeExpenseDetail.tpdcMV;
                incomeExpense.expiry2 = incomeExpenseDetail.expiry2;
                incomeExpense.tpdcPremium = incomeExpenseDetail.tpdcPremium;
                incomeExpense.tpdcRemarks = incomeExpenseDetail.tpdcRemarks;
                incomeExpense.criticalIllnessSA = incomeExpenseDetail.criticalIllnessSA;
                incomeExpense.criticalIllnessMV = incomeExpenseDetail.criticalIllnessMV;
                incomeExpense.expiry3 = incomeExpenseDetail.expiry3;
                incomeExpense.criticalIllnessPremium = incomeExpenseDetail.criticalIllnessPremium;
                incomeExpense.criticalIllnessRemarks = incomeExpenseDetail.criticalIllnessRemarks;
                incomeExpense.disabilityIncomeSA = incomeExpenseDetail.disabilityIncomeSA;
                incomeExpense.disabilityIncomeMV = incomeExpenseDetail.disabilityIncomeMV;
                incomeExpense.expiry4 = incomeExpenseDetail.expiry4;
                incomeExpense.disabilityIncomePremium = incomeExpenseDetail.disabilityIncomePremium;
                incomeExpense.disabilityIncomeRemarks = incomeExpenseDetail.disabilityIncomeRemarks;
                incomeExpense.mortgageSA = incomeExpenseDetail.mortgageSA;
                incomeExpense.mortgageMV = incomeExpenseDetail.mortgageMV;
                incomeExpense.expiry5 = incomeExpenseDetail.expiry5;
                incomeExpense.mortgagePremium = incomeExpenseDetail.mortgagePremium;
                incomeExpense.mortgageRemarks = incomeExpenseDetail.mortgageRemarks;
                incomeExpense.others1A = incomeExpenseDetail.others1A;
                incomeExpense.others1V = incomeExpenseDetail.others1V;
                incomeExpense.expiry6 = incomeExpenseDetail.expiry6;
                incomeExpense.others1Premium = incomeExpenseDetail.others1Premium;
                incomeExpense.others1Remarks = incomeExpenseDetail.others1Remarks;

                incomeExpense.DeathTermInsurancePremium = incomeExpenseDetail.DeathTermInsurancePremium;
                incomeExpense.DeathTermInsuranceSA = incomeExpenseDetail.DeathTermInsuranceSA;
                incomeExpense.DeathTermInsuranceTerm = incomeExpenseDetail.DeathTermInsuranceTerm;
                incomeExpense.DeathWholeLifeInsurancePremium = incomeExpenseDetail.DeathWholeLifeInsurancePremium;
                incomeExpense.DeathWholeLifeInsuranceSA = incomeExpenseDetail.DeathWholeLifeInsuranceSA;
                incomeExpense.DeathWholeLifeInsuranceTerm = incomeExpenseDetail.DeathWholeLifeInsuranceTerm;
                incomeExpense.incomeExpenseNeeded = incomeExpenseDetail.incomeExpenseNeeded;
                incomeExpense.incomeExpenseNotNeededReason = incomeExpenseDetail.incomeExpenseNotNeededReason;
                incomeExpense.assecertainingAffordabilityEnable = incomeExpenseDetail.assecertainingAffordabilityEnable;
                incomeExpense.assecertainingAffordabilityReason = incomeExpenseDetail.assecertainingAffordabilityReason;

                incomeExpense.otherSourcesOfIncome = incomeExpenseDetail.otherSourcesOfIncome;

                incomeExpense.caseId=incomeExpenseDetail.caseId;

                var queryIncomeExpenseOthers = from incomeExpenseOther in ct.incomeExpenseOthers
                                               where incomeExpenseOther.incomeExpenseId == incomeExpenseDetail.id
                                               select incomeExpenseOther;
                foreach (incomeExpenseOther incomeExpenseOther in queryIncomeExpenseOthers)
                {
                    ct.incomeExpenseOthers.DeleteOnSubmit(incomeExpenseOther);
                }

                //update income expense others list for the IncomeExpense goal
                if (incomeExpenseDetail.incomeExpenseOthers != null && incomeExpenseDetail.incomeExpenseOthers.Count > 0)
                {
                    EntitySet<incomeExpenseOther> incomeExpenseOtherSet = new EntitySet<incomeExpenseOther>();
                    foreach (incomeExpenseOther incomeExpenseOther in incomeExpenseDetail.incomeExpenseOthers)
                    {
                        incomeExpenseOtherSet.Add(incomeExpenseOther);
                    }
                    incomeExpense.incomeExpenseOthers = incomeExpenseOtherSet;
                }

                var queryIncomeExpenseSaving = from insuranceArrangementSaving in ct.insuranceArrangementSavings
                                               where insuranceArrangementSaving.incomeExpenseId == incomeExpenseDetail.id
                                               select insuranceArrangementSaving;
                foreach (insuranceArrangementSaving insuranceArrangementSaving in queryIncomeExpenseSaving)
                {
                    ct.insuranceArrangementSavings.DeleteOnSubmit(insuranceArrangementSaving);
                }

                //update income expense others list for the IncomeExpense goal
                if (incomeExpenseDetail.insuranceArrangementSavings != null && incomeExpenseDetail.insuranceArrangementSavings.Count > 0)
                {
                    EntitySet<insuranceArrangementSaving> insuranceArrangementSavingSet = new EntitySet<insuranceArrangementSaving>();
                    foreach (insuranceArrangementSaving insuranceArrangementSaving in incomeExpenseDetail.insuranceArrangementSavings)
                    {
                        insuranceArrangementSavingSet.Add(insuranceArrangementSaving);
                    }
                    incomeExpense.insuranceArrangementSavings = insuranceArrangementSavingSet;
                }

                var queryIncomeExpenseRetirement = from insuranceArrangementRetirement in ct.insuranceArrangementRetirements
                                                   where insuranceArrangementRetirement.incomeExpenseId == incomeExpenseDetail.id
                                                   select insuranceArrangementRetirement;
                foreach (insuranceArrangementRetirement insuranceArrangementRetirement in queryIncomeExpenseRetirement)
                {
                    ct.insuranceArrangementRetirements.DeleteOnSubmit(insuranceArrangementRetirement);
                }

                //update income expense others list for the IncomeExpense goal
                if (incomeExpenseDetail.insuranceArrangementRetirements != null && incomeExpenseDetail.insuranceArrangementRetirements.Count > 0)
                {
                    EntitySet<insuranceArrangementRetirement> insuranceArrangementRetirementSet = new EntitySet<insuranceArrangementRetirement>();
                    foreach (insuranceArrangementRetirement insuranceArrangementRetirement in incomeExpenseDetail.insuranceArrangementRetirements)
                    {
                        insuranceArrangementRetirementSet.Add(insuranceArrangementRetirement);
                    }
                    incomeExpense.insuranceArrangementRetirements = insuranceArrangementRetirementSet;
                }

                var queryIncomeExpenseEducation = from insuranceArrangementEducation in ct.insuranceArrangementEducations
                                                  where insuranceArrangementEducation.incomeExpenseId == incomeExpenseDetail.id
                                                  select insuranceArrangementEducation;
                foreach (insuranceArrangementEducation insuranceArrangementEducation in queryIncomeExpenseEducation)
                {
                    ct.insuranceArrangementEducations.DeleteOnSubmit(insuranceArrangementEducation);
                }

                //update income expense others list for the IncomeExpense goal
                if (incomeExpenseDetail.insuranceArrangementEducations != null && incomeExpenseDetail.insuranceArrangementEducations.Count > 0)
                {
                    EntitySet<insuranceArrangementEducation> insuranceArrangementEducationSet = new EntitySet<insuranceArrangementEducation>();
                    foreach (insuranceArrangementEducation insuranceArrangementEducation in incomeExpenseDetail.insuranceArrangementEducations)
                    {
                        insuranceArrangementEducationSet.Add(insuranceArrangementEducation);
                    }
                    incomeExpense.insuranceArrangementEducations = insuranceArrangementEducationSet;
                }

                ct.SubmitChanges();
            }
            catch (Exception e)
            {
                string str = e.Message;
            }
            return incomeExpense;
        }
Beispiel #13
0
        public void updateCkaDetails(CkaAssessment ckaAssessment)
        {
            CkaAssessment assessment = null;
            try
            {
                dbDataContext ct = new dbDataContext();
                var queryCkaDetails = from al in ct.CkaAssessments
                                           where al.caseId == ckaAssessment.caseId
                                           select al;
                foreach (CkaAssessment ckAssessment in queryCkaDetails)
                {
                    assessment = ckAssessment;
                }

                assessment.agreeCKA = ckaAssessment.agreeCKA;
                assessment.csaOutcomeOption1 = ckaAssessment.csaOutcomeOption1;
                assessment.csaOutcomeOption2 = ckaAssessment.csaOutcomeOption2;
                assessment.disagreeCKA = ckaAssessment.disagreeCKA;
                assessment.educationalExperienceOption1 = ckaAssessment.educationalExperienceOption1;
                assessment.educationalExperienceOption2 = ckaAssessment.educationalExperienceOption2;
                assessment.financeRelatedKnowledgeOption1 = ckaAssessment.financeRelatedKnowledgeOption1;
                assessment.financeRelatedKnowledgeOption2 = ckaAssessment.financeRelatedKnowledgeOption2;
                assessment.investmentExperienceOption1 = ckaAssessment.investmentExperienceOption1;
                assessment.investmentExperienceOption2 = ckaAssessment.investmentExperienceOption2;
                assessment.workingExperienceOption1 = ckaAssessment.workingExperienceOption1;
                assessment.workingExperienceOption2 = ckaAssessment.workingExperienceOption2;
                assessment.educationalExperienceList = ckaAssessment.educationalExperienceList;
                assessment.investmentExperienceList = ckaAssessment.investmentExperienceList;
                assessment.workingExperienceList = ckaAssessment.workingExperienceList;

                ct.SubmitChanges();

            }
            catch (Exception e)
            {
                string str = e.Message;
            }
        }
        public retirementgoal updateRetirementGoals(retirementgoal goals)
        {
            retirementgoal retrievedGoal = null;

            try
            {
                dbDataContext ct = new dbDataContext();

                //retrieve existing retirement goal
                var queryRetirementGoals = from sg in ct.retirementgoals
                                       where sg.caseid == goals.caseid
                                       && sg.selforspouse == goals.selforspouse
                                       select sg;
                foreach (retirementgoal sgoals in queryRetirementGoals)
                {
                    retrievedGoal = sgoals;
                }

                //update retirement goal attributes
                retrievedGoal.durationretirement = goals.durationretirement;
                retrievedGoal.futureincome = goals.futureincome;
                retrievedGoal.incomerequired = goals.incomerequired;
                retrievedGoal.intendedretirementage = goals.intendedretirementage;
                retrievedGoal.lumpsumrequired = goals.lumpsumrequired;
                retrievedGoal.maturityvalue = goals.maturityvalue;
                retrievedGoal.sourcesofincome = goals.sourcesofincome;
                retrievedGoal.total = goals.total;
                retrievedGoal.totalfirstyrincome = goals.totalfirstyrincome;
                retrievedGoal.yrstoretirement = goals.yrstoretirement;
                retrievedGoal.existingassetstotal = goals.existingassetstotal;
                retrievedGoal.inflationreturnrate = goals.inflationreturnrate;
                retrievedGoal.inflationrate = goals.inflationrate;
                retrievedGoal.retirementGoalNeeded = goals.retirementGoalNeeded;

                //delete existing assets for the retirement goal
                var queryExistingAssets = from easg in ct.existingassetrgs
                                          where easg.retirementgoalsid == retrievedGoal.id
                                       select easg;
                foreach (existingassetrg easgoals in queryExistingAssets)
                {
                    ct.existingassetrgs.DeleteOnSubmit(easgoals);
                    //ct.SubmitChanges();
                }

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

                ct.SubmitChanges();

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

            return retrievedGoal;
        }
Beispiel #15
0
        public void saveNewRiskProfile(RiskProfileAnalysis RiskProfileDetails)
        {
            try
            {
                dbDataContext ct = new dbDataContext();

                if (RiskProfileDetails.agreeWithRiskProfileoption2 == "true")
                {
                    RiskProfileDetails.riskProfileName = getRiskProfileName(Int32.Parse(RiskProfileDetails.riskProfileValue));
                }
                else
                {
                    int score = calculateRiskProfile(RiskProfileDetails);
                    RiskProfileDetails.riskProfileValue = score + "";
                    String profile_name = getRiskProfileName(score);
                    RiskProfileDetails.riskProfileName = profile_name;

                }

                ct.RiskProfileAnalysis.InsertOnSubmit(RiskProfileDetails);
                ct.SubmitChanges();
            }
            catch (Exception e)
            {
                string str = e.Message;
            }
        }
Beispiel #16
0
        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;
        }
Beispiel #17
0
        public savinggoal updateSavingGoals(savinggoal goals, int sgid)
        {
            savinggoal retrievedGoal = null;

            try
            {
                dbDataContext ct = new dbDataContext();

                //retrieve existing saving goal
                var querySavingGoals = from sg in ct.savinggoals
                                       where sg.caseid == goals.caseid && sg.id == sgid
                                       select sg;
                foreach (savinggoal sgoals in querySavingGoals)
                {
                    retrievedGoal = sgoals;
                }

                //retrievedGoal = goals;

                //update saving goal attributes
                retrievedGoal.amtneededfv = goals.amtneededfv;
                retrievedGoal.goal = goals.goal;
                retrievedGoal.maturityvalue = goals.maturityvalue;
                retrievedGoal.regularannualcontrib = goals.regularannualcontrib;
                retrievedGoal.total = goals.total;
                retrievedGoal.yrstoaccumulate = goals.yrstoaccumulate;
                retrievedGoal.existingassetstotal = goals.existingassetstotal;
                retrievedGoal.savingGoalNeeded = goals.savingGoalNeeded;

                //delete existing assets for the saving goal
                var queryExistingAssets = from easg in ct.existingassetsgs
                                          where easg.savinggoalsid == retrievedGoal.id
                                       select easg;
                foreach (existingassetsg easgoals in queryExistingAssets)
                {
                    ct.existingassetsgs.DeleteOnSubmit(easgoals);
                    //ct.SubmitChanges();
                }

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

                if (retrievedGoal.savingGoalNeeded == 1 || retrievedGoal.savingGoalNeeded == 0)
                {
                    var sgGoalRecords = from sgids in ct.savinggoals
                                        where sgids.caseid == goals.caseid
                                        select sgids;
                    int[] arrRecordIds = null;

                    if (sgGoalRecords != null)
                    {
                        int size = sgGoalRecords.ToArray().Length;
                        arrRecordIds = new int[size];
                    }

                    int index = 0;
                    foreach (savinggoal sgl in sgGoalRecords)
                    {
                        arrRecordIds[index] = sgl.id;
                        index++;
                    }

                    var todelExistingAssets = from easg in ct.existingassetsgs
                                              where arrRecordIds.Contains(easg.savinggoalsid)
                                              select easg;
                    foreach (existingassetsg easgoals in todelExistingAssets)
                    {
                        ct.existingassetsgs.DeleteOnSubmit(easgoals);
                    }

                    var toDeleteSgGoals = from sg in ct.savinggoals
                                          where sg.caseid == goals.caseid && sg.id != sgid
                                          select sg;
                    foreach (savinggoal s in toDeleteSgGoals)
                    {
                        ct.savinggoals.DeleteOnSubmit(s);
                    }
                }

                ct.SubmitChanges();

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

            return retrievedGoal;
        }
Beispiel #18
0
        public void updateRiskProfileDetails(RiskProfileAnalysis riskProfile,string type)
        {
            RiskProfileAnalysis riskProfileAnalysis = null;
            try
            {
                dbDataContext ct = new dbDataContext();

                //retrieve existing saving goal
                var queryRiskProfileDetails = from al in ct.RiskProfileAnalysis
                                                  where al.caseId == riskProfile.caseId
                                                  select al;
                foreach (RiskProfileAnalysis riskProfileVariable in queryRiskProfileDetails)
                {
                    riskProfileAnalysis = riskProfileVariable;
                }

                riskProfileAnalysis.caseId=riskProfile.caseId;

                    riskProfileAnalysis.agreeWithRiskProfileoption1 = riskProfile.agreeWithRiskProfileoption1;
                    riskProfileAnalysis.agreeWithRiskProfileoption2 = riskProfile.agreeWithRiskProfileoption2;

                    riskProfileAnalysis.riskApetiteQuestion1option1 = riskProfile.riskApetiteQuestion1option1;
                    riskProfileAnalysis.riskApetiteQuestion1option2 = riskProfile.riskApetiteQuestion1option2;
                    riskProfileAnalysis.riskApetiteQuestion1option3 = riskProfile.riskApetiteQuestion1option3;
                    riskProfileAnalysis.riskApetiteQuestion1option4 = riskProfile.riskApetiteQuestion1option4;
                    riskProfileAnalysis.riskApetiteQuestion1option5 = riskProfile.riskApetiteQuestion1option5;
                    riskProfileAnalysis.riskApetiteQuestion1option6 = riskProfile.riskApetiteQuestion1option6;

                    riskProfileAnalysis.riskApetiteQuestion2option1 = riskProfile.riskApetiteQuestion2option1;
                    riskProfileAnalysis.riskApetiteQuestion2option2 = riskProfile.riskApetiteQuestion2option2;
                    riskProfileAnalysis.riskApetiteQuestion2option3 = riskProfile.riskApetiteQuestion2option3;
                    riskProfileAnalysis.riskApetiteQuestion2option4 = riskProfile.riskApetiteQuestion2option4;

                    riskProfileAnalysis.riskApetiteQuestion3option1 = riskProfile.riskApetiteQuestion3option1;
                    riskProfileAnalysis.riskApetiteQuestion3option2 = riskProfile.riskApetiteQuestion3option2;
                    riskProfileAnalysis.riskApetiteQuestion3option3 = riskProfile.riskApetiteQuestion3option3;
                    riskProfileAnalysis.riskApetiteQuestion3option4 = riskProfile.riskApetiteQuestion3option4;
                    riskProfileAnalysis.riskApetiteQuestion3option5 = riskProfile.riskApetiteQuestion3option5;

                    riskProfileAnalysis.riskApetiteQuestion4option1 = riskProfile.riskApetiteQuestion4option1;
                    riskProfileAnalysis.riskApetiteQuestion4option2 = riskProfile.riskApetiteQuestion4option2;
                    riskProfileAnalysis.riskApetiteQuestion4option3 = riskProfile.riskApetiteQuestion4option3;

                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion1option1 = riskProfile.measuringRiskTakingAbilityQuestion1option1;
                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion1option2 = riskProfile.measuringRiskTakingAbilityQuestion1option2;
                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion1option3 = riskProfile.measuringRiskTakingAbilityQuestion1option3;
                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion1option4 = riskProfile.measuringRiskTakingAbilityQuestion1option4;

                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion2option1 = riskProfile.measuringRiskTakingAbilityQuestion2option1;
                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion2option2 = riskProfile.measuringRiskTakingAbilityQuestion2option2;
                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion2option3 = riskProfile.measuringRiskTakingAbilityQuestion2option3;

                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion3option1 = riskProfile.measuringRiskTakingAbilityQuestion3option1;
                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion3option2 = riskProfile.measuringRiskTakingAbilityQuestion3option2;
                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion3option3 = riskProfile.measuringRiskTakingAbilityQuestion3option3;
                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion3option4 = riskProfile.measuringRiskTakingAbilityQuestion3option4;

                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion4option1 = riskProfile.measuringRiskTakingAbilityQuestion4option1;
                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion4option2 = riskProfile.measuringRiskTakingAbilityQuestion4option2;
                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion4option3 = riskProfile.measuringRiskTakingAbilityQuestion4option3;
                    riskProfileAnalysis.measuringRiskTakingAbilityQuestion4option4 = riskProfile.measuringRiskTakingAbilityQuestion4option4;

            if (riskProfileAnalysis.agreeWithRiskProfileoption2 == "true")
                {
                    riskProfileAnalysis.riskProfileValue = riskProfile.riskProfileValue;
                    riskProfileAnalysis.riskProfileName = getRiskProfileName(Int32.Parse(riskProfile.riskProfileValue));
                }
                else
                {
                    int score = calculateRiskProfile(riskProfile);
                    riskProfileAnalysis.riskProfileValue = score + "";
                    String profile_name = getRiskProfileName(score);
                    riskProfileAnalysis.riskProfileName = profile_name;

                }
                ct.SubmitChanges();
            }
            catch (Exception e)
            {
                string str = e.Message;
            }
        }
Beispiel #19
0
 public void logException(exceptionlog exLog)
 {
     try
     {
         dbDataContext db = new dbDataContext();
         db.exceptionlogs.InsertOnSubmit(exLog);
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         string str = e.Message;
     }
 }
        public Boolean updateAssetLiabilityDetails(assetAndLiability assetAndLiability)
        {
            Boolean status = true;
            assetAndLiability assetLiability = null;
            try
            {
                dbDataContext ct = new dbDataContext();

                //retrieve existing saving goal
                var queryAssetAndLiabilityGoals = from al in ct.assetAndLiabilities
                                       where al.caseId == assetAndLiability.caseId
                                       select al;
                foreach (assetAndLiability assetLiabilityGoals in queryAssetAndLiabilityGoals)
                {
                    assetLiability = assetLiabilityGoals;
                }

                assetLiability.bankAcctCash = assetAndLiability.bankAcctCash;
                assetLiability.cashLoan = assetAndLiability.cashLoan;
                assetLiability.cpfoaBal = assetAndLiability.cpfoaBal;
                assetLiability.creditCard = assetAndLiability.creditCard;
                assetLiability.homeMortgage = assetAndLiability.homeMortgage;
                assetLiability.ilpCash = assetAndLiability.ilpCash;
                assetLiability.ilpCpf = assetAndLiability.ilpCpf;
                assetLiability.invPropCash = assetAndLiability.invPropCash;
                assetLiability.invPropCpf = assetAndLiability.invPropCpf;
                assetLiability.lumpSumCash = assetAndLiability.lumpSumCash;
                assetLiability.lumpSumCpf = assetAndLiability.lumpSumCpf;
                assetLiability.netWorth = assetAndLiability.netWorth;
                assetLiability.regularSumCash = assetAndLiability.regularSumCash;
                assetLiability.regularSumCpf = assetAndLiability.regularSumCpf;
                assetLiability.resPropCash = assetAndLiability.resPropCash;
                assetLiability.resPropCpf = assetAndLiability.resPropCpf;
                assetLiability.srsBal = assetAndLiability.srsBal;
                assetLiability.srsInvCash = assetAndLiability.srsInvCash;
                assetLiability.stocksSharesCash = assetAndLiability.stocksSharesCash;
                assetLiability.stocksSharesCpf = assetAndLiability.stocksSharesCpf;
                assetLiability.submissionDate = assetAndLiability.submissionDate;
                assetLiability.unitTrustsCash = assetAndLiability.unitTrustsCash;
                assetLiability.unitTrustsCpf = assetAndLiability.unitTrustsCpf;
                assetLiability.vehicleLoan = assetAndLiability.vehicleLoan;
                assetLiability.cpfsaBal = assetAndLiability.cpfsaBal;
                assetLiability.cpfMediSaveBalance = assetAndLiability.cpfMediSaveBalance;
                assetLiability.assetAndLiabilityNeeded = assetAndLiability.assetAndLiabilityNeeded;
                assetLiability.assetAndLiabilityNotNeededReason = assetAndLiability.assetAndLiabilityNotNeededReason;
                assetLiability.assetIncomePercent = assetAndLiability.assetIncomePercent;
                assetLiability.premiumRecomendedNeeded = assetAndLiability.premiumRecomendedNeeded;

                var queryliabilityOthers = from liabilityOther in ct.liabilityOthers
                                           where liabilityOther.assetLiabilityId == assetAndLiability.id
                                           select liabilityOther;
                foreach (liabilityOther liabilityOthers in queryliabilityOthers)
                {
                    ct.liabilityOthers.DeleteOnSubmit(liabilityOthers);
                }

                var querypersonalUseAssetsOthers = from personalUseAssetsOther in ct.personalUseAssetsOthers
                                                   where personalUseAssetsOther.assetLiabilityId == assetAndLiability.id
                                                   select personalUseAssetsOther;
                foreach (personalUseAssetsOther personalUseAssetsOther  in querypersonalUseAssetsOthers)
                {
                    ct.personalUseAssetsOthers.DeleteOnSubmit(personalUseAssetsOther);
                }

                var queryinvestedAssetOthers = from investedAssetOthers in ct.investedAssetOthers
                                               where investedAssetOthers.assetLiabilityId == assetAndLiability.id
                                               select investedAssetOthers;
                foreach (investedAssetOther investedAssetOther in queryinvestedAssetOthers)
                {
                    ct.investedAssetOthers.DeleteOnSubmit(investedAssetOther);
                }

                //update liability others list for the AssetLiability goal
                if (assetAndLiability.liabilityOthers != null && assetAndLiability.liabilityOthers.Count > 0)
                {
                    EntitySet<liabilityOther> liabilityOtherSet = new EntitySet<liabilityOther>();
                    foreach (liabilityOther liabilityOther in assetAndLiability.liabilityOthers)
                    {
                        liabilityOtherSet.Add(liabilityOther);
                    }
                    assetLiability.liabilityOthers = liabilityOtherSet;
                }

                //update personal UseAssets others list for the AssetLiability
                if (assetAndLiability.personalUseAssetsOthers != null && assetAndLiability.personalUseAssetsOthers.Count > 0)
                {
                    EntitySet<personalUseAssetsOther> personalUseAssetsOtherSet = new EntitySet<personalUseAssetsOther>();
                    foreach (personalUseAssetsOther liabilityOther in assetAndLiability.personalUseAssetsOthers)
                    {
                        personalUseAssetsOtherSet.Add(liabilityOther);
                    }
                    assetLiability.personalUseAssetsOthers = personalUseAssetsOtherSet;
                }

                //update invested others list for the AssetLiability
                if (assetAndLiability.investedAssetOthers != null && assetAndLiability.investedAssetOthers.Count > 0)
                {
                    EntitySet<investedAssetOther> investedAssetOtherSet = new EntitySet<investedAssetOther>();
                    foreach (investedAssetOther investedAssetOther in assetAndLiability.investedAssetOthers)
                    {
                        investedAssetOtherSet.Add(investedAssetOther);
                    }
                    assetLiability.investedAssetOthers = investedAssetOtherSet;
                }

                ct.SubmitChanges();
            }
            catch (Exception e)
            {
                status = false;
                string str = e.Message;
            }

            return status;
        }
Beispiel #21
0
        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;
                }

                //delete existing assets for my needs disability income
                var queryExistingDisablityAssets = from eamyneed in ct.myNeedsDisabilityAssets
                                                  where eamyneed.myNeedId == retrievedNeed.id
                                                  select eamyneed;
                foreach (myNeedsDisabilityAsset eamyneeds in queryExistingDisablityAssets)
                {
                    ct.myNeedsDisabilityAssets.DeleteOnSubmit(eamyneeds);
                    //ct.SubmitChanges();
                }

                //update existing assets list for disability income
                if (needs.myNeedsDisabilityAssets != null && needs.myNeedsDisabilityAssets.Count > 0)
                {
                    EntitySet<myNeedsDisabilityAsset> eaMNDisabilityList = new EntitySet<myNeedsDisabilityAsset>();
                    foreach (myNeedsDisabilityAsset mnea in needs.myNeedsDisabilityAssets)
                    {
                        eaMNDisabilityList.Add(mnea);
                    }
                    retrievedNeed.myNeedsDisabilityAssets = eaMNDisabilityList;
                }

                ct.SubmitChanges();

            }
            catch (Exception ex)
            {
                logException(ex);
                throw ex;
            }

            return retrievedNeed;
        }
        public personaldetail updatePersonalDetails(personaldetail personalDetail)
        {
            dbDataContext ct = new dbDataContext();
            personaldetail detail = null;
            //retrieve existing saving goal
            var queryPersonalDetails = from al in ct.personaldetails
                                       where al.caseid == personalDetail.caseid
                                       select al;
            foreach (personaldetail personalDetailObject in queryPersonalDetails)
            {
                detail = personalDetailObject;
            }

            detail.name = personalDetail.name;
            detail.surname = personalDetail.surname;
            detail.address = personalDetail.address;
            detail.companyname = personalDetail.companyname;
            detail.contactnumber = personalDetail.contactnumber;
            detail.contactnumberfax = personalDetail.contactnumberfax;
            detail.contactnumberhp = personalDetail.contactnumberhp;
            detail.contactnumberoffice = personalDetail.contactnumberoffice;
            detail.datepicker = personalDetail.datepicker;
            detail.educationlevel = personalDetail.educationlevel;
            detail.email = personalDetail.email;
            detail.employmentstatus = personalDetail.employmentstatus;
            detail.gender = personalDetail.gender;

            detail.maritalstatus = personalDetail.maritalstatus;
            detail.medicalcondition = personalDetail.medicalcondition;
            detail.medicalconditiondetails = personalDetail.medicalconditiondetails;
            detail.nationality = personalDetail.nationality;
            detail.nationalityothers = personalDetail.nationalityothers;
            detail.nominee = personalDetail.nominee;
            detail.will = personalDetail.will;
            detail.nric = personalDetail.nric;
            detail.occupation = personalDetail.occupation;
            detail.title = personalDetail.title;
            detail.titleothers = personalDetail.titleothers;
            detail.issmoker = personalDetail.issmoker;

            detail.familyDetailsRequired = personalDetail.familyDetailsRequired;
            detail.spokenLanguage = personalDetail.spokenLanguage;
            detail.spokenLanguageOtherstxt = personalDetail.spokenLanguageOtherstxt;
            detail.writtenLanguage = personalDetail.writtenLanguage;
            detail.writtenLanguageOtherstxt = personalDetail.writtenLanguageOtherstxt;
            detail.accompanyQuestion = personalDetail.accompanyQuestion;
            detail.trustedIndividualName = personalDetail.trustedIndividualName;
            detail.clientRelationship = personalDetail.clientRelationship;
            detail.NRICAccompany = personalDetail.NRICAccompany;
            detail.noAccompaniedIndividualReason = personalDetail.noAccompaniedIndividualReason;

            var queryfamilyMembers = from familyMemberDetails in ct.familyMemberDetails
                                       where familyMemberDetails.personalDetailId == detail.id
                                     select familyMemberDetails;
            foreach (familyMemberDetail familyMembers in queryfamilyMembers)
            {
                ct.familyMemberDetails.DeleteOnSubmit(familyMembers);
            }

            if (detail.familyDetailsRequired == "1")
            {
                //update family member details
                if (personalDetail.familyMemberDetails != null && personalDetail.familyMemberDetails.Count > 0)
                {
                    EntitySet<familyMemberDetail> familyMemberDetailSet = new EntitySet<familyMemberDetail>();
                    foreach (familyMemberDetail familyDetail in personalDetail.familyMemberDetails)
                    {
                        familyMemberDetailSet.Add(familyDetail);

                    }
                    detail.familyMemberDetails = familyMemberDetailSet;
                }
            }

            ct.SubmitChanges();
            return detail;
        }
Beispiel #23
0
        public void saveClonemapping(clonemappingid clonemapping)
        {
            try
            {
                dbDataContext db = new dbDataContext();
                db.clonemappingids.InsertOnSubmit(clonemapping);
                db.SubmitChanges();
            }
            catch (Exception e)
            {
                //log exception to db
                exceptionlog exLog = new exceptionlog();
                exLog.message = e.Message + " class: ActivityStatusDAO Method: saveClonemapping";
                exLog.source = e.Source;

                string strtmp = e.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = e.TargetSite.Name;

                logException(exLog);
            }
        }
Beispiel #24
0
        public void saveOrUpdateActivityStatus(string caseid, string activity, string status)
        {
            activitystatus actstatus = null;

            try
            {
                dbDataContext ct = new dbDataContext();

                //retrieve existing activity status
                var queryActivityStatus = from actst in ct.activitystatus
                                          where actst.caseid == caseid && actst.activity == activity
                                          select actst;

                foreach (activitystatus a in queryActivityStatus)
                {
                    actstatus = a;
                }
                if (actstatus == null)
                {
                    //adding new status
                    activitystatus actStatus = new activitystatus();
                    actStatus.caseid = caseid;
                    actStatus.activity = activity;
                    actStatus.status = status;
                    ct.activitystatus.InsertOnSubmit(actStatus);
                }
                else
                {
                    //update activity status
                    actstatus.status = status;
                }

                ct.SubmitChanges();
            }
            catch (Exception e)
            {
                string str = e.Message;
            }
        }
Beispiel #25
0
        public void saveSalesPortalInfo(string caseid, salesportalinfo salesPortalInfo)
        {
            salesportalinfo spistatus = null;

            try
            {
                dbDataContext ct = new dbDataContext();

                //retrieve existing sales portal info
                var querySalesPortalInfo = from spi in ct.salesportalinfos
                                          where spi.activityid == caseid
                                          select spi;

                foreach (salesportalinfo a in querySalesPortalInfo)
                {
                    spistatus = a;
                }
                if (spistatus == null)
                {
                    //adding new sales portal info
                    ct.salesportalinfos.InsertOnSubmit(salesPortalInfo);
                }
                else
                {
                    //update sales portal info
                    spistatus.activitytype = salesPortalInfo.activitytype;
                    spistatus.caseid = salesPortalInfo.caseid;
                    spistatus.redirecturl = salesPortalInfo.redirecturl;
                    spistatus.roletype = salesPortalInfo.roletype;
                    spistatus.salesportalurl = salesPortalInfo.salesportalurl;
                    spistatus.userfirstname = salesPortalInfo.userfirstname;
                    spistatus.userid = salesPortalInfo.userid;
                    spistatus.userlastname = salesPortalInfo.userlastname;
                    spistatus.usertype = salesPortalInfo.usertype;
                    spistatus.casestatus = salesPortalInfo.casestatus;
                    spistatus.country = salesPortalInfo.country;
                    spistatus.saleschannel = salesPortalInfo.saleschannel;
                }

                ct.SubmitChanges();
            }
            catch (Exception e)
            {
                //log exception to db
                exceptionlog exLog = new exceptionlog();
                exLog.message = e.Message + " class: ActivityStatusDAO Method: saveSalesPortalInfo";
                exLog.source = e.Source;

                string strtmp = e.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = e.TargetSite.Name;

                logException(exLog);
            }
        }