protected void ButtonAddNote_Click(object sender, EventArgs e) { var request = new AddOrUpdateNoteRequest(); CrmLead crmLead = JsonConvert.DeserializeObject <CrmLead>(HiddenFieldLeadJson.Value); request.Update = new List <AddOrUpdateCrmNote>(); request.Add = new List <AddOrUpdateCrmNote>(); { var _note = new AddOrUpdateCrmNote(); _note.ElementId = crmLead.Id; _note.ElementType = 2; _note.Text = TextBoxTextNote.Text; _note.ResponsibleUserId = Convert.ToInt64(3160069); _note.NoteType = 4; request.Add.Add(_note); } _service.AddOrUpdateNote(request); Response.Redirect("~/avgis.aspx?IdLead=" + crmLead.Id); TextBoxTextNote.Text = ""; LabelMsg.Visible = true; LabelMsg.CssClass = "alert alert-success"; LabelMsg.Text = "Примечание добавлено"; }
private long addNote(long LeadId, string Text, string IdNote) { var laed = _service.GetLead(LeadId); var requestNote = new AddOrUpdateNoteRequest(); requestNote.Update = new List <AddOrUpdateCrmNote>(); requestNote.Add = new List <AddOrUpdateCrmNote>(); { var _note = new AddOrUpdateCrmNote(); _note.ElementId = laed.Id; _note.ElementType = 2; _note.Text = Text; _note.ResponsibleUserId = Convert.ToInt64(3160069); _note.NoteType = 4; if (IdNote != "") { _note.Id = Convert.ToInt64(IdNote); requestNote.Update.Add(_note); } else { requestNote.Add.Add(_note); } } var newNotes = _service.AddOrUpdateNote(requestNote); return(newNotes.FirstOrDefault().Id); }
protected void ButtonAddNote_Click(object sender, EventArgs e) { var requestNote = new AddOrUpdateNoteRequest(); requestNote.Update = new List <AddOrUpdateCrmNote>(); requestNote.Add = new List <AddOrUpdateCrmNote>(); { var _note = new AddOrUpdateCrmNote(); _note.ElementId = Convert.ToInt64(HiddenFieldMainContactId.Value); _note.ElementType = 1; _note.Text = TextBoxNote.Text; // _note.ResponsibleUserId = note.ResponsibleUserId; _note.NoteType = 4; requestNote.Add.Add(_note); } _service.AddOrUpdateNote(requestNote); TextBoxNote.Text = ""; LabelMsg.Visible = true; LabelMsg.CssClass = "alert alert-success"; LabelMsg.Text = "Примечание добавлено"; }
public List <AddedOrUpdatedNote> AddOrUpdateNote(AddOrUpdateNoteRequest addOrUpdateNoteRequest) { var request = addOrUpdateNoteRequest; var response = AmoMethod.Post <AddOrUpdateNoteResponse>(request, _crmConfig); return(response.Response.Tasks); }
protected void ButtonUpdateAddLead_Click(object sender, EventArgs e) { if (HiddenFieldLeadJson.Value != "") { var request = new AddOrUpdateLeadRequest(); CrmLead crmLead = JsonConvert.DeserializeObject <CrmLead>(HiddenFieldLeadJson.Value); var lead = new AddOrUpdateCrmLead(); lead.Id = crmLead.Id; lead.Name = TextBoxLeadName.Text; lead.StatusId = DropDownListStatuses.SelectedValue; lead.PipelineId = DropDownListPipeline.SelectedValue; lead.Tags = TextBoxTags.Text; lead.ResponsibleUserId = Convert.ToInt64(DropDownListResponsibleUsers.SelectedValue); lead.DateCreateTimestamp = crmLead.DateCreateTimestamp; lead.Tags = TextBoxTags.Text; lead.StatusId = crmLead.StatusId.ToString(); lead.CustomFields = GetCustomFieldsValues <AddLeadCustomField>(TypeField.Lead, "Lead"); request.Update = new List <AddOrUpdateCrmLead>(); request.Update.Add(lead); _service.AddOrUpdateLead(request); } else { var request = new AddOrUpdateLeadRequest(); var lead = new AddOrUpdateCrmLead(); lead.Name = TextBoxLeadName.Text; lead.ResponsibleUserId = Convert.ToInt64(DropDownListResponsibleUsers.SelectedValue); lead.DateCreate = DateTime.Now; lead.Tags = TextBoxTags.Text; lead.StatusId = DropDownListStatuses.SelectedValue; lead.PipelineId = DropDownListPipeline.SelectedValue; // lead.MainContact = new CrmMainContact() { id = IdContact }; // lead.StatusId = crmLead.StatusId.ToString(); lead.CustomFields = GetCustomFieldsValues <AddLeadCustomField>(TypeField.Lead, "Lead"); request.Add = new List <AddOrUpdateCrmLead>(); request.Add.Add(lead); var newLead = _service.AddOrUpdateLead(request); if (newLead.Count > 0) { if (HiddenFieldIdChain.Value != null) { var requestNote = new AddOrUpdateNoteRequest(); requestNote.Update = new List <AddOrUpdateCrmNote>(); requestNote.Add = new List <AddOrUpdateCrmNote>(); { var _note = new AddOrUpdateCrmNote(); _note.ElementId = newLead.FirstOrDefault().Id; _note.ElementType = 2; _note.Text = "CallId:" + HiddenFieldIdChain.Value; _note.ResponsibleUserId = Convert.ToInt64(3160069); _note.NoteType = 4; requestNote.Add.Add(_note); } _service.AddOrUpdateNote(requestNote); } var IdContact = CreateContacts(newLead.FirstOrDefault().Id); Response.Redirect("~/avgis.aspx?IdLead=" + newLead.FirstOrDefault().Id); } } PanelNotes.Visible = true; LabelMsg.Visible = true; LabelMsg.CssClass = "alert alert-success"; LabelMsg.Text = "Данные по лиду обновлены"; }