Ejemplo n.º 1
0
        public ActionResult Add(Tariff tariff, FormCollection form)
        {
            bool response = _tariffService.AddnewTariff(tariff);

            //Add Defaultcategory for both drug and service
            TariffCategory category = new TariffCategory();

            category.Name        = "ALL Drugs";
            category.Description = "all the drugs in the tariff.";
            category.TariffId    = tariff.Id;
            category.Type        = 0;
            _tariffService.AddnewCategory(category);


            //Category Service
            TariffCategory category2 = new TariffCategory();

            category2.Name        = "ALL Services";
            category2.Description = "all the services in the tariff.";
            category2.TariffId    = tariff.Id;
            category2.Type        = 1;
            _tariffService.AddnewCategory(category2);


            //assign to a provider

            if (tariff.defaultProvider > 0)
            {
                Provider theprovider = _providerSvc.GetProvider(tariff.defaultProvider);

                if (theprovider != null)
                {
                    theprovider.ProviderTariffs = tariff.Id.ToString();
                    _providerSvc.UpdateProvider(theprovider);
                }
            }



            if (response)
            {
                //successfule
                //Set the success message for user to see
                _pageMessageSvc.SetSuccessMessage(string.Format("Tariff [{0}] was added successfully.", tariff.Name.ToUpper()));
            }
            else
            {
                _pageMessageSvc.SetErrormessage(string.Format("There was a problem  adding tariff [{0}] ",
                                                              tariff.Name.ToUpper()));
            }

            return(_uniquePageService.RedirectTo <TariffPage>());
        }
Ejemplo n.º 2
0
        public ActionResult DownloadFile(int Id)
        {
            DownloadFile filee = _helperSvc.getDownloadedFile(Id);

            if (filee != null)
            {
                //string filename = filee.fileName + ".zip";
                //string filepath = filee.filelink;
                //byte[] filedata = System.IO.File.ReadAllBytes(filepath);
                //string contentType = MimeMapping.GetMimeMapping(filee.filelink);

                //var cd = new System.Net.Mime.ContentDisposition
                //{
                //    FileName = filename ,
                //    Inline = true,
                //};
                //Response.AppendHeader("Content-Disposition", cd.ToString());


                int count = filee.downloadCount + 1;
                filee.downloadCount = count;
                _helperSvc.updateDownloadFile(filee);

                return(Redirect(filee.filelink));
                //return File(filedata, contentType);
            }

            _pageMessageSvc.SetErrormessage("The file does not exist.");
            return(_uniquePageService.RedirectTo <DownloadFilesPage>());
        }
Ejemplo n.º 3
0
        public ActionResult Add(ServiceVm services)
        {
            //set the created user
            bool response = _serviceService.AddnewService(services);

            if (response)
            {
                //successfule
                //Set the success message for user to see
                _pageMessageSvc.SetSuccessMessage(string.Format("Service [{0}] was added successfully.", services.Name.ToUpper()));
                //Session["PageSuccessMessage"] = string.Format("Service [{0}] was added successfully.", services.Name.ToUpper());
            }
            else
            {
                //there was an error
                //Set the Error message for user to see
                //Session["PageErrorMessage"] = string.Format("There was an error adding service [{0}] ", services.Name.ToUpper());
                _pageMessageSvc.SetErrormessage(string.Format("There was an error adding service [{0}] ",
                                                              services.Name.ToUpper()));
            }

            return(_uniquePageService.RedirectTo <ServicesPage>());
        }
