Ejemplo n.º 1
0
        /// <summary>
        /// Get currecny  based on invoice customer id
        /// </summary>
        /// <param name="invoiceCustomerId">invoice customer Id</param>
        /// <returns>invoice customer VO object</returns>
        public InvoiceCustomerVO GetCurrencyByCustomer(int invoiceCustomerId)
        {
            InvoiceCustomerVO invoiceCustomerVO = null;
            OACustomer        invoiceCustomer   = mdbDataContext.OACustomers.Where(x => x.ID == invoiceCustomerId).SingleOrDefault();

            if (invoiceCustomer != null)
            {
                invoiceCustomerVO            = new InvoiceCustomerVO();
                invoiceCustomerVO.CurrencyId = invoiceCustomer.CurrencyID;
            }

            return(invoiceCustomerVO);
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="invoiceCustomerVO"></param>
 public InvoiceCustomer(InvoiceCustomerVO invoiceCustomerVO)
 {
     ID                           = invoiceCustomerVO.InvoiceCustomerId;
     OACustomerId                 = invoiceCustomerVO.OACustomerId;
     CompanyId                    = invoiceCustomerVO.CompanyId;
     CompanyName                  = invoiceCustomerVO.CompanyName;
     Name                         = invoiceCustomerVO.Name;
     CurrencyId                   = invoiceCustomerVO.CurrencyId;
     CustomerandOACustomerId      = invoiceCustomerVO.CustomerandOACustomerId;
     ShortName                    = invoiceCustomerVO.ShortName;
     CustomerNameAndShortName     = Name + " - " + ShortName;
     CustomerNameCodeAndShortName = Name + " - " + OACustomerId + " - " + ShortName;
 }
 /// <summary>
 /// Get currecny based on invoice customer id
 /// </summary>
 /// <param name="invoiceCustomerId">The invoice customer Id</param>
 /// <returns>The inovice customer value object</returns>
 public ActionResult GetCurrencyByCustomer(int invoiceCustomerId)
 {
     try
     {
         InvoiceCustomerService invoiceCustomerService = new InvoiceCustomerService();
         InvoiceCustomerVO      invoiceCustomerVO      = invoiceCustomerService.GetCurrencyByCustomer(invoiceCustomerId);
         //CurrencyVO currency = new CurrencyService().GetCurrencyList().FirstOrDefault(x => x.CurrencyName == invoiceCustomerVO.CurrencyId);
         //string currencyName = "does not exist";
         //currencyName = invoiceCustomerVO.CurrencyId;
         return(Json(invoiceCustomerVO.CurrencyId, JsonRequestBehavior.AllowGet));
     }
     catch (Exception e)
     {
         return(new HttpStatusCodeAndErrorResult(500, e.Message));
     }
 }