public Space(string id, bool system, string parentOrgId, string parentSpaceId, string name, string nameSystem, string nameSystemFull, IOrg parentOrg, ISpace parentSpace) : base(id, system, parentSpaceId, nameSystem, nameSystemFull, parentSpace) { ParentOrgId = parentOrgId; Name = name; ParentOrg = parentOrg; }
public async Task <IActionResult> GetOrg(Guid guid) { IOrg org = await m_org_provider.GetOrg(guid); if (org == null) { return(NotFound()); } return(Ok(new OrgModel(org))); }
protected void btnAddOrUpdate_Click(object sender, EventArgs e) { int orgId = Convert.ToInt32(ddlOrg.SelectedValue); int accountId = Convert.ToInt32(ddlAccount.SelectedValue); IOrg org = Provider.Data.Org.GetOrg(orgId); IAccount acct = Provider.Data.Account.GetAccount(accountId); if (org != null && acct != null) { var util = new OrgRechargeUtility(DateTime.Now, Provider); util.Enable(org, acct); } LoadOrgRechargeItems(); }
public Org(IOrg org) : base(org) { Rating = org.Rating; if (org.Address != null) { Address = new Address(org.Address); } if (org.Locations != null && org.Locations.Any()) { Locations = org.Locations.Select(x => new Location(x)).OrderBy(x => x.ReorderLevel).ToArray(); } }
private void AssertOrg(IOrg o) { Assert.AreEqual(17, o.OrgID); Assert.AreEqual("University of Michigan", o.OrgName); Assert.AreEqual(18, o.DefClientAddressID); Assert.AreEqual(0, o.DefBillAddressID); Assert.AreEqual(0, o.DefShipAddressID); Assert.AreEqual(true, o.NNINOrg); Assert.AreEqual(true, o.PrimaryOrg); Assert.AreEqual(true, o.OrgActive); Assert.AreEqual(1, o.OrgTypeID); Assert.AreEqual("U of Michigan (US)", o.OrgTypeName); Assert.AreEqual(5, o.ChargeTypeID); Assert.AreEqual("UMich", o.ChargeTypeName); Assert.AreEqual(67, o.ChargeTypeAccountID); }
public IAccount GetRechargeAccount(IOrg org, DateTime startDate, DateTime endDate) { IAccount result = null; var or = Provider.Billing.OrgRecharge.GetOrgRecharge(org.OrgID, startDate, endDate); if (or == null) { IChargeType ct = Provider.Data.Org.GetChargeType(org.ChargeTypeID); result = Provider.Data.Account.GetAccount(ct.AccountID); //no recharge account specified for this org so use the default from ChargeType } else { result = Provider.Data.Account.GetAccount(or.AccountID); } return(result); }
public IOrgRecharge Enable(IOrg org, IAccount acct) { //first get the existing entity if there is one var existing = Provider.Billing.OrgRecharge.GetOrgRecharge(org.OrgID); if (existing != null) { //we don't need to do anything if Org and Account are the same if (existing.AccountID == acct.AccountID) { return(existing); } //disable existing existing.DisableDate = Now; } //add a new one var result = Provider.Billing.OrgRecharge.AddOrgRecharge(org.OrgID, acct.AccountID, Now, Now); return(result); }
public OrgModel(IOrg org) : base(org) { Rating = org.Rating; ReorderLevel = org.ReorderLevel; if (org.Address != null) { Address = new AddressModel(org.Address); } Cellular = org.Cellular; Phone = org.Phone; Email = org.Email; Skype = org.Skype; Description = org.Description; Uri = org.Uri; if (org.Locations != null && org.Locations.Any()) { Locations = org.Locations.Select(x => new LocationModel(x)).ToList(); } }
public ActionResult Edit(int orgId, int accountId) { var currentOrg = DataSession.Single <Org>(orgId); if (currentOrg == null) { return(RedirectToAction("Index", new { orgId })); } var model = new AccountEditModel { AccountID = accountId, CurrentOrg = currentOrg }; var fundingSources = DataSession.Query <FundingSource>().OrderBy(x => x.FundingSourceName).ToList(); model.FundingSources = fundingSources; var technicalFields = DataSession.Query <TechnicalField>().OrderBy(x => x.TechnicalFieldName).ToList(); model.TechnicalFields = technicalFields; var specialTopics = DataSession.Query <SpecialTopic>().OrderBy(x => x.SpecialTopicName).ToList(); model.SpecialTopics = specialTopics; Account acct = null; if (accountId > 0) { acct = DataSession.Single <Account>(accountId); if (acct == null && accountId > 0) { return(RedirectToAction("Index", new { orgId })); } if (acct.Org.OrgID != orgId) { return(RedirectToAction("Index", new { orgId })); } model.AccountName = acct.Name; } AccountEdit acctEdit; IAccount a = acct.CreateModel <IAccount>(); IOrg o = currentOrg.CreateModel <IOrg>(); if (Session["AccountEdit"] == null) { InitAccountEdit(a, o); } else { acctEdit = (AccountEdit)Session["AccountEdit"]; if (acctEdit.OrgID != currentOrg.OrgID || acctEdit.AccountID != accountId) { InitAccountEdit(a, o); } } acctEdit = (AccountEdit)Session["AccountEdit"]; model.AvailableManagers = AccountEditUtility.GetAvailableManagers(acctEdit); model.IsChartFieldOrg = AccountChartFields.IsChartFieldOrg(o); return(View(model)); }
private void InitAccountEdit(IAccount acct, IOrg org) { AccountEdit acctEdit = new AccountEdit(); // null means adding a new account if (acct != null) { acctEdit.OrgID = acct.OrgID; acctEdit.AccountID = acct.AccountID; acctEdit.AccountName = acct.AccountName; acctEdit.AccountNumber = acct.AccountNumber; acctEdit.AccountTypeID = acct.AccountTypeID; acctEdit.FundingSourceID = acct.FundingSourceID; acctEdit.Managers = AccountEditUtility.GetManagerEdits(acct.AccountID); acctEdit.ShortCode = acct.ShortCode.Trim(); acctEdit.SpecialTopicID = acct.SpecialTopicID; acctEdit.TechnicalFieldID = acct.TechnicalFieldID; acctEdit.InvoiceNumber = acct.InvoiceNumber; acctEdit.InvoiceLine1 = acct.InvoiceLine1; acctEdit.InvoiceLine2 = acct.InvoiceLine2; acctEdit.PoEndDate = acct.PoEndDate; acctEdit.PoInitialFunds = acct.PoInitialFunds; acctEdit.PoRemainingFunds = acct.PoRemainingFunds; acctEdit.Addresses = new Dictionary <string, AddressEdit> { { "billing", AccountEditUtility.GetAddressEdit(acct.BillAddressID) }, { "shipping", AccountEditUtility.GetAddressEdit(acct.ShipAddressID) } }; if (AccountChartFields.IsChartFieldOrg(org)) { var cf = ServiceProvider.Current.Data.Account.GetChartFields(acct); acctEdit.ChartFields = new AccountChartFieldEdit() { Account = cf.Account, Fund = cf.Fund, Department = cf.Department, Program = cf.Program, Class = cf.Class, Project = cf.Project, ShortCode = cf.ShortCode }; } } else { acctEdit.OrgID = org.OrgID; acctEdit.Managers = new List <AccountManagerEdit>(); acctEdit.Addresses = new Dictionary <string, AddressEdit> { { "billing", AccountEditUtility.GetAddressEdit(org.DefBillAddressID) }, { "shipping", AccountEditUtility.GetAddressEdit(org.DefShipAddressID) } }; acctEdit.AccountTypeID = 1; if (AccountChartFields.IsChartFieldOrg(org)) { acctEdit.ChartFields = new AccountChartFieldEdit(); } } Session["AccountEdit"] = acctEdit; }
public static bool IsChartFieldOrg(IOrg org) { return(org.OrgTypeID == 1); }
public DataType(string id, bool system, string orgId, string parentSpaceId, string name, string namePlural, string nameSystem, string nameSystemPlural, string nameSystemFull, IEnumerable <IDataProperty> properties, IEnumerable <IDataRelation> relations, IEnumerable <IDataRow> rows, IOrg parentOrg, ISpace parentSpace) : base(id, system, orgId, name, parentOrg) { ParentSpaceId = parentSpaceId; NamePlural = namePlural; NameSystem = nameSystem; NameSystemPlural = nameSystemPlural; NameSystemFull = nameSystemFull; Properties = properties; Relations = relations; Rows = rows; ParentSpace = parentSpace; }
public Org(string id, bool system, string orgId, string name, string nameShort, string nameShortFull, IEnumerable <IOrg> orgs, IOrg parentOrg) : base(id, system, orgId, name, parentOrg) { NameShort = nameShort; NameShortFull = nameShortFull; Orgs = orgs; }
public OrgChild(string id, bool system, string orgId, string name, IOrg parentOrg) : base(id, name) { System = system; ParentOrgId = orgId; ParentOrg = parentOrg; }