Example #1
0
 /// <summary>
 /// Contructor Modificado
 /// </summary>
 /// <param name="leadSource"> Leadsource con que se inicia </param>
 /// <history>
 /// [aalcocer] 10/03/2015 Created
 /// </history>
 public frmGraph(LeadSource leadSource)
 {
     InitializeComponent();
     _leadsource = leadSource;
     chartProduccion.Series.OfType <ColumnSeries>().ToList().ForEach(serie => serie.ItemsSource        = _lstGraphProductionByPRData);
     chartGeneralProduccion.Series.OfType <ColumnSeries>().ToList().ForEach(serie => serie.ItemsSource = _lstGeneralGraphProductionByPRData);
 }
Example #2
0
        /// <summary>
        /// Abre la ventana detalle en modo "detalle" o "edición" dependiendo de sus permisos
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 13/05/2016
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            LeadSource          leadSource          = (LeadSource)dgrLeadSources.SelectedItem;
            frmLeadSourceDetail frmLeadSourceDetail = new frmLeadSourceDetail();

            frmLeadSourceDetail.Owner         = this;
            frmLeadSourceDetail.enumMode      = (_blnEdit) ? EnumMode.Edit : EnumMode.ReadOnly;
            frmLeadSourceDetail.oldLeadSource = leadSource;
            if (frmLeadSourceDetail.ShowDialog() == true)
            {
                List <LeadSource> lstLeadSources = (List <LeadSource>)dgrLeadSources.ItemsSource;
                int nIndex = 0;
                if (ValidateFilter(frmLeadSourceDetail.leadSource))
                {
                    ObjectHelper.CopyProperties(leadSource, frmLeadSourceDetail.leadSource, true); //Actualizar los datos
                    lstLeadSources.Sort((x, y) => string.Compare(x.lsN, y.lsN));                   //Ordenar la lista
                    nIndex = lstLeadSources.IndexOf(leadSource);                                   //Obtener el indice del registro
                }
                else
                {
                    lstLeadSources.Remove(leadSource);
                }
                dgrLeadSources.Items.Refresh();                                //Actualizamos la vista
                GridHelper.SelectRow(dgrLeadSources, nIndex);                  //Seleccionamos el registro
                StatusBarReg.Content = lstLeadSources.Count + " Lead Sources"; //Actualizmos el contador
            }
        }
Example #3
0
 public static LeadSource GetLeadSourceByLeadSourceID(int LeadSourceID)
 {
     LeadSource leadSource = new LeadSource();
     SqlLeadSourceProvider sqlLeadSourceProvider = new SqlLeadSourceProvider();
     leadSource = sqlLeadSourceProvider.GetLeadSourceByLeadSourceID(LeadSourceID);
     return leadSource;
 }
Example #4
0
        private static void Initialize(SyncAppContext context)
        {
            if (context.Database.EnsureCreated())
            {
                User[] userEntries = new User[]
                {
                    new User {
                        UserId = Guid.NewGuid(), LoginId = "tamil", UserName = "******", Password = "******"
                    },
                    new User
                    {
                        UserId   = Guid.NewGuid(),
                        LoginId  = "udayan",
                        UserName = "******",
                        Password = "******"
                    }
                };

                context.Users.AddRange(userEntries);
                context.LeadStatuses.AddRange(LeadStatus.GetMasterData());
                context.Users.AddRange(userEntries);
                context.LeadSources.AddRange(LeadSource.GetMasterData());
                Addon365.WebSync.Models.SampleData.PopulateLicenseMachine();
                context.Profiles.AddRange(Addon365.WebSync.Models.SampleData.pro);
                context.Customers.AddRange(Addon365.WebSync.Models.SampleData.cus);
                context.Licenses.AddRange(Addon365.WebSync.Models.SampleData.lic);
                context.LicenseMachines.AddRange(Addon365.WebSync.Models.SampleData.licMac);

                context.SaveChanges();
            }
        }
    private void showLeadSourceData()
    {
        LeadSource leadSource = new LeadSource();

        leadSource             = LeadSourceManager.GetLeadSourceByLeadSourceID(Int32.Parse(Request.QueryString["ID"]));
        txtLeadSourceName.Text = leadSource.LeadSourceName.ToString();
    }
