Beispiel #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            var cities = GetSelectedCity();

            if (cities.Any())
            {
                DeleteCurrentCities();
                SaveSelectedCity(cities);

                var selectedCity = (PostClCity)cbCityList.SelectedItem;

                var context = new CLDMSEntities();

                var account =
                    context.Accounts.FirstOrDefault(o => o.AccountId == GlobalVar.CurrentAccount.AccountId);

                if (account != null)
                {
                    account.FirstCity   = selectedCity.CityId;
                    account.LastUpdated = DateTime.Now;
                    context.SaveChanges();

                    ReOrderCityList(selectedCity.CityId);

                    _frmMain.AfterLogging();
                }
                Close();
            }
            else
            {
                MessageBox.Show("Please choose at least one city in the list", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Beispiel #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (ValidateEmpty() && ValidateSamePassword())
            {
                var context = new CLDMSEntities();

                var account =
                    context.Accounts.FirstOrDefault(x => x.AccountId == GlobalVar.CurrentAccount.AccountId);

                account.AccountPassword = txtNewPass.Text;

                account.LastUpdated = DateTime.Now;

                account.IsFirstLogOn = false;

                account.Active = true;

                context.SaveChanges();

                frmMain.txtPassword.Text = txtNewPass.Text;

                Close();

                var cForm = CreditCardAuthorizeForm.Instance(frmMain);

                cForm.Show();

                cForm.Activate();
            }
        }
Beispiel #3
0
        private void SaveToDB()
        {
            var context = new CLDMSEntities();
            var item    = context.Inventories.FirstOrDefault(i => i.ListingID == listingID);

            if (item != null)
            {
                LoadData(item);
                context.SaveChanges();
            }
            else
            {
                var inventory = new Inventory();
                LoadData(inventory);
                context.Inventories.Add(inventory);
                context.SaveChanges();
            }
        }
Beispiel #4
0
        private static void SaveSelectedCity(IEnumerable <int> cities)
        {
            var context = new CLDMSEntities();

            foreach (int city in cities)
            {
                context.SelectedCities.Add(new SelectedCity()
                {
                    AccountId = GlobalVar.CurrentAccount.AccountId,
                    CityId    = city,
                    DateStamp = DateTime.Now,
                    DealerId  = GlobalVar.CurrentAccount.DealerId
                });
            }
            context.SaveChanges();
        }
Beispiel #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            this._frmMain.txtEndingSentence.Text = this.htmlEditorControl.InnerHtml;

            var context = new CLDMSEntities();

            var dealer = context.Dealers.First(o => o.DealerId == GlobalVar.CurrentDealer.DealerId);

            dealer.EndingSentence = String.IsNullOrEmpty(this.htmlEditorControl.InnerHtml) ? "" : this.htmlEditorControl.InnerHtml.Trim();

            context.SaveChanges();

            GlobalVar.CurrentDealer.EndingSentence = dealer.EndingSentence;

            this.Close();
        }
Beispiel #6
0
        private void DeleteCurrentCities()
        {
            var context = new CLDMSEntities();
            var item    =
                context.SelectedCities.Where(
                    i =>
                    i.AccountId == GlobalVar.CurrentAccount.AccountId &&
                    i.DealerId == GlobalVar.CurrentAccount.DealerId);

            foreach (var city in item)
            {
                context.SelectedCities.Remove(city);
            }
            if (item.Any())
            {
                context.SaveChanges();
            }
        }
Beispiel #7
0
        private void btnSubmitRequest_Click(object sender, EventArgs e)
        {
            var context = new CLDMSEntities();

            var account = context.Accounts.First(o => o.AccountId == GlobalVar.CurrentAccount.AccountId);

            account.APIUsername = String.IsNullOrEmpty(txtUserName.Text) ? "" : txtUserName.Text.Trim();

            account.APIPassword = String.IsNullOrEmpty(txtPassword.Text) ? "" : txtPassword.Text.Trim();

            account.APIAccountId = String.IsNullOrEmpty(txtAccountId.Text) ? "" : txtAccountId.Text.Trim();

            account.LastUpdated = DateTime.Now;

            context.SaveChanges();

            GlobalVar.CurrentAccount.APIUsername = account.APIUsername;

            GlobalVar.CurrentAccount.APIPassword = account.APIPassword;

            GlobalVar.CurrentAccount.APIAccountId = account.APIAccountId;

            this.Close();
        }