Пример #1
0
        protected void prebtnSubmitminor_Click(object sender, EventArgs e)
        {
            registerMultiView.SetActiveView(PaymentView);

            string fullname = TextFname.Text.Trim();
            string idno     = TextIdno.Text.Trim();
            //string phoneno = pretxtPhoneno.Text.Trim();
            string email       = pretxtEmail.Text.Trim();
            string countryr    = pretxtcountry.Text.Trim();
            string town        = pretxttown.Text.Trim();
            string pin         = TextPin.Text.Trim();
            string county      = pretcounty.Text.Trim();
            string reffullname = textrefName.Text.Trim();

            string refidno = pretxtRId.Text.Trim();
            //string refphone = Textrefphone.Text.Trim();

            string kinname  = TxtKnameMajor.Text.Trim();
            string kinID    = txtPrkinId.Text.Trim();
            string KinPhone = txtPrphone.Text.Trim();
            string rel      = ddlKinrelation.SelectedItem.Text;

            string guardianname  = TxtGname.Text.Trim();
            string guardianId    = pretxtKGid.Text.Trim();
            string guardianPhone = TextGphone.Text.Trim();

            string kinMinorname = TxtKinMinorname.Text.Trim();
            string relminor     = ddlKinminorrelation.SelectedItem.Text;


            var MobileString  = pretxtPhoneno.Text.Trim();
            var mobileBuilder = new StringBuilder(MobileString);

            mobileBuilder.Remove(0, 1);     //Trim one character from position 1
            mobileBuilder.Insert(0, "254"); // replace position 0 with 254
            MobileString = mobileBuilder.ToString();

            int    actype  = 0;
            int    idDocs  = 0;
            int    gen     = 0;
            string acctype = TextAcct.Text.Trim();

            switch (acctype)
            {
            case "Individual Deposists (BOSA)":
                actype = 0;
                break;

            case "KSA Individual (FOSA)":
                actype = 1;
                break;
            }
            string iddoc = pretxtIdtype.Text.Trim();

            switch (iddoc)
            {
            case "NATIONAL_ID":
                idDocs = 0;
                break;

            case "ID":
                idDocs = 1;
                break;
            }
            string gender = Textgnd.Text.Trim();

            switch (gender)
            {
            case "M":
                gen = 1;
                break;

            case "F":
                gen = 2;
                break;
            }

            string   dob = TextDob.Text;
            DateTime dt  = Convert.ToDateTime(dob);



            DateTime dobminor;
            var      kdb = kindob.Value;

            if (string.IsNullOrWhiteSpace(kdb))
            {
                SACCOFactory.ShowAlert("Please Select date of birth");
                kindob.Focus();
                return;
            }
            else
            {
                dobminor = DateTime.Parse(kdb);
            }


            string Guardiandob = TxtGdob.Text;

            DateTime Gdt = Convert.ToDateTime(Guardiandob);



            if (string.IsNullOrEmpty(fullname) || string.IsNullOrEmpty(iddoc) || string.IsNullOrEmpty(idno) ||
                string.IsNullOrEmpty(MobileString) || string.IsNullOrEmpty(email) || string.IsNullOrEmpty(acctype) || string.IsNullOrEmpty(countryr) || string.IsNullOrEmpty(town))
            {
                SACCOFactory.ShowAlert("Please fill all the empty required fields!");
                return;
            }
            else
            {
                try
                {
                    var     credentials = new NetworkCredential(ConfigurationManager.AppSettings["W_USER"], ConfigurationManager.AppSettings["W_PWD"], ConfigurationManager.AppSettings["DOMAIN"]);
                    Portals sup         = new Portals();
                    sup.Credentials     = credentials;
                    sup.PreAuthenticate = true;
                    sup.FnMemberApply(fullname, MobileString, email, idno, gen, pin, actype, dt, idDocs, countryr, county, town, refidno, reffullname);
                    sup.FnRegisterKin(guardianname, guardianId, "", guardianPhone, Gdt, idno, "GUARD");
                    sup.FnRegisterKin(kinMinorname, "", relminor, "", dobminor, idno, "MINOR");

                    SACCOFactory.ShowAlert("Your membership application submitted successfully. You will receive your Account details via SMS once approved. Thank you for choosing Kingdom sacco.");
                    //Your membership application submitted successfully. You will receive your Account details via SMS once approved. Thank you for choosing Kingdom sacco.
                    sup.IPRSPHOTOS(idno);
                }
                catch (Exception ex)
                {
                    SACCOFactory.ShowAlert(ex.Message);
                    //lblError.Text = ex.Message;
                    return;
                }
            }
        }