Example #6
0
        /// <summary>
        /// Cargamos los LeadSources lgados al notice
        /// </summary>
        /// <history>
        /// [emoguel] created 26/07/2016
        /// </history>
        private async void LoadLeadSources()
        {
            try
            {
                cmbLeadSources.ItemsSource = await BRLeadSources.GetLeadSources(-1, -1, -1);

                if (enumMode != EnumMode.Add)
                {
                    List <LeadSource> lstLeadSources = await BRLeadSources.GetLeadsourcesByNotice(notice.noID);

                    dgrLeadSources.ItemsSource = lstLeadSources;
                    _lstOldLeadSources         = lstLeadSources.Select(ls =>
                    {
                        LeadSource lss = new LeadSource();
                        ObjectHelper.CopyProperties(lss, ls);
                        return(lss);
                    }).ToList();
                    cmbLeadSources.Header = "Lead Sources (" + lstLeadSources.Count + ")";
                }
                skpStatus.Visibility = Visibility.Collapsed;
                btnAccept.Visibility = Visibility.Visible;
                GridHelper.SelectRow(dgrLeadSources, 0);
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
Example #7
0
    public static LeadSource GetLeadSourceByLeadSourceID(int LeadSourceID)
    {
        LeadSource            leadSource            = new LeadSource();
        SqlLeadSourceProvider sqlLeadSourceProvider = new SqlLeadSourceProvider();

        leadSource = sqlLeadSourceProvider.GetLeadSourceByLeadSourceID(LeadSourceID);
        return(leadSource);
    }
        public ActionResult EditLeadSource(int id)
        {
            List <LeadSource> leadSource = new List <LeadSource>();

            leadSource = _LeadSource.GetLeadSourceList();
            LeadSource leadSrc = leadSource.Where(x => x.LeadSourceId == id).FirstOrDefault();

            return(View(leadSrc));
        }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        LeadSource leadSource = new LeadSource();

        leadSource.LeadSourceID   = int.Parse(Request.QueryString["ID"].ToString());
        leadSource.LeadSourceName = txtLeadSourceName.Text;
        bool resutl = LeadSourceManager.UpdateLeadSource(leadSource);

        Response.Redirect("AdminDisplayLeadSource.aspx");
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        LeadSource leadSource = new LeadSource();

//	leadSource.LeadSourceID=  int.Parse(ddlLeadSourceID.SelectedValue);
        leadSource.LeadSourceName = txtLeadSourceName.Text;
        int resutl = LeadSourceManager.InsertLeadSource(leadSource);

        Response.Redirect("AdminDisplayLeadSource.aspx");
    }
        public LoanDetailsModel OpenConciergeCommandEmbedded(string workQueueType, string action, Guid loanId, string prospectId)
        {
            var user = ( UserAccount )HttpContext.Session[SessionHelper.UserData];

            if (action == "DefaultCommand")
            {
                if (workQueueType == "Prospects")
                {
                    action = loanId == Guid.Empty ? "Manage Prospects" : "Manage Loan Application";
                }
                else
                {
                    action = "Manage Loan Application";
                }
            }

            String additionalInformation = "";

            if (action == "Manage Disclosures")
            {
                additionalInformation = GeneralSettingsServiceFacade.RetrieveeSigningVendorIntegrationEnabled() &&
                                        LoanServiceFacade.RetrieveeSigningEnabledForLoan(loanId)
                                            ? "eSigning Room"
                                            : "";
            }

            var titleInformation = ConciergeWorkQueueServiceFacade.ExecuteSPGetBorrowerData("GetBorrowerData", loanId, user.UserAccountId);

            LeadSource leadSource  = LoanServiceFacade.RetrieveHearAboutUs(loanId);
            string     hearAboutUs = string.Empty;

            if (leadSource != null)
            {
                if (leadSource.AffinityGroup == Contracts.Affiliate.AffinityGroup.PartnersProfiles)
                {
                    if (leadSource.HBMId != null && leadSource.HBMId != Guid.Empty)
                    {
                        hearAboutUs = leadSource.LeadSourceId + " Realtor-HBM";
                    }
                    else
                    {
                        hearAboutUs = leadSource.LeadSourceId + " Realtor";
                    }
                }
                else
                {
                    hearAboutUs = leadSource.LeadSourceId + " " + leadSource.Description;
                }
            }

            return(new LoanDetailsModel {
                Title = action, TitleInformation = titleInformation, AdditionalInformation = additionalInformation, HearAboutUs = hearAboutUs
            });
        }
        public ActionResult NewLeadSource(LeadSource leadSource)
        {
            bool result = _LeadSource.SaveLeadSource(leadSource);

            if (result)
            {
                return(RedirectToAction("ViewLeadSource", "MasterSettings"));
            }

            return(RedirectToAction("NewLeadSource", "MasterSettings"));
        }
Example #13
0
        public ActionResult Edit(
            [Bind(Include = "Id,Name,IncomingNumberNational,IncomingNumberInternational,ForwardingNumber")]
            LeadSource leadSource)
        {
            if (ModelState.IsValid)
            {
                _repository.Update(leadSource);
                return(RedirectToAction("Index", new { Controller = "Dashboard" }));
            }

            return(View(leadSource));
        }
Example #14
0
        public static LeadSource Create(LeadSourceAddModel model, string userId)
        {
            var data = new LeadSource
            {
                Name      = model.Name,
                Status    = Constants.RecordStatus.Active,
                CreatedBy = userId ?? "0",
                CreatedOn = Utility.GetDateTime(),
            };

            return(data);
        }
Example #15
0
    public int InsertLeadSource(LeadSource leadSource)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("InsertLeadSource", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@LeadSourceID", SqlDbType.Int).Direction    = ParameterDirection.Output;
            cmd.Parameters.Add("@LeadSourceName", SqlDbType.NVarChar).Value = leadSource.LeadSourceName;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return((int)cmd.Parameters["@LeadSourceID"].Value);
        }
    }
