Exemplo n.º 1
0
        public static PORT.Company GetCompany(string connectionString, Int64 id)
        {
            using (UnitOfWork uow = new UnitOfWork())
            {
                uow.ConnectionString = connectionString;
                uow.Connect();

                PORT.Company company = new PORT.Company();

                DAL.Datamodel.ORG_Company xdp_company = uow.Query <DAL.Datamodel.ORG_Company>().Where(c => c.EntityId.EntityId.Id == id).FirstOrDefault();

                DAL.Datamodel.SYS_Address billing = uow.Query <DAL.Datamodel.ORG_CompanyAddress>().Where(a => a.CompanyId == xdp_company && a.AddressId.TypeId == DAL.Enums.SYS_Type.BillingAddress).FirstOrDefault().AddressId;

                company.billingAddressLine1 = billing.Line1;
                company.billingAddressLine2 = billing.Line2;
                company.billingAddressLine3 = billing.Line3;
                company.billingAddressLine4 = billing.Line4;
                company.billingAddressCode  = billing.Code;
                company.referenceShort1     = xdp_company.SalesmanCode;
                company.referenceShort2     = xdp_company.RepCode;
                company.code = xdp_company.EntityId.EntityId.CodeSub;
                company.name = xdp_company.EntityId.EntityId.Name;

                return(company);
            }
        }
Exemplo n.º 2
0
        public object Get(Int64 id)
        {
            try
            {
                var identity = User.Identity as ClaimsIdentity;

                String conn = identity.Claims.Where(n => n.Type == "conn").FirstOrDefault().Value;

                PORT.Company selectedCompany = BL.Web.ORG.ORG_CompanyProvider.GetCompany(conn, id);

                return(selectedCompany);
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }