public JsonResult ParticularQuoteReply(string QuoteID, string id)
        {
            DateTime indianTime      = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
            var      particularquote = quotationListsService.GetAllQuotations().FirstOrDefault(m => m.Id == long.Parse(QuoteID));

            if (particularquote.FirstTime == null && particularquote.FirstTimeQuoteDate == null)
            {
                particularquote.FirstTime          = id;
                particularquote.FirstTimeQuoteDate = indianTime.ToString("dd-MM-yyyy hh:mm:ss");
            }
            //else if (particularquote.FirstTime != null && particularquote.FirstTimeQuoteDate != null && particularquote.SecondTime == null && particularquote.SecondTimeQuoteDate == null)
            //{
            //    particularquote.SecondTime = id;
            //    particularquote.SecondTimeQuoteDate = indianTime.ToString("dd-MM-yyyy");
            //}
            //else if (particularquote.FirstTime != null && particularquote.FirstTimeQuoteDate != null && particularquote.SecondTime != null && particularquote.SecondTimeQuoteDate != null && particularquote.ThirdTime == null && particularquote.ThirdTimeQuoteDate == null)
            //{
            //    particularquote.ThirdTime = id;
            //    particularquote.ThirdTimeQuoteDate = indianTime.ToString("dd-MM-yyyy");
            //}

            FileInfo File     = new FileInfo(Server.MapPath("/mailtemplate/QuoteReply.html"));
            string   readFile = File.OpenText().ReadToEnd();

            readFile = readFile.Replace("[name]", particularquote.Name);
            readFile = readFile.Replace("[Email]", particularquote.EmailId);
            string txtto      = particularquote.EmailId;
            string txtmessage = readFile;
            string subj       = "Response to your Quote #" + particularquote.Id + "";
            int    count      = quotationListsService.UpdateQuote(particularquote);
            EmailSendingUtility emailSendingUtility = new EmailSendingUtility();

            emailSendingUtility.Email_maaaahwanam(txtto, txtmessage, subj, null);
            return(Json("sucess"));
        }
        public ActionResult submitquery1(string emailid, string txtone, string cid, string selectedcontest)
        {
            var contestdetails = contestsService.GetAllEntries(long.Parse(selectedcontest));
            var cont1          = contestdetails.Where(m => m.ContestId == long.Parse(cid)).FirstOrDefault();
            //   var userdetails = userLoginDetailsService.GetUser(id);
            var typeid   = cont1.UserLoginID;
            var username = cont1.Name;
            UserLoginDetailsService userLoginDetailsService = new UserLoginDetailsService();

            username = Capitalise(username);

            var userlogin = userLoginDetailsService.GetUserId(Convert.ToInt32(typeid));

            emailid = userlogin.UserName;
            EmailSendingUtility emailSendingUtility = new EmailSendingUtility();
            string url = Request.Url.Scheme + "://" + Request.Url.Authority + "/Contests";

            FileInfo File     = new FileInfo(Server.MapPath("/mailtemplate/Contest.html"));
            string   readFile = File.OpenText().ReadToEnd();

            readFile = readFile.Replace("[Message]", txtone);
            readFile = readFile.Replace("[ActivationLink]", url);

            readFile = readFile.Replace("[name]", username);
            string txtmessage = readFile;//readFile + body;

            string subj = "Contestant Is declined";

            emailSendingUtility.Email_maaaahwanam(emailid, txtmessage, subj, null);


            ViewBag.display = cid;
            var contestdetails1 = contestsService.GetAllEntries(long.Parse(selectedcontest));
            var cont11          = contestdetails.Where(m => m.ContestId == long.Parse(cid)).FirstOrDefault();

            ViewBag.selectedcontest = cont1;
            string command = "InActive";

            contestsService.Activationcontest(cont1, command);

            return(Json("success", JsonRequestBehavior.AllowGet));
        }
        public ActionResult SearchVendor(string searchvendor, string command, Vendormaster vendormaster, string pemail, string id)
        {
            UserLogin  userlogin   = new UserLogin();
            UserDetail userdetails = new UserDetail();
            //var details = vendorMasterService.SearchVendors();
            //var particularvendor = details.Where(m => m.BusinessName.Contains(searchvendor)).FirstOrDefault();
            //var VendorList = vendorMasterService.SearchVendors().Where(m => m.BusinessName.ToLower() == searchvendor.TrimEnd()).FirstOrDefault();
            var VendorList = vendorMasterService.SearchVendors().Where(m => m.BusinessName.ToLower().Contains(searchvendor.ToLower().TrimEnd())).FirstOrDefault();

            ViewBag.VendorList = VendorList;
            if (command == "Update")
            {
                if (pemail != vendormaster.EmailId)
                {
                    int query = vendorMasterService.checkemail(vendormaster.EmailId);
                    if (query != 0)
                    {
                        return(Content("<script language='javascript' type='text/javascript'>alert('Email ID Already Taken');location.href='/admin/Vendors/SearchVendor'</script>"));
                    }
                }
                var updatedetails = vendormaster;
                VenorVenueSignUpService venorVenueSignUpService = new VenorVenueSignUpService();
                vendormaster               = vendorMasterService.GetVendor(long.Parse(id));
                vendormaster.EmailId       = updatedetails.EmailId;
                vendormaster.ContactNumber = updatedetails.ContactNumber;
                vendormaster.ContactPerson = updatedetails.ContactPerson;
                vendormaster               = vendorMasterService.UpdateVendorDetails(vendormaster, long.Parse(id)); // Updating Email ID in Vendor Master Table
                //userlogin.UserName = pemail;
                //userlogin = venorVenueSignUpService.GetUserLogdetails(userlogin);
                userlogin          = venorVenueSignUpService.GetParticularUserdetails(pemail);
                userlogin.UserName = vendormaster.EmailId;
                userlogin          = userLoginDetailsService.UpdateUserName(userlogin, pemail); // Updating Email ID in User Login Table
                //userdetails = userLoginDetailsService.GetUserDetailsByEmail(pemail);
                userdetails = userLoginDetailsService.GetUser(int.Parse(userlogin.UserLoginId.ToString()));
                userdetails.AlternativeEmailID = vendormaster.EmailId;
                userdetails.FirstName          = vendormaster.ContactPerson;
                userdetails.UserPhone          = vendormaster.ContactNumber;
                //userdetails = userLoginDetailsService.UpdateUserDetailEmail(userdetails, pemail); // Updating Email ID in User Detail Table
                userdetails = userLoginDetailsService.UpdateUserdetails(userdetails, userlogin.UserLoginId);
                return(Content("<script language='javascript' type='text/javascript'>alert('Info Updated');location.href='/admin/Vendors/SearchVendor'</script>"));
            }
            if (command == "Email")
            {
                VenorVenueSignUpService venorVenueSignUpService = new VenorVenueSignUpService();
                userlogin.UserName = vendormaster.EmailId;
                var userResponse = venorVenueSignUpService.GetParticularUserdetails(pemail);
                if (userResponse != null)
                {
                    string emailid = userlogin.UserName;
                    if (userResponse.ActivationCode == null)
                    {
                        userlogin = userResponse;
                        userlogin.ActivationCode = Guid.NewGuid().ToString();
                        userlogin = userLoginDetailsService.UpdateUserName(userlogin, emailid);
                        userResponse.ActivationCode = userlogin.ActivationCode;
                    }

                    string activationcode = userResponse.ActivationCode;
                    int    userid         = Convert.ToInt32(userResponse.UserLoginId);
                    var    userdetail     = userLoginDetailsService.GetUser(userid);
                    string name           = userdetail.FirstName;

                    // vendor mail activation  begin

                    string   mailid   = userlogin.UserName;
                    var      userR    = userResponse;//venorVenueSignUpService.GetUserdetails(mailid);
                    string   pas1     = userR.Password;
                    string   url      = Request.Url.Scheme + "://" + Request.Url.Authority + "/NUserRegistration/ActivateEmail1?ActivationCode=" + activationcode + "&&Email=" + emailid;
                    FileInfo File     = new FileInfo(Server.MapPath("/mailtemplate/WelcomeMessage.html"));
                    string   readFile = File.OpenText().ReadToEnd();
                    readFile = readFile.Replace("[ActivationLink]", url);
                    readFile = readFile.Replace("[name]", name);
                    readFile = readFile.Replace("[username]", mailid);
                    readFile = readFile.Replace("[pass1]", pas1);
                    string txtto      = userlogin.UserName;
                    string txtmessage = readFile;//readFile + body;
                    string subj       = "Welcome to Ahwanam";

                    // vendor mail activation  end

                    EmailSendingUtility emailSendingUtility = new EmailSendingUtility();
                    emailSendingUtility.Email_maaaahwanam(txtto, txtmessage, subj, null);
                    return(Content("<script language='javascript' type='text/javascript'>alert('Invitation Sent to " + txtto + "');location.href='/admin/Vendors/SearchVendor'</script>"));
                }
            }
            return(View());
        }
        public ActionResult AllEnteredContestes(string selectedcontest, string id, string command, string selectedcontest1)
        {
            var records = contestsService.GetAllContests();

            ViewBag.records = records;
            if (selectedcontest != null && selectedcontest != "Select Contest" && selectedcontest1 == null)
            {
                ViewBag.contests        = contestsService.GetAllEntries(long.Parse(selectedcontest));
                ViewBag.selectedcontest = selectedcontest;
            }
            if (id != "0" && id != null && command == null && selectedcontest != null && selectedcontest != "Select Contest")
            {
                ViewBag.selectedcontest = selectedcontest;

                ViewBag.display = id;
                var contestdetails = contestsService.GetAllEntries(long.Parse(selectedcontest));
                ViewBag.contestdetails = contestdetails.Where(m => m.ContestId == long.Parse(id)).FirstOrDefault();
            }
            if (id != "0" && id != null && command != null && selectedcontest1 != null)
            {
                ViewBag.display = id;
                var contestdetails = contestsService.GetAllEntries(long.Parse(selectedcontest1));
                var cont1          = contestdetails.Where(m => m.ContestId == long.Parse(id)).FirstOrDefault();
                ViewBag.selectedcontest = cont1;

                var username = cont1.Name;
                var typeid   = cont1.UserLoginID;
                username = Capitalise(username);

                UserLoginDetailsService userLoginDetailsService = new UserLoginDetailsService();

                var userlogin = userLoginDetailsService.GetUserId(Convert.ToInt32(typeid));
                var emailid   = userlogin.UserName;
                EmailSendingUtility emailSendingUtility = new EmailSendingUtility();

                FileInfo File     = new FileInfo(Server.MapPath("/mailtemplate/Contest.html"));
                string   readFile = File.OpenText().ReadToEnd();
                var      txtone   = " Your contest is activated";
                readFile = readFile.Replace("[Message]", txtone);
                string url = Request.Url.Scheme + "://" + Request.Url.Authority + "/Contests";

                readFile = readFile.Replace("[ActivationLink]", url);
                readFile = readFile.Replace("[name]", username);
                string txtmessage = readFile;//readFile + body;

                string subj = "Attention required";

                emailSendingUtility.Email_maaaahwanam(emailid, txtmessage, subj, null);


                string txtmessage1 = username + " " + "is activated for father's day contest";

                string subj1 = "Contestant is activated";

                emailSendingUtility.Email_maaaahwanam("*****@*****.**", txtmessage1, subj1, null);


                contestsService.Activationcontest(cont1, command);
                return(Content("<script language='javascript' type='text/javascript'>alert('Vendor is " + command + "');location.href='" + @Url.Action("AllEnteredContestes", "ContestsManagement") + "'</script>"));
            }

            if (id != "0" && id != null && selectedcontest1 != null)
            {
                ViewBag.selectedcont1 = selectedcontest1;
                ViewBag.display       = id;
                var contestdetails = contestsService.GetAllEntries(long.Parse(selectedcontest1));
                var cont1          = contestdetails.Where(m => m.ContestId == long.Parse(id)).ToList();
                ViewBag.selectedcontest1 = cont1;

                // contestsService.Activationcontest(cont1, command);
                // return Content("<script language='javascript' type='text/javascript'>alert('Vendor is " + command + "');location.href='" + @Url.Action("AllEnteredContestes", "ContestsManagement") + "'</script>");
            }
            return(View());
        }
        public JsonResult ParticularQuoteReply(QuotationsList quoteResponse, string id, HttpPostedFileBase data1, string message, string replyto, string messagetype, string ext)
        {
            DateTime           indianTime     = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, INDIAN_ZONE);
            var                s1             = orderService.allorderslist1().ToList().Where(m => m.orderid == long.Parse(quoteResponse.OrderID)).FirstOrDefault();
            var                userdata       = userLoginDetailsService.GetUserId((int)s1.cutomerid);
            var                userdetails    = userLoginDetailsService.GetUser((int)s1.cutomerid);
            QuotationsList     quotationsList = new QuotationsList();
            var                s12            = ViewBag.orderdetails = orderService.allorderslist1().ToList().Where(m => m.orderid == long.Parse(quoteResponse.OrderID)).ToList();
            HttpPostedFileBase image1;

            if (ext != null || ext != "" || ext != "undefined")
            {
                image1 = Request.Files["/Quotefile/" + ext + ""];
            }
            else
            {
                image1 = null;
            }
            if (replyto == "Vendor")
            {
                //  quotationsList.EmailId = userdata.UserName; quotationsList.Name = userdetails.FirstName;
                var vendordetails = newmanageuse.getvendor(Convert.ToInt32(s1.vid));

                string txtto1 = vendordetails.EmailId;
                string vname  = vendordetails.BusinessName;
                //  vname = home.Capitalise(vname);
            }
            else if (replyto == "Customer")
            {
                quotationsList.EmailId = s1.username; quotationsList.Name = s1.fname;
            }
            quotationsList.ServiceType    = s1.servicetype;
            quotationsList.PhoneNo        = s1.customerphoneno;
            quotationsList.EventStartDate = Convert.ToDateTime(s1.bookdate);
            quotationsList.EventStartTime = DateTime.UtcNow;
            quotationsList.EventEnddate   = DateTime.UtcNow;
            quotationsList.EventEndtime   = DateTime.UtcNow;
            quotationsList.VendorId       = ""; quotationsList.OrderID = quoteResponse.OrderID;

            quotationsList.VendorMasterId = s1.vid.ToString();
            quotationsList.Persons        = s1.guestno.ToString();
            string ip = HttpContext.Request.UserHostAddress;

            quotationsList.IPaddress   = ip;
            quotationsList.UpdatedTime = DateTime.UtcNow;
            quotationsList.Status      = "Active";
            quotationsList.Reply_Type  = messagetype;
            quotationsList.ReplyToType = replyto;
            quotationsList.Description = message;

            quotationListsService.AddQuotationList(quotationsList);

            if (replyto == "Vendor")
            {
                mail = "/mailtemplate/kansiris1.html";
            }
            else if (replyto == "Customer")
            {
                mail = "/mailtemplate/kansiris.html";
            }
            FileInfo File = new FileInfo(Server.MapPath(mail));

            //  FileInfo File = new FileInfo(Server.MapPath("/mailtemplate/QuoteReply.html"));
            string        readFile = File.OpenText().ReadToEnd();
            StringBuilder cds      = new StringBuilder();
            StringBuilder cds1     = new StringBuilder();

            if (replyto == "Vendor")
            {
                var vendordetails = newmanageuse.getvendor(Convert.ToInt32(s1.vid));
                txtto = vendordetails.EmailId;
                string vname = vendordetails.BusinessName;
                readFile = readFile.Replace("[name]", vendordetails.BusinessName);
                readFile = readFile.Replace("[Email]", vendordetails.EmailId);
                // readFile = readFile.Replace("[bookdate]", s1.bookdate.ToString());
                cds1.Append("<table style='width: 70 %;border: 1px solid #fffff;'><tbody style='width: 70 %;border: 1px solid #fffff;'>");
                // cds1.Append("<tr><td style='width: 70 %;border: 1px solid #fffff;'></td><td style='width: 70 %;border: 1px solid #fffff;'><strong> Event Type</strong> </td></tr>");
                cds1.Append("<tr><td style='width: 70 %;border: 1px solid #fffff;'>  <p>" + "<strong>No. of Guests:</strong> " + s1.guestno + "</p> <p><strong>Event Type:</strong> " + s1.eventtype + "</p> <p><strong>Event Date:</strong> " + s1.bookdate + " </td> </tr>");
                cds1.Append("</tbody></table>");
                cds.Append("<table class='example - table'><tbody>");
                // cds.Append("<tr><td ><strong>Packgename</strong></td><td ><strong> Ahwanam Price</strong> </td><td ><strong> Market Price </strong> </td><td><strong>Availablity(Yes/No)</strong> </td></tr>");
                foreach (var item in s12)
                {
                    string image;
                    if (item.logo != null)
                    {
                        image = "/vendorimages/" + item.logo.Trim(',') + "";
                    }
                    else
                    {
                        image = "/noimages.png";
                    }
                    cds.Append("<tr><td style='width: 70 %;border: 1px solid #000;'>  <p>" + "<strong>Packgename:</strong>" + item.packagename + "</p><strong><p>Please provide the information for booking :</p><p>Date Available: Y / N(if no pls give alternate available date)</p><p>Package Price for Customer incl GST:</p><p>Package Price for Ahwanam incl GST:</p> </strong> </td></tr></tr>");
                }
                cds.Append("</tbody></table>");
            }
            else if (replyto == "Customer")
            {
                readFile = readFile.Replace("[name]", s1.fname);
                readFile = readFile.Replace("[Email]", s1.username);
                txtto    = s1.username;
                cds.Append("<table style='width:70%;'><tbody>");
                cds.Append("<tr><td style = 'width:20%;'></td><td><strong> Details</strong> </td><td> <strong>Event Type</strong> </td><td><strong>Total Amount</strong></td></tr>");
                foreach (var item in s12)
                {
                    string image;
                    if (item.logo != null)
                    {
                        image = "/vendorimages/" + item.logo.Trim(',') + "";
                    }
                    else
                    {
                        image = "/noimages.png";
                    }
                    cds.Append("<tr><td style = 'width:20%;'>  <img src = " + image + " style='height: 182px;width: 132px;'/></td><td style = '' > <p>" + "<strong>Business Name: </strong>" + item.BusinessName + "</p><p>" + "<strong>Packgename: </strong>" + item.packagename + "</p><p>" + "<strong>Price/person:</strong> " + '₹' + item.perunitprice.ToString().Replace(".00", "") + "</p><p>" + "<strong>No. of Guests:</strong> " + item.guestno + "</p> </td><td > " + item.eventtype + " </td><td style = ''><p>" + '₹' + item.totalprice.ToString().Replace(".00", "") + "</p> </td> </tr>");
                }
                cds.Append("</tbody></table>");
            }
            if (message == "")
            {
                message = null;
            }
            readFile = readFile.Replace("[message]", message);
            string url = Request.Url.Scheme + "://" + Request.Url.Authority;

            readFile = readFile.Replace("[ActivationLink]", url);
            readFile = readFile.Replace("[name]", name);
            readFile = readFile.Replace("[orderid]", quoteResponse.OrderID);
            readFile = readFile.Replace("[table]", cds.ToString());
            readFile = readFile.Replace("[table1]", cds1.ToString());
            string txtmessage = readFile;
            string subj       = "Response to your Quote #" + s1.orderid + "";
            EmailSendingUtility emailSendingUtility = new EmailSendingUtility();

            emailSendingUtility.Email_maaaahwanam(txtto, txtmessage, subj, image1);
            return(Json("Success"));
        }
        public ActionResult email(string id, string type)
        {
            var    orders = orderService.alluserOrderList(type).Where(m => m.ordertype == "Quote").ToList();
            var    s12    = ViewBag.orderdetails = orders.Where(m => m.OrderId == long.Parse(id)).ToList();
            var    s1     = ViewBag.orderdetails = orders.Where(m => m.OrderId == long.Parse(id)).FirstOrDefault();
            string txtto;

            if (type == "Vendor")
            {
                var    userlogdetails = mnguserservice.getuserbyid(Convert.ToInt32(s1.userid));
                string txtt1          = userlogdetails.email;
                string name1          = userlogdetails.firstname;
                txtto = txtt1;
                name  = name1;
                name  = Capitalise(name);
            }
            else if (type == "User")
            {
                var    userdata  = userLoginDetailsService.GetUserId((int)s1.userid);
                var    userdata1 = userLoginDetailsService.GetUser((int)s1.userid);
                string txtto2    = userdata.UserName;
                string name2     = userdata1.FirstName;
                txtto = txtto2;
                name  = name2;
                name  = Capitalise(name);
            }

            name = Capitalise(name);
            string        OrderId = Convert.ToString(s1.OrderId);
            StringBuilder cds     = new StringBuilder();

            cds.Append("<table style='width:70%;'><tbody>");
            cds.Append("<tr><td style = 'width:20%;'></td><td><strong> Details</strong> </td><td> <strong>Event Type</strong> </td><td><strong>Total Amount</strong></td></tr>");
            foreach (var item in s12)
            {
                string image;
                if (item.logo != null)
                {
                    image = "/vendorimages/" + item.logo.Trim(',') + "";
                }
                else
                {
                    image = "/noimages.png";
                }
                cds.Append("<tr><td style = 'width:20%;'>  <img src = " + image + " style='height: 182px;width: 132px;'/></td><td style = '' > <p>" + "<strong>Business Name: </strong>" + item.BusinessName + "</p><p>" + "<strong>Packgename: </strong>" + item.PackageName + "</p><p>" + "<strong>Price/person:</strong> " + '₹' + item.PerunitPrice.ToString().Replace(".00", "") + "</p><p>" + "<strong>No. of Guests:</strong> " + item.Quantity + "</p> </td><td > " + item.EventType + " </td><td style = ''><p>" + '₹' + item.TotalPrice.ToString().Replace(".00", "") + "</p> </td> </tr>");
            }
            cds.Append("</tbody></table>");
            string url = Request.Url.Scheme + "://" + Request.Url.Authority;
            //FileInfo File = new FileInfo(Server.MapPath("/mailtemplate/order.html"));
            FileInfo File     = new FileInfo(Server.MapPath("/mailtemplate/kansiris.html"));
            string   readFile = File.OpenText().ReadToEnd();

            readFile = readFile.Replace("[ActivationLink]", url);
            readFile = readFile.Replace("[name]", name);
            readFile = readFile.Replace("[orderid]", OrderId);
            readFile = readFile.Replace("[table]", cds.ToString());
            string txtmessage1 = readFile;
            string subj1       = "order has been placed";
            string txtto1      = s1.username;
            EmailSendingUtility emailSendingUtility = new EmailSendingUtility();

            emailSendingUtility.Email_maaaahwanam(txtto1, txtmessage1, subj1, null);
            var msg = "email sent";

            return(Json(msg, JsonRequestBehavior.AllowGet));
        }