Example #16
0
    public bool UpdateLeadSource(LeadSource leadSource)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("UpdateLeadSource", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@LeadSourceID", SqlDbType.Int).Value        = leadSource.LeadSourceID;
            cmd.Parameters.Add("@LeadSourceName", SqlDbType.NVarChar).Value = leadSource.LeadSourceName;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return(result == 1);
        }
    }
Example #17
0
        /// <summary>
        /// Envia el correo electronico de huespedes que se presentaron sin su invitacion impresa
        /// </summary>
        /// <param name="guest">Guest</param>
        /// <param name="salesRoom">SalesRoom</param>
        /// <param name="leadSource">LeadSource</param>
        /// <param name="personnel">Personal PRInvit1</param>
        /// <param name="bookingDepositTable">Datatable de Deposit</param>
        /// <returns>mensaje si ocurre error</returns>
        /// <history>
        /// [aalcocer] 18/08/2016 Created
        /// </history>
        internal static string SendMail(Guest guest, SalesRoomShort salesRoom, LeadSource leadSource, PersonnelShort personnel, DataTable bookingDepositTable)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();

            string strtemplate;

            using (Stream stream = assembly.GetManifestResourceStream(assembly.GetName().Name + ".Template.emailShowTemplate.html"))
                using (StreamReader reader = new StreamReader(stream))
                {
                    strtemplate = reader.ReadToEnd();
                }

            var values = Regex.Matches(strtemplate, @"(\[.*?\])+").Cast <Match>().Select(m => m.Value).ToList();

            //Obtenemos los tipos de objeto
            var objects = new List <object> {
                guest, salesRoom, leadSource, personnel
            };

            //Remplazamos
            objects.ForEach(obj =>
            {
                Type type = obj.GetType();//Obtenemos el tipo de objeto

                foreach (PropertyInfo pi in type.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(pi => !pi.GetMethod.IsVirtual).Where(pi => values.Contains($"[{pi.Name}]")))
                {
                    var value    = type.GetProperty(pi.Name).GetValue(obj, null) ?? string.Empty;
                    var strValue = value.ToString();
                    if (value is DateTime)
                    {
                        strValue = ((DateTime)value).ToString("dd/MM/yyyy");
                    }

                    strtemplate = strtemplate.Replace($"[{pi.Name}]", strValue);
                }
            });

            strtemplate = strtemplate.Replace("[BookingDepositTable]", BookingDepositDataTableToHtml(bookingDepositTable));
            try
            {
                Notifier.SendMail(Settings.Default.Subject, strtemplate, Settings.Default.ToEmail.Cast <string>().ToArray(),
                                  string.Empty, string.Empty);
                return(string.Empty);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Example #18
0
        public List <LeadSource> GetLeadSourceList()
        {
            List <LeadSource> leadSource = new List <LeadSource>();
            LeadSource        lead       = new LeadSource();
            var leadResult = _LeadProvider.GetLeadSourceList();

            foreach (var items in leadResult)
            {
                lead.LeadSourceId   = items.LeadSourceId;
                lead.LeadSourceName = items.LeadSourceName;
                lead.LeadStatus     = items.LeadStatus;
                leadSource.Add(lead);
            }
            return(leadSource);
        }
Example #19
0
        public async Task <ActionResult> Create(string phoneNumber)
        {
            var twiMLApplicationSid = Credentials.TwiMLApplicationSid ?? await _restClient.GetApplicationSidAsync();

            var twilioNumber = await _restClient.PurchasePhoneNumberAsync(phoneNumber, twiMLApplicationSid);

            var leadSource = new LeadSource
            {
                IncomingNumberNational      = twilioNumber.FriendlyName,
                IncomingNumberInternational = twilioNumber.PhoneNumber?.ToString()
            };

            _repository.Create(leadSource);

            return(RedirectToAction("Edit", new { id = leadSource.Id }));
        }
Example #20
0
        /// <summary>
        /// Evento para validar los cambios de una celda en el grid
        /// </summary>
        /// <history>
        /// [vipacheco] 30/Junio/2016 Created
        /// </history>
        private async void grdExchange_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            if (!bandCancel)
            {
                dtgExchange.CellEditEnding -= grdExchange_CellEditEnding;
                DataGrid           dataGrid           = sender as DataGrid;
                ComboBox           comboBox           = e.EditingElement as ComboBox;
                GiftsReceiptDetail giftsReceiptDetail = dataGrid.Items.CurrentItem as GiftsReceiptDetail;

                // Validamos la celda
                bool HasErrorValidate = await ReceiptsGifts.ValidateEdit(dataGrid, giftsReceiptDetail, true, _currentCell);

                // Si se cancela la edicion
                if (!HasErrorValidate)
                {
                    ChargeTo   pChargeTo   = frmHost._lstChargeTo.Where(x => x.ctID.ToUpper() == "MARKETING").Single();
                    LeadSource pLeadSource = cboLeadSource.SelectedItem as LeadSource;

                    ReceiptsGifts.AfterEdit(ref dtgExchange, _Guest.guID, row: ref giftsReceiptDetail, pCell: _currentCell, pUseCxCCost: useCxCCost, pIsExchange: _isExchangeReceipt,
                                            pChargeTo: pChargeTo, pLeadSourceID: pLeadSource.lsID, pTxtTotalCost: txtTotalGiftsExchange, pTxtgrCxCGifts: txtgrcxcGifts,
                                            pTxtTotalCxC: txtTotalCxC, pTxtgrCxCAdj: txtgrcxcAdj, pTxtgrMaxAuthGifts: txtMaxAuthGifts, pLblgrMaxAuthGifts: txbMaxAuthGiftsCaption);

                    CalculateTotalGifts();
                    txbMaxAuthGiftsCaption.Visibility = Visibility.Visible;
                    txtMaxAuthGifts.Visibility        = Visibility.Visible;

                    // Verificamos si se actualiza los costs CxC
                    if (_applicationAdj)
                    {
                        txtgrcxcGifts.Text = txtTotalCost.Text;
                        decimal cxcGifts = string.IsNullOrEmpty(txtgrcxcGifts.Text) ? 0 : Convert.ToDecimal(txtgrcxcGifts.Text.TrimStart('$'));
                        decimal cxcAdj   = string.IsNullOrEmpty(txtgrcxcAdj.Text) ? 0 : Convert.ToDecimal(txtgrcxcAdj.Text.TrimStart('$'));
                        txtTotalCxC.Text = string.Format("{0:C2}", cxcAdj + cxcGifts);
                    }
                }
                else
                {
                    e.Cancel = true;
                }
                dtgExchange.CellEditEnding += grdExchange_CellEditEnding;
            }
            // Verificamos si se puso en modo lectura la celda
            if (_currentCell.Column.IsReadOnly)
            {
                _currentCell.Column.IsReadOnly = false;
            }
        }
