public ActionResult Kurumlar(string RecordId, string MenuId) { CrmRepository crmDB = RepositoryManager.GetRepository <CrmRepository>(); Kurum model = new Kurum(); #region Ortak Set Edilecek Değerler MenuId = GlobalHelper.Decrypt(MenuId); model.RecordId = RecordId; model.MenuId = MenuId; SessionContext.Current.ActiveUser.MenuId = MenuId; #endregion Guid recordId = Guid.Empty; if (GlobalHelper.IsGuid(model.RecordId)) { try { recordId = Guid.Parse(model.RecordId); model = crmDB.BindKurum(model, recordId); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } return(View(model)); }
public void Execute(IServiceProvider serviceProvider) { try { ServerConnection cnx = new ServerConnection(serviceProvider); Entity entity = cnx.context.InputParameters["Target"] as Entity; if (!ValidacionContexto(cnx, entity)) { return; } CrmRepository crmRepository = new CrmRepository(cnx); List <Tab> tabs = crmRepository.RecuperarTabs(entity.Id); tabs.ForEach(t => t.Fichas = crmRepository.RecuperarFichas(t.Id)); foreach (var tab in tabs) { tab.Fichas.ForEach(f => f.Secciones = crmRepository.RecuperarSecciones(f.Id)); } entity["rs_configuraciontabs"] = ContruirCadenaConfiguracionesTabs(tabs); entity["rs_publicarconfiguracion"] = false; } catch (Exception ex) { throw new InvalidPluginExecutionException($"IntBank.ConfiguracionTabs.Generar: " + ex.Message); } }
public ActionResult Tasks(string RecordId, string MenuId, string FromNotification, string NotificationId) { CrmRepository crmDB = RepositoryManager.GetRepository <CrmRepository>(); TaskRepository tskDB = RepositoryManager.GetRepository <TaskRepository>(); GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); Task model = new Task(); MenuId = GlobalHelper.Decrypt(MenuId); model.RecordId = RecordId; model.MenuId = MenuId; SessionContext.Current.ActiveUser.MenuId = MenuId; Guid recordId = Guid.Empty; model.activeProjects = crmDB.GetProjectList(); model.activeUsers = gnlDB.GetActiveUsers(); model.taskStatus = tskDB.GetTaskStatusList(); model.taskPriority = tskDB.GetTaskPriorityList(); if (GlobalHelper.IsGuid(model.RecordId)) { try { recordId = Guid.Parse(model.RecordId); model = tskDB.BindTask(model, recordId); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; if (FromNotification == "1" && GlobalHelper.IsGuid(NotificationId)) { gnlDB.UpdateNotificationShown(Guid.Parse(NotificationId)); } } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { if (recordId == Guid.Empty) { model.task_user_id = SessionContext.Current.ActiveUser.UserUid.ToString(); model.assigned_user_id = SessionContext.Current.ActiveUser.UserUid.ToString(); } } return(View(model)); }
public DmsWebService(IOrganizationService service) { _service = service; _dotcySettingRepository = new CrmRepository <dot_dotcysetting>(_service); _documentRepository = new CrmRepository <dot_documents>(_service); _contactRepository = new CrmRepository <Contact>(_service); _leadRepository = new CrmRepository <Lead>(_service); _accountRepository = new CrmRepository <Account>(_service); _systemUserRepository = new CrmRepository <SystemUser>(_service); _annotationRepository = new CrmRepository <Annotation>(_service); _documentTypeRepository = new CrmRepository <dot_documenttype>(_service); authorization = CheckIsAuthorization(); }
static void Main(string[] args) { freshdesk = new FreshdeskRepository(); accountMapper = new AccountMapper(); contactMapper = new ContactMapper(); ticketMapper = new TicketMapper(); crm = new CrmRepository(); string dayOfWeek = DateTime.Now.DayOfWeek.ToString(); if (dayOfWeek == "Saturday") { AgentSync(); } AccountSync(); ContactSync(); TicketSync(); }
public void Execute(IServiceProvider serviceProvider) { try { ServerConnection cnx = new ServerConnection(serviceProvider); CrmRepository crm = new CrmRepository(cnx); ValidaContexto(cnx); foreach (EntityReference created in (IEnumerable <Object>)cnx.context.OutputParameters["CreatedEntities"]) { if (created.LogicalName == "account") { Entity account = crm.GetAccount(created.Id); } } } catch (Exception e) { throw new InvalidPluginExecutionException("QualifyLeadOutputP.ObtenerRegistros: " + e.Message); } }
public void Execute(IServiceProvider serviceProvider) { try { ServerConnection cnx = new ServerConnection(serviceProvider); CrmRepository crmRepository = new CrmRepository(cnx); Entity entity = (Entity)cnx.context.InputParameters["Target"]; if (!ValidarContexto(entity, cnx)) { return; } ListaDePrecio listaDePrecio = crmRepository.ObtenerListaDePrecios().Find(l => l.Name == "Retail"); Oportunidad opportunity = BuildOportunidad(entity, listaDePrecio); crmRepository.CrearOportunidad(opportunity); } catch (Exception e) { throw new InvalidPluginExecutionException(); } }
public ActionResult Bireyler(string RecordId, string MenuId) { CrmRepository crmDB = RepositoryManager.GetRepository <CrmRepository>(); Birey model = new Birey(); #region Ortak Set Edilecek Değerler MenuId = GlobalHelper.Decrypt(MenuId); model.RecordId = RecordId; model.MenuId = MenuId; SessionContext.Current.ActiveUser.MenuId = MenuId; #endregion Guid recordId = Guid.Empty; model.activeKurumlar = crmDB.GetKurumList(); if (GlobalHelper.IsGuid(model.RecordId)) { try { recordId = Guid.Parse(model.RecordId); model = crmDB.BindBirey(model, recordId); if (model.calistigi_kurum_id != null && GlobalHelper.IsGuidOrEmpty(model.calistigi_kurum_id)) { model.calistigi_kurum_id = model.calistigi_kurum_id.ToString(); } ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } return(View(model)); }
public ActionResult Tasks(Task model) { Guid recordId = Guid.Empty; TaskRepository tskDB = RepositoryManager.GetRepository <TaskRepository>(); CrmRepository crmDB = RepositoryManager.GetRepository <CrmRepository>(); GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); SessionContext.Current.ActiveUser.MenuId = model.MenuId; ViewBag.Success = true; model.activeProjects = crmDB.GetProjectList(); model.activeUsers = gnlDB.GetActiveUsers(); model.taskStatus = tskDB.GetTaskStatusList(); model.taskPriority = tskDB.GetTaskPriorityList(); ModelState.Remove("is_active"); ModelState.Remove("is_task_sent"); if (model.FromDeleteButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { tskDB.DeleteTask(model, Guid.Parse(model.RecordId)); return(RedirectToAction("ListPage", "General", new { MenuId = Dcm.Source.GlobalHelper.Encrypt(model.MenuId) })); } } else if (model.FromCreateTaskButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { tskDB.UpdateTaskStatus(model, Guid.Parse(model.RecordId), (int)Enums.TaskStatus.Gonderildi, true); model = tskDB.BindTask(model, Guid.Parse(model.RecordId)); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } } else if (model.FromAddExplanationButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { tskDB.UpdateExplanation(model, Guid.Parse(model.RecordId)); model = tskDB.BindTask(model, Guid.Parse(model.RecordId)); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } } else { if (ModelState.IsValid) { if (GlobalHelper.IsGuid(model.RecordId)) { recordId = Guid.Parse(model.RecordId); try { if (model.task_user_id != BaseDB.SessionContext.Current.ActiveUser.UserUid.ToString() && model.assigned_user_id == BaseDB.SessionContext.Current.ActiveUser.UserUid.ToString()) { tskDB.UpdateTaskStatus(model, Guid.Parse(model.RecordId), Convert.ToInt32(model.task_status_id), model.is_active); model = tskDB.BindTask(model, Guid.Parse(model.RecordId)); } else { model = tskDB.UpdateTask(model, recordId); model = tskDB.BindTask(model, Guid.Parse(model.RecordId)); } ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { try { tsk_tasks task = new tsk_tasks(); tskDB.AddTask(task, model); model.RecordId = task.task_id.ToString(); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } } else { ViewBag.Success = false; } } return(View(model)); }
public TicketMapper() { service = CrmServiceFactory.GetOrganization(); _crmRepository = new CrmRepository(); }
public ActionResult Kurumlar(Kurum model) { Guid recordId = Guid.Empty; CrmRepository crmDB = RepositoryManager.GetRepository <CrmRepository>(); #region Ortak Set Edilecek Değerler SessionContext.Current.ActiveUser.MenuId = model.MenuId; ViewBag.Success = true; #endregion ModelState.Remove("is_active"); if (model.FromDeleteButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { crmDB.DeleteKurum(model, Guid.Parse(model.RecordId)); return(RedirectToAction("ListPage", "General", new { MenuId = Dcm.Source.GlobalHelper.Encrypt(model.MenuId) })); } } else { if (ModelState.IsValid) { if (GlobalHelper.IsGuid(model.RecordId)) { recordId = Guid.Parse(model.RecordId); try { model = crmDB.UpdateKurum(model, recordId); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { try { crm_kurumlar kurum = new crm_kurumlar(); crmDB.AddKurum(kurum, model); model.RecordId = kurum.kurum_id.ToString(); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } } else { ViewBag.Success = false; } } return(View(model)); }
public ActionResult Projects(Project model) { Guid recordId = Guid.Empty; CrmRepository crmDB = RepositoryManager.GetRepository <CrmRepository>(); GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); #region Ortak Set Edilecek Değerler SessionContext.Current.ActiveUser.MenuId = model.MenuId; ViewBag.Success = true; #endregion model.activeKurumlar = crmDB.GetKurumList(); model.activeBireyler = crmDB.GetBireyList(); model.activeUsers = gnlDB.GetActiveUsers(); model.projectTypes = crmDB.GetProjectTypeList(); model.activeBireylerKurumlar = crmDB.GetBireyKurumList(); model.project_type_id = "1"; ModelState.Remove("is_active"); if (model.FromDeleteButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { crmDB.DeleteProject(model, Guid.Parse(model.RecordId)); return(RedirectToAction("ListPage", "General", new { MenuId = Dcm.Source.GlobalHelper.Encrypt(model.MenuId) })); } } else { if (ModelState.IsValid) { if (GlobalHelper.IsGuid(model.RecordId)) { recordId = Guid.Parse(model.RecordId); try { model = crmDB.UpdateProject(model, recordId); if (model.birey_id != null && GlobalHelper.IsGuidOrEmpty(model.birey_id)) { model.birey_id = model.birey_id.ToString(); } if (model.kurum_id != null && GlobalHelper.IsGuidOrEmpty(model.kurum_id)) { model.kurum_id = model.kurum_id.ToString(); } if (model.statik != null && GlobalHelper.IsGuidOrEmpty(model.statik)) { model.statik = model.statik.ToString(); } if (model.mekanik != null && GlobalHelper.IsGuidOrEmpty(model.mekanik)) { model.mekanik = model.mekanik.ToString(); } if (model.elektrik != null && GlobalHelper.IsGuidOrEmpty(model.elektrik)) { model.elektrik = model.elektrik.ToString(); } if (model.harita != null && GlobalHelper.IsGuidOrEmpty(model.harita)) { model.harita = model.harita.ToString(); } if (model.yapi_denetim != null && GlobalHelper.IsGuidOrEmpty(model.yapi_denetim)) { model.yapi_denetim = model.yapi_denetim.ToString(); } if (model.isveren_mobil_phone != null) { model.isveren_mobil_phone = model.isveren_mobil_phone.ToString(); } if (model.proje_metrekare != null && !string.IsNullOrEmpty(model.proje_metrekare.ToString())) { model.proje_metrekare = model.proje_metrekare.ToString(); } ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { try { crm_projects project = new crm_projects(); crmDB.AddProject(project, model); model.RecordId = project.project_id.ToString(); if (project.birey_id != null) { model.birey_id = project.birey_id.ToString(); } if (project.kurum_id != null) { model.kurum_id = project.kurum_id.ToString(); } if (project.statik != null) { model.statik = project.statik.ToString(); } if (project.mekanik != null) { model.mekanik = project.mekanik.ToString(); } if (project.elektrik != null) { model.elektrik = project.elektrik.ToString(); } if (project.harita != null) { model.harita = project.harita.ToString(); } if (project.yapı_denetimi != null) { model.yapi_denetim = project.yapı_denetimi.ToString(); } if (project.isveren_mobile_phone != null) { model.isveren_mobil_phone = project.isveren_mobile_phone.ToString(); } if (project.metre_kare != null && !string.IsNullOrEmpty(model.proje_metrekare.ToString())) { model.proje_metrekare = project.metre_kare.ToString(); model.proje_metrekare = model.proje_metrekare.Replace(',', '.'); } ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } } else { ViewBag.Success = false; } } return(View(model)); }
public ActionResult Projects(string RecordId, string MenuId) { CrmRepository crmDB = RepositoryManager.GetRepository <CrmRepository>(); GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); Project model = new Project(); #region Ortak Set Edilecek Değerler MenuId = GlobalHelper.Decrypt(MenuId); model.RecordId = RecordId; model.MenuId = MenuId; SessionContext.Current.ActiveUser.MenuId = MenuId; #endregion Guid recordId = Guid.Empty; model.activeKurumlar = crmDB.GetKurumList(); model.activeBireyler = crmDB.GetBireyList(); model.activeBireylerKurumlar = crmDB.GetBireyKurumList(); model.activeUsers = gnlDB.GetActiveUsers(); model.projectTypes = crmDB.GetProjectTypeList(); model.kurum_id = Guid.Empty.ToString(); model.birey_id = Guid.Empty.ToString(); model.project_type_id = "1"; if (GlobalHelper.IsGuid(model.RecordId)) { try { recordId = Guid.Parse(model.RecordId); model = crmDB.BindProject(model, recordId); if (model.birey_id != null && GlobalHelper.IsGuidOrEmpty(model.birey_id)) { model.birey_id = model.birey_id.ToString(); } if (model.kurum_id != null && GlobalHelper.IsGuidOrEmpty(model.kurum_id)) { model.kurum_id = model.kurum_id.ToString(); } if (model.statik != null && GlobalHelper.IsGuidOrEmpty(model.statik)) { model.statik = model.statik.ToString(); } if (model.mekanik != null && GlobalHelper.IsGuidOrEmpty(model.mekanik)) { model.mekanik = model.mekanik.ToString(); } if (model.elektrik != null && GlobalHelper.IsGuidOrEmpty(model.elektrik)) { model.elektrik = model.elektrik.ToString(); } if (model.harita != null && GlobalHelper.IsGuidOrEmpty(model.harita)) { model.harita = model.harita.ToString(); } if (model.yapi_denetim != null && GlobalHelper.IsGuidOrEmpty(model.yapi_denetim)) { model.yapi_denetim = model.yapi_denetim.ToString(); } if (model.isveren_mobil_phone != null) { model.isveren_mobil_phone = model.isveren_mobil_phone.ToString(); } if (model.proje_metrekare != null && !string.IsNullOrEmpty(model.proje_metrekare.ToString())) { model.proje_metrekare = model.proje_metrekare; model.proje_metrekare = model.proje_metrekare.Replace(',', '.'); } ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } return(View(model)); }