public void UpdateCell(DealHistroy dealHistory)
 {
     LabelDealHistroyDate.Text = DateTime.Parse(dealHistory.Date).ToString("MMM. dd, yyyy  hh:mm tt");
     LabelLocation.Text = "Location:" + dealHistory.City + "," + dealHistory.State;
     LabelIndustry.Text = dealHistory.LeadIndustry;
     LabelBrokerName.Text = "Lead Contact : " + (string.IsNullOrEmpty(dealHistory.BrokerName) ? "N/A" : dealHistory.BrokerName);
 }
Пример #2
0
 public int SaveDealHistory(DealHistroy dealHistroy)
 {
     //RestService restSevice = new RestService ();
     string leadsApicall = Constants.DealHistory;
     string postData = Newtonsoft.Json.JsonConvert.SerializeObject(dealHistroy);
     string response =  RestService.Instance.PostData (leadsApicall, postData);
     var parsedResponse = Newtonsoft.Json.JsonConvert.DeserializeObject<int>(response.ToString());
     return parsedResponse;
 }
Пример #3
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            ScrollViewF2F.ContentSize = new CGSize (414f, 1113.0f);
            ViewF2FMeetingDown.Hidden = true;
            LabelConformMeeting.Text = "Confirm Your Meeting w/" + meetingObj.CustomerName;
            IList<string> ListThumbsDownReason = new List<string>
            {
                "Customer Cancelled",
                "No Show",
                "Need to Reschedule"
            };
            IList<string> ListCustomerCategorisation = new List<string>
            {
                "Dreamer",
                "Climber",
                "Purist"
            };
            IList<string> ListSalesStages = new List<string>
            {
                "New",
                "Working",
                "Connection Made",
                "Proposal Negotiation",
                "Closed Won"
            };
            IList<string> ListNextStep = new List<string>
            {
                "Get Product Info",
                "Purist"
            };

            List<LeadF2FFeedBack> leadf2ffeedbacklist = AppDelegate.leadsBL.GetLeadF2FFeedBack (meetingObj.LeadId);
            LeadF2FFeedBack leadf2ffeedbackLast = leadf2ffeedbacklist.Count > 0 ? leadf2ffeedbacklist[leadf2ffeedbacklist.Count -1 ] : null;

            cancelButton.TouchUpInside += (object sender, EventArgs e) => {
                UserMeetings usermeeting = new UserMeetings();
                usermeeting.Id = meetingObj.Id;
                usermeeting.Status="Done";
                usermeeting.Comments = meetingObj.Comments;
                AppDelegate.userBL.UpdateMeetingList(usermeeting);
                DismissViewController(true,null);
            };

            ButtonLikeMeeting.TouchUpInside += (object sender, EventArgs e) => {
                ButtonLikeMeeting.SetImage(UIImage.FromBundle ("Thumbs Up White.png"), UIControlState.Normal);
                ButtonDisLikeMeeting.SetImage(UIImage.FromBundle ("Thumbs Down Grey.png"), UIControlState.Normal);
                ButtonConfirmMeetingSide.SetImage(UIImage.FromBundle ("Grey Neutral.png"), UIControlState.Normal);
                localConfirmMeeting = "UP";
                ViewF2FMeetingDown.Hidden = true;
                localReasonForDown = "";
                TableViewInteractionDislikeReason.Hidden = true;
                ViewSecond.Frame = new CGRect (0, 173, this.View.Bounds.Size.Width, 1113);
                ScrollViewF2F.ContentSize = new CGSize (375.0f,910.0f);
            };

            ButtonDisLikeMeeting.TouchUpInside += (object sender, EventArgs e) => {
                ButtonLikeMeeting.SetImage(UIImage.FromBundle ("Thumbs Up Grey.png"), UIControlState.Normal);
                ButtonDisLikeMeeting.SetImage(UIImage.FromBundle ("Thumbs Down White.png"), UIControlState.Normal);
                ButtonConfirmMeetingSide.SetImage(UIImage.FromBundle ("Grey Neutral.png"), UIControlState.Normal);
                localConfirmMeeting = "DOWN";
                ViewF2FMeetingDown.Hidden = false;
                ViewSecond.Frame = new CGRect (0, 307, this.View.Bounds.Size.Width, 1250);
                ButtonMeetingDislikeReasonDropDown.Enabled = true;
            };

            ButtonConfirmMeetingSide.TouchUpInside+= (object sender, EventArgs e) => {
                ButtonLikeMeeting.SetImage(UIImage.FromBundle ("Thumbs Up Grey.png"), UIControlState.Normal);
                ButtonDisLikeMeeting.SetImage(UIImage.FromBundle ("Thumbs Down Grey.png"), UIControlState.Normal);
                ButtonConfirmMeetingSide.SetImage(UIImage.FromBundle ("Thumbs Side White.png"), UIControlState.Normal);
                localConfirmMeeting = "SIDE";
                localReasonForDown = "";
                ViewF2FMeetingDown.Hidden = true;
                ViewSecond.Frame = new CGRect (0, 173, this.View.Bounds.Size.Width, 1113.0f);
                TableViewInteractionDislikeReason.Hidden = true;

            };

            ButtonLikeMeetingInfoHelpful.TouchUpInside += (object sender, EventArgs e) => {
                ButtonLikeMeetingInfoHelpful.SetImage(UIImage.FromBundle ("Thumbs Up White.png"), UIControlState.Normal);
                ButtonDisLikeMeetingInfoHelpful.SetImage(UIImage.FromBundle ("Thumbs Down Grey.png"), UIControlState.Normal);
                ButtonMeetingInfoSide.SetImage(UIImage.FromBundle ("Grey Neutral.png"), UIControlState.Normal);
                localMeetingInfoHelpFull = "UP";

            };

            ButtonDisLikeMeetingInfoHelpful.TouchUpInside += (object sender, EventArgs e) => {
                ButtonLikeMeetingInfoHelpful.SetImage (UIImage.FromBundle ("Thumbs Up Grey.png"), UIControlState.Normal);
                ButtonDisLikeMeetingInfoHelpful.SetImage (UIImage.FromBundle ("Thumbs Down White.png"), UIControlState.Normal);
                ButtonMeetingInfoSide.SetImage(UIImage.FromBundle ("Grey Neutral.png"), UIControlState.Normal);
                localMeetingInfoHelpFull = "DOWN";

            };
            ButtonMeetingInfoSide.TouchUpInside+= (object sender, EventArgs e) => {
                ButtonLikeMeetingInfoHelpful.SetImage (UIImage.FromBundle ("Thumbs Up Grey.png"), UIControlState.Normal);
                ButtonDisLikeMeetingInfoHelpful.SetImage (UIImage.FromBundle ("Thumbs Down Grey.png"), UIControlState.Normal);
                ButtonMeetingInfoSide.SetImage(UIImage.FromBundle ("Thumbs Side White.png"), UIControlState.Normal);
                localMeetingInfoHelpFull = "SIDE";
            };

            //			ButtonLikeLeadAdvanced.TouchUpInside += (object sender, EventArgs e) => {
            //				ButtonDisLikeLeadAdvanced.SetImage(UIImage.FromBundle ("Thumbs Down Grey.png"), UIControlState.Normal);
            //				ButtonLikeLeadAdvanced.SetImage(UIImage.FromBundle ("Thumbs Up White.png"), UIControlState.Normal);
            //				localLeadAdvanced = "UP";
            //			};

            ButtonLikeLeadAdvanced.TouchUpInside += (object sender, EventArgs e) => {
                ButtonLikeLeadAdvanced.SetImage(UIImage.FromBundle ("Thumbs Up White.png"), UIControlState.Normal);
                ButtonDisLikeLeadAdvanced.SetImage(UIImage.FromBundle ("Thumbs Down Grey.png"), UIControlState.Normal);
                ButtonLeadAdvancedSide.SetImage(UIImage.FromBundle ("Grey Neutral.png"), UIControlState.Normal);
                localLeadAdvanced = "UP";
                if(leadf2ffeedbackLast != null && leadf2ffeedbackLast.LeadAdvanced == "UP")
                {
                    UIAlertView alert = new UIAlertView () {
                    Title = "",
                    Message = "Looks like things are going well. Would you like to update your sales stage?"
                    };
                    alert.AddButton ("OK");
                    alert.Show ();
                }
            };

            ButtonDisLikeLeadAdvanced.TouchUpInside += (object sender, EventArgs e) => {
                ButtonLikeLeadAdvanced.SetImage (UIImage.FromBundle ("Thumbs Up Grey.png"), UIControlState.Normal);
                ButtonDisLikeLeadAdvanced.SetImage (UIImage.FromBundle ("Thumbs Down White.png"), UIControlState.Normal);
                ButtonLeadAdvancedSide.SetImage(UIImage.FromBundle ("Grey Neutral.png"), UIControlState.Normal);
                localLeadAdvanced = "DOWN";
            };
            ButtonLeadAdvancedSide.TouchUpInside+= (object sender, EventArgs e) => {
                ButtonLikeLeadAdvanced.SetImage (UIImage.FromBundle ("Thumbs Up Grey.png"), UIControlState.Normal);
                ButtonDisLikeLeadAdvanced.SetImage (UIImage.FromBundle ("Thumbs Down Grey.png"), UIControlState.Normal);
                ButtonLeadAdvancedSide.SetImage(UIImage.FromBundle ("Thumbs Side White.png"), UIControlState.Normal);
                localLeadAdvanced = "SIDE";
            };

            TableViewInteractionDislikeReason.Hidden = true;
            TableViewInteractionDislikeReason.Source = new TableSource (ListThumbsDownReason, this,"ReasonForPass");
            ButtonMeetingDislikeReasonDropDown.TouchUpInside += (object sender, EventArgs e) => {
                localReasonForDown = "Customer Cancelled";

            //				ViewFirst.Frame =
                TableViewInteractionDislikeReason.Hidden = false;
            };

            TableViewSalesStage.Source = new TableSource (ListSalesStages, this,"SalesStage");
            localSalesStage = "New";
            ButtonSaleStageDropDown.TouchUpInside += (object sender, EventArgs e) => {
                TableViewSalesStage.Hidden = false;
            };

            TableViewCustomerCategorization.Source = new TableSource (ListCustomerCategorisation, this, "CustomerCategorisation");
            localCustomerCategorization = "Dreamer";
            ButtonCustomerCategorizationDropDown.TouchUpInside += (object sender, EventArgs e) =>  {
                localCustomerCategorization = "Dreamer";
                TableViewCustomerCategorization.Hidden = false;
            };

            TableViewNextSteps.Source = new TableSource (ListNextStep, this, "NextStep");
            localNextSteps = "Get Product Info";
            ButtonNextStepsDropDown.TouchUpInside += (object sender, EventArgs e) =>  {
                localNextSteps = "Get Product Info";
                TableViewNextSteps.Hidden = false;
            };

            ButtonSubmit.TouchUpInside += (object sender, EventArgs e) => {
                LeadF2FFeedBack leadf2ffeedback = new LeadF2FFeedBack ();
                leadf2ffeedback.LeadID = meetingObj.LeadId;
                leadf2ffeedback.UserID = AppDelegate.UserDetails.UserId;
                leadf2ffeedback.ReasonForDown = localReasonForDown;
                leadf2ffeedback.ConfirmMeeting = localConfirmMeeting;
                leadf2ffeedback.CustomerCategorization = localCustomerCategorization;
                leadf2ffeedback.MeetingInfoHelpFull = localMeetingInfoHelpFull;
                leadf2ffeedback.LeadAdvanced = localLeadAdvanced;
                leadf2ffeedback.NextSteps = localNextSteps;
                leadf2ffeedback.SalesStage = localSalesStage;
                leadf2ffeedback.MeetingID = meetingObj.Id;
                AppDelegate.leadsBL.SaveLeadF2FFeedBack (leadf2ffeedback);
                //Xamarin Insights tracking
                Insights.Track("Save LeadF2F FeedBack", new Dictionary <string,string>{
                    {"UserId", leadf2ffeedback.UserID.ToString()},
                    {"LeadID", leadf2ffeedback.LeadID.ToString()},
                    {"MeetingID", leadf2ffeedback.MeetingID.ToString()}
                });

                UserMeetings usermeeting = new UserMeetings();
                usermeeting.Id = meetingObj.Id;
                usermeeting.Status="Done";
                usermeeting.Comments = meetingObj.Comments;
                AppDelegate.userBL.UpdateMeetingList(usermeeting);
                //Xamarin Insights tracking
                Insights.Track("Update MeetingList", new Dictionary <string,string>{
                    {"Id", usermeeting.Id.ToString()},
                    {"Status", usermeeting.Status}
                });

               string[] domainArr = AppDelegate.UserDetails.Email.Split('@');

                if(!string.IsNullOrEmpty(meetingObj.SFDCLead_ID) && meetingObj.SFDCLead_ID != "N/A" && (localSalesStage == "New" || localSalesStage== "Working"))
                {
                    if(string.IsNullOrEmpty(AppDelegate.accessToken))
                    {
                        //AppDelegate.accessToken = AppDelegate.leadsBL.SFDCAuthentication(AppDelegate.UserDetails.UserId);
                        AppDelegate.accessToken = AppDelegate.leadsBL.SFDCAuthentication(domainArr[1]);
                    }
            //					string[] salesStageArray = localSalesStage.Split(' ');
            //					string salesStatus = salesStageArray.Length == 3 ? salesStageArray[1] + " " + salesStageArray[2] : salesStageArray[1];
                    AppDelegate.leadsBL.UpdateSFDCData(AppDelegate.accessToken,meetingObj.SFDCLead_ID,localSalesStage);
                }

                if(localSalesStage == "Closed Won")
                {
                    DealHistroy dealHistory = new DealHistroy();
                    dealHistory.UserId = AppDelegate.UserDetails.UserId;
                    dealHistory.State = meetingObj.State;
                    dealHistory.City = meetingObj.City;
                    dealHistory.Date = meetingObj.EndDate;
                    //dealHistory.country = "USA";
                    dealHistory.CustomerName = meetingObj.CustomerName;
                    dealHistory.LeadId = meetingObj.LeadId;
                    dealHistory.BrokerID = 0;
                    dealHistory.LeadIndustry = AppDelegate.UserDetails.Industry;
                    try {
                        AppDelegate.customerBL.SaveDealHistory(dealHistory);
                    }
                    catch
                    {
                    }
                    //Xamarin Insights tracking
                    Insights.Track("Save DealHistory", new Dictionary <string,string>{
                        {"UserId", dealHistory.UserId.ToString()},
                        {"CustomerName", dealHistory.CustomerName},
                        {"LeadId",dealHistory.LeadId.ToString()}
                    });
                }
                AppDelegate.IsUpdateLeadDone = true;
                DismissViewController(true,null);
            };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            ScrollViewInteractionPage.ContentSize = new CGSize (375.0f,761.0f);

            ViewInteractionThumbsDown.Hidden = true;
            IList<string> InteractionDislikerReason = new List<string>
            {
                "Wasn't Prepared",
                "Did Not Have Enough Info",
                "Customer Not Interested"
            };

            IList<string> ListSalesStages = new List<string>
            {
                "New",
                "Working",
                "Connection Made",
                "Proposal Negotiation",
                "Closed Won"
            };

            cancelButton.TouchUpInside += (object sender, EventArgs e) => {

                DismissViewController(true,null);

            };

            LabelInteractionTitle.Text = "Your Interaction With " + leadObj.LEAD_NAME;
            ButtonSubmit.Layer.CornerRadius = 5.0f;
            ButtonLikeCustomerAcknowledge.TouchUpInside += (object sender, EventArgs e) =>
            {
                CustomerAcknowledge = "UP";
                ButtonLikeCustomerAcknowledge.SetImage(UIImage.FromBundle ("Thumbs Up White.png"), UIControlState.Normal);
                ButtonDisLikeCustomerAcknowledge.SetImage(UIImage.FromBundle ("Thumbs Down Grey.png"), UIControlState.Normal);
                ButtonAcknowledgementSide.SetImage(UIImage.FromBundle ("Grey Neutral.png"), UIControlState.Normal);
            };

            TextViewComments.Layer.BorderWidth = 2.0f;
            TextViewComments.Layer.BorderColor = UIColor.DarkGray.CGColor;
            TextViewComments.ShouldBeginEditing = delegate {
                ScrollViewInteractionPage.SetContentOffset ( new CGPoint(0,300),true);
                return true;
            };

            TextViewComments.ShouldChangeText = (text, range, replacementString) =>
            {
                if (replacementString.Equals("\n"))	{
                    TextViewComments.EndEditing(true);
                    ScrollViewInteractionPage.SetContentOffset ( new CGPoint(0,0),true);
                    return false;
                }
                else {
                    return true;
                }
            };

            ButtonDisLikeCustomerAcknowledge.TouchUpInside += (object sender, EventArgs e) =>
            {
                CustomerAcknowledge = "DOWN";
                ButtonLikeCustomerAcknowledge.SetImage(UIImage.FromBundle ("Thumbs Up Grey.png"), UIControlState.Normal);
                ButtonDisLikeCustomerAcknowledge.SetImage(UIImage.FromBundle ("Thumbs Down White.png"), UIControlState.Normal);
                ButtonAcknowledgementSide.SetImage(UIImage.FromBundle ("Grey Neutral.png"), UIControlState.Normal);
            };
            ButtonAcknowledgementSide.TouchUpInside+= (object sender, EventArgs e) =>
            {
                CustomerAcknowledge = "SIDE";
                ButtonLikeCustomerAcknowledge.SetImage(UIImage.FromBundle ("Thumbs Up Grey.png"), UIControlState.Normal);
                ButtonDisLikeCustomerAcknowledge.SetImage(UIImage.FromBundle ("Thumbs Down Grey.png"), UIControlState.Normal);
                ButtonAcknowledgementSide.SetImage(UIImage.FromBundle ("Thumbs Side White.png"), UIControlState.Normal);
            };
            TableViewInteractionDislikerReason.Source = new TableSource (InteractionDislikerReason, this,"Interaction");

            TableViewInteractionDislikerReason.Hidden = true;

            ButtonInteractionDislikeReasonDropDown.TouchUpInside += (object sender, EventArgs e) => {
                //ButtonInteractionDislikeReasonDropDown.CurrentTitle = "Wasn't Prepared";
                TableViewInteractionDislikerReason.Hidden = false;
            };

            ButtonDislikeInteraction.TouchUpInside += (object sender, EventArgs e) => {
                ViewInteractionThumbsDown.Hidden = false;
                Interaction = "DOWN";
                ButtonLikeInteraction.SetImage(UIImage.FromBundle ("Thumbs Up Grey.png"), UIControlState.Normal);
                ButtonDislikeInteraction.SetImage(UIImage.FromBundle ("Thumbs Down White.png"), UIControlState.Normal);
                ButtonInteractionSide.SetImage(UIImage.FromBundle ("Grey Neutral.png"), UIControlState.Normal);
                ViewSecond.Frame = new CGRect (0, 312, this.View.Bounds.Size.Width, ViewSecond.Frame.Height);
                ScrollViewInteractionPage.ContentSize = new CGSize (375.0f,910.0f);
            };
            ButtonLikeInteraction.TouchUpInside += (object sender, EventArgs e) => {
                ViewInteractionThumbsDown.Hidden = true;
                Interaction = "UP";
                ButtonLikeInteraction.SetImage(UIImage.FromBundle ("Thumbs Up White.png"), UIControlState.Normal);
                ButtonDislikeInteraction.SetImage(UIImage.FromBundle ("Thumbs Down Grey.png"), UIControlState.Normal);
                ButtonInteractionSide.SetImage(UIImage.FromBundle ("Grey Neutral.png"), UIControlState.Normal);
                ViewSecond.Frame = new CGRect (0, 163, this.View.Bounds.Size.Width, 875);
                ScrollViewInteractionPage.ContentSize = new CGSize (375.0f,845.0f);
                TableViewInteractionDislikerReason.Hidden = true;
            };
            ButtonInteractionSide.TouchUpInside+= (object sender, EventArgs e) =>
            {
                Interaction = "SIDE";
                ButtonDislikeInteraction.SetImage(UIImage.FromBundle ("Thumbs Down Grey.png"), UIControlState.Normal);
                ButtonLikeInteraction.SetImage(UIImage.FromBundle ("Thumbs Up Grey.png"), UIControlState.Normal);
                ButtonInteractionSide.SetImage(UIImage.FromBundle ("Thumbs Side White.png"), UIControlState.Normal);
                ViewSecond.Frame = new CGRect (0, 163, this.View.Bounds.Size.Width, 875);
                ScrollViewInteractionPage.ContentSize = new CGSize (375.0f,845.0f);
                TableViewInteractionDislikerReason.Hidden = true;

            };

            ButtonSubmit.TouchUpInside += (object sender, EventArgs e) => {
                LeadIntialContactFeedBack leadfeedback = new LeadIntialContactFeedBack();
                leadfeedback.LeadID = leadObj.LEAD_ID;
                leadfeedback.UserID = AppDelegate.UserDetails.UserId;
                leadfeedback.ReasonForDown = Interaction == "DOWN" ? ButtonInteractionDislikeReasonDropDown.CurrentTitle : "";
                leadfeedback.InteractionFeedBack = Interaction;
                leadfeedback.CustomerAcknowledged = CustomerAcknowledge;
                leadfeedback.Comments = TextViewComments.Text == "Enter comments here..." ? "" : TextViewComments.Text ;
                leadfeedback.MeetingID = AppDelegate.UserDetails.UserId;
                leadfeedback.SalesStage = salesStage;
                AppDelegate.leadsBL.SaveLeadFeedBack(leadfeedback);

                if(salesStage == "Closed Won" && leadObj.LEAD_STATUS != "Closed Won")
                {
                    DealHistroy dealHistory = new DealHistroy();
                    dealHistory.UserId = AppDelegate.UserDetails.UserId;
                    dealHistory.State = leadObj.STATE;
                    dealHistory.City = leadObj.CITY;
                    dealHistory.Date = DateTime.Now.ToString();
                    //dealHistory.country = "USA";
                    dealHistory.CustomerName = leadObj.LEAD_NAME;
                    dealHistory.LeadId = leadObj.LEAD_ID;
                    dealHistory.BrokerID = 0;
                    dealHistory.LeadIndustry = AppDelegate.UserDetails.Industry;
                    AppDelegate.customerBL.SaveDealHistory(dealHistory);
                    //Xamarin Insights tracking
                    Insights.Track("Save DealHistory", new Dictionary <string,string>{
                        {"UserId", dealHistory.UserId.ToString()},
                        {"CustomerName", dealHistory.CustomerName},
                        {"LeadId",dealHistory.LeadId.ToString()}
                    });
                }

                string[] domainArr = AppDelegate.UserDetails.Email.Split('@');
                if(leadObj.LEAD_SOURCE == 2 && (salesStage == "New" || salesStage== "Working"))
                {
                    if(string.IsNullOrEmpty(AppDelegate.accessToken))
                    {
                        //AppDelegate.accessToken = AppDelegate.leadsBL.SFDCAuthentication(AppDelegate.UserDetails.UserId);
                        AppDelegate.accessToken = AppDelegate.leadsBL.SFDCAuthentication(domainArr[1]);
                    }
                    //string[] salesStageArray = salesStage.Split(' ');
                    //string salesStatus = salesStageArray.Length == 3 ? salesStageArray[1] + " " + salesStageArray[2] : salesStageArray[1];
                    AppDelegate.leadsBL.UpdateSFDCData(AppDelegate.accessToken,leadObj.SFDCLEAD_ID,salesStage);
                }

                DismissViewController(true,null);
                //Xamarin Insights tracking
                Insights.Track("Save Lead FeedBack", new Dictionary <string,string>{
                    {"LeadID", leadfeedback.LeadID.ToString()},
                    {"UserID", leadfeedback.UserID.ToString()}
                });
            };

            TableViewSalesStage.Source = new TableSource (ListSalesStages, this,"SalesStage");
            TableViewSalesStage.Hidden = true;
            salesStage = "New";
            ButtonSalesStageDropDown.TouchUpInside += (object sender, EventArgs e) => {
            //				salesStage = "(1) Acquire Lead";
                TableViewSalesStage.Hidden = false;
            };
        }