Example #21
0
    public LeadSource GetLeadSourceFromReader(IDataReader reader)
    {
        try
        {
            LeadSource leadSource = new LeadSource
                                    (

                DataAccessObject.IsNULL <int>(reader["LeadSourceID"]),
                DataAccessObject.IsNULL <string>(reader["LeadSourceName"])
                                    );
            return(leadSource);
        }
        catch (Exception ex)
        {
            return(null);
        }
    }
Example #22
0
        /// <summary>
        /// Inicializa el modulo con el Login y el Splash
        /// </summary>
        /// <history>
        ///   [aalcocer]  10/03/2016 Created
        /// </history>
        protected override async void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            frmSplash frmSplash = new frmSplash();
            Window    frmLS     = new frmLS(frmSplash);

            await((frmLS)frmLS).GetLeadSources();
            frmSplash.Show();
            frmSplash.ShowLogin(ref frmLS);
            if (((frmLS)frmLS).IsValidated)
            {
                LeadSource leadsource = ((frmLS)frmLS).LeadSource;
                frmGraph   frmMain    = new frmGraph(leadsource);
                frmMain.Title = $"{Context.Module} - [{Context.Environment}]";
                frmMain.ShowDialog();
                frmSplash.Close();
            }
        }
Example #23
0
 /// <summary>
 /// Elimina registros nuevos con el boton suprimir
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// <history>
 /// [created] 25/05/2016
 /// </history>
 private void Row_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Delete)
     {
         var item = dgrLeadSources.SelectedItem;
         if (item.GetType().Name == "LeadSource")
         {
             LeadSource leadSource = (LeadSource)item;
             if (leadSource.lspg == program.pgID)
             {
                 e.Handled = true;
             }
         }
         else
         {
             cmbLeadSources.Header = "Lead Source (" + (dgrLeadSources.Items.Count - 2) + ")";
         }
     }
 }
Example #24
0
        /// <summary>
        /// Abre la ventana de busqueda
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 13/05/2016
        /// </history>
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            frmLeadSourceDetail frmLeadSourceDetail = new frmLeadSourceDetail();

            frmLeadSourceDetail.Owner         = this;
            frmLeadSourceDetail.enumMode      = EnumMode.Search;
            frmLeadSourceDetail.nStatus       = _nStatus;
            frmLeadSourceDetail.nRegen        = _nRegen;
            frmLeadSourceDetail.nAnimation    = _nAnimation;
            frmLeadSourceDetail.oldLeadSource = _leadSourceFilter;
            if (frmLeadSourceDetail.ShowDialog() == true)
            {
                _leadSourceFilter = frmLeadSourceDetail.leadSource;
                _nStatus          = frmLeadSourceDetail.nStatus;
                _nRegen           = frmLeadSourceDetail.nRegen;
                _nAnimation       = frmLeadSourceDetail.nAnimation;
                loadLeadSources();
            }
        }
Example #25
0
        public List <LeadSource> GetAllSource()
        {
            objResponse       Response = new objResponse();
            List <LeadSource> source   = new List <LeadSource>();

            try
            {
                DATA_ACCESS_LAYER.Fill(Response.ResponseData, "usp_GetAllSource", DB_CONSTANTS.ConnectionString_ICS);

                if (Response.ResponseData.Tables[0].Rows.Count > 0)
                {
                    Response.ErrorCode = 0;
                    foreach (DataRow dr in Response.ResponseData.Tables[0].Rows)
                    {
                        LeadSource objSource = new LeadSource();
                        objSource.LeadSourceID   = Convert.ToInt64(dr["Source_ID_Auto_PK"]);
                        objSource.SourceName     = Convert.ToString(dr["Source_Name"]);
                        objSource.CreatedByName  = Convert.ToString(dr["CreatedByName"]);
                        objSource.CreatedDate    = Convert.ToDateTime(dr["CreatedDate"]);
                        objSource.UpdatedByName  = Convert.ToString(dr["UpdatedByName"]);
                        objSource.UpdatedDate    = Convert.ToDateTime(dr["UpdatedDate"]);
                        objSource.Status         = Convert.ToString(dr["Status"]);
                        objSource.LinkedSalesRep = Convert.ToString(dr["SRepName"]);

                        source.Add(objSource);
                    }
                }
                else
                {
                    Response.ErrorCode    = 2001;
                    Response.ErrorMessage = "There is an Error. Please Try After some time.";
                }
            }
            catch (Exception ex)
            {
                Response.ErrorCode    = 2001;
                Response.ErrorMessage = "Error while processing: " + ex.Message;
                BAL.Common.LogManager.LogError("GetAllSource", 1, Convert.ToString(ex.Source), Convert.ToString(ex.Message), Convert.ToString(ex.StackTrace));
            }
            return(source);
        }
