Example #1
0
        private void ExistingCustomer()
        {
            ApiObjectFactory.GetObject <ResellerClub.Interface.IDomain>();
            //     ResellerClub.BusinessLogic.Customer customer = new ResellerClub.BusinessLogic.Customer(authUser, authPassword);
            ResellerClub.Interface.ICustomer customer = ApiObjectFactory.GetObject <ResellerClub.Interface.ICustomer>();


            //     customer.GetCustomerDetailByUserName(Request["input_email"]);
            trRegistrationForm.Style["display"] = "none";
            trUserOption.Style["display"]       = "";

            if (customer.ValidateCustomer(Request["input_email"], Request["password"]))
            {
                Guid sessionFID = Guid.NewGuid();
                SessionM["Customer"]   = customer;
                SessionM["SessionFID"] = sessionFID;
                ResellerClub.Interface.ISessionLogger sessionLogger = ApiObjectFactory.GetObject <ResellerClub.Interface.ISessionLogger>();
                sessionLogger.Insert(sessionFID,
                                     SessionM.AspSessionId(),
                                     customer.CusInfo.Email,
                                     UserIPAddress());


                RedirectAfterLogin();
            }
            else
            {
                divError.Style["display"] = "";
                divError.InnerHtml        = "<div>Invalid Email ID or Password</div>";
            }
        }
        private void RegisterCustomer()
        {
            if (!ValidateInput())
            {
                return;
            }

            ResellerClub.Interface.ICustomer customer = ApiObjectFactory.GetObject <ResellerClub.Interface.ICustomer>();
            //  ResellerClub.Interface.Messages.ICustomerInfoMessage cusInfo = new ResellerClub.BusinessLogic.Messages.CustomerInfoMessage();
            customer.CusInfo.Name             = input_fullname.Value;
            customer.CusInfo.Password         = passwd.Value;
            customer.CusInfo.Company          = input_companyname.Value;
            customer.CusInfo.Country          = country.Value;
            customer.CusInfo.State            = string.Compare(Request[stateSelect.UniqueID], "other", StringComparison.InvariantCultureIgnoreCase) == 0 ? Request[input_otherState.UniqueID] : Request[stateSelect.UniqueID];
            customer.CusInfo.City             = select_city.Value;
            customer.CusInfo.ZipCode          = input_zip.Value;
            customer.CusInfo.PhoneNumber      = input_phone.Value;
            customer.CusInfo.PhoneCountryCode = input_phone_cc.Value;
            customer.CusInfo.AddressLine1     = input_address1.Value;
            customer.CusInfo.Email            = username.Value;
            customer.CusInfo.Language         = "en";

            try
            {
                customer.Register();
                customer.GetCustomerDetailByUserName(username.Value);

                Guid sessionFID = Guid.NewGuid();
                SessionM["Customer"]   = customer;
                SessionM["SessionFID"] = sessionFID;
                ResellerClub.Interface.ISessionLogger sessionLogger = ApiObjectFactory.GetObject <ResellerClub.Interface.ISessionLogger>();
                sessionLogger.Insert(sessionFID,
                                     SessionM.AspSessionId(),
                                     customer.CusInfo.Email,
                                     UserIPAddress());


                if (UserCart.Items.Count > 0)
                {
                    Response.Redirect(Application["rootPath"].ToString() + "/Payment/PaymentOption.aspx");
                }
                else
                {
                    Response.Redirect(Application["rootPath"].ToString() + "/Home.aspx");
                }
            }
            catch (ResellerClub.BusinessLogic.ServerException ex)
            {
                ShowErrorMessage(ex.Message);
            }
        }