Ejemplo n.º 1
0
        public ILead GetLeadChatUpdateData(IMessage message, SFDCCallType callType, string duration, string chatContent)
        {
            try
            {
                this.logger.Info("GetLeadChatUpdateData :  Reading Lead Update Data.....");
                this.logger.Info("GetLeadChatUpdateData :  Event Name : " + message.Name);
                if (this.leadChatOptions != null)
                {
                    dynamic popupEvent = Convert.ChangeType(message, message.GetType());

                    if (popupEvent != null)
                    {
                        ILead lead = new LeadData();

                        #region Collect Lead Data

                        lead.ObjectName = leadChatOptions.ObjectName;

                        if (callType == SFDCCallType.InboundChat)
                        {
                            if (leadChatOptions.InboundCanUpdateLog)
                            {
                                lead.UpdateActivityLog     = true;
                                lead.UpdateActivityLogData = this.sfdcObject.GetChatUpdateActivityLog(this.LeadChatLogConfig, popupEvent, callType, duration, chatContent);
                            }
                        }
                        if (callType == SFDCCallType.ConsultChatReceived)
                        {
                            if (leadChatOptions.ConsultCanUpdateLog)
                            {
                                lead.UpdateActivityLog     = true;
                                lead.UpdateActivityLogData = this.sfdcObject.GetChatUpdateActivityLog(this.LeadChatLogConfig, popupEvent, callType, duration, chatContent);
                            }
                        }
                        //update lead record fields
                        lead.UpdateRecordFields = leadChatOptions.CanUpdateRecordData;
                        if (GetNoRecordFoundAction(callType, leadChatOptions).Equals("createnew") && this.LeadRecordConfig != null)
                        {
                            if (leadChatOptions.CanUpdateRecordData)
                            {
                                lead.UpdateRecordFieldsData = this.sfdcObject.GetChatUpdateActivityLog(this.LeadRecordConfig, popupEvent, callType, duration, chatContent);
                            }
                        }

                        #endregion Collect Lead Data

                        return(lead);
                    }
                }
                else
                {
                    this.logger.Info("Can not Collect Lead Update data because Lead Configuration is null.");
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetLeadChatUpdateData : Error occurred while reading Lead Data : " + generalException.ToString());
            }
            return(null);
        }
Ejemplo n.º 2
0
        public LeadData GetLeadsByLeadID(int leadID)
        {
            LeadData lstLeads = new LeadData();

            using (uow = new UnitOfWork.UnitOfWork())
            {
                try
                {
                    lstLeads = uow.LeadRepository.Get().Where(x => x.LeadID == leadID).Select(usd => new LeadData
                    {
                        BusinessName      = usd.BusinessName,
                        ContactName       = usd.ContactName,
                        Date              = usd.Date,
                        DOTNo             = usd.DOTNo,
                        Email             = usd.Email,
                        LeadID            = usd.LeadID,
                        PhoneNoForContact = usd.PhoneNoForContact,
                        SalesPersonID     = usd.SalesPersonID,
                        ServiceDiscussed  = usd.ServiceDiscussed,
                        ComplianceAgent   = usd.ComplianceAgent
                    }).FirstOrDefault();
                }
                catch
                {
                }
            }
            return(lstLeads);
        }
Ejemplo n.º 3
0
        public void InsertDataChangeOwner(LeadData leadData, string createByUsername, DateTime createDate)
        {
            try
            {
                kkslm_tr_activity activity = new kkslm_tr_activity();
                activity.slm_TicketId = leadData.TicketId;
                if (!string.IsNullOrEmpty(leadData.OldOwner2))
                {
                    activity.slm_OldOwner          = leadData.OldOwner2;
                    activity.slm_OldOwner_Position = GetPositionId(leadData.OldOwner2, slmdb);
                }
                activity.slm_NewOwner           = leadData.NewOwner2;
                activity.slm_NewOwner_Position  = GetPositionId(leadData.NewOwner2, slmdb);
                activity.slm_OldStatus          = null;
                activity.slm_NewStatus          = null;
                activity.slm_CreatedBy          = createByUsername;
                activity.slm_CreatedBy_Position = GetPositionId(createByUsername, slmdb);
                activity.slm_CreatedDate        = createDate;
                activity.slm_Type           = leadData.Type2;
                activity.slm_SystemAction   = SLM.Resource.SLMConstant.SystemName;      //System ที่เข้ามาทำ action (19/03/2015)
                activity.slm_SystemActionBy = SLM.Resource.SLMConstant.SystemName;      //action เกิดขึ้นที่ระบบอะไร (19/03/2015)

                slmdb.kkslm_tr_activity.AddObject(activity);
                slmdb.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the Email Update data.
        /// </summary>
        /// <param name="emailData"></param>
        /// <param name="callType"></param>
        /// <param name="duration"></param>
        /// <param name="emailContent"></param>
        /// <returns></returns>
        public LeadData GetLeadEmailUpdateData(IXNCustomData emailData, SFDCCallType callType, string eventName)
        {
            try
            {
                this.logger.Info("GetLeadEmailUpdateData :  Reading Account Update Data.....");

                if (emailData != null)
                {
                    LeadData _lead = new LeadData();

                    #region Collect Lead Data

                    _lead.ObjectName = leadEmailOptions.ObjectName;
                    if (callType == SFDCCallType.InboundEmail || callType == SFDCCallType.InboundEmailPulled)
                    {
                        if (leadEmailOptions.InboundCanUpdateLog)
                        {
                            _lead.UpdateActivityLog     = true;
                            _lead.UpdateActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadEmailLogConfig, null, callType, emailData.Duration, emailData: emailData);
                            if (!string.IsNullOrWhiteSpace(leadEmailOptions.EmailAppendActivityLogEventNames) && leadEmailOptions.EmailAppendActivityLogEventNames.Contains(eventName))
                            {
                                _lead.AppendActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadEmailLogConfig, null, callType, emailData.Duration, emailData: emailData, isAppendLogData: true);
                            }
                        }
                    }
                    else if (callType == SFDCCallType.OutboundEmailFailure || callType == SFDCCallType.OutboundEmailSuccess || callType == SFDCCallType.OutboundEmailPulled)
                    {
                        if (leadEmailOptions.OutboundCanUpdateLog)
                        {
                            _lead.UpdateActivityLog     = true;
                            _lead.UpdateActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadEmailLogConfig, null, callType, emailData.Duration, emailData: emailData);
                            if (!string.IsNullOrWhiteSpace(leadEmailOptions.EmailAppendActivityLogEventNames) && leadEmailOptions.EmailAppendActivityLogEventNames.Contains(eventName))
                            {
                                _lead.AppendActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadEmailLogConfig, null, callType, emailData.Duration, emailData: emailData, isAppendLogData: true);
                            }
                        }
                    }
                    //update account record fields
                    _lead.UpdateRecordFields = leadEmailOptions.CanUpdateRecordData;
                    _lead.NoRecordFound      = SFDCObjectHelper.GetNoRecordFoundAction(callType, leadEmailOptions);
                    if (_lead.NoRecordFound.Equals("createnew") && this.LeadEmailRecordConfig != null)
                    {
                        if (leadEmailOptions.CanUpdateRecordData)
                        {
                            _lead.UpdateRecordFieldsData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadEmailRecordConfig, null, callType, emailData.Duration, emailData: emailData);
                        }
                    }

                    #endregion Collect Lead Data

                    return(_lead);
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetLeadEmailUpdateData : Error occurred while reading Account Data : " + generalException.ToString());
            }
            return(null);
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> SaveLeadAsync(LeadData lead)
        {
            await SaveDataToDb(lead);

            return(new ContentResult {
                Content = lead.ToString()
            });
        }
Ejemplo n.º 6
0
        protected void btnSearchByDOTNo_Click(object sender, EventArgs e)
        {
            LeadData        LeadsData    = leadHelper.GetLeadsByDOTNo(txtDOTNo.Text);
            List <LeadData> lstLeadsData = new List <LeadData>();

            lstLeadsData.Add(LeadsData);
            lstOfLeads.DataSource = lstLeadsData;
            lstOfLeads.DataBind();
        }