Example #26
0
        /// <summary>
        /// Llena el grid de LeadSources
        /// </summary>
        /// <param name="leadSources">Objeto a seleccionar</param>
        /// <history>
        /// [emoguel] created 13/05/2016
        /// [emoguel] modified 25/05/2016 se volvio async el método
        /// </history>
        private async void loadLeadSources(LeadSource leadSources = null)
        {
            try
            {
                status.Visibility = Visibility.Visible;
                int nIndex = 0;
                List <LeadSource> lstLeadSource = await BRLeadSources.GetLeadSources(_nStatus, _nRegen, _nAnimation, _leadSourceFilter, true);

                if (lstLeadSource.Count > 0 && leadSources != null)
                {
                    leadSources = lstLeadSource.Where(ls => ls.lsID == leadSources.lsID).FirstOrDefault();
                    nIndex      = lstLeadSource.IndexOf(leadSources);
                }
                dgrLeadSources.ItemsSource = lstLeadSource;
                GridHelper.SelectRow(dgrLeadSources, nIndex);
                StatusBarReg.Content = lstLeadSource.Count + " Lead Sources.";
                status.Visibility    = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
Example #27
0
 public void Edit(LeadSource entity)
 {
     _dataContext.LeadSource.Update(entity);
 }
Example #28
0
 public async Task AddAsync(LeadSource entity)
 {
     await _dataContext.LeadSource.AddAsync(entity);
 }
Example #29
0
    public LeadSource GetLeadSourceFromReader(IDataReader reader)
    {
        try
        {
            LeadSource leadSource = new LeadSource
                (

                     DataAccessObject.IsNULL<int>(reader["LeadSourceID"]),
                     DataAccessObject.IsNULL<string>(reader["LeadSourceName"])
                );
             return leadSource;
        }
        catch(Exception ex)
        {
            return null;
        }
    }
Example #30
0
    public bool UpdateLeadSource(LeadSource leadSource)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("UpdateLeadSource", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@LeadSourceID", SqlDbType.Int).Value = leadSource.LeadSourceID;
            cmd.Parameters.Add("@LeadSourceName", SqlDbType.NVarChar).Value = leadSource.LeadSourceName;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }
Example #31
0
    public int InsertLeadSource(LeadSource leadSource)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("InsertLeadSource", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@LeadSourceID", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@LeadSourceName", SqlDbType.NVarChar).Value = leadSource.LeadSourceName;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return (int)cmd.Parameters["@LeadSourceID"].Value;
        }
    }
 /// <summary>
 /// 
 /// </summary>
 /// 
 /// <param name="lead"></param>
 /// 
 /// <returns></returns>
 /// 
 public ExchangeResponse Post(DebtLeadType lead, LeadSource source)
 {
     return ExchangeTranslator.Assign(engine.Allocate(ExchangeTranslator.Assign(lead)));
 }
        public void Execute()
        {
            #region Check and convert input parameters

            if (!InputParameters.ContainsKey("LoanId"))
            {
                throw new ArgumentException("LoanId value was expected!");
            }

            if (!InputParameters.ContainsKey("ProspectId"))
            {
                throw new ArgumentException("ProspectId value was expected!");
            }



            var user = AccountHelper.GetUserAccount(HttpContext);
            if (user == null)
            {
                throw new InvalidOperationException("UserData is null");
            }

            #endregion

            #region Update title information
            Guid  loanId     = Guid.Parse(InputParameters["LoanId"].ToString().TrimEnd());
            Int32 prospectId = Int32.Parse(InputParameters["ProspectId"].ToString().TrimEnd());

            BasicLoanData loan = LoanServiceFacade.RetrieveBasicLoanData(loanId, user.UserAccountId);

            ManageProspectsViewModel model = new ManageProspectsViewModel();
            model.ProspectId = prospectId;
            model.LoanId     = loanId;

            if (loan != null)
            {
                model.CompanyId  = loan.CompanyId != Guid.Empty ? loan.CompanyId.ToString() : "0";
                model.ChannelId  = loan.ChannelId != null ? ( Int32 )loan.ChannelId : 0;
                model.DivisionId = loan.DivisionId != null ? ( Int32 )loan.DivisionId : 0;
                model.BranchId   = loan.BranchId != Guid.Empty ? ( Guid )loan.BranchId : Guid.Empty;
            }
            else
            {
                Contact contactData = ContactServiceFacade.RetrieveContactByContactId(prospectId);
                if (contactData != null)
                {
                    model.CompanyId  = contactData.CompanyProfileId != Guid.Empty ? contactData.CompanyProfileId.ToString() : "0";
                    model.ChannelId  = contactData.ChannelId != null ? ( Int32 )contactData.ChannelId : 0;
                    model.DivisionId = contactData.DivisionId != null ? ( Int32 )contactData.DivisionId : 0;
                    model.BranchId   = contactData.BranchId != Guid.Empty ? ( Guid )contactData.BranchId : Guid.Empty;
                }
            }



            //var leadSource = ContactServiceFacade.RetrieveLeadSourceByContactIdAndLoanId( prospectId, loanId, user.UserAccountId );
            //model.LeadSourceInformation = leadSource != null ? leadSource.LeadSourceId + " " + leadSource.Description : String.Empty;
            LeadSource hearAboutUs = LoanServiceFacade.RetrieveHearAboutUs(loanId);

            if (hearAboutUs != null)
            {
                if (hearAboutUs.AffinityGroup == Contracts.Affiliate.AffinityGroup.PartnersProfiles)
                {
                    if (hearAboutUs.HBMId != null && hearAboutUs.HBMId != Guid.Empty)
                    {
                        model.HearAboutUs = hearAboutUs.LeadSourceId + " Realtor-HBM";
                    }
                    else
                    {
                        model.HearAboutUs = hearAboutUs.LeadSourceId + " Realtor";
                    }
                }
                else
                {
                    model.HearAboutUs = hearAboutUs.LeadSourceId + " " + hearAboutUs.Description;
                }
            }

            model.TitleInformation = ConciergeWorkQueueServiceFacade.ExecuteSPGetBorrowerData("GetBorrowerData", loanId, user.UserAccountId);

            #endregion

            #region Update emails

            var emailList = ContactServiceFacade.RetrieveSentEmailItems(prospectId, user.UserAccountId);
            if (emailList != null && emailList.Count > 0)
            {
                model.Emails = emailList;
            }

            #endregion

            #region Update Lists



            bool isLoa = false;
            if (user.Roles != null && user.Roles.Any(r => r.RoleName == RoleName.LoanOfficerAssistant && r.IsActive))
            {
                isLoa = true;
            }

            LoadCompanies(model);

            LoadChannels(model);

            LoadDivisions(model);

            LoadBranches(model);

            LoadRelatedConciergeList(model, user, loan, loanId, null, isLoa);

            LoadRelatedLoaList(model, user, loan, loanId, null, isLoa);

            // Get Call Center/Loan Processor Officers
            var callCenterInfos = UserAccountServiceFacade.RetrieveCallCenterInfo();

            if (callCenterInfos != null)
            {
                callCenterInfos = new Collection <CallCenterInfo>(callCenterInfos.OrderBy(l => l.CallCenterName).ToList());
                callCenterInfos.Insert(0, new CallCenterInfo()
                {
                    UserAccountId = 0, CallCenterName = "Select One"
                });
            }


            model.CallCenterInfoList = new Collection <CallCenterInfo>();
            model.CallCenterInfoList = callCenterInfos;

            #endregion

            #region Get Highest priority role
            if (user.Roles != null && user.Roles.Count() > 0)
            {
                var filteredRoles = user.Roles.OrderBy(r => r.RolePriority);
                if (filteredRoles != null && filteredRoles.FirstOrDefault() != null)
                {
                    var topPriorityRole       = filteredRoles.FirstOrDefault().RoleName;
                    var retrievedProspectData = ContactServiceFacade.RetrieveContactProspect(prospectId);

                    if (retrievedProspectData != null)
                    {
                        model.SelectedStatus    = retrievedProspectData.Status.ToString();
                        model.SelectedConcierge = retrievedProspectData.Concierge.ToString();
                        model.SelectedLoa       = retrievedProspectData.Loa.ToString();
                        if (model.CallCenterInfoList.FirstOrDefault(c => c.UserAccountId.Equals(retrievedProspectData.CallCenter)) != null)
                        {
                            model.SelectedCallCenter = model.CallCenterInfoList.FirstOrDefault(c => c.UserAccountId.Equals(retrievedProspectData.CallCenter)).UserAccountId.ToString();
                        }
                        if (model.ConciergeInfoList.FirstOrDefault(c => c.UserAccountId.Equals(retrievedProspectData.Concierge)) != null)
                        {
                            model.NMLSNumber = model.ConciergeInfoList.FirstOrDefault(c => c.UserAccountId.Equals(retrievedProspectData.Concierge)).NMLSNumber;
                        }
                    }
                }
            }
            #endregion

            //TODO: Move this in Lookup
            model.Statuses = new Collection <KeyValuePair <String, String> >();
            foreach (ContactStatus contactStatus in Enum.GetValues(typeof(ContactStatus)))
            {
                if (contactStatus != ContactStatus.None)
                {
                    model.Statuses.Add(new KeyValuePair <String, String>((( int )contactStatus).ToString(),
                                                                         MML.Web.LoanCenter.Helpers.LoanCenterEnumHelper.ContactStatusToString(contactStatus)));
                }
            }

            model.Statuses = new Collection <KeyValuePair <String, String> >(model.Statuses.OrderBy(s => s.Value).ToList());

            ViewName = "Commands/_manageprospects";
            ViewData = model;

            if (HttpContext == null || HttpContext.Session == null)
            {
                throw new NullReferenceException("Session is empty!");
            }

            HttpContext.Session[SessionHelper.ManageProspects] = model.ToXml();
        }
