public HttpResponseMessage GetBusinessDetails(int id)
        {
            if (!IsTokenAuthenticated())
            {
                return(ResponseOutput());
            }
            else
            {
                BusinessVM _businessVM = _businessBLL.GetBusinessDetails(id);

                if (_businessVM != null)
                {
                    String _JSONData = new JavaScriptSerializer().Serialize(_businessVM);
                    String _Message  = "\"status\":\"Success\",";
                    _success        = true;
                    _strJSONContent = Business_BLL.GenerateReturnJSONData(_JSONData, _Message);
                }
                else
                {
                    _strJSONContent.Append("{\"status\":\"Failed\"}");
                    _strJSONContent.Append("{\"message\":\"User does not exists.\"}");
                }
                return(ResponseOutput());
            }
        }
Exemple #2
0
        public ActionResult AddSupportQuery(SupportQueryVM _supportQuery)
        {
            try
            {
                ViewBag.UnSuccessMessage = null;
                ViewBag.SuccessMessage   = null;

                if (!ModelState.IsValid)
                {
                    ViewBag.UnSuccessMessage = "Please enter your Email Address/Query.";
                    return(View("AddSupportQuery"));
                }
                else
                {
                    _supportQuery.IPAddress = Request.UserHostAddress;

                    if (_supportQuery.EmailAddress != string.Empty && _supportQuery.Query != string.Empty)
                    {
                        _supportQuery = new Business_BLL().AddSupportQuery(_supportQuery);

                        if (_supportQuery != null)
                        {
                            ViewBag.SuccessMessage = "Your query has been submitted successfully. Support person will contact you shortly to help you with this.";

                            //Send Email to Admin
                            //Fetching Email Body Text from EmailTemplate File.
                            string       FilePath = Server.MapPath(@"~\EmailTemplates") + @"\SupportQuery.html";
                            StreamReader str      = new StreamReader(FilePath);
                            string       MailText = str.ReadToEnd();
                            str.Close();

                            //Repalce EmailTemplate Parameters
                            MailText = MailText.Replace("[#SHPOT]", "SHPOT");
                            MailText = MailText.Replace("[#FULLNAME]", _supportQuery.FullName);
                            MailText = MailText.Replace("[#IPADDRESS]", _supportQuery.IPAddress);
                            MailText = MailText.Replace("[#QUERYDATE]", _supportQuery.QueryDateTime.ToString());
                            MailText = MailText.Replace("[#EMAILID]", _supportQuery.EmailAddress);
                            MailText = MailText.Replace("[#QUERY]", _supportQuery.Query);

                            String _fromEmail = _supportQuery.EmailAddress;
                            String _fromName  = _supportQuery.FullName;
                            String _toEmail   = Common.SMTPUserName;
                            String _toName    = "SHPOT Admin";
                            SendEmailNotifications(_supportQuery.EmailAddress, _supportQuery.FullName, _toEmail, _toName, MailText, "Support Query By: " + _supportQuery.FullName);
                        }
                        else
                        {
                            ViewBag.UnSuccessMessage = "Please submit your query again.";
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.UnSuccessMessage = "Please submit your query again. Some error has occurred. Error is: " + ex.Message;
            }
            return(View("AddSupportQuery"));
        }
        public HttpResponseMessage GetAllBusinesses()
        {
            if (!IsTokenAuthenticated())
            {
                return(ResponseOutput());
            }
            else
            {
                List <BusinessVM> _businessVMs = _businessBLL.GetAllBusinesses();

                if (_businessVMs != null)
                {
                    String _JSONData = new JavaScriptSerializer().Serialize(_businessVMs);
                    _strJSONContent = Business_BLL.GenerateReturnJSONData(_JSONData, "");
                }
                else
                {
                    _strJSONContent.Append("{\"message\":\"No Business record(s) exists.\"}");
                }
                return(ResponseOutput());
            }
        }
 public BusinessController()
 {
     _businessBLL    = new Business_BLL();
     _strJSONContent = new StringBuilder();
     _Message        = string.Empty;
 }
 public BusinessController()
 {
     _businessBLL    = new Business_BLL();
     _strJSONContent = new StringBuilder();
     _success        = true;
 }