Ejemplo n.º 7
0
        public string GetCallCASScript(LeadData data, string userId)
        {
            string subScriptionTypeId = "0";

            if (data.CardType != null)
            {
                subScriptionTypeId = SlmScr008Biz.GetSubScriptionTypeId(data.CardType.Value);
            }

            string url    = SLMConstant.CARLogService.CARActivityUrl;
            string script = @"var form = document.createElement('form');
                                var input_system = document.createElement('input');
                                var input_ticket = document.createElement('input');
                                var input_subscriptiontype = document.createElement('input');
                                var input_subscription = document.createElement('input');
                                var input_lead = document.createElement('input');
                                var input_userid = document.createElement('input');
            
                                form.action = '" + url + @"';
                                form.method = 'post';
                                form.setAttribute('target', 'searchcas');
            
                                input_system.name = 'system';
                                input_system.value = '" + (data.PreleadId != null ? SLMConstant.CARLogService.CARLoginOBT : SLMConstant.CARLogService.CARLoginSLM) + @"';
                                form.appendChild(input_system);
            
                                input_ticket.name = 'ticket';
                                input_ticket.value = '" + data.TicketId + @"';
                                form.appendChild(input_ticket);
            
                                input_subscriptiontype.name = 'subscriptiontype';
                                input_subscriptiontype.value = '" + subScriptionTypeId + @"';
                                form.appendChild(input_subscriptiontype);
            
                                input_subscription.name = 'subscription';
                                input_subscription.value = '" + data.CitizenId + @"';
                                form.appendChild(input_subscription);
            
                                input_lead.name = 'lead';
                                input_lead.value = '" + (data.PreleadId != null ? data.PreleadId.Value.ToString() : "") + @"';
                                form.appendChild(input_lead);

                                input_userid.name = 'userid'
                                input_userid.value = '" + userId + @"';
                                form.appendChild(input_userid);
            
                                document.body.appendChild(form);
                                form.submit();
            
                                document.body.removeChild(form);";

            return(script);
        }
        public void UpdateData(LeadData leadData, string updateByUsername, DateTime updateDate)
        {
            var info = slmdb.kkslm_tr_cusinfo.Where(p => p.slm_TicketId.Equals(leadData.TicketId)).FirstOrDefault();

            if (info != null)
            {
                try
                {
                    string oldCitizenId = info.slm_CitizenId;
                    info.slm_LastName      = leadData.LastName;
                    info.slm_Email         = leadData.Email;
                    info.slm_TelNo_2       = leadData.TelNo_2;
                    info.slm_TelNo_3       = leadData.TelNo_3;
                    info.slm_Ext_2         = leadData.Ext_2;
                    info.slm_Ext_3         = leadData.Ext_3;
                    info.slm_BuildingName  = leadData.BuildingName;
                    info.slm_AddressNo     = leadData.AddressNo;
                    info.slm_Floor         = leadData.Floor;
                    info.slm_Soi           = leadData.Soi;
                    info.slm_Street        = leadData.Street;
                    info.slm_Tambon        = leadData.Tambon;
                    info.slm_Amphur        = leadData.Amphur;
                    info.slm_Province      = leadData.Province;
                    info.slm_PostalCode    = leadData.PostalCode;
                    info.slm_Occupation    = leadData.Occupation;
                    info.slm_BaseSalary    = leadData.BaseSalary;
                    info.slm_IsCustomer    = leadData.IsCustomer;
                    info.slm_CusCode       = leadData.CusCode;
                    info.slm_Birthdate     = leadData.Birthdate;
                    info.slm_CardType      = leadData.CardType;
                    info.slm_CitizenId     = string.IsNullOrEmpty(leadData.CitizenId) ? null : leadData.CitizenId;
                    info.slm_Topic         = leadData.Topic;
                    info.slm_Detail        = leadData.Detail;
                    info.slm_PathLink      = leadData.PathLink;
                    info.slm_ContactBranch = leadData.ContactBranch;
                    info.slm_UpdatedBy     = updateByUsername;
                    info.slm_UpdatedDate   = updateDate;

                    if (oldCitizenId != leadData.CitizenId)
                    {
                        KKSlmTrHistoryModel.InsertHistory(slmdb, leadData.TicketId, SLMConstant.HistoryTypeCode.UpdateCardId, oldCitizenId, leadData.CitizenId, updateByUsername, updateDate);
                    }

                    slmdb.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Ejemplo n.º 9
0
        //public bool InsertLeadData(LeadData leadData, List<CampaignWSData> camDataList, string createbyUsername)
        //{
        //    string ticketId = "";
        //    try
        //    {
        //        StoreProcedure store = new StoreProcedure();
        //        ticketId = store.GenerateTicketId();
        //        leadData.TicketId = ticketId;

        //        foreach (CampaignWSData cpdata in camDataList)
        //        {
        //            cpdata.TicketId = ticketId;
        //        }

        //        using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted }))
        //        {
        //            KKSlmTrLeadModel lead = new KKSlmTrLeadModel();
        //            lead.InsertData(leadData, createbyUsername);

        //            KKSlmTrCusInfoModel customerInfo = new KKSlmTrCusInfoModel();
        //            customerInfo.InsertData(leadData, createbyUsername);

        //            KKSlmTrProductInfoModel productInfo = new KKSlmTrProductInfoModel();
        //            productInfo.InsertData(leadData, createbyUsername);

        //            KKSlmTrChannelInfoModel channelInfo = new KKSlmTrChannelInfoModel();
        //            channelInfo.InsertData(leadData, createbyUsername);

        //            KKSLMTrCampaignFinalModel camFinal = new KKSLMTrCampaignFinalModel();
        //            camFinal.InsertCampaignList(camDataList, createbyUsername);

        //            ts.Complete();
        //        }
        //        return true;
        //    }
        //    catch (Exception ex)
        //    {
        //        _Error = ex.Message.ToString();
        //        return false;
        //    }
        //}

        public string InsertLeadSuggestCampaign(LeadData leadData, CampaignWSData cpdata, string createByUsername)
        {
            string ticketId = "";

            try
            {
                DateTime createDate = DateTime.Now;
                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {
                    IsolationLevel = IsolationLevel.ReadCommitted
                }))
                {
                    StoreProcedure store = new StoreProcedure();
                    ticketId          = store.GenerateTicketId();
                    leadData.TicketId = ticketId;
                    cpdata.TicketId   = ticketId;

                    List <ProductData> prodList = SlmScr016Biz.GetProductCampaignDataForSuggestCampaign(cpdata.CampaignId);
                    if (prodList.Count > 0)
                    {
                        leadData.ProductGroupId = prodList[0].ProductGroupId;
                        leadData.ProductId      = prodList[0].ProductId;
                        leadData.ProductName    = prodList[0].ProductName;
                    }

                    KKSlmTrLeadModel lead = new KKSlmTrLeadModel();
                    lead.InsertData(leadData, createByUsername, createDate);

                    KKSlmTrCusInfoModel customerInfo = new KKSlmTrCusInfoModel();
                    customerInfo.InsertData(leadData, createByUsername, createDate);

                    KKSlmTrProductInfoModel productInfo = new KKSlmTrProductInfoModel();
                    productInfo.InsertData(leadData, createByUsername);

                    KKSlmTrChannelInfoModel channelInfo = new KKSlmTrChannelInfoModel();
                    channelInfo.InsertData(leadData, createByUsername, createDate);

                    KKSLMTrCampaignFinalModel camFinal = new KKSLMTrCampaignFinalModel();
                    camFinal.InsertData(cpdata, createByUsername, createDate);

                    KKSlmTrHistoryModel history = new KKSlmTrHistoryModel();
                    history.InsertData(ticketId, SLMConstant.HistoryTypeCode.CreateLead, "", "", createByUsername, createDate);

                    ts.Complete();
                }
                return(ticketId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 10
0
        public static string UpdateLeadData(LeadData leadData, string username, bool actStatus, bool actDelegate, bool actOwner)
        {
            try
            {
                DateTime updateDate = DateTime.Now;
                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {
                    IsolationLevel = IsolationLevel.ReadCommitted
                }))
                {
                    KKSlmTrLeadModel lead = new KKSlmTrLeadModel();
                    lead.UpdateData(leadData, username, actDelegate, actOwner, updateDate);

                    KKSlmTrCusInfoModel customerInfo = new KKSlmTrCusInfoModel();
                    customerInfo.UpdateData(leadData, username, updateDate);

                    KKSlmTrProductInfoModel productInfo = new KKSlmTrProductInfoModel();
                    productInfo.UpdateData(leadData, username);

                    KKSlmTrChannelInfoModel channelInfo = new KKSlmTrChannelInfoModel();
                    channelInfo.UpdateData(leadData, username);

                    if (actStatus == true || actDelegate == true)
                    {
                        KKSlmTrActivityModel Activity = new KKSlmTrActivityModel();
                        Activity.InsertData(leadData, username, updateDate);

                        KKSlmTrHistoryModel historydel = new KKSlmTrHistoryModel();
                        historydel.InsertData(leadData.TicketId, SLMConstant.HistoryTypeCode.UpdateDelegate, leadData.OldDelegate, leadData.NewDelegate, username, updateDate);
                    }

                    if (actOwner == true)
                    {
                        KKSlmTrActivityModel Activity = new KKSlmTrActivityModel();
                        Activity.InsertDataChangeOwner(leadData, username, updateDate);

                        KKSlmTrHistoryModel historydel = new KKSlmTrHistoryModel();
                        historydel.InsertData(leadData.TicketId, SLMConstant.HistoryTypeCode.UpdateOwner, leadData.OldOwner2, leadData.NewOwner2, username, updateDate);
                    }

                    KKSlmTrHistoryModel history = new KKSlmTrHistoryModel();
                    history.InsertData(leadData.TicketId, SLMConstant.HistoryTypeCode.UpdateLead, "", "", username, updateDate);

                    ts.Complete();
                }
                return(leadData.TicketId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    CampaignId = "";
                    ((Label)Page.Master.FindControl("lblTopic")).Text = "เพิ่มข้อมูล Lead (Add)";

                    ScreenPrivilegeData priData = RoleBiz.GetScreenPrivilege(HttpContext.Current.User.Identity.Name, "SLM_SCR_010");
                    if (priData == null || priData.IsView != 1)
                    {
                        AppUtil.ClientAlertAndRedirect(Page, "คุณไม่มีสิทธิ์เข้าใช้หน้าจอนี้", "SLM_SCR_003.aspx");
                    }


                    //รับค่า Seaaion มากจากหน้า viewlead, ปุ่ม คัดลอกข้อมูลผู้มุ่งหวัง
                    if (Session["ticket_id"] != null)
                    {
                        hdfCopyTicket.Value = Session["ticket_id"] as string;
                        Session.Remove("ticket_id");

                        // load default data
                        //var ticketid = Session["ticket_id"] as string;
                        //LeadData lead = SlmScr010Biz.GetLeadData(ticketid);
                        // Session["ticket_id"] = null;
                        LeadData lead = SlmScr010Biz.GetLeadData(hdfCopyTicket.Value);
                        lead.Delegate        = "";
                        lead.Delegate_Branch = "";
                        lead.Delegate_Flag   = 0;

                        if (lead != null)
                        {
                            //CampaignId = lead.CampaignId;
                            ctlCommon.SetLeadData(lead, true, true);

                            //LoadDetailControl();
                            //ctlLead.LoadData(lead);
                        }
                    }
                    ctlCommon.SetControlMode(Lead_Detail_Master.CtlMode.New);
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
Ejemplo n.º 12
0
        public void UpdateData(LeadData leadData, string UserId)
        {
            var prodInfo = slmdb.kkslm_tr_productinfo.Where(p => p.slm_TicketId.Equals(leadData.TicketId)).FirstOrDefault();

            if (prodInfo != null)
            {
                try
                {
                    prodInfo.slm_InterestedProd = leadData.InterestedProd;
                    prodInfo.slm_LicenseNo      = leadData.LicenseNo;
                    prodInfo.slm_YearOfCar      = leadData.YearOfCar;
                    prodInfo.slm_YearOfCarRegis = leadData.YearOfCarRegis;
                    prodInfo.slm_ProvinceRegis  = leadData.ProvinceRegis;
                    prodInfo.slm_Brand          = leadData.Brand;
                    prodInfo.slm_Model          = leadData.Model;
                    prodInfo.slm_Submodel       = leadData.Submodel;
                    prodInfo.slm_DownPayment    = leadData.DownPayment;
                    prodInfo.slm_DownPercent    = leadData.DownPercent;
                    prodInfo.slm_CarPrice       = leadData.CarPrice;
                    prodInfo.slm_FinanceAmt     = leadData.FinanceAmt;
                    prodInfo.slm_PaymentTerm    = leadData.PaymentTerm;
                    prodInfo.slm_PaymentType    = leadData.PaymentType;
                    prodInfo.slm_BalloonAmt     = leadData.BalloonAmt;
                    prodInfo.slm_BalloonPercent = leadData.BalloonPercent;
                    prodInfo.slm_PlanType       = leadData.PlanType;
                    prodInfo.slm_CoverageDate   = leadData.CoverageDate;
                    prodInfo.slm_AccType        = leadData.AccType;
                    prodInfo.slm_AccPromotion   = leadData.AccPromotion;
                    prodInfo.slm_AccTerm        = leadData.AccTerm;
                    prodInfo.slm_Interest       = leadData.Interest;
                    prodInfo.slm_Invest         = leadData.Invest;
                    prodInfo.slm_LoanOd         = leadData.LoanOd;
                    prodInfo.slm_LoanOdTerm     = leadData.LoanOdTerm;
                    prodInfo.slm_Ebank          = leadData.Ebank;
                    prodInfo.slm_Atm            = leadData.Atm;
                    //prodInfo.slm_OtherDetail_1 = leadData.OtherDetail_1;
                    //prodInfo.slm_OtherDetail_2 = leadData.OtherDetail_2;
                    //prodInfo.slm_OtherDetail_3 = leadData.OtherDetail_3;
                    //prodInfo.slm_OtherDetail_4 = leadData.OtherDetail_4;
                    prodInfo.slm_CarType = leadData.CarType;

                    slmdb.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Ejemplo n.º 13
0
        public void InsertData(LeadData leadData, string UserId)
        {
            try
            {
                kkslm_tr_productinfo prodInfo = new kkslm_tr_productinfo();
                prodInfo.slm_TicketId = leadData.TicketId;

                prodInfo.slm_InterestedProd = leadData.InterestedProd;
                prodInfo.slm_LicenseNo      = leadData.LicenseNo;
                prodInfo.slm_YearOfCar      = leadData.YearOfCar;
                prodInfo.slm_YearOfCarRegis = leadData.YearOfCarRegis;
                prodInfo.slm_ProvinceRegis  = leadData.ProvinceRegis;
                prodInfo.slm_Brand          = leadData.Brand;
                prodInfo.slm_Model          = leadData.Model;
                prodInfo.slm_Submodel       = leadData.Submodel;
                prodInfo.slm_DownPayment    = leadData.DownPayment;
                prodInfo.slm_DownPercent    = leadData.DownPercent;
                prodInfo.slm_CarPrice       = leadData.CarPrice;
                prodInfo.slm_FinanceAmt     = leadData.FinanceAmt;
                prodInfo.slm_PaymentTerm    = leadData.PaymentTerm;
                prodInfo.slm_PaymentType    = leadData.PaymentType;
                prodInfo.slm_BalloonAmt     = leadData.BalloonAmt;
                prodInfo.slm_BalloonPercent = leadData.BalloonPercent;
                prodInfo.slm_PlanType       = leadData.PlanType;
                prodInfo.slm_CoverageDate   = leadData.CoverageDate;
                prodInfo.slm_AccType        = leadData.AccType;
                prodInfo.slm_AccPromotion   = leadData.AccPromotion;
                prodInfo.slm_AccTerm        = leadData.AccTerm;
                prodInfo.slm_Interest       = leadData.Interest;
                prodInfo.slm_Invest         = leadData.Invest;
                prodInfo.slm_LoanOd         = leadData.LoanOd;
                prodInfo.slm_LoanOdTerm     = leadData.LoanOdTerm;
                prodInfo.slm_Ebank          = leadData.Ebank;
                prodInfo.slm_Atm            = leadData.Atm;
                prodInfo.slm_OtherDetail_1  = leadData.OtherDetail_1;
                prodInfo.slm_OtherDetail_2  = leadData.OtherDetail_2;
                prodInfo.slm_OtherDetail_3  = leadData.OtherDetail_3;
                prodInfo.slm_OtherDetail_4  = leadData.OtherDetail_4;
                prodInfo.slm_CarType        = leadData.CarType;

                slmdb.kkslm_tr_productinfo.AddObject(prodInfo);
                slmdb.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         int      leadID   = Convert.ToInt32(Request.QueryString["leadid"]);
         LeadData leadData = leadHelper.GetLeadsByLeadID(leadID);
         txtBestPhone.Text        = leadData.PhoneNoForContact;
         txtBusinessName.Text     = leadData.BusinessName;
         txtComplianceAgent.Text  = leadData.ComplianceAgent;
         txtContactName.Text      = leadData.ContactName;
         txtDoT.Text              = leadData.DOTNo;
         txtEmail.Text            = leadData.Email;
         txtServiceDiscussed.Text = leadData.ServiceDiscussed;
         BindLeads();
     }
 }
 public void InsertData(LeadData leadData, string createByUsername, DateTime createDate)
 {
     try
     {
         kkslm_tr_cusinfo info = new kkslm_tr_cusinfo();
         info.slm_TicketId     = leadData.TicketId;
         info.slm_LastName     = leadData.LastName;
         info.slm_Email        = leadData.Email;
         info.slm_TelNo_2      = leadData.TelNo_2;
         info.slm_TelNo_3      = leadData.TelNo_3;
         info.slm_Ext_2        = leadData.Ext_2;
         info.slm_Ext_3        = leadData.Ext_3;
         info.slm_BuildingName = leadData.BuildingName;
         info.slm_AddressNo    = leadData.AddressNo;
         info.slm_Floor        = leadData.Floor;
         info.slm_Soi          = leadData.Soi;
         info.slm_Street       = leadData.Street;
         info.slm_Tambon       = leadData.Tambon;
         info.slm_Amphur       = leadData.Amphur;
         info.slm_Province     = leadData.Province;
         info.slm_PostalCode   = leadData.PostalCode;
         info.slm_Occupation   = leadData.Occupation;
         info.slm_BaseSalary   = leadData.BaseSalary;
         info.slm_IsCustomer   = leadData.IsCustomer;
         info.slm_CusCode      = leadData.CusCode;
         if (leadData.Birthdate != null)
         {
             info.slm_Birthdate = leadData.Birthdate;
         }
         info.slm_CardType      = leadData.CardType;
         info.slm_CitizenId     = leadData.CitizenId;
         info.slm_Topic         = leadData.Topic;
         info.slm_Detail        = leadData.Detail;
         info.slm_PathLink      = leadData.PathLink;
         info.slm_ContactBranch = leadData.ContactBranch;
         info.slm_CreatedBy     = createByUsername;
         info.slm_CreatedDate   = createDate;
         info.slm_UpdatedBy     = createByUsername;
         info.slm_UpdatedDate   = createDate;
         slmdb.kkslm_tr_cusinfo.AddObject(info);
         slmdb.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 16
0
        private bool CheckTicketCloseOrTicketCOC(LeadData lead)
        {
            if (lead.ISCOC == "1" && lead.COCCurrentTeam != SLMConstant.COCTeam.Marketing)
            {
                string message = "ข้อมูลผู้มุ่งหวังรายนี้ ไม่สามารถแก้ไขได้เนื่องจากเข้าระบบ COC แล้ว";
                AppUtil.ClientAlertAndRedirect(Page, message, "SLM_SCR_003.aspx");
                return(false);
            }

            if (lead.Status == "08" || lead.Status == "09" || lead.Status == "10")
            {
                string message = "ข้อมูลผู้มุ่งหวังรายนี้ ไม่สามารถแก้ไขได้เนื่องจากอยู่ในสถานะ" + lead.StatusName;
                AppUtil.ClientAlertAndRedirect(Page, message, "SLM_SCR_003.aspx");
                return(false);
            }

            return(true);
        }
Ejemplo n.º 17
0
        public static string InsertLeadData(LeadData leadData, CampaignWSData camData, string createbyUsername)
        {
            string ticketId = "";

            try
            {
                StoreProcedure store = new StoreProcedure();
                ticketId          = store.GenerateTicketId();
                leadData.TicketId = ticketId;
                camData.TicketId  = ticketId;

                DateTime createDate = DateTime.Now;

                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {
                    IsolationLevel = IsolationLevel.ReadCommitted
                }))
                {
                    KKSlmTrLeadModel lead = new KKSlmTrLeadModel();
                    lead.InsertData(leadData, createbyUsername, createDate);

                    KKSlmTrCusInfoModel customerInfo = new KKSlmTrCusInfoModel();
                    customerInfo.InsertData(leadData, createbyUsername, createDate);

                    KKSlmTrProductInfoModel productInfo = new KKSlmTrProductInfoModel();
                    productInfo.InsertData(leadData, createbyUsername);

                    KKSlmTrChannelInfoModel channelInfo = new KKSlmTrChannelInfoModel();
                    channelInfo.InsertData(leadData, createbyUsername, createDate);

                    KKSLMTrCampaignFinalModel camFinal = new KKSLMTrCampaignFinalModel();
                    camFinal.InsertData(camData, createbyUsername, createDate);

                    KKSlmTrHistoryModel history = new KKSlmTrHistoryModel();
                    history.InsertData(ticketId, SLMConstant.HistoryTypeCode.CreateLead, "", "", createbyUsername, createDate);

                    ts.Complete();
                }
                return(ticketId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 18
0
        public bool EditLead(LeadData lead)
        {
            bool isSalesEdited = false;

            using (uow = new UnitOfWork.UnitOfWork())
            {
                try
                {
                    Lead leaddb = uow.LeadRepository.Get().Where(x => x.LeadID == lead.LeadID).FirstOrDefault();
                    leaddb.BusinessName      = lead.BusinessName;
                    leaddb.ComplianceAgent   = lead.ComplianceAgent;
                    leaddb.ContactName       = lead.ContactName;
                    leaddb.Date              = DateTime.Now.Date.ToShortDateString();
                    leaddb.DOTNo             = lead.DOTNo;
                    leaddb.Email             = lead.Email;
                    leaddb.PhoneNoForContact = lead.PhoneNoForContact;
                    leaddb.ServiceDiscussed  = lead.ServiceDiscussed;
                    leaddb.SalesPersonID     = lead.SalesPersonID;
                    uow.LeadRepository.Update(leaddb);
                    uow.Save();
                    if (!String.IsNullOrEmpty(lead.Notes) && !String.IsNullOrEmpty(lead.TimeLine))
                    {
                        LeadNote leadNote = new LeadNote();
                        leadNote.LeadID     = leaddb.LeadID;
                        leadNote.Note       = lead.Notes;
                        leadNote.Timeline   = lead.TimeLine;
                        leadNote.NoteLeftAt = DateTimeJavaScript.GetCurrentTime().ToString();
                        uow.LeadNoteRepository.Insert(leadNote);
                        uow.Save();
                    }
                    isSalesEdited = true;
                }
                catch
                {
                    isSalesEdited = false;
                }
            }

            return(isSalesEdited);
        }
Ejemplo n.º 19
0
 private async Task SaveDataToDb(LeadData lead)
 {
     //todo: Create DTOs and populate with data
     EnrichedLead crmLead = new EnrichedLead
     {
         City          = lead.City,
         CurrentAgent  = lead.CurrentAgent,
         Email         = lead.Email,
         FirstName     = lead.FirstName,
         FreeEvent     = lead.FreeEvent,
         FreeProduct   = lead.FreeProduct,
         LastName      = lead.LastName,
         PhoneNumber   = lead.PhoneNumber,
         SalesCareer   = lead.SalesCareer,
         State         = lead.State,
         StreetAddress = lead.StreetAddress,
         TriedProduct  = lead.TriedProduct,
         Zip           = lead.Zip
     };
     //todo: Send the dtos to the CRM to process(here just saved to DB)
     var doc = await _repo.CreateItemAsync(crmLead);
 }
Ejemplo n.º 20
0
        public void InitialControl(LeadData data)
        {
            try
            {
                txtTicketID.Text   = data.TicketId;
                txtFirstname.Text  = data.Name;
                txtLastname.Text   = data.LastName;
                txtOwnerLead.Text  = data.OwnerName;
                txtCampaign.Text   = data.CampaignName;
                txtTelNo1.Text     = data.TelNo_1;
                txtExt1.Text       = data.Ext_1;
                cbNoteFlag.Checked = data.NoteFlag != null ? (data.NoteFlag == "1" ? true : false) : false;

                pcTop.SetVisible = false;
                DoBindGridview();
                CheckEmailSubject();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 21
0
        public void InitialControl(LeadData data)
        {
            try
            {
                //txtTicketID.Text = data.TicketId;
                txtCitizenId.Text = data.CitizenId;
                //txtFirstname.Text = data.Name;
                //txtLastname.Text = data.LastName;
                //txtOwnerLead.Text = data.OwnerName;
                //txtOwner.Text = data.Owner;
                //txtCampaign.Text = data.CampaignName;
                txtTelNo1.Text = data.TelNo_1;
                //txtExt1.Text = data.Ext_1;

                //cmbLeadStatus.DataSource = SlmScr008Biz.GetLeadStatus(AppConstant.OptionType.LeadStatus);
                //cmbLeadStatus.DataTextField = "TextField";
                //cmbLeadStatus.DataValueField = "ValueField";
                //cmbLeadStatus.DataBind();

                //if (cmbLeadStatus.Items.Count > 0)
                //{
                //    cmbLeadStatus.SelectedIndex = cmbLeadStatus.Items.IndexOf(cmbLeadStatus.Items.FindByValue(data.Status));
                //    txtOldStatus.Text = data.Status;
                //}

                //cmbLeadStatus.Enabled = data.AssignedFlag == "1" ? true : false;
                //if (data.AssignedFlag == "1" && data.Status != "00")
                //{
                //    cmbLeadStatus.Items.Remove(cmbLeadStatus.Items.FindByValue("00"));  //ถ้าจ่ายงานแล้ว และสถานะปัจจุบันไม่ใช่สนใจ ให้เอาสถานะ สนใจ ออก
                //}

                pcTop.SetVisible = false;
                DoBindGridview();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 22
0
        public void GetLeadData(LeadData lead)
        {
            try
            {
                pnlLead.Visible = true;

                CampaignId = lead.CampaignId;
                ctlCommon.SetLeadData(lead);
                LoadDetailControl();
                ctlLead.LoadData(lead);
            }
            catch (Exception ex)
            {
                _log.Error(ex.InnerException != null ? ex.InnerException.Message : ex.Message);
            }
            finally
            {
                ctlCommon.SetControlMode(Lead_Detail_Master.CtlMode.View);
                ctlLead.SetControlMode(Lead_Detail_Master.CtlMode.View);
                SetAllView();
            }
        }
Ejemplo n.º 23
0
        public bool AddLead(LeadData lead)
        {
            bool isSalesAdded = false;

            using (uow = new UnitOfWork.UnitOfWork())
            {
                try
                {
                    Lead leaddb = new Lead();
                    leaddb.BusinessName      = lead.BusinessName;
                    leaddb.ComplianceAgent   = lead.ComplianceAgent;
                    leaddb.ContactName       = lead.ContactName;
                    leaddb.Date              = DateTime.Now.Date.ToShortDateString();
                    leaddb.DOTNo             = lead.DOTNo;
                    leaddb.Email             = lead.Email;
                    leaddb.PhoneNoForContact = lead.PhoneNoForContact;
                    leaddb.ServiceDiscussed  = lead.ServiceDiscussed;
                    leaddb.SalesPersonID     = lead.SalesPersonID;
                    uow.LeadRepository.Insert(leaddb);
                    uow.Save();
                    LeadNote leadNote = new LeadNote();
                    leadNote.LeadID     = leaddb.LeadID;
                    leadNote.Note       = lead.Notes;
                    leadNote.Timeline   = lead.TimeLine;
                    leadNote.NoteLeftAt = DateTimeJavaScript.GetCurrentTime().ToString();
                    uow.LeadNoteRepository.Insert(leadNote);
                    uow.Save();
                    isSalesAdded = true;
                }
                catch
                {
                    isSalesAdded = false;
                }
            }

            return(isSalesAdded);
        }
Ejemplo n.º 24
0
        // public LeadData GetLeadChatUpdateData(IMessage message, string eventName, SFDCCallType callType, string duration, string chatContent)
        public LeadData GetLeadChatUpdateData(IXNCustomData chatData, string eventName)
        {
            try
            {
                this.logger.Info("GetLeadChatUpdateData :  Reading Lead Update Data.....");
                this.logger.Info("GetLeadChatUpdateData :  Event Name : " + chatData.EventName);
                if (this.leadChatOptions != null)
                {
                    dynamic popupEvent = Convert.ChangeType(chatData.InteractionEvent, chatData.InteractionEvent.GetType());

                    if (popupEvent != null)
                    {
                        LeadData lead = new LeadData();

                        #region Collect Lead Data

                        lead.ObjectName = leadChatOptions.ObjectName;

                        if (chatData.InteractionType == SFDCCallType.InboundChat)
                        {
                            if (leadChatOptions.InboundCanUpdateLog)
                            {
                                lead.UpdateActivityLog     = true;
                                lead.UpdateActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadChatLogConfig, popupEvent, chatData.InteractionType, chatData.Duration, emailData: chatData);
                                if (!string.IsNullOrWhiteSpace(leadChatOptions.ChatAppendActivityLogEventNames) && leadChatOptions.ChatAppendActivityLogEventNames.Contains(eventName))
                                {
                                    lead.AppendActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadChatLogConfig, null, chatData.InteractionType, chatData.Duration, emailData: chatData, isAppendLogData: true);
                                }
                            }
                        }
                        if (chatData.InteractionType == SFDCCallType.ConsultChatReceived)
                        {
                            if (leadChatOptions.ConsultCanUpdateLog)
                            {
                                lead.UpdateActivityLog     = true;
                                lead.UpdateActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadChatLogConfig, popupEvent, chatData.InteractionType, chatData.Duration, emailData: chatData);
                                if (!string.IsNullOrWhiteSpace(leadChatOptions.ChatAppendActivityLogEventNames) && leadChatOptions.ChatAppendActivityLogEventNames.Contains(eventName))
                                {
                                    lead.AppendActivityLogData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadChatLogConfig, null, chatData.InteractionType, chatData.Duration, emailData: chatData, isAppendLogData: true);
                                }
                            }
                        }
                        //update lead record fields
                        lead.UpdateRecordFields = leadChatOptions.CanUpdateRecordData;
                        if (SFDCObjectHelper.GetNoRecordFoundAction(chatData.InteractionType, leadChatOptions).Equals("createnew") && this.LeadChatRecordConfig != null)
                        {
                            if (leadChatOptions.CanUpdateRecordData)
                            {
                                lead.UpdateRecordFieldsData = this.sfdcUtility.GetUpdateActivityLogData(this.LeadChatRecordConfig, popupEvent, chatData.InteractionType, chatData.Duration, emailData: chatData);
                            }
                        }

                        #endregion Collect Lead Data

                        return(lead);
                    }
                }
                else
                {
                    this.logger.Info("Can not Collect Lead Update data because Lead Configuration is null.");
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetLeadChatUpdateData : Error occurred while reading Lead Data : " + generalException.ToString());
            }
            return(null);
        }
Ejemplo n.º 25
0
        public void UpdateData(LeadData leadData, string UserId, bool actDelegate, bool actOwner, DateTime updateDate)
        {
            var lead = slmdb.kkslm_tr_lead.Where(p => p.slm_ticketId == leadData.TicketId).FirstOrDefault();

            if (lead != null)
            {
                try
                {
                    lead.slm_ticketId = leadData.TicketId;
                    lead.slm_Name     = leadData.Name;
                    lead.slm_LastName = leadData.LastName;
                    lead.slm_TelNo_1  = leadData.TelNo_1;
                    //lead.slm_Ext_1 = leadData.Ext_1;
                    lead.slm_CampaignId = leadData.CampaignId;

                    //lead.slm_Status = leadData.Status;
                    //if (leadData.StatusDate != null)
                    //    lead.slm_StatusDate = leadData.StatusDate;
                    lead.slm_AvailableTime = leadData.AvailableTime;
                    if (leadData.StaffId != null)
                    {
                        lead.slm_StaffId = Convert.ToInt32("0" + leadData.StaffId);
                    }
                    else
                    {
                        lead.slm_StaffId = null;
                    }

                    lead.slm_ChannelId = leadData.ChannelId;

                    if (actDelegate)
                    {
                        lead.slm_Delegate_Flag = leadData.Delegate_Flag.Value;
                        if (string.IsNullOrEmpty(leadData.Delegate))
                        {
                            lead.slm_DelegateDate = null;
                        }
                        else
                        {
                            lead.slm_DelegateDate = updateDate;
                        }

                        lead.slm_Delegate          = string.IsNullOrEmpty(leadData.Delegate) ? null : leadData.Delegate;
                        lead.slm_Delegate_Position = string.IsNullOrEmpty(leadData.Delegate) ? null : GetPositionId(leadData.Delegate, slmdb);

                        if (!string.IsNullOrEmpty(leadData.Delegate_Branch))
                        {
                            lead.slm_Delegate_Branch = leadData.Delegate_Branch;
                        }
                        else
                        {
                            lead.slm_Delegate_Branch = null;
                        }
                    }

                    if (actOwner)
                    {
                        lead.slm_AssignedFlag = "0";
                        lead.slm_AssignedDate = null;
                        lead.slm_AssignedBy   = null;

                        if (!string.IsNullOrEmpty(leadData.Owner_Branch))
                        {
                            lead.slm_Owner_Branch = leadData.Owner_Branch;
                        }
                        else
                        {
                            lead.slm_Owner_Branch = null;
                        }

                        lead.slm_Owner          = leadData.Owner;
                        lead.slm_Owner_Position = GetPositionId(leadData.Owner, slmdb);
                    }

                    lead.slm_OldOwner        = leadData.slmOldOwner;
                    lead.slm_UpdatedBy       = UserId;
                    lead.slm_UpdatedDate     = updateDate;
                    lead.slm_ContractNoRefer = leadData.ContractNoRefer;
                    slmdb.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Ejemplo n.º 26
0
        protected void btnAddLead_Click(object sender, EventArgs e)
        {
            LeadData lead = new LeadData();

            lead.BusinessName      = txtBusinessName.Text;
            lead.ComplianceAgent   = txtComplianceAgent.Text;
            lead.ContactName       = txtContactName.Text;
            lead.DOTNo             = txtDoT.Text;
            lead.Email             = txtEmail.Text;
            lead.Notes             = txtNotes.Text;
            lead.PhoneNoForContact = txtBestPhone.Text;
            lead.SalesPersonID     = Convert.ToInt32(Request.Cookies["UserID"].Value);
            lead.ServiceDiscussed  = txtServiceDiscussed.Text;
            lead.TimeLine          = txtTimeLine.Text;

            bool isLeadAdded = leadHelper.AddLead(lead);

            IUserServiceContext    userServiceContext = new UserServiceContext(_accessToken, _apiKey);
            ConstantContactFactory serviceFactory     = new ConstantContactFactory(userServiceContext);
            //List<string> lists = new List<string>() { "1236366064" };

            List <string> lists = new List <string>();

            string[] emailid = hdnEmailID.Value.Split(',');
            foreach (string item in emailid)
            {
                if (!String.IsNullOrEmpty(item))
                {
                    lists.Add(item);
                }
            }
            List <ContactList> contactLists = new List <ContactList>();

            foreach (string list in lists)
            {
                ContactList contactList = new ContactList()
                {
                    Id = list
                };
                contactLists.Add(contactList);
            }
            if (isLeadAdded)
            {
                int             leadID         = Convert.ToInt32(Request.QueryString["LeadID"]);
                DailyLeadEntity dailyLead      = dailyLeadHelper.GetLeadRecordsByLeadID(leadID);
                var             contactService = serviceFactory.CreateContactService();
                string          physicalCity   = "";
                try
                {
                    physicalCity = dailyLead.PhysicalAddress.Split(',')[1].Split(null)[1];
                }
                catch
                {
                }
                Address address = new Address();
                try
                {
                    address = new Address()
                    {
                        AddressType = "BUSINESS",
                        City        = toString(physicalCity),
                        CountryCode = "US",
                        Line1       = toString(dailyLead.MailingAddress.Substring(0, 40)),
                        Line2       = toString(dailyLead.MailingAddress.Substring(0, 40)),
                        PostalCode  = toString(dailyLead.ZipCode),
                        StateCode   = toString("ID"),
                    };
                }
                catch
                {
                    address = new Address()
                    {
                        AddressType = "BUSINESS"
                    };
                }

                try
                {
                    if (dailyLead != null)
                    {
                        Contact contact = new Contact()
                        {
                            Addresses = new List <Address> {
                                address
                            },
                            Lists          = contactLists,
                            CellPhone      = dailyLead.PhoneNo,
                            CompanyName    = toString(dailyLead.LegalName),
                            Confirmed      = true,
                            EmailAddresses = new List <EmailAddress> {
                                new EmailAddress(toString(txtEmail.Text))
                            },
                            Fax        = dailyLead.PhoneNo,
                            FirstName  = txtContactName.Text,
                            HomePhone  = txtBestPhone.Text,
                            JobTitle   = "Purcell Compliance Lead",
                            LastName   = toString(""),
                            PrefixName = "Mr.",
                            WorkPhone  = dailyLead.PhoneNo
                        };
                        contactService.AddContact(contact, false);
                    }
                    else
                    {
                        Contact contact = new Contact()
                        {
                            Addresses = new List <Address> {
                                address
                            },
                            Lists          = contactLists,
                            CellPhone      = txtBestPhone.Text,
                            CompanyName    = toString(txtBusinessName.Text),
                            Confirmed      = true,
                            EmailAddresses = new List <EmailAddress> {
                                new EmailAddress(toString(txtEmail.Text))
                            },
                            Fax        = txtBestPhone.Text,
                            FirstName  = txtContactName.Text,
                            HomePhone  = txtBestPhone.Text,
                            JobTitle   = "Purcell Compliance Lead",
                            LastName   = toString(""),
                            PrefixName = "Mr.",
                            WorkPhone  = txtBestPhone.Text
                        };
                        contactService.AddContact(contact, false);
                    }
                    Response.Write("<script>alert('Lead added Successfully.');</script>");
                    resetControls();
                }
                catch
                {
                    //Response.Write("<script>alert('" + ex.Message + "');</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Some error occured.');</script>");
            }
        }
Ejemplo n.º 27
0
        private void GetLeadData()
        {
            try
            {
                lead = SearchLeadBiz.GetLeadInfo(txtTicketID.Text.Trim());
                if (lead != null)
                {
                    tabLeadInfo.GetLeadData(lead);
                    txtstatus.Text            = lead.StatusName;
                    txtFirstname.Text         = lead.Name;
                    txtFirstname.ToolTip      = lead.Name;
                    txtLastname.Text          = lead.LastName;
                    txtLastname.ToolTip       = lead.LastName;
                    txtCampaignId.Text        = lead.CampaignId;
                    txtCampaignName.Text      = lead.CampaignName;
                    txtCampaignName.ToolTip   = lead.CampaignName;
                    txtInterestedProd.Text    = lead.InterestedProd;
                    txtInterestedProd.ToolTip = lead.InterestedProd;
                    txtCitizenId.Text         = lead.CitizenId;
                    txtChannelId.Text         = lead.ChannelId;
                    txtTelNo1.Text            = lead.TelNo_1;
                    if (lead.ContactLatestDate != null)
                    {
                        txtContactLatestDate.Text = lead.ContactLatestDate.Value.ToString("dd/MM/") + lead.ContactLatestDate.Value.Year.ToString() + " " + lead.ContactLatestDate.Value.ToString("HH:mm:ss");
                    }
                    if (lead.AssignedDateView != null)
                    {
                        txtAssignDate.Text = lead.AssignedDateView.Value.ToString("dd/MM/") + lead.AssignedDateView.Value.Year.ToString() + " " + lead.AssignedDateView.Value.ToString("HH:mm:ss");
                    }
                    if (lead.ContactFirstDate != null)
                    {
                        txtContactFirstDate.Text = lead.ContactFirstDate.Value.ToString("dd/MM/") + lead.ContactFirstDate.Value.Year.ToString() + " " + lead.ContactFirstDate.Value.ToString("HH:mm:ss");
                    }
                    if (lead.CocAssignedDate != null)
                    {
                        txtCOCAssignDate.Text = lead.CocAssignedDate.Value.ToString("dd/MM/") + lead.CocAssignedDate.Value.Year.ToString() + " " + lead.CocAssignedDate.Value.ToString("HH:mm:ss");
                    }
                    txtOwnerLead.Text         = lead.OwnerName;
                    txtOwnerLead.ToolTip      = lead.OwnerName;
                    txtDelegateLead.Text      = lead.DelegateName;
                    txtDelegateLead.ToolTip   = lead.DelegateName;
                    txtDelegateBranch.Text    = lead.DelegatebranchName;
                    txtDelegateBranch.ToolTip = lead.DelegatebranchName;
                    txtOwnerBranch.Text       = lead.OwnerBranchName;
                    txtOwnerBranch.ToolTip    = lead.OwnerBranchName;
                    txtTelNo_1.Text           = lead.TelNo_1;
                    txtTelNo2.Text            = lead.TelNo_2;
                    txtExt2.Text              = lead.Ext_2;
                    txtTelNo3.Text            = lead.TelNo_3;
                    txtExt3.Text              = lead.Ext_3;
                    txtMarketingOwner.Text    = lead.MarketingOwnerName;
                    txtMarketingOwner.ToolTip = lead.MarketingOwnerName;
                    txtLastOwner.Text         = lead.LastOwnerName;
                    txtLastOwner.ToolTip      = lead.LastOwnerName;
                    txtCocTeam.Text           = lead.CocTeam;
                    txtCocTeam.ToolTip        = lead.CocTeam;
                    txtCocStatus.Text         = lead.CocStatusDesc;
                    txtCocStatus.ToolTip      = lead.CocStatusDesc;

                    GetCampaignList();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    ((Label)Page.Master.FindControl("lblTopic")).Text = "แก้ไขข้อมูล Lead (Edit)";
                    Page.Form.DefaultButton = btnSave.UniqueID;

                    ctlCommon.SetControlMode(Lead_Detail_Master.CtlMode.Edit);

                    if (Request["ticketid"] != null && Request["ticketid"].ToString().Trim() != string.Empty)
                    {
                        CheckTicketIdPrivilege(Request["ticketid"].ToString().Trim());
                    }
                    else
                    {
                        AppUtil.ClientAlertAndRedirect(Page, "Ticket Id not found", "SLM_SCR_003.aspx");
                        return;
                    }

                    if (!string.IsNullOrEmpty(Request["ticketid"]))
                    {
                        var      ticketid = Request["ticketid"];
                        LeadData lead     = SlmScr010Biz.GetLeadData(ticketid);
                        if (lead == null)
                        {
                            AppUtil.ClientAlertAndRedirect(Page, "ไม่พบ Ticket Id " + ticketid + " ในระบบ", "SLM_SCR_003.aspx");
                            return;
                        }


                        if (!CheckTicketCloseOrTicketCOC(lead))
                        {
                            return;
                        }

                        CampaignId = lead.CampaignId;
                        ctlCommon.SetLeadData(lead);
                        LoadDetailControl();
                        ctlLead.LoadData(lead);

                        //InitialControl();
                        //SetScript();
                    }
                    else
                    {
                        AppUtil.ClientAlertAndRedirect(Page, "Ticket Id not found", "SLM_SCR_003.aspx");
                        return;
                    }

                    ScreenPrivilegeData priData = RoleBiz.GetScreenPrivilege(HttpContext.Current.User.Identity.Name, "SLM_SCR_011");
                    if (priData == null || priData.IsView != 1)
                    {
                        AppUtil.ClientAlertAndRedirect(Page, "คุณไม่มีสิทธิ์เข้าใช้หน้าจอนี้", "SLM_SCR_003.aspx");
                        return;
                    }

                    //Check สิทธิ์ภัทรในการเข้าใช้งาน
                    StaffData staff = StaffBiz.GetStaff(HttpContext.Current.User.Identity.Name);
                    ConfigBranchPrivilegeData data = ConfigBranchPrivilegeBiz.GetConfigBranchPrivilege(staff.BranchCode);
                    if (data != null)
                    {
                        if (data.IsEdit != null && data.IsEdit.Value == false)
                        {
                            AppUtil.ClientAlertAndRedirect(Page, "คุณไม่มีสิทธิ์เข้าใช้หน้าจอนี้", "SLM_SCR_003.aspx");
                            return;
                        }
                    }
                    //------------------------------------------------------------------------------------------------------
                }
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
Ejemplo n.º 29
0
        public LeadData GetLeadVoicePopupData(IMessage message, SFDCCallType callType)
        {
            try
            {
                this.logger.Info("GetLeadVoicePopupData :  Reading Lead Popup Data.....");
                this.logger.Info("GetLeadVoicePopupData :  Event Name : " + message.Name);
                dynamic popupEvent = Convert.ChangeType(message, message.GetType());
                if (this.leadVoiceOptions != null)
                {
                    if (popupEvent != null)
                    {
                        LeadData lead = new LeadData();

                        #region Collect Lead Data

                        lead.SearchData                             = this.sfdcUtilityHelper.GetVoiceSearchValue(leadVoiceOptions, message, callType);
                        lead.ObjectName                             = leadVoiceOptions.ObjectName;
                        lead.NoRecordFound                          = SFDCObjectHelper.GetNoRecordFoundAction(callType, leadVoiceOptions);
                        lead.MultipleMatchRecord                    = SFDCObjectHelper.GetMultiMatchRecordAction(callType, leadVoiceOptions);
                        lead.NewRecordFieldIds                      = leadVoiceOptions.NewrecordFieldIds;
                        lead.SearchCondition                        = leadVoiceOptions.SearchCondition;
                        lead.CreateLogForNewRecord                  = leadVoiceOptions.CanCreateLogForNewRecordCreate;
                        lead.MaxRecordOpenCount                     = leadVoiceOptions.MaxNosRecordOpen;
                        lead.SearchpageMode                         = leadVoiceOptions.SearchPageMode;
                        lead.PhoneNumberSearchFormat                = leadVoiceOptions.PhoneNumberSearchFormat;
                        lead.CanCreateNoRecordActivityLog           = SFDCObjectHelper.GetCanCreateProfileActivity(callType, leadVoiceOptions, true);
                        lead.CanPopupNoRecordActivityLog            = SFDCObjectHelper.GetCanPopupProfileActivity(callType, leadVoiceOptions, true);
                        lead.CanCreateMultiMatchActivityLog         = SFDCObjectHelper.GetCanCreateProfileActivity(callType, leadVoiceOptions);
                        lead.CanPopupMultiMatchActivityLog          = SFDCObjectHelper.GetCanPopupProfileActivity(callType, leadVoiceOptions);
                        lead.CanCreateProfileActivityforInbNoRecord = leadVoiceOptions.CanCreateProfileActivityforInbNoRecord;
                        lead.CanCreateProfileActivityforOutNoRecord = leadVoiceOptions.CanCreateProfileActivityforOutNoRecord;
                        lead.CanCreateProfileActivityforConNoRecord = leadVoiceOptions.CanCreateProfileActivityforConNoRecord;
                        if (lead.NoRecordFound.Equals("createnew") && this.LeadVoiceRecordConfig != null)
                        {
                            lead.CreateRecordFieldData = this.sfdcUtility.GetCreateActivityLogData(this.LeadVoiceRecordConfig, message, callType);
                        }

                        switch (callType)
                        {
                        case SFDCCallType.InboundVoice:
                            lead.CreateActvityLog = leadVoiceOptions.InboundCanCreateLog;
                            if (leadVoiceOptions.InboundCanCreateLog && this.LeadLogConfig != null)
                            {
                                lead.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(this.LeadLogConfig, popupEvent, callType);
                            }
                            break;

                        case SFDCCallType.OutboundVoiceSuccess:
                            lead.CreateActvityLog = leadVoiceOptions.OutboundCanCreateLog;
                            if (leadVoiceOptions.OutboundCanCreateLog && this.LeadLogConfig != null)
                            {
                                lead.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(this.LeadLogConfig, popupEvent, callType);
                            }
                            break;

                        case SFDCCallType.OutboundVoiceFailure:
                            lead.CreateActvityLog = leadVoiceOptions.OutboundFailureCanCreateLog;
                            if (leadVoiceOptions.OutboundFailureCanCreateLog && this.LeadLogConfig != null)
                            {
                                lead.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(this.LeadLogConfig, popupEvent, callType);
                            }
                            break;

                        case SFDCCallType.ConsultVoiceReceived:
                            lead.CreateActvityLog = leadVoiceOptions.ConsultCanCreateLog;
                            if (leadVoiceOptions.ConsultCanCreateLog && this.LeadLogConfig != null)
                            {
                                lead.ActivityLogData = this.sfdcUtility.GetCreateActivityLogData(this.LeadLogConfig, popupEvent, callType);
                            }
                            break;

                        default:
                            break;
                        }

                        #endregion Collect Lead Data

                        return(lead);
                    }
                }
                else
                {
                    this.logger.Info("Can not Collect Lead Popup data because Lead Configuration is null.");
                }
            }
            catch (Exception generalException)
            {
                this.logger.Error("GetLeadVoicePopupData : Error occurred while reading Lead Data : " + generalException.ToString());
            }
            return(null);
        }
Ejemplo n.º 30
0
        public void GetLeadData(LeadData lead)
        {
            try
            {
                txtAddressNo.Text    = lead.AddressNo;
                txtBuildingName.Text = lead.BuildingName;
                txtFloor.Text        = lead.Floor;
                txtSoi.Text          = lead.Soi;
                txtStreet.Text       = lead.Street;
                txtTambon.Text       = lead.TambolName;
                txtAmphur.Text       = lead.AmphurName;
                txtProvince.Text     = lead.ProvinceName;
                txtPostalCode.Text   = lead.PostalCode;
                txtIsCustomer.Text   = (string.IsNullOrEmpty(lead.IsCustomer) ? "": (lead.IsCustomer.Trim() == "1" ? "เคย" : "ไม่เคย"));
                txtCusCode.Text      = lead.CusCode;
                txtOccupation.Text   = lead.OccupationName;
                if (lead.BaseSalary != null)
                {
                    txtBaseSalary.Text = lead.BaseSalary.Value.ToString("#,##0.00");
                }
                txtLicenseNo.Text      = lead.LicenseNo;
                txtYearOfCar.Text      = lead.YearOfCar;
                txtYearOfCarRegis.Text = lead.YearOfCarRegis;
                txtBrand.Text          = lead.BrandName;
                if (lead.CarPrice != null)
                {
                    txtCarPrice.Text = lead.CarPrice.Value.ToString("#,##0.00");
                }
                txtModel.Text    = lead.ModelName;
                txtSubmodel.Text = lead.SubModelName;
                if (lead.DownPayment != null)
                {
                    txtDownPayment.Text = lead.DownPayment.Value.ToString("#,##0.00");
                }
                txtDownPercent.Text = lead.DownPercent.ToString();
                if (lead.FinanceAmt != null)
                {
                    txtFinanceAmt.Text = lead.FinanceAmt.Value.ToString("#,##0.00");
                }
                txtPaymentTerm.Text = lead.PaymentTerm;
                txtPaymentType.Text = lead.PaymentName;
                if (lead.BalloonAmt != null)
                {
                    txtBalloonAmt.Text = lead.BalloonAmt.Value.ToString("#,##0.00");
                }
                txtBalloonPercent.Text = lead.BalloonPercent.ToString();
                txtProvinceRegis.Text  = lead.ProvinceRegisName;
                if (!string.IsNullOrEmpty(lead.CoverageDate))
                {
                    if (lead.CoverageDate.Trim().Length == 8)
                    {
                        txtCoverageDate.Text = lead.CoverageDate.Substring(6, 2) + "/" + lead.CoverageDate.Substring(4, 2) + "/" + lead.CoverageDate.Substring(0, 4);
                    }
                }
                txtPlanType.Text     = lead.PlanBancName;
                txtAccType.Text      = lead.AccTypeName;
                txtAccPromotion.Text = lead.PromotionName;
                txtAccTerm.Text      = lead.AccTerm;
                txtInterest.Text     = lead.Interest;
                if (!string.IsNullOrEmpty(lead.Invest))
                {
                    txtInvest.Text = Convert.ToDecimal(lead.Invest).ToString("#,##0.00");
                }
                txtLoanOd.Text     = lead.LoanOd;
                txtLoanOdTerm.Text = lead.LoanOdTerm;
                txtEbank.Text      = (string.IsNullOrEmpty(lead.Ebank) ? "": (lead.Ebank.Trim() == "1" ? "ใช่" : "ไม่ใช่"));
                txtAtm.Text        = (string.IsNullOrEmpty(lead.Atm) ? "": (lead.Atm.Trim() == "1" ? "ใช่" : "ไม่ใช่"));
                txtCompany.Text    = lead.Company;

                lbPathLink.Text = lead.PathLink;
                if (!string.IsNullOrEmpty(lead.PathLink))
                {
                    if (lead.PathLink.IndexOf("http") < 0)
                    {
                        lbPathLink.OnClientClick = "window.open('http://" + lead.PathLink + "'), '_blank'";
                    }
                    else
                    {
                        lbPathLink.OnClientClick = "window.open('" + lead.PathLink + "'), '_blank'";
                    }
                }

                if (lead.Birthdate != null)
                {
                    txtBitrhDate.Text = lead.Birthdate.Value.ToString("dd/MM/") + lead.Birthdate.Value.Year.ToString();
                }

                txtCardType.Text    = lead.CardTypeDesc;
                txtCitizenId.Text   = lead.CitizenId;
                txtTopic.Text       = lead.Topic;
                txtDetail.Text      = lead.Detail;
                txtChannelName.Text = lead.ChannelDesc;
                if (lead.CreatedDateView != null)
                {
                    txtCreateDate.Text = lead.CreatedDateView.Value.ToString("dd/MM/") + lead.CreatedDateView.Value.Year.ToString();
                }
                txtBranchName.Text = lead.BranchName;
                txtBranchprod.Text = lead.Branchprod;
                if (lead.CreatedDateView != null)
                {
                    txtCreateTime.Text = lead.CreatedDateView.Value.ToString("HH:mm:ss");
                }

                if (!string.IsNullOrEmpty(lead.AvailableTime) && lead.AvailableTime.Trim().Length == 6)
                {
                    txtAvailableTime.Text = lead.AvailableTime.Substring(0, 2) + ":" + lead.AvailableTime.Substring(2, 2) + ":" + lead.AvailableTime.Substring(4, 2);
                }
                txtEmail.Text           = lead.Email;
                txtInterestedProd.Text  = (string.IsNullOrEmpty(lead.CarType) ? "" : (lead.CarType.Trim() == "0" ? "รถใหม่" :(lead.CarType.Trim() == "1"?"รถเก่า":"")));
                txtCreateBy.Text        = lead.LeadCreateBy;
                txtDealerCode.Text      = lead.DealerCode;
                txtDealerName.Text      = lead.DealerName;
                txtDealerName.ToolTip   = lead.DealerName;
                txtContractNoRefer.Text = lead.ContractNoRefer;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }