AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Разработка
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 07.05.2009, 17:31   #10  
Elka is offline
Elka
Участник
Аватар для Elka
 
431 / 22 (1) +++
Регистрация: 02.12.2008
Адрес: г. Ростов-на-Дону
Спасибо большое за ссылки... У меня есть еще 2 вопроса ():
1)не знаю как получить значение из моего поля new_esum
2)Если я правильно понимаю , то BusinessEntityCollection retrieved = service.RetrieveMultiple(query);
в retrieved я получаю все позиции прайс-листа с нужным мне значением продукта.. как можно перебрать эти позиции() и присвоить им новое значение amount





publicvoid Execute(IPluginExecutionContext context)
{
DynamicEntity entity = null;
if (context.InputParameters.Properties.Contains(ParameterName.Target) &&
context.InputParameters.Properties[
ParameterName.Target] isDynamicEntity)
{
// Obtain the target business entity from the input parmameters.
entity = (DynamicEntity)context.InputParameters.Properties[ParameterName.Target];
//______________________________
if (context.MessageName != MessageName.Update.ToString()
&& context.MessageName !=
MessageName.Create.ToString())
{
thrownewInvalidPluginExecutionException("Smth wrong with Update stage may be");
}
//___________________________
}
else
{
return;
}
try
{

ICrmService crmService = context.CreateCrmService(true);
//_________________________________________________________
//пытаюсь получить значение из моего поля new_esum (тип money)---
//
float sum = (float)entity.Properties["new_esum"];
String new_productname = "";

//считываю значение продукта
if(entity.Properties.Contains("productid"))
{

ColumnSet cs = newColumnSet();
Lookup regarding = (Lookup)entity.Properties["productid"];
cs.Attributes.Add(
"name");
product _product = (product)crmService.Retrieve(EntityName.product.ToString(), regarding.Value, cs);
if (_product == null || _product.name == null)
{
return;
}
else
{
new_productname = _product.name.ToString();
}
}
//ищу нужную позицию в прайс-листе
CrmService service = newCrmService();
service.Credentials = System.Net.
CredentialCache.DefaultCredentials;
// Create the query object.
QueryByAttribute query = newQueryByAttribute();
query.ColumnSet =
newAllColumns();
query.EntityName =
EntityName.productpricelevel.ToString();
// The query will retrieve all productpricelevel whose productidname is new_productname.
query.Attributes = newstring[] { "productidname" };
query.Values =
newstring[] { new_productname };
// Execute the retrieval.
// если правильно понимаю, получила все позиции прайс-листа с продуктом
//равным new_productname
BusinessEntityCollection retrieved = service.RetrieveMultiple(query);
// не знаю как перебрать значения и присвоить значение sum
// ((((
retrieved.Properties.Add(newStringProperty("amount", sum));



}
Теги
c#, plugin, pluginregistrationtool, регистрация

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
CRM DE LA CREME! Three Top Tips for CRM 4.0 Plugin Development Blog bot Dynamics CRM: Blogs 0 13.08.2009 15:05
haditeo: Is it possible to register different event handlers in only one assembly to be registered in Dynamics CRM Plugin ? Blog bot Dynamics CRM: Blogs 0 13.08.2009 15:05
a33ik: Plugin for copying notes and attachements from lead to contact whis is converted from lead for Microsoft Dynamics CRM 4.0 Blog bot Dynamics CRM: Blogs 0 10.07.2009 17:05
Ronald Lemmen: Plugin registration tools for Visual Studio 2005 Blog bot Dynamics CRM: Blogs 0 17.04.2009 01:05
PlugIn ImageEntity Konstantin Katsovich Dynamics CRM: Разработка 3 16.01.2009 17:35

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 07:11.