protected void Page_Load(object sender, EventArgs e)
        {
            lblStatusSubmissionFailed.Visible = false;
            lblStatusSubmitted.Visible = false;
            lblZurichAdvFailed.Visible = false;
            lblZurichAdvSuccess.Visible = false;

            activity = activityStatusDao.getActivity(13);
            ViewState["activity"] = activity;

            ZPlanResponseDataContract zPlanResponse = null;
            string clonedFrom = "";

            if (!IsPostBack)
            {

                /*string nextCaseId = Request.Form["caseid"];
                string menuCaseId = Request.QueryString["caseid"];

                if (nextCaseId != null && nextCaseId != "")
                {
                    caseid = nextCaseId;
                }

                if (menuCaseId != null && menuCaseId != "")
                {
                    caseid = menuCaseId;
                }*/

                string activityID = string.Empty;

                string country = string.Empty;
                if (Request.Form["Country"] != null)
                {
                    country = Request.Form["Country"].ToString();
                }

                string salesChannel = string.Empty;
                if (Request.Form["SalesChannel"] != null)
                {
                    salesChannel = Request.Form["SalesChannel"].ToString();
                }

                if (Request.Form["ActivityID"] != null)
                {
                    activityID = Request.Form["ActivityID"].ToString();
                    //activityID = "1500";

                    ZPlanDataContract zPlanContract = new ZPlanDataContract();
                    zPlanContract.ActivityId = activityID;
                    zPlanContract.Activity = ActivityTypeEnum.ZPlan;
                    zPlanContract.Action = ActionEnumContracts.View;
                    UserInfoEntity ufo = new UserInfoEntity();
                    ufo.Country = country;
                    ufo.RoleType = salesChannel;
                    zPlanContract.UserInfo = ufo;
                    zPlanResponse = new ZPlanResponseDataContract();

                    try
                    {
                        BusinessServiceClient client = new BusinessServiceClient();
                        client.ClientCredentials.Windows.AllowedImpersonationLevel =
                            System.Security.Principal.TokenImpersonationLevel.Impersonation;
                        zPlanResponse = client.ManageZPlan(zPlanContract);

                        if (zPlanResponse != null)
                        {
                            salesportalinfo salesPortalDto = new salesportalinfo();
                            salesPortalDto.activityid = activityID;
                            salesPortalDto.activitytype = zPlanResponse.ActivityType;
                            salesPortalDto.caseid = zPlanResponse.CaseId;
                            salesPortalDto.redirecturl = zPlanResponse.RedirectUrl;
                            salesPortalDto.roletype = zPlanResponse.RoleType;
                            salesPortalDto.salesportalurl = zPlanResponse.SalesPortalUrl;
                            salesPortalDto.userfirstname = zPlanResponse.UserFirstName;
                            salesPortalDto.userid = zPlanResponse.UserId;
                            salesPortalDto.userlastname = zPlanResponse.UserLastName;
                            salesPortalDto.usertype = zPlanResponse.UserType;
                            salesPortalDto.casestatus = zPlanResponse.CaseStatus;
                            salesPortalDto.country = country;
                            salesPortalDto.saleschannel = salesChannel;
                            activityStatusDao.saveSalesPortalInfo(activityID, salesPortalDto);

                            caseid = zPlanResponse.ActivityId;

                            //check if ClonedFrom is sent from portal
                            if (zPlanResponse.ClonedFrom != null && zPlanResponse.ClonedFrom != "")
                            {
                                clonedFrom = zPlanResponse.ClonedFrom;

                                //check if case has been cloned earlier
                                clonemappingid clonemapping = activityStatusDao.getCloneMappingForCaseid(clonedFrom, zPlanResponse.ActivityId);

                                if (clonemapping == null)
                                {
                                    //if the case is not cloned, add entry in the clone mapping table and clone the case
                                    clonemapping = new clonemappingid();
                                    clonemapping.clonedfrom = clonedFrom;
                                    clonemapping.newid = zPlanResponse.ActivityId;
                                    activityStatusDao.saveClonemapping(clonemapping);

                                    activityStatusDao.cloneCase(clonedFrom, zPlanResponse.ActivityId);
                                }

                            }

                        }
                    }
                    catch (Exception ex)
                    {
                        //log exception to db
                        exceptionlog exLog = new exceptionlog();
                        exLog.message = ex.Message + " class: MyZurichAdviser Method: Page_Load";
                        exLog.source = ex.Source;

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

                        exLog.targetsitename = ex.TargetSite.Name;

                        activityStatusDao.logException(exLog);
                    }

                }
                else
                {
                    string backCaseId = Request.Form["caseid"];
                    string menuCaseId = Request.QueryString["caseid"];

                    if (backCaseId != null && backCaseId != "")
                    {
                        caseid = backCaseId;
                    }
                    else if (menuCaseId != null && menuCaseId != "")
                    {
                        caseid = menuCaseId;
                    }
                    else if (Session["fnacaseid"] != null)
                    {
                        caseid = Session["fnacaseid"].ToString();
                    }
                    else
                    {
                        caseid = "2040";
                    }

                }

                activityId.Value = caseid;
                PersonalDetailsDAO dao = new PersonalDetailsDAO();
                personaldetail detail = dao.getPersonalDetail(caseid);

                if (detail != null)
                {
                    if (zPlanResponse != null)
                    {
                        detail.datepicker = zPlanResponse.Dob;
                        detail.gender = zPlanResponse.Gender;
                        //detail.maritalstatus = zPlanResponse.MaritalStatus;
                        detail.name = zPlanResponse.UserFirstName;
                        detail.surname = zPlanResponse.UserLastName;
                        detail.nationality = zPlanResponse.Nationality;
                        detail.nric = zPlanResponse.NricOrPassport;
                        detail.occupation = zPlanResponse.Occupation;
                        if (zPlanResponse.Smoker)
                        {
                            detail.issmoker = "Yes";
                        }
                        else
                        {
                            detail.issmoker = "No";
                        }
                        detail.title = zPlanResponse.Title;
                    }

                    dao.updatePersonalDetails(detail);
                }
                else
                {
                    detail = new personaldetail();
                    detail.caseid = caseid;

                    if (zPlanResponse != null)
                    {
                        detail.datepicker = zPlanResponse.Dob;
                        detail.gender = zPlanResponse.Gender;
                        //detail.maritalstatus = zPlanResponse.MaritalStatus;
                        detail.name = zPlanResponse.UserFirstName;
                        detail.surname = zPlanResponse.UserLastName;
                        detail.nationality = zPlanResponse.Nationality;
                        detail.nric = zPlanResponse.NricOrPassport;
                        detail.occupation = zPlanResponse.Occupation;
                        if (zPlanResponse.Smoker)
                        {
                            detail.issmoker = "Yes";
                        }
                        else
                        {
                            detail.issmoker = "No";
                        }
                        detail.title = zPlanResponse.Title;
                    }
                    dao.savePersonalDetails(detail);
                }

                if (caseid != "")
                {
                    ViewState["caseid"] = caseid;

                    List<myzurichadviser> savedMzaoptions = mzaDao.getMza(caseid);

                    if (savedMzaoptions != null && savedMzaoptions.Count>0)
                    {
                        ViewState["casetype"] = "update";
                    }
                    else
                    {
                        ViewState["casetype"] = "new";
                        savedMzaoptions = new List<myzurichadviser>();
                        myzurichadviser mzadv = new myzurichadviser();
                        mzadv.caseid = caseid;
                        mzadv.selectedoptionid = 1;
                        savedMzaoptions.Add(mzadv);

                        mzadv = new myzurichadviser();
                        mzadv.caseid = caseid;
                        mzadv.selectedoptionid = 2;
                        savedMzaoptions.Add(mzadv);
                    }

                    populateMzaoptions(savedMzaoptions, caseid);

                }

            }
            markStatusOnTab(caseid);
        }
Example #2
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);
            }
        }
Example #3
0
 partial void Updateclonemappingid(clonemappingid instance);
Example #4
0
 partial void Deleteclonemappingid(clonemappingid instance);
Example #5
0
 partial void Insertclonemappingid(clonemappingid instance);