コード例 #1
0
        public void Run(IHR1Context db, AccountingEntity accountingEntity)
        {
            var amtInput = new JournalTemplateInput()
            {
                AppTenantID   = accountingEntity.AppTenantID,
                Name          = "Salary",
                UserInputType = db.UserInputTypes.First(x => x.Code == "CURRENCY")
            };

            var template = new JournalTemplate();

            template.AppTenantID = accountingEntity.AppTenantID;
            template.JournalType = db.JournalTypes.First(x => x.Code == "PAYSTUB");
            template.Name        = "Salary";
            template.OriginKey   = "EmploymentContract";
            template.UserInputs.Add(amtInput);


            var templateTxn = new JournalTemplateTxn();

            templateTxn.AppTenantID    = accountingEntity.AppTenantID;
            templateTxn.AmountInput    = amtInput;
            templateTxn.Description    = "Salary";
            templateTxn.JournalTxnType = template.JournalType.JournalTxnTypes.First(x => x.IsCode == "AMT");

            template.JournalTemplateTxns.Add(templateTxn);

            accountingEntity.JournalTemplates.Add(template);
        }
コード例 #2
0
        public async Task <IHttpActionResult> Register(RegisterRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            //using (TransactionScope scope = new TransactionScope())
            {
                IHR1Context db = AppCore.IoC.Container.Resolve <IHR1Context>();

                try
                {
                    AppTenant tenant = new AppTenant();
                    tenant.Name = model.CompanyName;
                    var user = new AppUser()
                    {
                        UserName = model.Email, Email = model.Email, AppTenant = tenant
                    };
                    IdentityResult result = await UserManager.CreateAsync(user, model.Password);

                    if (!result.Succeeded)
                    {
                        //scope.Dispose();
                        return(GetErrorResult(result));
                    }

                    var tenantParty = new Party()
                    {
                        AppTenantID = tenant.ID, Name = model.CompanyName, PartyType = "C"
                    };
                    var tentantEntity = new AccountingEntity()
                    {
                        AppTenantID = tenant.ID, Party = tenantParty
                    };
                    db.AccountingEntities.Add(tentantEntity);
                    await db.SaveChangesAsync();

                    //scope.Complete();
                }
                catch (Exception ex)
                {
                    //scope.Dispose();
                    throw ex;
                }
            }

            return(Ok());
        }
コード例 #3
0
 public SearchController(IHR1Context appContext, IAppIdentityContext identityContext, ISearchService searchService)
     : base(appContext, identityContext, searchService)
 {
 }
コード例 #4
0
 public AccountController(IHR1Context appContext, IAppIdentityContext identityContext)
     : base(appContext, identityContext)
 {
 }