public OverviewServices(DPOContext context) : base(context) { this.projectService = new ProjectServices(context); this.htmlService = new HtmlServices(context); this.conversionService = new ConversionServices(context); }
// #################################################################################### // Create user // #################################################################################### public User GetOrCreateTestUser(DPOContext context, Group group, Business business, string name, UserTypeEnum userType, bool approved, bool isGroupOwner) { string email = string.Format("{0}@somewhere.com", name); var user = Db.UserQueryByEmail(email).FirstOrDefault(); if (user == null) { user = Db.UserCreate(business, group, userType); user.FirstName = name; user.LastName = userType.ToString();; user.RegisteredOn = DateTime.Now; user.Email = email; user.Salt = 234544543; user.Password = Crypto.Hash("test", 234544543); user.LastLoginOn = DateTime.Now; user.UseBusinessAddress = true; user.IsGroupOwner = isGroupOwner; if (approved) { user.Approved = true; user.ApprovedOn = DateTime.Now; user.Enabled = true; } // Add all permissions to user Db.CopyPermissions(EntityEnum.Business, business.BusinessId, EntityEnum.User, user.UserId); Db.CopyPermissions(EntityEnum.UserType, (long)userType, EntityEnum.User, user.UserId); } return(user); }
public BusinessServices(DPOContext context) : base(context) { this.addressService = new AddressServices(this.Context); this.contactService = new ContactServices(this.Context); this.businessLinkService = new BusinessLinkServices(this.Context); this.htmlService = new HtmlServices(this.Context); }
public DaikinServices(DPOContext context) : base(context) { daikinSuperUser = new AccountServices().GetSuperUserSessionModel().Model as UserSessionModel; quoteServices = new QuoteServices(this.Context); businessService = new BusinessServices(this.Context); client = new CrmServiceClient(Utilities.Config("dpo.webservices.endpoint")); }
public UserServices(DPOContext context) : base(context) { permissionService = new PermissionServices(this.Context); addressService = new AddressServices(this.Context); contactService = new ContactServices(this.Context); businessService = new BusinessServices(this.Context); htmlService = new HtmlServices(this.Context); }
public BaseServices(DPOContext context) { this.Db = new Repository(context); this.Context = this.Db.Context; this.Response = new ServiceResponse(); DropDownMode = Common.DropDownMode.Filtering; this.Log = LogManager.GetLogger(this.GetType()); }
public static DPOContext TestContext() { return(new DPOContext(DPOContext.GenerateConnectionString(DPOContext.Domain))); //return new DPOContext(DPOContext.GenerateConnectionString(DomainEnum.QA)); //string connectionString = //DPOContext dpoContext = new DPOContext(); }
public BasketServices(DPOContext context) : base(context) { if (Log == null) { Log = log4net.LogManager.GetLogger(typeof(BasketServices)); } if (this.log == null && Log != null) { this.log = Log; } }
public void CreateNewTestContext() { if (TContext != null && TContext.TransactionScope != null) { TContext.Rollback(); } TContext = TestAdmin.TestContext(); TContext.SetTransactional(System.Data.IsolationLevel.ReadUncommitted); db = new Repository(this.TContext); this.TContext.ReadOnly = false; }
// #################################################################################### // Create quote item // #################################################################################### public QuoteItem CreateTestQuoteItem(DPOContext context, Quote quote, Product product, decimal quantity, AccountMultiplier multiplier) { var item = Db.QuoteItemCreate(quote); item.QuoteId = quote.QuoteId; item.ProductId = product.ProductId; item.ProductNumber = product.ProductNumber; item.Description = product.Name; item.Quantity = quantity; item.Multiplier = multiplier.Multiplier; item.AccountMultiplierId = multiplier.AccountMultiplierId; item.ListPrice = product.ListPrice; return(item); }
public static void InitialiseTests(TestContext test) { string rootpath = (AppDomain.CurrentDomain.BaseDirectory ?? Environment.CurrentDirectory) + @"\\..\\..\\..\\..\\"; bool recreateSchema = DPOContext.GenerateSQLCEedmx(rootpath, @"DPO.Tests\\DPO.Tests\\Context\\DPOContextTest.edmx"); // file path of the database to create var dbTestFilePath = TestDatabasePath(); if (recreateSchema) { throw new Exception("New Edmx Test file found and copied. Please publish the new database and compile code"); } var context = TestAdmin.TestContext(); //new SystemServices().SeedSystemDataDefaults(); // new SystemTestDataServices().SeedSystemTestData(); }
// #################################################################################### // Create Quote // #################################################################################### public Quote CreateTestQuote(DPOContext context, Project project, string title, bool active, int version) { var quote = Db.QuoteCreate(project.ProjectId); quote.Title = title; quote.QuoteId = context.GenerateNextLongId(); quote.ProjectId = project.ProjectId; quote.Title = title; quote.Active = active; quote.Revision = version; if (active) { project.ActiveVersion = version; } return(quote); }
// #################################################################################### // Create project // #################################################################################### public Project CreateTestProject(DPOContext context, User owner, string customername, string title, DateTime projectDate, ProjectType type, ProjectOpenStatusType status, ProjectStatusType projectstatus, VerticalMarketType vertical) { var project = Db.ProjectCreate(owner.UserId); project.CustomerName = customername; project.Name = title; project.ProjectTypeId = type.ProjectTypeId; project.ConstructionTypeId = (int)ConstructionTypeEnum.New; project.ProjectOpenStatusTypeId = status.ProjectOpenStatusTypeId; project.ProjectStatusTypeId = projectstatus.ProjectStatusTypeId; project.VerticalMarketTypeId = vertical.VerticalMarketTypeId; project.ProjectDate = projectDate; project.BidDate = projectDate.AddDays(1); project.EstimatedClose = projectDate.AddDays(3); project.EstimatedDelivery = project.EstimatedClose.AddDays(7); project.Expiration = project.EstimatedClose.AddDays(30); return(project); }
private void ConcurrencyCheck <T>(DPOContext user1, DbSet <T> set1, DPOContext user2, DbSet <T> set2) where T : class { try { user1.IgnoreTimestampChecking = true; user2.IgnoreTimestampChecking = true; var entity = set1.First() as IConcurrency; //The other user comes and performs an update var entity2 = set2.First() as IConcurrency; entity2.Timestamp = DateTime.Now; user2.SaveChanges(); entity.Timestamp = DateTime.Now; user1.SaveChanges(); Assert.Fail("Failed concurrency check for" + typeof(T).ToString()); } catch (DbUpdateConcurrencyException e) { var ex = e; } }
public BusinessLinkServices(DPOContext context) : base(context) { }
public DaikinCityServices(DPOContext context) : base(context) { }
public PermissionServices(DPOContext context) : base(context) { }
public ContactServices(DPOContext context) : base(context) { }
public ConversionServices(DPOContext context) : base(context) { }
public LinkServices(DPOContext context) : base(context) { }
public ProductComponentCalculator(DPOContext context) : base(context) { }
public SubmittalPackageServices(DPOContext context) : base(context) { }
public BaseDaikinUniveristyServices(DPOContext context) : base(context) { LoadConfig(); }
public DaikinUniversityApiServices(DPOContext context) : base(context) { daikinSuperUser = new AccountServices().GetSuperUserSessionModel().Model as UserSessionModel; }
public HtmlServices(DPOContext context) : base(context) { }
public static DPOContext TestContext() { return(new DPOContext(DPOContext.GenerateConnectionString(DPOContext.Domain))); }
public AddressServices(DPOContext context) : base(context) { }
public UserGroupsServices(DPOContext context) : base(context) { }
public SystemTestDataServices(DPOContext context) : base(context) { }
public OrderServices(DPOContext context) : base(context) { htmlService = new HtmlServices(context); }