Beispiel #1
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            int CountryId = int.Parse(ddlAddCountries.SelectedValue);

            MinistryView.MinistryViewDataContext d = new MinistryView.MinistryViewDataContext();
            ssoGUID = UserInfo.Profile.GetPropertyValue("ssoGUID");
            var q = from c in d.MinistryView_UserCountryProfiles where c.GUID == ssoGUID && c.CountryId == CountryId select c;

            if (q.Count() > 0)
            {
                q.First().Username = tbUsername.Text;
                q.First().Password = AgapeEncryption.ADCEncrypt.Encrypt(tbPassword.Text);
            }
            else
            {
                var insert = new MinistryView.MinistryView_UserCountryProfile();
                insert.CountryId = CountryId;
                insert.Username  = tbUsername.Text;
                insert.Password  = AgapeEncryption.ADCEncrypt.Encrypt(tbPassword.Text);
                insert.GUID      = ssoGUID;
                d.MinistryView_UserCountryProfiles.InsertOnSubmit(insert);
                MyCountries.Items.Add(new ListItem(ddlAddCountries.SelectedItem.Text, "ADD" + insert.UserCountryProfileId));
            }
            d.SubmitChanges();

            MyCountries.SelectedIndex = MyCountries.Items.Count - 1;
            MyCountries_SelectedIndexChanged(this, null);
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            int CountryId = int.Parse(ddlAddCountries.SelectedValue);
            MinistryView.MinistryViewDataContext d = new MinistryView.MinistryViewDataContext();
            ssoGUID = UserInfo.Profile.GetPropertyValue("ssoGUID");
            var q = from c in d.MinistryView_UserCountryProfiles where c.GUID == ssoGUID && c.CountryId == CountryId select c;

            if (q.Count() > 0)
            {
                q.First().Username = tbUsername.Text;
                q.First().Password = AgapeEncryption.ADCEncrypt.Encrypt(tbPassword.Text);
            }
            else
            {
                var insert = new MinistryView.MinistryView_UserCountryProfile();
                insert.CountryId = CountryId;
                insert.Username = tbUsername.Text;
                insert.Password = AgapeEncryption.ADCEncrypt.Encrypt(tbPassword.Text);
                insert.GUID = ssoGUID;
                d.MinistryView_UserCountryProfiles.InsertOnSubmit(insert);
                MyCountries.Items.Add(new ListItem(ddlAddCountries.SelectedItem.Text, "ADD" + insert.UserCountryProfileId));
            }
            d.SubmitChanges();

            MyCountries.SelectedIndex = MyCountries.Items.Count - 1;
            MyCountries_SelectedIndexChanged(this, null);
        }