/// <summary> /// Crear los data sources del formulario /// </summary> protected override void AgregarDataSources() { //Congelar el formulario Formulario.Freeze(true); udsTxtServidor = Formulario.DataSources.UserDataSources.Add("udsTxtSer", BoDataType.dt_SHORT_TEXT, 254); udsTxtComp = Formulario.DataSources.UserDataSources.Add("udsTxtComp", BoDataType.dt_SHORT_TEXT, 254); udsTxtSob = Formulario.DataSources.UserDataSources.Add("udsTxtSob", BoDataType.dt_SHORT_TEXT, 254); udsTxtBan = Formulario.DataSources.UserDataSources.Add("udsTxtBan", BoDataType.dt_SHORT_TEXT, 254); udsTxtResp = Formulario.DataSources.UserDataSources.Add("udsTxtResp", BoDataType.dt_SHORT_TEXT, 254); udsTxtRepDi = Formulario.DataSources.UserDataSources.Add("udsTxtReDi", BoDataType.dt_SHORT_TEXT, 254); udsTxtUsuario = Formulario.DataSources.UserDataSources.Add("udsTxtUsr", BoDataType.dt_SHORT_TEXT, 254); udsTxtClave = Formulario.DataSources.UserDataSources.Add("udsTxtClv", BoDataType.dt_SHORT_TEXT, 254); udsTxtRepWsE = Formulario.DataSources.UserDataSources.Add("udsTxReWsE", BoDataType.dt_SHORT_TEXT, 254); udsTxtRepWsC = Formulario.DataSources.UserDataSources.Add("udsTxReWsC", BoDataType.dt_SHORT_TEXT, 254); udsTxtRepConSob = Formulario.DataSources.UserDataSources.Add("udsConSob", BoDataType.dt_SHORT_TEXT, 254); udsTxtRepConCom = Formulario.DataSources.UserDataSources.Add("udsConCom", BoDataType.dt_SHORT_TEXT, 254); udsTxtRepConReDi = Formulario.DataSources.UserDataSources.Add("udsConReDi", BoDataType.dt_SHORT_TEXT, 254); udsTxtRepCfe = Formulario.DataSources.UserDataSources.Add("udsTxReCf", BoDataType.dt_SHORT_TEXT, 254); udsTxtRepCerAnu = Formulario.DataSources.UserDataSources.Add("udsCerAnu", BoDataType.dt_SHORT_TEXT, 254); udsTxtRepConSobDgi = Formulario.DataSources.UserDataSources.Add("udsSobDgi", BoDataType.dt_SHORT_TEXT, 254); udsTxtRutDgi = Formulario.DataSources.UserDataSources.Add("udsRutDgi", BoDataType.dt_SHORT_TEXT, 254); udschkFileDelete = Formulario.DataSources.UserDataSources.Add("udFileD", BoDataType.dt_SHORT_TEXT, 1); //Descongelar el formulario Formulario.Freeze(false); }
/// <summary> /// Creates a new store object /// </summary> /// <param name="storeName">Name of the new store</param> /// <param name="adminEmail">Email address of initial super user account</param> /// <param name="adminPassword">Password for initial super user account</param> /// <param name="switchContext">If true, the token context is switched to the new store. If false, the token /// context remains the same as it was before the method is called.</param> /// <returns>The created store object</returns> public static Store CreateStore(string storeName, string adminEmail, string adminPassword, bool switchContext) { //NEED TO SAVE THE CURRENT STORE CONTEXT Store masterStore = Token.Instance.Store; //CREATE THE STORE Store newStore = new Store(); newStore.Name = storeName; newStore.NextOrderId = 1; newStore.OrderIdIncrement = 1; newStore.WeightUnit = CommerceBuilder.Shipping.WeightUnit.Pounds; newStore.MeasurementUnit = CommerceBuilder.Shipping.MeasurementUnit.Inches; newStore.Save(); //NEED TO SWITCH OUR TOKEN CONTEXT TO THE NEW STORE Token.Instance.InitStoreContext(newStore); //INITIALIZE THE AUDIT LOGS Logger.Audit(AuditEventType.ApplicationStarted, true, string.Empty); //INITIALIZE ROLES AND GROUPS RoleDataSource.EnsureDefaultRoles(); GroupDataSource.EnsureDefaultGroups(); //CREATE THE SUPER USER User user = UserDataSource.CreateUser(adminEmail, adminPassword); //ASSIGN USER TO APPROPRIATE GROUP CommerceBuilder.Users.Group suGroup = GroupDataSource.LoadForName("Super Users"); user.UserGroups.Add(new UserGroup(user.UserId, suGroup.GroupId)); user.Save(); //RESET THE ORIGINAL STORE CONTEXT if (!switchContext) { Token.Instance.InitStoreContext(masterStore); } //RETURN THE NEW STORE return(newStore); }
public void TestInitialize() { UserManager.Login(Settings.Default.TestUserName, Settings.Default.TestPassword, _applicationName, false); // Set used datasources UserDataSource.SetDataSource(); TaxonDataSource.SetDataSource(); TaxonAttributeDataSource.SetDataSource(); ReferenceDataSource.SetDataSource(); bool loginSuccess = false; // Added try catch due to problems with Moneses-Dev loosing connection. try { loginSuccess = Login(Settings.Default.TestUserName, Settings.Default.TestPassword); } catch (TimeoutException) { Thread.Sleep(20000); loginSuccess = Login(Settings.Default.TestUserName, Settings.Default.TestPassword); } if (!loginSuccess) { throw new ArgumentException("UserManager login failed."); } }
protected void Page_Init(object sender, EventArgs e) { _SubscriptionId = AlwaysConvert.ToInt(Request.QueryString["SubscriptionId"]); _UserId = AlwaysConvert.ToInt(Request.QueryString["UserId"]); _User = UserDataSource.Load(_UserId); CountryCode.DataSource = CountryDataSource.LoadAll("Name"); CountryCode.DataBind(); //INIT ADDRESS Address address = _User.PrimaryAddress; FirstName.Text = address.FirstName; LastName.Text = address.LastName; Company.Text = address.Company; Address1.Text = address.Address1; Address2.Text = address.Address2; City.Text = address.City; Province.Text = address.Province; PostalCode.Text = address.PostalCode; ListItem selectedCountry = CountryCode.Items.FindByValue(AbleContext.Current.Store.DefaultWarehouse.CountryCode); if (!String.IsNullOrEmpty(address.CountryCode)) { selectedCountry = CountryCode.Items.FindByValue(address.CountryCode.ToString()); } if (selectedCountry != null) { CountryCode.SelectedIndex = CountryCode.Items.IndexOf(selectedCountry); } Phone.Text = address.Phone; Fax.Text = address.Fax; Residence.SelectedIndex = (address.Residence ? 0 : 1); }
public void MyTestInitialize() { // Kör tester mot produktionsmiljö //Configuration.Debug = false; //Configuration.InstallationType = InstallationType.Production; // Set used datasources CoreData.CountryManager = new CountryManagerMultiThreadCache(); CoreData.LocaleManager = new LocaleManagerMultiThreadCache(); CoreData.TaxonManager = new TaxonManagerMultiThreadCache(); CoreData.UserManager = new UserManagerMultiThreadCache(); CoreData.RegionManager = new RegionManagerMultiThreadCache(new CoordinateSystem()); CoreData.ReferenceManager = new ReferenceManagerMultiThreadCache(); CoreData.SpeciesObservationManager = new SpeciesObservationManagerMultiThreadCache(); CoreData.MetadataManager = new MetadataManagerMultiThreadCache(); CoreData.AnalysisManager = new AnalysisManager(); CoreData.SpeciesFactManager = new SpeciesFactManagerMultiThreadCache(); CoreData.FactorManager = new FactorManagerMultiThreadCache(); UserDataSource.SetDataSource(); SpeciesObservationDataSource.SetDataSource(); GeoReferenceDataSource.SetDataSource(); AnalysisDataSource.SetDataSource(); TaxonDataSource.SetDataSource(); TaxonAttributeDataSource.SetDataSource(); ReferenceDataSource.SetDataSource(); // Finally login application user //LoginApplicationUser(null, null); }
private void SetMailTarget(bool selectedOnly) { List <string> userIdsToEmail = new List <string>(); if (selectedOnly) { // TO SELCTED USERS foreach (GridViewRow row in UserGrid.Rows) { HtmlInputCheckBox checkbox = (HtmlInputCheckBox)row.FindControl("SelectUserCheckBox"); if ((checkbox != null) && (checkbox.Checked)) { int userId = Convert.ToInt32(UserGrid.DataKeys[row.RowIndex].Value); userIdsToEmail.Add(userId.ToString()); } } } else { // TO ALL USERS IN SEARCH RESULTS IList <User> users = UserDataSource.Search(GetSearchCriteria(), "U.LoweredUserName"); // Looping through all the rows in the GridView foreach (User user in users) { userIdsToEmail.Add(user.Id.ToString()); } } Session["SendMail_IdList"] = "UserId:" + string.Join(",", userIdsToEmail.ToArray()); }
protected void Page_Load(object sender, EventArgs e) { // LOCATE THE USER THAT THE ORDER IS BEING PLACED FOR _UserId = AlwaysConvert.ToInt(Request.QueryString["UID"]); _User = UserDataSource.Load(_UserId); if (_User == null) { Response.Redirect("CreateOrder1.aspx"); } _Basket = _User.Basket; // INITIALIZE INVENTORY VARIABLES _InventoryManager = AbleContext.Resolve <IInventoryManager>(); _StoreInventoryEnabled = AbleContext.Current.Store.Settings.EnableInventory; // SHOW QUANTITY AVAILABLE COLUMN IF INVENTORY IS ENABLED BasketGrid.Columns[4].Visible = _StoreInventoryEnabled; // INITIALIZE THE CAPTION string userName = _User.IsAnonymous ? "Unregistered User" : _User.UserName; Caption.Text = string.Format(Caption.Text, userName); // SEE IF THE ADD PRODUCT FORM SHOULD BE VISIBLE int productId = AlwaysConvert.ToInt(Request.Form[AddProductId.UniqueID]); Product product = ProductDataSource.Load(productId); if (product != null) { ShowProductForm(product); } }
public void TestInitialize() { CoreData.ApplicationManager = new ApplicationManager(); CoreData.CountryManager = new CountryManagerSingleThreadCache(); CoreData.LocaleManager = new LocaleManagerSingleThreadCache(); CoreData.OrganizationManager = new OrganizationManager(); CoreData.TaxonManager = new TaxonManagerSingleThreadCache(); CoreData.UserManager = new UserManagerSingleThreadCache(); UserDataSource.SetDataSource(); TaxonDataSource.SetDataSource(); ReferenceDataSource.SetDataSource(); TaxonAttributeDataSource.SetDataSource(); try { _userContext = CoreData.UserManager.Login(Settings.Default.TestUserName, Settings.Default.TestPassword, ApplicationIdentifier.Dyntaxa.ToString()); } catch (TimeoutException) { // Try Once more if service is turned off... Thread.Sleep(20000); _userContext = CoreData.UserManager.Login(Settings.Default.TestUserName, Settings.Default.TestPassword, ApplicationIdentifier.Dyntaxa.ToString()); } }
protected void LoginButton_Click(object sender, EventArgs e) { if (Membership.ValidateUser(UserName.Text, Password.Text)) { //MIGRATE USER IF NEEDED int newUserId = UserDataSource.GetUserId(UserName.Text); if ((AbleContext.Current.UserId != newUserId) && (newUserId != 0)) { User.Migrate(AbleContext.Current.User, UserDataSource.Load(newUserId)); AbleContext.Current.UserId = newUserId; AbleContext.Current.User = UserDataSource.Load(newUserId); } //HANDLE LOGIN PROCESSING if (RememberUserName.Checked) { HttpCookie cookie = new HttpCookie("UserName", UserName.Text); cookie.Expires = DateTime.MaxValue; Response.Cookies.Add(cookie); } else { Response.Cookies.Add(new HttpCookie("UserName", "")); } //UPDATE AUTHORIZATION COOKIE FormsAuthentication.SetAuthCookie(UserName.Text, false); //REDIRECT TO CHECKOUT Response.Redirect(AbleCommerce.Code.NavigationHelper.GetCheckoutUrl(true)); } else { InvalidLogin.IsValid = false; } }
public void MyTestInitialize() { //Set session helper for handling HttpContext data. sessionHelper = new DictionarySessionHelper(); SessionHandler.SetSessionHelper(sessionHelper); //Set applicatiobn start parameters that will be set in Global.asax.cs-Application_Start()) CoreData.ApplicationManager = new ApplicationManager(); CoreData.CountryManager = new CountryManagerMultiThreadCache(); CoreData.LocaleManager = new LocaleManagerMultiThreadCache(); CoreData.OrganizationManager = new OrganizationManager(); CoreData.TaxonManager = new TaxonManagerMultiThreadCache(); CoreData.UserManager = new UserManagerMultiThreadCache(); CoreData.RegionManager = new RegionManagerMultiThreadCache(new CoordinateSystem()); CoreData.AnalysisManager = new AnalysisManager(); //Create datasources UserDataSource.SetDataSource(); TaxonDataSource.SetDataSource(); SpeciesObservationDataSource.SetDataSource(); GeoReferenceDataSource.SetDataSource(); AnalysisDataSource.SetDataSource(); //Set Session start parameters that will be set in Global.asax.cs-Session_Start(object sender, EventArgs e) SessionHelper.SetInSession("language", "en-GB"); SessionHelper.SetInSession("mySettings", new AnalysisPortal.MySettings.MySettings()); SessionHelper.SetInSession("results", new CalculatedDataItemCollection()); // Set language that will be set in Global.asax.cs-Application_BeginRequest(object sender, EventArgs e) Thread.CurrentThread.CurrentUICulture = new CultureInfo(SessionHelper.GetFromSession <string>("language")); Thread.CurrentThread.CurrentCulture = new CultureInfo(SessionHelper.GetFromSession <string>("language")); LoginApplicationUser(); // to remove this call, you must implement SpeciesObservationDataSourceTestRepository.GetSpeciesObservationFieldDescriptions }
public virtual ActionResult List(UserDataSource datasource = null) { datasource.Data = Mapper.Map <List <UserViewModel> >(UserManager.Users); datasource.Initialize(); return(View(datasource)); }
private User GetUser(object dataItem) { User user = dataItem as User; if (user != null) { return(user); } EmailListUser elu = dataItem as EmailListUser; if (elu == null) { return(null); } if ((_LastUser != null) && (_LastUser.Email == elu.Email)) { return(_LastUser); } IList <User> users = UserDataSource.LoadForEmail(elu.Email); if (users.Count > 0) { _LastUser = users[0]; } else { _LastUser = null; } return(_LastUser); }
/// <summary> /// Load users in the id list /// </summary> /// <param name="idList">List of user ids</param> private void ParseUserIdList(string idList) { // VALIDATE THE INPUT if (string.IsNullOrEmpty(idList)) { throw new ArgumentNullException("idList"); } if (!Regex.IsMatch(idList, "^\\d+(,\\d+)*$")) { throw new ArgumentException("Id list can only be a comma delimited list of integer.", "idList"); } // PARSE THE LIST OF INTEGERS if (idList.Contains(",")) { ICriteria criteria = NHibernateHelper.CreateCriteria <User>(); criteria.Add(Restrictions.Eq("Store", AbleContext.Current.Store)); criteria.Add(Restrictions.In("Id", AlwaysConvert.ToIntArray(idList))); _UserList = UserDataSource.LoadForCriteria(criteria); } else { ICriteria criteria = NHibernateHelper.CreateCriteria <User>(); criteria.Add(Restrictions.Eq("Store", AbleContext.Current.Store)); criteria.Add(Restrictions.Eq("Id", AlwaysConvert.ToInt(idList))); _UserList = UserDataSource.LoadForCriteria(criteria); } }
protected void Application_Start() { #if DEBUG DyntaxaLogger.WriteMessage("Web application started"); #endif AreaRegistration.RegisterAllAreas(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); // MK 2015-10-12 County map isn't used? //String path = Server.MapPath("~/Images/Maps/Sverigekarta med län.shp"); //CountyOccurrenceMap.InitializeMap(path); Configuration.SetInstallationType(); CoreData.CountryManager = new CountryManagerMultiThreadCache(); CoreData.LocaleManager = new LocaleManagerMultiThreadCache(); CoreData.ReferenceManager = new ReferenceManagerMultiThreadCache(); CoreData.TaxonManager = new TaxonManagerMultiThreadCache(); CoreData.UserManager = new UserManagerMultiThreadCache(); CoreData.SpeciesFactManager = new SpeciesFactManagerMultiThreadCache(); UserDataSource.SetDataSource(); TaxonDataSource.SetDataSource(); PesiNameDataSource.SetDataSource(); TaxonAttributeDataSource.SetDataSource(); ReferenceDataSource.SetDataSource(); AnalysisDataSource.SetDataSource(); CoreData.UserManager.LoginApplicationUser(); CoreData.UserManager.LoginApplicationTransactionUser(); ScheduledTasksManager.AddTasks(); }
protected void ForgotPasswordNextButton_Click(object sender, EventArgs e) { if (Page.IsValid) { User user = null; IList <User> users = UserDataSource.LoadForEmail(ForgotPasswordUserName.Text); if (users.Count != 0) { user = users[0]; } if (user != null && user.IsApproved) { user.GeneratePasswordRequest(); ForgotPasswordPanel.Visible = false; EmailSentPanel.Visible = true; EmailSentHelpText.Text = string.Format(EmailSentHelpText.Text, user.Email); } else { if ((user != null) && (!user.IsApproved)) { DisabledUsernameValidator.IsValid = false; } else { ForgotPasswordUserNameValidator.IsValid = false; } } } }
public IdentityController(UserDataSource uds, IdentityDataSource ids, IdentityService isrv, JwtAuthenticationService jwtAuthSrv) { _userDataSource = uds ?? throw new ArgumentNullException(nameof(uds)); _identityDataSource = ids ?? throw new ArgumentNullException(nameof(ids)); _identityService = isrv ?? throw new ArgumentNullException(nameof(isrv)); _jwtAuthenticationService = jwtAuthSrv ?? throw new ArgumentNullException(nameof(jwtAuthSrv)); }
/// <summary> /// Crea y asigna los data sources al formulario /// </summary> /// <param name="formUID"></param> protected override void AgregarDataSources() { //Crea el user data source para el combo box de tipsos de documento udsTiposDocumento = Formulario.DataSources.UserDataSources.Add("dsCbxTDoc", BoDataType.dt_LONG_TEXT, 40); //crea el user data source para el combo box de sucursales udsSucursales = Formulario.DataSources.UserDataSources.Add("dsCbxSuc", BoDataType.dt_LONG_TEXT, 100); }
protected void Page_Init(object sender, EventArgs e) { _userId = AlwaysConvert.ToInt(Request.QueryString["UserId"]); _User = UserDataSource.Load(_userId); CountryCode.DataSource = CountryDataSource.LoadAll("Name"); CountryCode.DataBind(); BindShippingAddresses(true); }
public SelfPostsController(PostDataSource pds, UserDataSource uds, ImageProcessingService imgSrv, AzureStorage stSrv) { _postDataSource = pds ?? throw new ArgumentNullException(nameof(pds)); _userDataSource = uds ?? throw new ArgumentNullException(nameof(uds)); _imageService = imgSrv ?? throw new ArgumentNullException(nameof(imgSrv)); _storageService = stSrv ?? throw new ArgumentNullException(nameof(stSrv)); }
protected void Page_Init(object sender, EventArgs e) { // LOCATE THE USER THAT THE ORDER IS BEING PLACED FOR _UserId = AlwaysConvert.ToInt(Request.QueryString["UID"]); _User = UserDataSource.Load(_UserId); if (_User == null) { Response.Redirect("CreateOrder1.aspx"); } _Basket = _User.Basket; MiniBasket1.BasketId = _Basket.Id; // ENSURE THE BASKET IS PACKAGED IBasketService preCheckoutService = AbleContext.Resolve <IBasketService>(); preCheckoutService.Package(_Basket); // INITIALIZE THE CAPTION string userName = _User.IsAnonymous ? "Unregistered User" : _User.UserName; Caption.Text = string.Format(Caption.Text, userName); //INITIALIZE BILLING COUNTRY LIST ON EVERY VISIT InitializeBillingCountryAndProvince(); // INITIALIZE SHIPPING CONTROLS trAddressBook.Visible = _Basket.Items.HasShippableProducts(); if (trAddressBook.Visible) { // THESE TASKS MUST OCCUR EVER VISIT DUE TO DISABLED VIEWSTATE InitializeAddressBook(); InitializeShippingCountryAndProvince(); // SEE IF WE NEED TO SHOW THE SHIPPING OFORM int shipAddressId = GetShippingAddressId(); if (shipAddressId == 0 || shipAddressId == _User.PrimaryAddress.Id) { // SHIP TO BILLING ADDRESS ShipAddressPanel.Visible = false; trContinueButton1.Visible = true; BillAddressPanel.DefaultButton = "ContinueButton"; } else { // INITIALIZE SHIPPING ADDRESS ShipAddressPanel.Visible = true; trContinueButton1.Visible = false; BillAddressPanel.DefaultButton = "ContinueButton2"; } } // POPULATE BILLING FORM ON FIRST PAGE VISIT if (!Page.IsPostBack) { InitializeBillingAddress(); } }
/// <summary> /// Parse date from /// </summary> /// <param name="dataSource"></param> /// <returns></returns> /// <example> /// var date = form.DataSources.UserDataSources.Item("Date").ToDate(); /// </example> public static DateTime?ToDate(this UserDataSource dataSource) { if (string.IsNullOrEmpty(dataSource.ValueEx)) { return(null); } return(DateTime.ParseExact(dataSource.ValueEx, "yyyyMMdd", CultureInfo.InvariantCulture)); }
protected bool ShowDeleteButton(object dataItem) { CommerceBuilder.Users.Group g = (CommerceBuilder.Users.Group)dataItem; if (!IsEditableGroup(dataItem)) { return(false); } return(UserDataSource.CountForGroup(g.Id) <= 0); }
void InitializeFromBindingList(GridControl gridControl) { UserDataSource userDataSource = new UserDataSource(Form1.maxRowCount); for (int i = 0; i < userDataSource.Capacity; i++) { userDataSource.Add(new TestStruct()); } gridControl.DataSource = userDataSource; }
public virtual ActionResult List() { var users = UserManager.Users; var model = new UserDataSource(); model.Users = Mapper.Map <List <UserViewModel> >(users); model.SetActions(); return(View(MVC.Shared.Views._Grid, model.GetGridModel())); }
protected void Page_Load(object sender, EventArgs e) { _UserId = AlwaysConvert.ToInt(Request.QueryString["UserId"]); user = UserDataSource.Load(_UserId); if (user == null) { Response.Redirect("~/Admin/"); } Caption.Text = string.Format(Caption.Text, (user.IsAnonymous ? "anonymous" : user.UserName)); }
/// <summary> /// Loads profile for the given user /// </summary> /// <param name="userName">Name of the user to load profile for</param> /// <param name="createMissing">If <b>true</b> a profile will be created if it does not already exist.</param> /// <returns></returns> public static Profile LoadForUserName(string userName, bool createMissing) { User user = UserDataSource.LoadForUserName(userName, createMissing); if (user == null) { return(null); } return(user.Profile); }
public void TestShowName() { var ds = new UserDataSource(); Assert.AreEqual("Hello", ds.ShowString); var ds1 = new PersonDataSource(); Assert.AreEqual("Person", ds1.ShowString); }
protected void BillingAddress_AddressUpdate(object sender, AddressEventArgs e) { // update the user instance, user instance might be changed if a new account is registered _user = AbleContext.Current.User; _basket = _user.Basket; if (e.Address.IsValid) { // if anonymous user or guest checkout then validate email address, check if it is not already registerd string email = e.Address.Email; if (_user.IsAnonymousOrGuest && UserDataSource.IsEmailRegistered(email)) { EmailRegisteredPanel.Visible = true; } else { // Update user primary address Address address = _user.PrimaryAddress; if (address.Id != e.Address.Id) { address.FirstName = e.Address.FirstName; address.LastName = e.Address.LastName; address.Nickname = e.Address.Nickname; address.FullName = e.Address.FullName; address.Address1 = e.Address.Address1; address.Address2 = e.Address.Address2; address.City = e.Address.City; address.Company = e.Address.Company; address.Country = e.Address.Country; address.Email = e.Address.Email; address.Fax = e.Address.Fax; address.IsBilling = e.Address.IsBilling; address.Phone = e.Address.Phone; address.PostalCode = e.Address.PostalCode; address.Province = e.Address.Province; } address.Save(); BillingAddressTextPanel.Visible = true; FormattedBillingAddress.Text = GetFormattedAddressString(e.Address); BillingAddress.Visible = false; _basketService.Package(_basket, true); BasketShipment shipment = _basket.Shipments.FirstOrDefault(); if (shipment != null) { if (shipment.Address == null || shipment.Address.Id == address.Id) { BindShippingMethods(address, true); } } IntializeEmailLists(); } } }
protected void Page_Init(object sender, EventArgs e) { // LOCATE THE USER THAT THE ORDER IS BEING PLACED FOR _UserId = AlwaysConvert.ToInt(Request.QueryString["UID"]); _User = UserDataSource.Load(_UserId); if (_User == null) { return; } _Basket = _User.Basket; }
public void MyTestInitialize() { //Set session helper for handling HttpContext data. sessionHelper = new DictionarySessionHelper(); SessionHandler.SetSessionHelper(sessionHelper); // this.StubDataSourceData(); CoreData.CountryManager = new CountryManagerMultiThreadCache(); CoreData.LocaleManager = new LocaleManagerMultiThreadCache(); CoreData.TaxonManager = new TaxonManagerMultiThreadCache(); CoreData.UserManager = new UserManagerMultiThreadCache(); CoreData.RegionManager = new RegionManagerMultiThreadCache(new CoordinateSystem()); CoreData.ReferenceManager = new ReferenceManagerMultiThreadCache(); CoreData.SpeciesObservationManager = new SpeciesObservationManagerMultiThreadCache(); CoreData.MetadataManager = new MetadataManagerMultiThreadCache(); CoreData.AnalysisManager = new AnalysisManager(); UserDataSource.SetDataSource(); SpeciesObservationDataSource.SetDataSource(); GeoReferenceDataSource.SetDataSource(); AnalysisDataSource.SetDataSource(); TaxonDataSource.SetDataSource(); TaxonAttributeDataSource.SetDataSource(); ReferenceDataSource.SetDataSource(); //Finally login application user try { CoreData.UserManager.LoginApplicationUser(); } catch (Exception) { // Try Once more... Thread.Sleep(20000); CoreData.UserManager.LoginApplicationUser(); } IUserContext user = CacheHandler.GetApplicationUserContext("ApplicationContext:"); SessionHelper.SetInSession("userContext", user); SessionHelper.SetInSession("ApplicationContext:en-GB", user); SessionHelper.SetInSession("ApplicationContext:", user); SessionHelper.SetInSession("mySettings", new MySettings()); SessionHelper.SetInSession("results", new CalculatedDataItemCollection()); user.User = new User(user); user.User.UserName = AnalysisPortalTestSettings.Default.TestUserName + "Appuser"; userContext = user; applicationUserContext = user; //SessionHelper.SetInSession("userContext", userContext); //SessionHelper.SetInSession("ApplicationContext:en-GB", applicationUserContext); //SessionHelper.SetInSession("ApplicationContext:", applicationUserContext); // CacheHandler.SetApplicationUserContext("ApplicationContext:", applicationUserContext); }
protected void Page_Load(object sender, EventArgs e) { _AffiliateAccounts = UserDataSource.LoadUserAffiliateAccounts(AbleContext.Current.User.Id); //IF SELEF SIGNUP IS NOT ALLOWED AND AFFILIATE IS NOT REGISTERED THEN NO ACCESS TO THIS PAGE if (!AbleContext.Current.Store.Settings.AffiliateAllowSelfSignup && _AffiliateAccounts.Count == 0) { Response.Redirect("MyAccount.aspx"); } //IF NO EXISTING AFFILIATE ACCOUNT THEN ENABLE SIGNUP if (_AffiliateAccounts.Count == 0) { AffiliateForm1.Visible = true; AffiliateInfoPanel.Visible = false; } //IF HAVE REGISTED AFFILIATE ACCOUNTS THEN SHOW THEM IN DROPDOWN else { AffiliateForm1.Visible = false; AffiliateInfoPanel.Visible = true; trAffiliateReport.Visible = true; int affiliateId = 0; if (!Page.IsPostBack && _AffiliateAccounts.Count > 1) { AffiliateAccountList.DataSource = _AffiliateAccounts; AffiliateAccountList.DataBind(); trMultiAccounts.Visible = true; } else if (!Page.IsPostBack && _AffiliateAccounts.Count == 1) { _Affiliate = _AffiliateAccounts[0]; trMultiAccounts.Visible = false; } if (_AffiliateAccounts.Count > 1) { affiliateId = AlwaysConvert.ToInt(AffiliateAccountList.SelectedValue); _Affiliate = AffiliateDataSource.Load(affiliateId); } else if (_AffiliateAccounts.Count == 1) { _Affiliate = _AffiliateAccounts[0]; } if (!Page.IsPostBack && _Affiliate != null) { BindAffiliateReport(); } HiddenAffiliateId.Value = _Affiliate.Id.ToString(); } }
public void chceckIfLastAdmin() { if (TypeOf == TypeOfUser.Employee) { throw new TravelAgency.Exeptions.UserException(TravelAgency.Exeptions.CreateUserError.CANNOT_CHECK_LAST_ADMIN); } else { UserDataSource dataSource = new UserDataSource(); if (dataSource.CheckIfLastAdmin()) { throw new TravelAgency.Exeptions.DeleteException(TravelAgency.Exeptions.DeleteError.LAST_ADMIN_DELETE); } else if (this.ID == TravelAgency.Utils.SystemManager.Instance.CurrentUser.ID) { throw new TravelAgency.Exeptions.DeleteException(TravelAgency.Exeptions.DeleteError.YOUR_ACCOUNT_DELETE); } } }
public EmployeesViewModel() { _dataSource = new UserDataSource(); }
private void ValidateInputFields(string password) { UserDataSource var = new UserDataSource(); if (String.IsNullOrWhiteSpace(Login) || String.IsNullOrEmpty(Login)) { throw new LoginException(TravelAgencySystem.Exeptions.LoginError.LOGIN_EMPTY); } else if (String.IsNullOrWhiteSpace(password) || String.IsNullOrEmpty(password)) { throw new LoginException(TravelAgencySystem.Exeptions.LoginError.PASSWORD_EMPTY); } User tmpUser = var.IsUserInDatabase(Login, password, _typeOfUser); if (tmpUser == null) { throw new LoginException(TravelAgencySystem.Exeptions.LoginError.INCORRECT_LOGIN_OR_PASSWORD); } else { SystemManager.Instance.CurrentUser = tmpUser; Error = String.Empty; if (_typeOfUser == TypeOfUser.Employee) { SystemWindowViewModel.Instance.ContentControlView = new View.Employee.MainControl(); } else { SystemWindowViewModel.Instance.ContentControlView = new View.Admin.MainControl(); } } }
public void UpdateUser() { UserDataSource dataSource = new UserDataSource(); dataSource.Update(this); }
void Init() { userVC = this.FindResource("UserViewModelDataSource") as UserViewModel; ChannelList = new ObservableCollection<Channel>(); bool ret = wsAdapter.queryAllVdieoRecorder(); if (ret) { foreach (Recorder rec in wsAdapter.RecorderCollection) { foreach (Camera c in rec.Cameras) { foreach (Channel ch in c.chnItemList) { UserDataSource ds = new UserDataSource(); ds.channel = ch; ds.camera = c; userVC.UserList.Add(ds); ChannelList.Add(ch); } } } } }