public CurrencyInfoWrapper UpdateCRMCurrency(String currency) { if (!CRMSecurity.IsAdmin) { throw CRMSecurity.CreateSecurityException(); } if (string.IsNullOrEmpty(currency)) { throw new ArgumentException(); } currency = currency.ToUpper(); var cur = CurrencyProvider.Get(currency); if (cur == null) { throw new ArgumentException(); } Global.SaveDefaultCurrencySettings(cur); MessageService.Send(Request, MessageAction.CrmDefaultCurrencyUpdated); return(ToCurrencyInfoWrapper(cur)); }
private Invoice GetInvoice(DaoFactory dao) { var invoice = new Invoice(); if (ActionType == InvoiceActionType.Edit) { invoice.ID = TargetInvoice.ID; invoice.Number = TargetInvoice.Number; invoice.FileID = TargetInvoice.FileID; } else { invoice.Number = Request["invoiceNumber"]; if (dao.InvoiceDao.IsExist(invoice.Number)) { throw new InvoiceValidationException(CRMErrorsResource.InvoiceNumberBusy); } } DateTime issueDate; if (!DateTime.TryParse(Request["invoiceIssueDate"], out issueDate)) { throw new InvoiceValidationException("invalid issueDate"); } invoice.IssueDate = issueDate; invoice.ContactID = Convert.ToInt32(Request["invoiceContactID"]); if (invoice.ContactID <= 0) { throw new InvoiceValidationException(CRMErrorsResource.InvoiceContactNotFound); } var contact = dao.ContactDao.GetByID(invoice.ContactID); if (contact == null || !CRMSecurity.CanAccessTo(contact)) { throw new InvoiceValidationException(CRMErrorsResource.InvoiceContactNotFound); } invoice.ConsigneeID = Convert.ToInt32(Request["invoiceConsigneeID"]); if (invoice.ConsigneeID > 0) { var consignee = dao.ContactDao.GetByID(invoice.ConsigneeID); if (consignee == null || !CRMSecurity.CanAccessTo(consignee)) { throw new InvoiceValidationException(CRMErrorsResource.InvoiceConsigneeNotFound); } } else { invoice.ConsigneeID = 0; } invoice.EntityType = EntityType.Opportunity; invoice.EntityID = Convert.ToInt32(Request["invoiceOpportunityID"]); if (invoice.EntityID > 0) { var deal = dao.DealDao.GetByID(invoice.EntityID); if (deal == null || !CRMSecurity.CanAccessTo(deal)) { throw new InvoiceValidationException(CRMErrorsResource.DealNotFound); } var dealMembers = dao.DealDao.GetMembers(invoice.EntityID); if (!dealMembers.Contains(invoice.ContactID)) { throw new InvoiceValidationException("contact doesn't have this opportunity"); } } DateTime dueDate; if (!DateTime.TryParse(Request["invoiceDueDate"], out dueDate)) { throw new InvoiceValidationException(CRMErrorsResource.InvoiceDueDateInvalid); } if (issueDate > dueDate) { throw new InvoiceValidationException(CRMErrorsResource.InvoiceIssueMoreThanDue); } invoice.DueDate = dueDate; invoice.Language = Request["invoiceLanguage"]; if (string.IsNullOrEmpty(invoice.Language) || SetupInfo.EnabledCultures.All(c => c.Name != invoice.Language)) { throw new InvoiceValidationException(CRMErrorsResource.LanguageNotFound); } invoice.Currency = Request["invoiceCurrency"]; if (string.IsNullOrEmpty(invoice.Currency)) { throw new InvoiceValidationException(CRMErrorsResource.CurrencyNotFound); } else { invoice.Currency = invoice.Currency.ToUpper(); if (CurrencyProvider.Get(invoice.Currency) == null) { throw new InvoiceValidationException(CRMErrorsResource.CurrencyNotFound); } } invoice.ExchangeRate = Convert.ToDecimal(Request["invoiceExchangeRate"], new CultureInfo("en-US")); if (invoice.ExchangeRate <= 0) { throw new InvoiceValidationException(CRMErrorsResource.ExchangeRateNotSet); } invoice.PurchaseOrderNumber = Request["invoicePurchaseOrderNumber"]; invoice.Terms = Request["invoiceTerms"]; if (string.IsNullOrEmpty(invoice.Terms)) { throw new InvoiceValidationException(CRMErrorsResource.InvoiceTermsNotFound); } invoice.Description = Request["invoiceDescription"]; invoice.Status = InvoiceStatus.Draft; invoice.TemplateType = InvoiceTemplateType.Eur; return(invoice); }
private IEnumerable <OpportunityWrapper> ToListOpportunityWrapper(ICollection <Deal> deals) { if (deals == null || deals.Count == 0) { return(new List <OpportunityWrapper>()); } var result = new List <OpportunityWrapper>(); var contactIDs = new List <int>(); var dealIDs = new List <int>(); var dealMilestoneIDs = new List <int>(); foreach (var deal in deals) { contactIDs.Add(deal.ContactID); dealIDs.Add(deal.ID); dealMilestoneIDs.Add(deal.DealMilestoneID); } dealMilestoneIDs = dealMilestoneIDs.Distinct().ToList(); var contacts = new Dictionary <int, ContactBaseWrapper>(); var customFields = DaoFactory.GetCustomFieldDao().GetEnityFields(EntityType.Opportunity, dealIDs.ToArray()) .GroupBy(item => item.EntityID) .ToDictionary(item => item.Key, item => item.Select(x => ToCustomFieldWrapper(x))); var dealMilestones = DaoFactory.GetDealMilestoneDao().GetAll(dealMilestoneIDs.ToArray()) .ToDictionary(item => item.ID, item => ToDealMilestoneWrapper(item)); var dealMembers = DaoFactory.GetDealDao().GetMembers(dealIDs.ToArray()); foreach (var value in dealMembers.Values) { contactIDs.AddRange(value); } contactIDs = contactIDs.Distinct().ToList(); if (contactIDs.Count > 0) { DaoFactory.GetContactDao().GetContacts(contactIDs.ToArray()).ForEach(item => { if (item == null) { return; } contacts.Add(item.ID, ToContactBaseWrapper(item)); }); } foreach (var deal in deals) { var dealWrapper = new OpportunityWrapper(deal); if (contacts.ContainsKey(deal.ContactID)) { dealWrapper.Contact = contacts[deal.ContactID]; } if (customFields.ContainsKey(deal.ID)) { dealWrapper.CustomFields = customFields[deal.ID]; } else { dealWrapper.CustomFields = new List <CustomFieldWrapper>(); } if (dealMembers.ContainsKey(dealWrapper.ID)) { dealWrapper.Members = dealMembers[dealWrapper.ID].Where(contacts.ContainsKey).Select(item => contacts[item]); } else { dealWrapper.Members = new List <ContactBaseWrapper>(); } if (dealMilestones.ContainsKey(deal.DealMilestoneID)) { dealWrapper.Stage = dealMilestones[deal.DealMilestoneID]; } dealWrapper.IsPrivate = CRMSecurity.IsPrivate(deal); if (dealWrapper.IsPrivate) { dealWrapper.AccessList = CRMSecurity.GetAccessSubjectTo(deal) .Select(item => EmployeeWraper.Get(item.Key)).ToItemList(); } if (!String.IsNullOrEmpty(deal.BidCurrency)) { dealWrapper.BidCurrency = ToCurrencyInfoWrapper(CurrencyProvider.Get(deal.BidCurrency)); } result.Add(dealWrapper); } return(result); }
protected void SaveOrUpdateContact(object sender, CommandEventArgs e) { try { var dao = Global.DaoFactory; Contact contact; List <Contact> contactsForSetManager = new List <Contact>(); var typeAddedContact = Request["typeAddedContact"]; #region Rights part #1 ShareType shareType = ShareType.None;// 0 - NotShared, 1 - ReadWriting, 2 - Reading if (!String.IsNullOrEmpty(Request["isPublicContact"])) { try { shareType = (ShareType)(Convert.ToInt32(Request["isPublicContact"])); } catch (Exception) { throw new ArgumentException(); } } #endregion #region BaseInfo var companyID = 0; if (!String.IsNullOrEmpty(Request["baseInfo_compID"])) { companyID = Convert.ToInt32(Request["baseInfo_compID"]); } else if (!String.IsNullOrEmpty(Request["baseInfo_compName"])) { var peopleCompany = new Company { CompanyName = Request["baseInfo_compName"].Trim(), ShareType = shareType }; peopleCompany.ID = dao.GetContactDao().SaveContact(peopleCompany); companyID = peopleCompany.ID; contactsForSetManager.Add(peopleCompany); } if (typeAddedContact.Equals("people")) { contact = new Person { FirstName = Request["baseInfo_firstName"].Trim(), LastName = Request["baseInfo_lastName"].Trim(), JobTitle = Request["baseInfo_personPosition"].Trim(), CompanyID = companyID }; } else { contact = new Company { CompanyName = Request["baseInfo_companyName"].Trim() }; } contact.About = !String.IsNullOrEmpty(Request["baseInfo_contactOverview"]) ? Request["baseInfo_contactOverview"].Trim() : null; contact.ShareType = shareType; #endregion #region ContactType and Currency contact.ContactTypeID = Convert.ToInt32(Request["baseInfo_contactType"]); if (contact.ContactTypeID != 0) { var listItem = dao.GetListItemDao().GetByID(contact.ContactTypeID); if (listItem == null) { throw new Exception(CRMErrorsResource.ContactTypeNotFound); } } contact.Currency = Convert.ToString(Request["baseInfo_currency"]); if (!String.IsNullOrEmpty(contact.Currency)) { var currency = CurrencyProvider.Get(contact.Currency); if (currency == null) { throw new Exception(CRMErrorsResource.CurrencyNotFound); } } #endregion #region Base Operation Of Save/Update if (TargetContact != null) { contact.ID = TargetContact.ID; contact.StatusID = TargetContact.StatusID; dao.GetContactDao().UpdateContact(contact); var messageAction = contact is Company ? MessageAction.CompanyUpdated : MessageAction.PersonUpdated; MessageService.Send(HttpContext.Current.Request, messageAction, contact.GetTitle()); contact = dao.GetContactDao().GetByID(contact.ID); } else { contact.ID = dao.GetContactDao().SaveContact(contact); var messageAction = contact is Company ? MessageAction.CompanyCreated : MessageAction.PersonCreated; MessageService.Send(HttpContext.Current.Request, messageAction, contact.GetTitle()); contact = dao.GetContactDao().GetByID(contact.ID); } contactsForSetManager.Add(contact); #endregion #region persons for company if (contact is Company) { var assignedContactsIDs = new List <int>(); if (!String.IsNullOrEmpty(Request["baseInfo_assignedNewContactsIDs"])) { try { var assignedContactsObjs = JArray.Parse(Request["baseInfo_assignedNewContactsIDs"]); var newAssignedContacts = new List <Contact>(); var recordIndex = 0; foreach (var assignedContactsObj in assignedContactsObjs) { newAssignedContacts.Add(new Person { ID = recordIndex, ShareType = shareType, CompanyID = contact.ID, FirstName = assignedContactsObj.Value <String>("FirstName"), LastName = assignedContactsObj.Value <String>("LastName") }); recordIndex++; } dao.GetContactDao().SaveContactList(newAssignedContacts); if (newAssignedContacts.Count != 0) { contactsForSetManager.AddRange(newAssignedContacts); assignedContactsIDs.AddRange(newAssignedContacts.Select(c => c.ID).ToList()); } } catch (Exception ex) { log4net.LogManager.GetLogger("ASC.CRM").Error(ex); } } if (!String.IsNullOrEmpty(Request["baseInfo_assignedContactsIDs"])) { assignedContactsIDs.AddRange(Request["baseInfo_assignedContactsIDs"].Split(',').Select(item => Convert.ToInt32(item)).ToList()); } if (TargetContact != null && !CRMSecurity.IsAdmin) { var restrictedMembers = dao.GetContactDao().GetRestrictedMembers(contact.ID); assignedContactsIDs.AddRange(restrictedMembers.Select(m => m.ID).ToList()); } dao.GetContactDao().SetMembers(contact.ID, assignedContactsIDs.ToArray()); } #endregion #region tags var assignedTags = Request["baseInfo_assignedTags"]; if (assignedTags != null) { var oldTagList = dao.GetTagDao().GetEntityTags(EntityType.Contact, contact.ID); foreach (var tag in oldTagList) { dao.GetTagDao().DeleteTagFromEntity(EntityType.Contact, contact.ID, tag); } if (assignedTags != string.Empty) { var tagListInfo = JObject.Parse(assignedTags)["tagListInfo"].ToArray(); var newTagList = tagListInfo.Select(t => t.ToString()).ToArray(); dao.GetTagDao().SetTagToEntity(EntityType.Contact, contact.ID, newTagList); } } #endregion #region contact infos (addresses, mailes, phones etc.) var contactInfos = new List <ContactInfo>(); var addressList = new Dictionary <int, ContactInfo>(); var addressTemplate = new JObject(); foreach (String addressPartName in Enum.GetNames(typeof(AddressPart))) { addressTemplate.Add(addressPartName.ToLower(), ""); } var addressTemplateStr = addressTemplate.ToString(); foreach (var item in Request.Form.AllKeys) { if (item.StartsWith("customField_")) { int fieldID = Convert.ToInt32(item.Split('_')[1]); String fieldValue = Request.Form[item].Trim(); if (contact is Person) { if (!String.IsNullOrEmpty(fieldValue)) { dao.GetCustomFieldDao().SetFieldValue(EntityType.Person, contact.ID, fieldID, ""); } dao.GetCustomFieldDao().SetFieldValue(EntityType.Person, contact.ID, fieldID, fieldValue); } else { if (!String.IsNullOrEmpty(fieldValue)) { dao.GetCustomFieldDao().SetFieldValue(EntityType.Company, contact.ID, fieldID, ""); } dao.GetCustomFieldDao().SetFieldValue(EntityType.Company, contact.ID, fieldID, fieldValue); } } else if (item.StartsWith("contactInfo_")) { var nameParts = item.Split('_').Skip(1).ToList(); var contactInfoType = (ContactInfoType)Enum.Parse(typeof(ContactInfoType), nameParts[0]); var category = Convert.ToInt32(nameParts[2]); if (contactInfoType == ContactInfoType.Address) { var index = Convert.ToInt32(nameParts[1]); var addressPart = (AddressPart)Enum.Parse(typeof(AddressPart), nameParts[3]); var isPrimaryAddress = Convert.ToInt32(nameParts[4]) == 1; var dataValues = Request.Form.GetValues(item).Select(n => n.Trim()).ToList(); if (!addressList.ContainsKey(index)) { var newAddress = new ContactInfo { Category = category, InfoType = contactInfoType, Data = addressTemplateStr, IsPrimary = isPrimaryAddress, ContactID = contact.ID }; addressList.Add(index, newAddress); } foreach (var data in dataValues) { var addressParts = JObject.Parse(addressList[index].Data); addressParts[addressPart.ToString().ToLower()] = data; addressList[index].Data = addressParts.ToString(); } continue; } var isPrimary = Convert.ToInt32(nameParts[3]) == 1; if (Request.Form.GetValues(item) != null) { var dataValues = Request.Form.GetValues(item).Where(n => !string.IsNullOrEmpty(n.Trim())).ToList(); contactInfos.AddRange(dataValues.Select(dataValue => new ContactInfo { Category = category, InfoType = contactInfoType, Data = dataValue.Trim(), IsPrimary = isPrimary, ContactID = contact.ID })); } } } if (addressList.Count > 0) { contactInfos.AddRange(addressList.Values.ToList()); } dao.GetContactInfoDao().DeleteByContact(contact.ID); dao.GetContactInfoDao().SaveList(contactInfos); #endregion #region Photo var photoPath = Request["uploadPhotoPath"]; if (!String.IsNullOrEmpty(photoPath)) { if (photoPath != "null") { if (photoPath.StartsWith(PathProvider.BaseAbsolutePath)) { var tmpDirName = photoPath.Substring(0, photoPath.LastIndexOf('/')); ContactPhotoManager.TryUploadPhotoFromTmp(contact.ID, TargetContact == null, tmpDirName); } else { ContactPhotoManager.UploadPhoto(photoPath, contact.ID); } } } else if (TargetContact != null) { ContactPhotoManager.DeletePhoto(TargetContact.ID); } #endregion #region Rights part #2 SetContactManager(contactsForSetManager); #endregion #region Link with mail message int result; var linkMessageId = int.TryParse(Request["linkMessageId"], out result) ? result : 0; if (linkMessageId > 0) { try { LinkWithMessage(linkMessageId, contact.ID); } catch (Exception ex) { log4net.LogManager.GetLogger("ASC.CRM").Error(ex); } } #endregion Response.Redirect(String.Compare(e.CommandArgument.ToString(), "0", true) == 0 ? String.Format("default.aspx?id={0}{1}", contact.ID, contact is Company ? "" : String.Format("&{0}=people", UrlConstant.Type)) : String.Format("default.aspx?action=manage{0}", contact is Company ? "" : String.Format("&{0}=people", UrlConstant.Type)), false); Context.ApplicationInstance.CompleteRequest(); } catch (Exception ex) { log4net.LogManager.GetLogger("ASC.CRM").Error(ex); var cookie = HttpContext.Current.Request.Cookies.Get(ErrorCookieKey); if (cookie == null) { cookie = new HttpCookie(ErrorCookieKey) { Value = ex.Message }; HttpContext.Current.Response.Cookies.Add(cookie); } } }
public static void DemandCreateOrUpdate(Invoice invoice) { if (invoice.IssueDate == DateTime.MinValue || invoice.ContactID <= 0 || invoice.DueDate == DateTime.MinValue || String.IsNullOrEmpty(invoice.Currency) || invoice.ExchangeRate <= 0 || String.IsNullOrEmpty(invoice.Terms) || String.IsNullOrEmpty(invoice.Currency)) { throw new ArgumentException(); } var contact = Global.DaoFactory.GetContactDao().GetByID(invoice.ContactID); if (contact == null) { throw new ArgumentException(); } if (!CanAccessTo(contact)) { throw new SecurityException("Access denied to contact"); } if (invoice.ConsigneeID != 0 && invoice.ConsigneeID != invoice.ContactID) { var consignee = Global.DaoFactory.GetContactDao().GetByID(invoice.ConsigneeID); if (consignee == null) { throw new ArgumentException(); } if (!CanAccessTo(consignee)) { throw new SecurityException("Access denied to consignee contact"); } } if (invoice.EntityID != 0) { var deal = Global.DaoFactory.GetDealDao().GetByID(invoice.EntityID); if (deal == null) { throw new ArgumentException(); } if (!CanAccessTo(deal)) { throw new SecurityException("Access denied to opportunity"); } var dealMembers = Global.DaoFactory.GetDealDao().GetMembers(invoice.EntityID); if (!dealMembers.Contains(invoice.ContactID)) { throw new ArgumentException(); } } if (CurrencyProvider.Get(invoice.Currency.ToUpper()) == null) { throw new ArgumentException(); } }
public static void DemandCreateOrUpdate(Invoice invoice) { if (invoice.IssueDate == DateTime.MinValue || invoice.ContactID <= 0 || invoice.DueDate == DateTime.MinValue || String.IsNullOrEmpty(invoice.Currency) || invoice.ExchangeRate <= 0 || String.IsNullOrEmpty(invoice.Terms)) { throw new ArgumentException(); } using (var scope = DIHelper.Resolve()) { var daoFactory = scope.Resolve <DaoFactory>(); var contact = daoFactory.ContactDao.GetByID(invoice.ContactID); if (contact == null) { throw new ArgumentException(); } if (!CanAccessTo(contact)) { throw new SecurityException(CRMErrorsResource.AccessDenied); } if (invoice.ConsigneeID != 0 && invoice.ConsigneeID != invoice.ContactID) { var consignee = daoFactory.ContactDao.GetByID(invoice.ConsigneeID); if (consignee == null) { throw new ArgumentException(); } if (!CanAccessTo(consignee)) { throw new SecurityException(CRMErrorsResource.AccessDenied); } } if (invoice.EntityID != 0) { var deal = daoFactory.DealDao.GetByID(invoice.EntityID); if (deal == null) { throw new ArgumentException(); } if (!CanAccessTo(deal)) { throw new SecurityException(CRMErrorsResource.AccessDenied); } var dealMembers = daoFactory.DealDao.GetMembers(invoice.EntityID); if (!dealMembers.Contains(invoice.ContactID)) { throw new ArgumentException(); } } } if (CurrencyProvider.Get(invoice.Currency.ToUpper()) == null) { throw new ArgumentException(); } }
public OpportunityDto Convert(Deal source, OpportunityDto destination, ResolutionContext context) { var dealDto = new OpportunityDto { Id = source.ID, CreateBy = _employeeWraperHelper.Get(source.CreateBy), Created = _apiDateTimeHelper.Get(source.CreateOn), Title = source.Title, Description = source.Description, Responsible = _employeeWraperHelper.Get(source.ResponsibleID), BidType = source.BidType, BidValue = source.BidValue, PerPeriodValue = source.PerPeriodValue, SuccessProbability = source.DealMilestoneProbability, ActualCloseDate = _apiDateTimeHelper.Get(source.ActualCloseDate), ExpectedCloseDate = _apiDateTimeHelper.Get(source.ExpectedCloseDate), CanEdit = _crmSecurity.CanEdit(source) }; if (source.ContactID > 0) { dealDto.Contact = context.Mapper.Map <ContactBaseDto>(_daoFactory.GetContactDao().GetByID(source.ContactID)); } if (source.DealMilestoneID > 0) { var dealMilestone = _daoFactory.GetDealMilestoneDao().GetByID(source.DealMilestoneID); if (dealMilestone == null) { throw new ItemNotFoundException(); } dealDto.Stage = new DealMilestoneBaseDto(dealMilestone); } dealDto.AccessList = _crmSecurity.GetAccessSubjectTo(source) .Select(item => _employeeWraperHelper.Get(item.Key)); dealDto.IsPrivate = _crmSecurity.IsPrivate(source); if (!string.IsNullOrEmpty(source.BidCurrency)) { dealDto.BidCurrency = context.Mapper.Map <CurrencyInfoDto>(_currencyProvider.Get(source.BidCurrency)); } dealDto.CustomFields = _daoFactory.GetCustomFieldDao().GetEnityFields(EntityType.Opportunity, source.ID, false).ConvertAll(item => context.Mapper.Map <CustomFieldBaseDto>(item)); dealDto.Members = new List <ContactBaseDto>(); var memberIDs = _daoFactory.GetDealDao().GetMembers(source.ID); var membersList = _daoFactory.GetContactDao().GetContacts(memberIDs); var membersDtoList = new List <ContactBaseDto>(); foreach (var member in membersList) { if (member == null) { continue; } membersDtoList.Add(context.Mapper.Map <ContactBaseDto>(member)); } dealDto.Members = membersDtoList; return(dealDto); }
private IEnumerable <OpportunityDto> ToListOpportunityDto(ICollection <Deal> deals) { if (deals == null || deals.Count == 0) { return(new List <OpportunityDto>()); } var result = new List <OpportunityDto>(); var contactIDs = new List <int>(); var dealIDs = new List <int>(); var dealMilestoneIDs = new List <int>(); foreach (var deal in deals) { contactIDs.Add(deal.ContactID); dealIDs.Add(deal.ID); dealMilestoneIDs.Add(deal.DealMilestoneID); } dealMilestoneIDs = dealMilestoneIDs.Distinct().ToList(); var contacts = new Dictionary <int, ContactBaseDto>(); var customFields = _daoFactory.GetCustomFieldDao().GetEnityFields(EntityType.Opportunity, dealIDs.ToArray()) .GroupBy(item => item.EntityID) .ToDictionary(item => item.Key, item => item.Select(x => _mapper.Map <CustomFieldBaseDto>(x))); var dealMilestones = _daoFactory.GetDealMilestoneDao().GetAll(dealMilestoneIDs.ToArray()) .ToDictionary(item => item.ID, item => new DealMilestoneBaseDto(item)); var dealMembers = _daoFactory.GetDealDao().GetMembers(dealIDs.ToArray()); foreach (var value in dealMembers.Values) { contactIDs.AddRange(value); } contactIDs = contactIDs.Distinct().ToList(); if (contactIDs.Count > 0) { _daoFactory.GetContactDao().GetContacts(contactIDs.ToArray()).ForEach(item => { if (item == null) { return; } contacts.Add(item.ID, _mapper.Map <ContactBaseDto>(item)); }); } foreach (var deal in deals) { var dealDto = _mapper.Map <OpportunityDto>(deal); if (contacts.ContainsKey(deal.ContactID)) { dealDto.Contact = contacts[deal.ContactID]; } dealDto.CustomFields = customFields.ContainsKey(deal.ID) ? customFields[deal.ID] : new List <CustomFieldBaseDto>(); dealDto.Members = dealMembers.ContainsKey(dealDto.Id) ? dealMembers[dealDto.Id].Where(contacts.ContainsKey).Select(item => contacts[item]) : new List <ContactBaseDto>(); if (dealMilestones.ContainsKey(deal.DealMilestoneID)) { dealDto.Stage = dealMilestones[deal.DealMilestoneID]; } dealDto.IsPrivate = _crmSecurity.IsPrivate(deal); if (dealDto.IsPrivate) { dealDto.AccessList = _crmSecurity.GetAccessSubjectTo(deal).Select(item => _employeeWraperHelper.Get(item.Key)); } if (!string.IsNullOrEmpty(deal.BidCurrency)) { dealDto.BidCurrency = _mapper.Map <CurrencyInfoDto>(_currencyProvider.Get(deal.BidCurrency)); } result.Add(dealDto); } return(result); }
public List <RateAndAbbr> UpdateSummaryTable(string newCurrency) { var table = CurrencyProvider.MoneyConvert(CurrencyProvider.Get(newCurrency)); return(table.Select(tableItem => new RateAndAbbr(tableItem.Value, tableItem.Key.Abbreviation)).ToList()); }
public RateInfo ChangeCurrency(string fromCurrency, string toCurrency) { return(new RateInfo(CurrencyProvider.MoneyConvert(1, fromCurrency, toCurrency), CurrencyProvider.Get(fromCurrency).Title, CurrencyProvider.Get(toCurrency).Title)); }