Ejemplo n.º 4
0
        public ActionResult TestService(FormCollection Form)
        {
            string idd                      = Form["previousid"];
            string fullname                 = Form["fullnametxt"];
            string gender                   = Form["gender"];
            string country                  = Form["country"];
            string state                    = Form["state"];
            string zipcode                  = Form["zipcode"];
            string address                  = Form["Address"];
            string phonenumber              = Form["phonenumber"];
            string emaill                   = Form["email"];
            string occupation               = Form["occupation"];
            string secondaryemail           = Form["ssemail"];
            string addon                    = Form["addon"];;
            string instalment               = Form["Instalment"];
            string policystart              = Form["policystartdate"];
            string policyend                = Form["policyenddate"];
            string policynotificationConfig = Form["Policynotificationconfig"];

            string bencount = Form["beneCount"];
            List <ConnectCareBeneficiary> benelist = new List <ConnectCareBeneficiary>();

            bool notnew = false;


            ConnectCareSponsor sponsordetails = new ConnectCareSponsor();

            bool sendpolicynumber = false;

            int previousid = 0;

            if (!string.IsNullOrEmpty(idd) && int.TryParse(idd, out previousid))
            {
                ConnectCareSponsor prsponsor = _helperSvc.GetSponsor(previousid);

                if (prsponsor == null)
                {
                    _pageMessageSvc.SetErrormessage("Seem the sponsor have been deleted from the system.");
                    return(_uniquePageService.RedirectTo <ConnectCareNewSponsorPage>());
                }
                notnew         = true;
                sponsordetails = prsponsor;

                DateTime startdate = Convert.ToDateTime(prsponsor.PolicyStartDate);
                DateTime enddate   = Convert.ToDateTime(prsponsor.PolicyEndDate);


                if (!string.IsNullOrEmpty(policystart) && !string.IsNullOrEmpty(policyend))
                {
                    if (startdate.Year > 2012 && enddate.Year > 2012 && (prsponsor.PolicyStartDate != Tools.ParseMilitaryTime(policystart) || prsponsor.PolicyEndDate != Tools.ParseMilitaryTime(policyend)))
                    {
                        sendpolicynumber = true;
                    }
                }
            }


            sponsordetails.fullname                 = fullname;
            sponsordetails.gender                   = gender;
            sponsordetails.country                  = country;
            sponsordetails.state                    = state;
            sponsordetails.zipcode                  = zipcode;
            sponsordetails.address                  = address;
            sponsordetails.phonenumber              = phonenumber;
            sponsordetails.email                    = emaill;
            sponsordetails.occupation               = occupation;
            sponsordetails.secondarysponsor         = secondaryemail;
            sponsordetails.Addon                    = addon == "0" ? false : true;;
            sponsordetails.instalment               = Convert.ToInt32(instalment);
            sponsordetails.PolicyStartDate          = !string.IsNullOrEmpty(policystart) ? Tools.ParseMilitaryTime(policystart) : CurrentRequestData.Now.AddYears(-100);
            sponsordetails.PolicyEndDate            = !string.IsNullOrEmpty(policyend) ? Tools.ParseMilitaryTime(policyend) : CurrentRequestData.Now.AddYears(-100);
            sponsordetails.PolicynotificationConfig = Convert.ToInt32(policynotificationConfig);

            if (!notnew)
            {
                sponsordetails.policynumber = _helperSvc.GenerateCCPolicyNumber();
                sponsordetails.sponsorSTRID = "";
                _helperSvc.addSponsor(sponsordetails);
            }
            else
            {
                _helperSvc.UpdateSponsor(sponsordetails);
            }



            List <ConnectCareBeneficiary> beneficiarylist = new List <ConnectCareBeneficiary>();



            int bene_count = 1;

            if (int.TryParse(bencount, out bene_count))
            {
                for (int i = 1; i <= bene_count; i++)
                {
                    bool benenotnew = false;
                    //Beneficiary
                    string prID = Form["bIDtxt_" + i.ToString()];

                    int prIDint = 0;


                    string bfirstname    = Form["bfirstnametxt_" + i.ToString()];
                    string blastname     = Form["blastnametxt_" + i.ToString()];
                    string bgender       = Form["bgender_" + i.ToString()];
                    string bcategory     = Form["bcat_" + i.ToString()];
                    string bdob          = Form["bdob_" + i.ToString()];
                    string brelationship = Form["brelationship_" + i.ToString()];
                    string bcountry      = Form["bcountry_" + i.ToString()];
                    string bstate        = Form["bstate_" + i.ToString()];
                    string bcity         = Form["bcity_" + i.ToString()];
                    string blga          = Form["blga_" + i.ToString()];
                    string baddress      = Form["baddress_" + i.ToString()];
                    string bemail        = Form["bemail_" + i.ToString()];
                    string bphonnumber   = Form["bphonenumber_" + i.ToString()];
                    string bgaudemail    = Form["bgemail_" + i.ToString()];
                    string bgphone       = Form["bgphonenumber_" + i.ToString()];

                    string suggprovider       = Form["bsuggestedprovider_" + i.ToString()];
                    string suggplan           = Form["bsuggestedplan_" + i.ToString()];
                    string verificationstatus = Form["bverificationstatus_" + i.ToString()];
                    string baddon             = Form["baddon_" + i.ToString()];



                    ConnectCareBeneficiary benefit = new ConnectCareBeneficiary();
                    if (!string.IsNullOrEmpty(prID) && int.TryParse(prID, out prIDint))
                    {
                        ConnectCareBeneficiary pbene = _helperSvc.getBeneficiary(prIDint);

                        if (pbene != null)
                        {
                            benenotnew = true;
                            benefit    = pbene;
                        }
                    }
                    benefit.sponsorid       = sponsordetails.Id;
                    benefit.sponsoridstring = sponsordetails.sponsorSTRID;
                    benefit.firstname       = bfirstname;
                    benefit.lastname        = blastname;
                    benefit.gender          = bgender;
                    if (!benenotnew)
                    {
                        benefit.PolicyNumber = sponsordetails.policynumber + "-" + i.ToString();
                    }

                    benefit.Category            = bcategory;
                    benefit.dob                 = Tools.ParseMilitaryTime(bdob);
                    benefit.relationship        = brelationship;
                    benefit.country             = bcountry;
                    benefit.state               = bstate;
                    benefit.city                = bcity;
                    benefit.LGA                 = blga;
                    benefit.address             = baddress;
                    benefit.email               = bemail;
                    benefit.phonenumber         = bphonnumber;
                    benefit.GuardianEmail       = bgaudemail;
                    benefit.GuardianPhonenumber = bgphone;
                    benefit.suggestedPlan       = suggplan;
                    benefit.SuggestedProvider   = suggprovider;
                    benefit.VerificationStatus  = verificationstatus == "1" ? true : false;;
                    benefit.BeneficiaryID       = "NHACCB-" + benefit.Id.ToString();
                    benefit.addon               = baddon == "1" ? true : false;

                    //add beneficiary


                    beneficiarylist.Add(benefit);


                    _helperSvc.addBeneficiary(benefit);

                    benefit.BeneficiaryID = "NHACCB-" + benefit.Id.ToString();


                    _helperSvc.addBeneficiary(benefit);
                    //update
                }
            }

            //save to database
            //var resp = _helperSvc.addSponsor(sponsordetails);

            if (true)
            {
                ServiceReference1.sponsordata            sponsor       = new ServiceReference1.sponsordata();
                List <ServiceReference1.beneficiarydata> beneficiaries = new List <ServiceReference1.beneficiarydata>();
                //double[] balance = new double[10];

                sponsor.fullname                 = sponsordetails.fullname;
                sponsor.phonenumber              = sponsordetails.phonenumber;
                sponsor.sponsorid                = "NHACC-" + sponsordetails.Id.ToString();
                sponsor.email                    = sponsordetails.email;
                sponsor.country                  = sponsordetails.country;
                sponsor.state                    = sponsordetails.state;
                sponsor.gender                   = sponsordetails.gender;
                sponsor.address                  = sponsordetails.address;
                sponsor.zipcode                  = sponsordetails.zipcode;
                sponsor.occupation               = sponsordetails.occupation;
                sponsor.Policynumber             = string.Empty; //sponsordetails.policynumber;  no policynumber initially.
                sponsor.Instalment               = sponsordetails.instalment;
                sponsor.addon                    = sponsordetails.Addon;
                sponsor.Policynotificationconfig = sponsordetails.PolicynotificationConfig;
                sponsor.SponsorStartDate         = CurrentRequestData.Now.AddYears(-100); //Convert.ToDateTime(sponsordetails.PolicyStartDate);
                sponsor.PolicyStartDate          = CurrentRequestData.Now.AddYears(-100); //Convert.ToDateTime(sponsordetails.PolicyStartDate);
                sponsor.PolicyEndDate            = CurrentRequestData.Now.AddYears(-100); //Convert.ToDateTime(sponsordetails.PolicyEndDate);
                sponsor.SecondarySponsor         = sponsordetails.secondarysponsor;

                foreach (ConnectCareBeneficiary item in beneficiarylist)
                {
                    ServiceReference1.beneficiarydata beneficiary = new ServiceReference1.beneficiarydata();

                    //beneficiary details
                    beneficiary.beneficiaryid        = "NHACCB-" + item.Id.ToString();
                    beneficiary.sponsorid            = sponsor.sponsorid;
                    beneficiary.fullname             = item.firstname + " " + item.lastname;
                    beneficiary.email                = item.email;
                    beneficiary.gender               = item.gender;
                    beneficiary.phonenumber          = item.phonenumber;
                    beneficiary.relationship         = item.relationship;
                    beneficiary.category             = item.Category;
                    beneficiary.dateofbirth          = item.dob;
                    beneficiary.country              = item.country;
                    beneficiary.state                = item.state;
                    beneficiary.lga                  = item.LGA;
                    beneficiary.city                 = item.city;
                    beneficiary.guardianemail        = item.GuardianEmail;
                    beneficiary.guardianphone        = item.GuardianPhonenumber;
                    beneficiary.suggestedprovider    = item.SuggestedProvider;
                    beneficiary.suggestedplan        = item.suggestedPlan;
                    beneficiary.Policynumber         = item.PolicyNumber;
                    beneficiary.addon                = item.addon;
                    beneficiary.BeneficiaryStartDate = DateTime.Now.AddYears(2);
                    beneficiary.VerificationStatus   = item.VerificationStatus;

                    beneficiaries.Add(beneficiary);

                    if (notnew && beneficiary.VerificationStatus)
                    {
                        //update the shit
                        string resp = serv.SENDVERIFIEDBENDTLS(beneficiary);
                    }
                }
                ServiceReference1.ArrayOfBeneficiarydata beneficairyyyydata = new ServiceReference1.ArrayOfBeneficiarydata();
                beneficairyyyydata.AddRange(beneficiaries);

                //send to Matontine
                try
                {
                    if (!notnew)
                    {//"success";
                        string respon = serv.SENDINSURDTLS(sponsor, beneficairyyyydata);

                        if (respon.ToLower().Contains("success"))
                        {
                            sponsordetails.sponsorSTRID      = sponsor.sponsorid;
                            sponsordetails.pushedtoMatontine = true;
                            sponsordetails.pushedDate        = CurrentRequestData.Now;
                            _helperSvc.UpdateSponsor(sponsordetails);
                        }
                    }
                    //not new and date changed


                    if (notnew && sendpolicynumber)
                    {
                        sponsor.Policynumber = sponsordetails.policynumber;
                        string respon = serv.SENDPOLICYNUMBER(sponsor, beneficairyyyydata);
                    }
                }
                catch (Exception ex)
                {
                    _pageMessageSvc.SetErrormessage("There was an error,sending to Matontine the data have been saved in the database.You can rety later by clicking on the push button.");

                    return(_uniquePageService.RedirectTo <ConnectCareNewSponsorPage>());
                }



                //var receive = serv.RECVBENDTLS();


                //foreach(var item in receive)
                //{
                //    item.suggestedplan = "Bronze-001";
                //    item.Policynumber = "NHA-010";
                //    item.suggestedprovider = "Testing";
                //    item.country = "SN";
                //    item.state = "State";
                //    item.lga = "dere";
                //    item.BeneficiaryStartDate = CurrentRequestData.Now;
                //    item.gender = "Male";
                //    item.beneficiaryid = "NHACCB-0081";
                //    item.VerificationStatus = true;


                //    //var tesst=serv.SENDVERIFIEDBENDTLS(item);

                //}

                //var payment = serv.RECVPAYMTDTLS();
            }
            if (notnew)
            {
                _pageMessageSvc.SetSuccessMessage("Sponsor Updated successfully.");
            }
            else
            {
                _pageMessageSvc.SetSuccessMessage("Sponsor Added successfully.");
            }


            return(_uniquePageService.RedirectTo <ConnectCareNewSponsorPage>());
        }