예제 #1
0
        public ActionResult GetIsCustomerExist(string mobileNo, string GroupId)
        {
            CustomerDetailwithFeedback obj = new CustomerDetailwithFeedback();

            try
            {
                obj = FMR.GetCustomerInfo(mobileNo, GroupId);
            }
            catch (Exception ex)
            {
                newexception.AddException(ex, "Get feedbackcust");
            }
            return(new JsonResult()
            {
                Data = obj, JsonRequestBehavior = JsonRequestBehavior.AllowGet, MaxJsonLength = Int32.MaxValue
            });
        }
        public CustomerDetailwithFeedback GetCustomerInfo(string mobileNo, string GroupId)
        {
            CustomerDetail             objcustdetails = new CustomerDetail();
            CustomerDetailwithFeedback obj            = new CustomerDetailwithFeedback();
            FeedBackMaster             objfeedback    = new FeedBackMaster();
            string connStr = objCustRepo.GetCustomerConnString(GroupId);

            using (var context = new BOTSDBContext(connStr))
            {
                objfeedback = context.FeedBackMasters.Where(x => x.MobileNo == mobileNo).OrderByDescending(y => y.FeedBackId).FirstOrDefault();
                var customer = context.CustomerDetails.Where(x => x.MobileNo == mobileNo).FirstOrDefault();

                if (objfeedback != null && GroupId == "1163")
                {
                    obj.IsFeedBackGiven = true;
                }
                else
                {
                    if (objfeedback != null && objfeedback.DOJ.Value.Date == DateTime.Now.Date)
                    {
                        obj.IsFeedBackGiven = true;
                        if (customer != null)
                        {
                            obj.CustomerName = customer.CustomerName;
                            obj.MobileNo     = customer.MobileNo;
                            obj.Points       = customer.Points;
                        }
                    }
                    else
                    {
                        obj.IsFeedBackGiven = false;
                        if (customer != null)
                        {
                            obj.CustomerName = customer.CustomerName;
                            obj.MobileNo     = customer.MobileNo;
                            obj.Points       = customer.Points;
                        }
                    }
                }
            }
            return(obj);
        }