Beispiel #1
0
        /// <summary>
        /// Method Name     : PutCustomerProfileData
        /// Author          : Hiren Patel
        /// Creation Date   : 18 Dec 2017
        /// Purpose         : Puts the customer profile data.
        /// Revision :
        /// </summary>
        /// <returns>The customer profile data.</returns>
        /// <param name="privacyPolicyModel">Customer model.</param>
        public async Task <APIResponse <CustomerModel> > PutCustomerProfileData(PrivacyPolicyModel privacyPolicyModel)
        {
            string apiURL = string.Format(Resource.CustomerProfileUrl, baseAPIURL, privacyPolicyModel.CustomerId);
            APIResponse <CustomerModel> response = new APIResponse <CustomerModel>()
            {
                STATUS = false
            };

            HttpResponseMessage responseMessage = await apiHelper.InvokePutAPI <PrivacyPolicyModel>(apiURL, privacyPolicyModel);

            if (responseMessage.StatusCode == HttpStatusCode.OK)
            {
                response.STATUS  = true;
                response.Message = Resource.msgPutCustomerService;
            }
            else
            {
                if (responseMessage.StatusCode == HttpStatusCode.NoContent)
                {
                    response.Message = Resource.msgInvalidCustomer;
                }
                else
                {
                    response.Message = apiHelper.GetAPIResponseStatusCodeMessage(responseMessage);
                }
            }
            return(response);
        }
