Advertisement
Guest User

Linking an Activity to a Sales Opportunity

a guest
Jun 26th, 2014
429
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.36 KB | None | 0 0
  1. CompanyService actCmp = Git_DIApi.VCmp.GetCompanyService();
  2. ActivitiesService actService = (ActivitiesService)actCmp.GetBusinessService(ServiceTypes.ActivitiesService);
  3. Activity act = (Activity)actService.GetDataInterface(ActivitiesServiceDataInterfaces.asActivity);
  4.                            
  5. try
  6. {   ActivityParams oParams;            
  7.     act.Activity = BoActivities.cn_Task;
  8.     act.ActivityType = -1; //"1 Продажи"
  9.     act.Subject = 50; //"Follow Up"
  10.     act.CardCode = CardCode;
  11.  
  12.     act.ContactPersonCode = CntctCode;
  13.     act.HandledBy = SlpCode;
  14.     act.Notes = "";
  15.  
  16.     DateTime now = DateTime.Now;
  17.     DateTime startDate = now.AddDays(3);
  18.     DateTime endDate = now.AddDays(10);
  19.     act.ActivityDate = now;
  20.     act.ActivityTime = now;
  21.     act.StartDate = startDate;
  22.     act.StartTime = startDate;
  23.     act.EndDuedate = endDate;
  24.     act.EndTime = endDate;
  25.    
  26.     act.DocType = ObjTypeQt;
  27.     act.DocEntry = DocId;
  28.                                    
  29.     act.SalesOpportunityId = OpprId; // ! Linking an Activity
  30.     act.SalesOpportunityLine = Line; // !
  31.                                    
  32.     oParams = actService.AddActivity(act);
  33.     int ActCode = oParams.ActivityCode;
  34. }
  35. catch(Exception ex)
  36. {   BubbleEvent = false;
  37.     errMsg = "Ошибка при добавлении активности: " + ex.Message;  
  38. }
  39. finally
  40. {   Marshal.ReleaseComObject(actCmp); actCmp = null;
  41.     Marshal.ReleaseComObject(actService); actService = null;
  42.     Marshal.ReleaseComObject(act); act = null;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement