Ejemplo n.º 1
0
        private void GetUsers()
        {
            event_followup_log _item = new event_followup_log();
            List<CTSubCampaignUser> _lstItems = new List<CTSubCampaignUser>();
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {
                _item = _efDbContext.event_followup_log.FirstOrDefault(i => i.id == m_EventFollowUpLogId);
                _lstItems = _efDbContext.FIGetSubCampaignUsers(_item.subcampaign_id).ToList();
            }

            cboSubCampaignUsers.Properties.DataSource = null;
            cboSubCampaignUsers.Properties.Columns.Clear();
            cboSubCampaignUsers.Properties.DataSource = _lstItems;
            cboSubCampaignUsers.Properties.ValueMember = "id";
            cboSubCampaignUsers.Properties.DisplayMember = "fullname";
            cboSubCampaignUsers.Properties.Columns.Add(new LookUpColumnInfo("fullname"));
            cboSubCampaignUsers.EditValue = _item.assigned_user;
        }
Ejemplo n.º 2
0
        public void LoadSalesUsers(int pSubCampaignId = 0, int DefaultSalesUserId = 0)
        {
            /**
             * DAN: As don't know what is the purpose as on below code, id=0 belongs to Team.
             * So if user select Team or 0 as id, it will not reflect because the default selected will be the
             * Current User Id.
             * https://brightvision.jira.com/browse/PLATFORM-2615
             *
             * if (DefaultSalesUserId == 0)
             * DefaultSalesUserId = UserSession.CurrentUser.UserId;
             */

            int _SubCampaignId = pSubCampaignId;
            if (pSubCampaignId == 0)
                _SubCampaignId = SubCampaignId;

            /**
             * pSubCampaignId:
             * 0 = means that it will load the users for this current sub campaign.
             * greater than 0 = means we must load the users of the selected nurture sub campaign.
             */
            using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) {

                if (pSubCampaignId == 0) {
                    int _FinalListId = 0;
                    final_lists _efeFinalList = _efDbContext.final_lists.FirstOrDefault(i => i.sub_campaign_id == _SubCampaignId);
                    _efDbContext.Detach(_efeFinalList);

                    if (_efeFinalList != null)
                        _FinalListId = _efeFinalList.id;
                    if (m_FinalListId != _FinalListId)
                        m_FinalListId = _FinalListId;
                    if (m_FinalListId < 1)
                        return;
                }

                try {
                    if (salesScriptGetUsers != null)
                        salesScriptGetUsers.Clear();

                    List<CTSubCampaignUser> _lstItems = new List<CTSubCampaignUser>();
                    if (pSubCampaignId > 0)
                        _lstItems.Add(new CTSubCampaignUser() { id = 0, fullname = "Team" });

                    List<CTSubCampaignUser> _lstData = _efDbContext.FIGetSubCampaignUsers(_SubCampaignId).ToList();
                    if (_lstData.Count > 0)
                        foreach (CTSubCampaignUser _item in _lstData)
                            _lstItems.Add(_item);

                    cboSalesUser.Properties.DataSource = null;
                    cboSalesUser.Properties.DataSource = _lstItems;
                    cboSalesUser.Properties.DisplayMember = "fullname";
                    cboSalesUser.Properties.ValueMember = "id";

                    if (_lstItems.Exists(i => i.id == DefaultSalesUserId))
                        cboSalesUser.EditValue = DefaultSalesUserId;
                    else if (_lstItems.Exists(i => i.id == 0))
                        cboSalesUser.EditValue = 0;
                }
                catch {
                    return;
                }
            }
        }