Beispiel #2
0
        /// <summary>
        /// Event Name      : BtnOkay_TouchUpInside
        /// Author          : Hiren Patel
        /// Creation Date   : 20 Feb 2018
        /// Purpose         : To set no alrets notifications when app is close
        /// Revision        :
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">Event Argument</param>
        private async void BtnOkay_TouchUpInside(object sender, EventArgs e)
        {
            if (btnOkay.Tag == 0)
            {
                this.TabBarController.SelectedIndex = 0;
                this.TabBarController.TabBar.Hidden = false;
            }
            else
            {
                PrivacyPolicyModel privacyPolicyModel =
                    new PrivacyPolicyModel()
                {
                    CustomerId           = UtilityPCL.LoginCustomerData.CustomerId,
                    Phone                = txtPhone.Text,
                    PreferredContact     = (btnEmail.Tag == 1 ? JKMEnum.PreferredContact.Email.GetStringValue() : JKMEnum.PreferredContact.SMS.GetStringValue()),
                    ReceiveNotifications = (btnSendMeAlertsYes.Tag == 1)
                };

                string message = myAccountValidateService.ValidatePrivacyPolicyModel(privacyPolicyModel);
                if (String.IsNullOrEmpty(message))
                {
                    await CallMyAccountService(privacyPolicyModel);
                }
                else
                {
                    UIHelper.ShowAlertMessage(this, message);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Method Name     : PutMyAccountDetails
        /// Author          : Vivek Bhavsar
        /// Creation Date   : 20 Feb 2018
        /// Purpose         : Update acount details like phone & preffered contact
        /// Revision        :
        /// </summary>
        /// <param name="privacyPolicyModel"></param>
        /// <returns></returns>
        public async Task <APIResponse <PrivacyPolicyModel> > PutMyAccountDetails(PrivacyPolicyModel privacyPolicyModel)
        {
            APIResponse <PrivacyPolicyModel> apiResponse = new APIResponse <PrivacyPolicyModel> {
                STATUS = false
            };

            try
            {
                var response = await loginAPIServies.PutCustomerProfileData(privacyPolicyModel);

                if (response.STATUS)
                {
                    apiResponse.STATUS  = true;
                    apiResponse.Message = Resource.msgAccountSuccessfullyUpdate;
                    UtilityPCL.LoginCustomerData.Phone                = privacyPolicyModel.Phone;
                    UtilityPCL.LoginCustomerData.PreferredContact     = privacyPolicyModel.PreferredContact;
                    UtilityPCL.LoginCustomerData.ReceiveNotifications = privacyPolicyModel.ReceiveNotifications;
                }
                else
                {
                    apiResponse.Message = response.Message;
                }

                return(apiResponse);
            }
            catch
            {
                apiResponse.Message = Resource.msgDefaultServieMessage;
                return(apiResponse);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Method Name     : EditData
        /// Author          : Sanket Prajapati
        /// Creation Date   : 23 Jan 2018
        /// Purpose         : edit Estimate Data
        /// Revision        :
        /// </summary>
        public async Task EditDataAsync()
        {
            MyAccountValidateService myAccountValidateService = new MyAccountValidateService();

            if (!string.IsNullOrEmpty(txtphone.Text))
            {
                PrivacyPolicyModel privacyPolicyModel = new PrivacyPolicyModel()
                {
                    CustomerId           = UtilityPCL.LoginCustomerData.CustomerId,
                    Phone                = StripCharacters(txtphone.Text), PreferredContact = (radioButtonEmail.Checked ? "2" : "3"),
                    ReceiveNotifications = (radioButtonYes.Checked)
                };

                string message = myAccountValidateService.ValidatePrivacyPolicyModel(privacyPolicyModel);
                if (String.IsNullOrEmpty(message))
                {
                    await CallMyAccountService(privacyPolicyModel);
                }
                else
                {
                    AlertMessage(message);
                }
            }
            else
            {
                AlertMessage(StringResource.msgPhoneNoIsRequired);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Method Name     : GetPrivacyPolicyModel
        /// Author          : Vivek Bhavsar
        /// Creation Date   : 23 Jan 2018
        /// Purpose         : generate privacy policy model
        /// Revision        :
        /// </summary>
        /// <param name="isAgree"></param>
        /// <returns></returns>
        private PrivacyPolicyModel GetPrivacyPolicyModel(bool isAgree)
        {
            PrivacyPolicyModel privacyPolicyModel;

            privacyPolicyModel             = new PrivacyPolicyModel();
            privacyPolicyModel.CustomerId  = UtilityPCL.LoginCustomerData.CustomerId;
            privacyPolicyModel.TermsAgreed = isAgree;

            return(privacyPolicyModel);
        }
Beispiel #6
0
        public static PrivacyPolicyModel MergeViewWithModelPrivacyPolicy(PrivacyPolicyModel model, PrivacyPolicyView view)
        {
            model.PageUrl     = view.PageUrl;
            model.CompanyName = view.CompanyName;
            model.Street      = view.Street;
            model.City        = view.City;
            model.ZipCode     = view.ZipCode;
            model.Email       = view.Email;
            model.HostingName = view.HostingName;

            return(model);
        }
        /// <summary>
        /// Method Name     : ValidatePrivacyPolicyModel
        /// Author          : Hiren Patel
        /// Creation Date   : 20 Feb 2018
        /// Purpose         : Validates the privacy policy model.
        /// Revision        :
        /// </summary>

        public string ValidatePrivacyPolicyModel(PrivacyPolicyModel privacyPolicyModel)
        {
            string errorMessage = string.Empty;

            if (UtilityPCL.IsNullOrEmptyOrWhiteSpace(privacyPolicyModel.Phone))
            {
                errorMessage = Resource.msgPhoneNumberIsRequired;
            }
            else if (privacyPolicyModel.Phone.Length < 10)
            {
                errorMessage = Resource.msgPleaseEnterValidPhoneNo;
            }

            return(errorMessage);
        }
Beispiel #8
0
        public static PrivacyPolicyView ConvertToViewPrivacePolicy(PrivacyPolicyModel result)
        {
            var privacyPolicyView = new PrivacyPolicyView
            {
                Id          = result.Id,
                PageUrl     = result.PageUrl,
                CompanyName = result.CompanyName,
                Street      = result.Street,
                City        = result.City,
                ZipCode     = result.ZipCode,
                Email       = result.Email,
                HostingName = result.HostingName
            };

            return(privacyPolicyView);
        }
        public ActionResult Create(PrivacyPolicyModel PrivacyPolicyModel)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(PrivacyPolicyModel.Content))
                {
                    ModelState.AddModelError("content", "Please enter content.");
                }
                if (ModelState.IsValid)
                {
                    var isExists = _PrivacyPolicyService.GetPrivacyPolicies().FirstOrDefault();
                    Mapper.CreateMap <PrivacyPolicyModel, PrivacyPolicy>();
                    var PrivacyPolicies = Mapper.Map <PrivacyPolicyModel, PrivacyPolicy>(PrivacyPolicyModel);

                    if (isExists != null)
                    {
                        isExists.Content = PrivacyPolicies.Content;
                        _PrivacyPolicyService.UpdatePrivacyPolicy(isExists);
                    }
                    else
                    {
                        _PrivacyPolicyService.InsertPrivacyPolicy(PrivacyPolicies);
                    }


                    TempData["ShowMessage"] = "success";
                    TempData["MessageBody"] = " PrivacyPolicy saved  successfully.";
                    return(View(PrivacyPolicyModel));
                }
                else
                {
                    return(View(PrivacyPolicyModel));
                }
            }


            catch (Exception ex)
            {
                string ErrorMsg = ex.Message.ToString();//
                ErrorLogging.LogError(ex);
            }
            var errors           = ModelState.Where(x => x.Value.Errors.Count > 0).Select(x => new { x.Key, x.Value.Errors }).ToArray();
            var modelStateErrors = this.ModelState.Keys.SelectMany(key => this.ModelState[key].Errors);


            return(View(PrivacyPolicyModel));
        }
Beispiel #10
0
        /// <summary>
        /// Method Name     : PrivacyPolicyService
        /// Author          : Sanket Prajapati
        /// Creation Date   : 5 Dec 2017
        /// Purpose         : For Save Customer Password
        /// Revision        :
        /// </summary>
        public async Task <ServiceResponse> PrivacyPolicyService(bool isAgree)
        {
            string errorMessage = string.Empty;
            bool   isTermAgree  = false;

            PrivacyPolicyModel          privacyPolicyModel = GetPrivacyPolicyModel(isAgree);
            APIResponse <CustomerModel> response           = await loginAPIServies.PutCustomerProfileData(privacyPolicyModel);

            if (response.STATUS)
            {
                isTermAgree = isAgree;
            }
            else
            {
                isTermAgree  = false;
                errorMessage = response.Message;
            }
            UtilityPCL.LoginCustomerData.TermsAgreed = isTermAgree;

            return(getServiceResponse(errorMessage, isTermAgree));
        }
Beispiel #11
0
        /// <summary>
        /// Event Name      : CallMyAccountService
        /// Author          : Sanket Prajapati
        /// Creation Date   : 13 Dec 2017
        /// Purpose         : Calls my account service to update account data
        /// Revision        :
        /// </summary>
        /// <param name="privacyPolicyModel">Privacy policy model.</param>
        private async Task CallMyAccountService(PrivacyPolicyModel privacyPolicyModel)
        {
            APIResponse <PrivacyPolicyModel> serviceResponse = null;
            string errorMessage = string.Empty;

            try
            {
                MyAccount myAccountService = new MyAccount();
                progressDialog  = UIHelper.SetProgressDailoge(this);
                serviceResponse = await myAccountService.PutMyAccountDetails(privacyPolicyModel);

                errorMessage = serviceResponse.Message;
            }
            catch (Exception error)
            {
                errorMessage = error.Message;
            }
            finally
            {
                progressDialog.Dismiss();
                if (!string.IsNullOrEmpty(errorMessage))
                {
                    Android.App.AlertDialog.Builder dialogue;
                    Android.App.AlertDialog         alert;
                    dialogue = new Android.App.AlertDialog.Builder(new ContextThemeWrapper(this, Resource.Style.AlertDialogCustom));
                    alert    = dialogue.Create();
                    alert.SetMessage(errorMessage);
                    alert.SetButton(StringResource.msgOK, (c, ev) =>
                    {
                        if (serviceResponse.STATUS)
                        {
                            StartActivity(new Intent(this, typeof(MainActivity)));
                        }
                        alert.Dispose();
                    });
                    alert.Show();
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// Event Name      : CallMyAccountService
        /// Author          : Hiren Patel
        /// Creation Date   : 13 Dec 2017
        /// Purpose         : Calls my account service to update account data
        /// Revision        :
        /// </summary>
        /// <param name="privacyPolicyModel">Privacy policy model.</param>
        private async Task CallMyAccountService(PrivacyPolicyModel privacyPolicyModel)
        {
            string         errorMessage        = string.Empty;
            LoadingOverlay objectLoadingScreen = UIHelper.ShowLoadingScreen(View);

            try
            {
                APIResponse <PrivacyPolicyModel> serviceResponse = await myAccountService.PutMyAccountDetails(privacyPolicyModel);

                if (serviceResponse.STATUS)
                {
                    await UIHelper.ShowMessageWithOKConfirm(string.Empty, serviceResponse.Message, AppConstant.ALERT_OK_BUTTON_TEXT);

                    btnOkay.Tag = 0;
                    btnOkay.SetTitle(AppConstant.MYACCOUNT_OK_BUTTON_TEXT, UIControlState.Normal);
                    this.TabBarController.SelectedIndex = 0;
                    this.TabBarController.TabBar.Hidden = false;
                    await DTOConsumer.GetCustomerProfileData();
                }
                else
                {
                    errorMessage = serviceResponse.Message;
                }
            }
            catch (Exception error)
            {
                errorMessage = error.Message;
            }
            finally
            {
                if (!string.IsNullOrEmpty(errorMessage))
                {
                    UIHelper.ShowAlertMessage(this, errorMessage);
                }
                objectLoadingScreen.Hide();
            }
        }
Beispiel #13
0
        public static async Task SeedData(CMSContext context, UserManager <User> userManager)
        {
            // Seed dla podstawowych kont użytkowników
            if (!userManager.Users.Any())
            {
                var users = new List <User>
                {
                    new User
                    {
                        UserName = "******",
                        Email    = "*****@*****.**",
                        Name     = "admin",
                        Surname  = "adminowski"
                    },
                    new User
                    {
                        UserName = "******",
                        Email    = "*****@*****.**",
                        Name     = "user",
                        Surname  = "userowski"
                    }
                };

                foreach (var user in users)
                {
                    await userManager.CreateAsync(user, "haslo");
                }
            }

            // Seed dla ustawień systemu
            if (!context.BlogSettings.Any())
            {
                var blogSettings = new BlogModel
                {
                    CommentsNotify = false,
                    PostPerPage    = 12,
                    AllowComments  = false,
                    DateFormat     = "dd-MM-yyyy",
                    TimeFormat     = "H:mm:ss"
                };

                await context.BlogSettings.AddAsync(blogSettings);

                await context.SaveChangesAsync();
            }

            // seed dla ustawień e-maila
            if (!context.EmailSettings.Any())
            {
                var emailsettings = new EmailModel
                {
                    Host      = "smtp.gmail.com",
                    Port      = 587,
                    EmailTo   = "*****@*****.**",
                    EmailFrom = "*****@*****.**",
                    Password  = "******",
                    EnableSSL = true,
                };

                await context.EmailSettings.AddAsync(emailsettings);

                await context.SaveChangesAsync();
            }

            // Seed dla polityki prywatności
            if (!context.PrivacyPolicySettings.Any())
            {
                var privacySettings = new PrivacyPolicyModel
                {
                    PageUrl     = "https://test.pl",
                    CompanyName = "Nazwa firmy",
                    Street      = "ul. ulicowska 45",
                    City        = "miasto",
                    ZipCode     = "12-345",
                    Email       = "*****@*****.**",
                    HostingName = "hosting.pl"
                };

                await context.PrivacyPolicySettings.AddAsync(privacySettings);

                await context.SaveChangesAsync();
            }

            // Seed dla polityki prywatności
            if (!context.IntegrationSettings.Any())
            {
                var integrationSettings = new IntegrationModel {
                };

                await context.IntegrationSettings.AddAsync(integrationSettings);

                await context.SaveChangesAsync();
            }

            // Seed dla ogólnych ustawień seo
            if (!context.SeoSettings.Any())
            {
                var generalSettings = new GeneralSeoSettingsModel
                {
                    MainUrl = "https://cmsopen.net",
                    Title   = "Twoja pierwsza strona w systemie CMSOPEN"
                };

                await context.SeoSettings.AddAsync(generalSettings);

                await context.SaveChangesAsync();
            }
        }
Beispiel #14
0
 public async Task <bool> SetPrivacyPolicySettings(PrivacyPolicyModel result)
 {
     _context.PrivacyPolicySettings.Update(result);
     return(await _context.SaveChangesAsync() > 0);
 }