Exemple #1
0
        private void CreateSelfProfile(Models.Company.NewCompanyModel newCompany)
        {
            Console.WriteLine("> Create Self Organization Profile");

            if (this.DataItems.Get(Models.Datum.DataItemKey.OrganizationName) == null)
            {
                this.DataItems.Set(Models.Datum.DataItemKey.OrganizationName, newCompany.Name);
                this.DataItems.Set(Models.Datum.DataItemKey.TaxId, newCompany.TaxID);

                var profilesDal = new Repository.Profiles.Profiles(this);

                var erpProfile = new Models.Profiles.Profile()
                {
                    Id                 = Guid.NewGuid(),
                    ProfileType        = Models.Profiles.ProfileType.Organization,
                    Name               = newCompany.Name,
                    CreatedDate        = DateTime.Today,
                    localizedLanguage  = Models.Profiles.EnumLanguage.en,
                    TaxNumber          = newCompany.TaxID,
                    isSelfOrganization = true
                };

                this.erpNodeDBContext.Profiles.Add(erpProfile);
                this.erpNodeDBContext.SaveChanges();
            }
        }
Exemple #2
0
        public ReceivePayment Create(Models.Profiles.Profile profile, Commercial com, DateTime workingDate)
        {
            var payment = new ReceivePayment()
            {
                TransactionDate = workingDate,
                Profile         = profile,
                AssetAccount    = organization.SystemAccounts.Cash,
                TransactionType = TransactionTypes.ReceivePayment,
                No = this.NextNumber
            };

            erpNodeDBContext.ReceivePayments.Add(payment);

            if (com != null && com.CommercialPayment == null)
            {
                payment.AddCommercial(com);
            }



            erpNodeDBContext.SaveChanges();


            return(payment);
        }
Exemple #3
0
 public Supplier Create(Models.Profiles.Profile newSupplierProfile)
 {
     if (newSupplierProfile.Supplier == null)
     {
         newSupplierProfile.Supplier = new Supplier()
         {
             Status = SupplierStatus.Active
         };
     }
     erpNodeDBContext.SaveChanges();
     return(newSupplierProfile.Supplier);
 }
Exemple #4
0
 public Employee Create(Models.Profiles.Profile newEmployeeProfile)
 {
     if (newEmployeeProfile.Employee == null)
     {
         newEmployeeProfile.Employee = new Employee()
         {
             Status      = EmployeeStatus.Active,
             OnBoardDate = DateTime.Today,
         };
     }
     erpNodeDBContext.SaveChanges();
     return(newEmployeeProfile.Employee);
 }
Exemple #5
0
        public Models.Equity.Investor Create(Models.Profiles.Profile newEmployeeProfile)
        {
            if (newEmployeeProfile.Investor == null)
            {
                newEmployeeProfile.Investor = new Investor()
                {
                    Status      = Models.Equity.Enums.InvestorStatus.Active,
                    StockAmount = 0
                };
            }
            erpNodeDBContext.SaveChanges();

            return(newEmployeeProfile.Investor);
        }
Exemple #6
0
        public Sale Create(Models.Profiles.Profile profile, DateTime trDate)
        {
            var newSale = new Sale()
            {
                No              = this.NextNumber,
                ProfileGuid     = profile.Id,
                Profile         = profile,
                TransactionDate = trDate,
                CompanyProfile  = organization.SelfProfile,
                Status          = CommercialStatus.Open,
                CommercialItems = new HashSet <CommercialItem>(),
                TransactionType = this.transactionType,
            };

            newSale.AddCommercialTax(organization.TaxCodes.GetDefaultOuput);

            erpNodeDBContext.Sales.Add(newSale);
            erpNodeDBContext.SaveChanges();

            return(newSale);
        }