Example #34
0
 public static int InsertLeadSource(LeadSource leadSource)
 {
     SqlLeadSourceProvider sqlLeadSourceProvider = new SqlLeadSourceProvider();
     return sqlLeadSourceProvider.InsertLeadSource(leadSource);
 }
Example #35
0
        /// <summary>
        /// Verifica que el LS|LO|SR|WH no se repita en la lista
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 11/05/2016
        /// </history>
        private void dgrGoals_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            if (!Keyboard.IsKeyDown(Key.Escape))        //Verificar si se está cancelando
            {
                if (e.Column is DataGridComboBoxColumn) //verificar si es el datagridcolumn
                {
                    List <Goal> lstGoals = (List <Goal>)dgrGoals.ItemsSource;
                    Goal        goalSel  = (Goal)dgrGoals.SelectedItem;
                    switch (_goal.gopy)
                    {
                        #region LeadSource
                    case "LS":
                    {
                        LeadSource leadSource = (LeadSource)((ComboBox)e.EditingElement).SelectedItem;
                        if (leadSource != null)
                        {
                            if (goalSel.goPlaceID != leadSource.lsID)
                            {
                                Goal goalVal = lstGoals.Where(go => !go.Equals(goalSel) && go.goPlaceID == leadSource.lsID).FirstOrDefault();
                                if (goalVal != null)
                                {
                                    UIHelper.ShowMessage("Lead Source must not be repeated");
                                    e.Cancel = true;
                                }
                            }
                        }
                        break;
                    }
                        #endregion

                        #region Locations
                    case "LO":
                    {
                        Location location = (Location)((ComboBox)e.EditingElement).SelectedItem;
                        if (location != null)
                        {
                            if (goalSel.goPlaceID != location.loID)
                            {
                                Goal goalVal = lstGoals.Where(go => !go.Equals(goalSel) && go.goPlaceID == location.loID).FirstOrDefault();
                                if (goalVal != null)
                                {
                                    UIHelper.ShowMessage("Location must not be repeated");
                                    e.Cancel = true;
                                }
                            }
                        }
                        break;
                    }
                        #endregion

                        #region SalesRoom
                    case "SR":
                    {
                        SalesRoom saleRoom = (SalesRoom)((ComboBox)e.EditingElement).SelectedItem;
                        if (saleRoom != null)
                        {
                            if (goalSel.goPlaceID != saleRoom.srID)
                            {
                                Goal goalVal = lstGoals.Where(go => !go.Equals(goalSel) && go.goPlaceID == saleRoom.srID).FirstOrDefault();
                                if (goalVal != null)
                                {
                                    UIHelper.ShowMessage("Sales Room must not be repeated");
                                    e.Cancel = true;
                                }
                            }
                        }
                        break;
                    }
                        #endregion

                        #region Warehouse
                    case "WH":
                    {
                        Warehouse warehouse = (Warehouse)((ComboBox)e.EditingElement).SelectedItem;
                        if (warehouse != null)
                        {
                            if (goalSel.goPlaceID != warehouse.whID)
                            {
                                Goal goalVal = lstGoals.Where(go => !go.Equals(goalSel) && go.goPlaceID == warehouse.whID).FirstOrDefault();
                                if (goalVal != null)
                                {
                                    UIHelper.ShowMessage("Warehouse must not be repeated");
                                    e.Cancel = true;
                                }
                            }
                        }
                        break;
                    }
                        #endregion
                    }
                }
            }
        }
Example #36
0
 public static void Create(LeadSourceEditModel model, LeadSource entity, string userId)
 {
     entity.Name = model.Name;
 }
Example #37
0
 public static bool UpdateLeadSource(LeadSource leadSource)
 {
     SqlLeadSourceProvider sqlLeadSourceProvider = new SqlLeadSourceProvider();
     return sqlLeadSourceProvider.UpdateLeadSource(leadSource);
 }