예제 #1
0
        public ActionResult TenderNotice(string refno)
        {
            var globalTenderInformation = _tenderInfo.GetGlobalTenderInfoById(refno);

            ViewBag.Location        = "";
            ViewBag.LocationForLink = "";

            var statename    = "";
            var city         = "";
            var country      = "";
            var location     = "";
            int tenderStatus = 0;// 1:ACTIVE, 2:NEW, 3:CLOSE

            ViewBag.DocType = "";

            const string searchdesiplaytext = "";

            if (globalTenderInformation != null)
            {
                country          = _tenderInfo.GetCountry(globalTenderInformation.CountryId).CountryName;
                statename        = _tenderInfo.GetState(globalTenderInformation.StateId).StateName;
                city             = _tenderInfo.GetCity(globalTenderInformation.LocId).Location;
                ViewBag.Location = location = country;

                if (globalTenderInformation.dt != null)
                {
                    var dt       = globalTenderInformation.dt.Value;
                    var submDate = globalTenderInformation.SubmDate;

                    if (dt.ToString("MM/dd/yyyy") == DateTime.Today.AddDays(-1).ToString("MM/dd/yyyy") && submDate >= DateTime.Today)
                    {
                        tenderStatus = 2;
                    }
                    else if (submDate >= DateTime.Today)
                    {
                        tenderStatus = 1;
                    }
                    else if (submDate < DateTime.Today)
                    {
                        tenderStatus = 3;
                    }
                }
            }

            city      = new CultureInfo("en-US", false).TextInfo.ToTitleCase(city.ToLower());
            statename = new CultureInfo("en-US", false).TextInfo.ToTitleCase(statename.ToLower());

            int refNo = refno == "" ? 0 : Convert.ToInt32(refno);

            var searchtype = new SearchType();

            if (globalTenderInformation != null)
            {
                var duedate = globalTenderInformation.SubmDate.ToString("dd MMM, yyyy");
                var detail  = globalTenderInformation.WorkDesc;

                var tenderMetaData = _common.GetTenderMetaDataGlobal(TenderTypeList.GlobalDetailPage);
                var Title          = tenderMetaData.Title;
                Title = Title.Replace(TenderMetaReplaceName.TenderDescription, detail.Replace("-", " "));
                Title = Title.Replace(TenderMetaReplaceName.CityName, location.Replace("-", " "));

                var Description = tenderMetaData.Description;
                Description = Description.Replace(TenderMetaReplaceName.TenderDescription, detail);
                Description = Description.Replace(TenderMetaReplaceName.TenderDueDate, duedate);
                Description = Description.Replace(TenderMetaReplaceName.TenderLocation, location.Replace("-", " "));
                Description = Description.Replace(TenderMetaReplaceName.TenderOurrefNo, globalTenderInformation.OurRefNo.ToString());

                string   displayKeyword = "";
                string[] keywordList    = null;
                if (!string.IsNullOrEmpty(detail))
                {
                    keywordList = Regex.Split(detail, " ");
                }

                if (keywordList != null)
                {
                    displayKeyword =
                        keywordList.Where(
                            item =>
                            item.Length > 2 && !item.ToLower().Trim().Contains("and") &&
                            !item.ToLower().Trim().Contains("but") && !item.ToLower().Trim().Contains("before") &&
                            !item.ToLower().Trim().Contains("after") && !item.ToLower().Trim().Contains("above") &&
                            !item.ToLower().Trim().Contains("via") && !item.ToLower().Trim().Contains("from") &&
                            !item.ToLower().Trim().Contains("length") && !item.ToLower().Trim().Contains("height") &&
                            !item.ToLower().Trim().Contains("weight"))
                        .Aggregate(displayKeyword,
                                   (current, item) => current == "" ? item + " Tenders" : current + ", " + item + " Tenders");
                }

                ViewBag.Title       = Title;
                ViewBag.description = Description;
                ViewBag.keywords    = tenderMetaData.Keyword.Replace(TenderMetaReplaceName.KeywordName, displayKeyword);
            }
            var tenderDetail = new TenderDetail
            {
                TenderDetails = globalTenderInformation,
                StateList     = _getListItems.StateList(),
                CityList      = _getListItems.CityList(0),

                OurRefNo            = globalTenderInformation.OurRefNo,
                TenderStatus        = tenderStatus,
                DisplayText3        = searchdesiplaytext,
                IdVal               = 0,
                Subscribetype       = SubscribType.DownloadTender,
                DownloadTenderRefNo = Convert.ToInt32(refno),
                FormTitle           = SubscribTypeDisplsyText.DownloadTender,
                FormType            = FormType.PopupForms,
                IsGlobalTender      = true
            };

            return(View("TenderNotice", tenderDetail));
        }
예제 #2
0
        public ActionResult SubmitInquiryDetail(FormCollection coll)
        {
            var    msg = "ok";
            string userEmail;
            var    inqForm       = new tbInquiryRegForm();
            var    inqFormUserId = 0;

            var ModuleType    = 0;
            var InquiryTypeId = 0;
            var LinkId        = 0;
            var BrowserLink   = "";

            var tYear    = "";
            var tenderId = 0;

            var encryptedOurRefNo = "";
            var encryptedtYear = "";
            var encryptedtUserId = "";
            var isDowloadDoc = false; var isExportExcelDoc = false;

            var DownloadDocumentUrl = "";

            var PopUpFormControlId = "";
            var InquiryTypeName    = "";

            string adminFromId = ConfigurationManager.AppSettings["SMTP_EmailId"].ToString();

            var LoginUserId = Session["ClientID"] == null ? 0 : Convert.ToInt32(Session["ClientID"]);

            try
            {
                //var ClientIpAddress = RequestHelpers.GetClientIpAddress();

                var FormType = coll.Get("FormType").ToString().ToLower().Trim();
                InquiryTypeName = coll.Get("InquiryTypeName").ToString();
                var captchaHiddenId = "hdn_Captcha_Code";

                var captchaCode = coll.Get(captchaHiddenId);
                var txtCaptcha  = coll.Get("txtCaptcha" + PopUpFormControlId);
                BrowserLink = coll.Get("BrowserLink").ToString();

                if (Convert.ToInt32(FormType) != Utility.FormType.PayOnline)
                {
                    if (captchaCode == null || (txtCaptcha.Trim() != captchaCode.ToString().Trim()))
                    {
                        msg = "captchaerror"; userEmail = "";
                        return(Json(new { msg, userEmail, inqFormUserId }, JsonRequestBehavior.AllowGet));
                    }
                }

                InquiryRegFormFields RegFormParams = new InquiryRegFormFields()
                {
                    InquiryTypeID    = Convert.ToInt32(coll.Get("InquiryTypeID")),
                    intClientPurpose = 1,
                    OurRefNo         = Convert.ToInt32(coll.Get("TenderID")),
                    NewID            = Convert.ToInt32(coll.Get("NewID")),
                    ModuleType       = Convert.ToInt32(coll.Get("ModuleType")),

                    Name              = coll.Get("txtName"),
                    MobNo             = coll.Get("txtMobileNo"),
                    EmailID           = coll.Get("txtEmailId"),
                    InterestedTenders = coll.Get("txtInterestedTenders"),
                    CompName          = FormType != Utility.FormType.ContactForm.ToString() ? coll.Get("txtCompanyName") : "",

                    //Designation = !isContactForm ? coll.Get("txtDesignation") : "",

                    //Address = FormType == Utility.FormType.RegistrationForm.ToString() ? coll.Get("txtAddress") : "",
                    //PhoneNo = !isContactForm ? coll.Get("txtPhoneNo") : "",
                    //Website = !isContactForm ? coll.Get("txtWebsite") : "",

                    Country = FormType == Utility.FormType.RegistrationForm.ToString() ? Convert.ToInt32(coll.Get("drpCountry")) : 0,
                    State   = Convert.ToInt32(coll.Get("drpState")),
                    City    = (FormType == Utility.FormType.RegistrationForm.ToString() || FormType == Utility.FormType.OtherForms.ToString()) ? Convert.ToInt32(coll.Get("drpCity")) : 0,

                    Flag        = 0,
                    LinkId      = 0,               //string.IsNullOrEmpty(coll.Get("LinkId" + PopUpFormControlId)) ? 0 : Convert.ToInt32(coll.Get("LinkId" + PopUpFormControlId)),
                    BrowserLink = BrowserLink,
                    FormTitle   = InquiryTypeName, //= string.IsNullOrEmpty(coll.Get("FormTitle" + PopUpFormControlId)) ? "" : coll.Get("FormTitle" + PopUpFormControlId).ToString(),
                    //ClientIPAddress = ClientIpAddress
                };

                tenderId      = RegFormParams.OurRefNo;
                InquiryTypeId = RegFormParams.InquiryTypeID;
                ModuleType    = RegFormParams.ModuleType;
                userEmail     = RegFormParams.EmailID;

                var userName        = RegFormParams.Name;
                var userContactNo   = RegFormParams.MobNo.ToString();
                var userProductInfo = string.IsNullOrEmpty(RegFormParams.InterestedTenders) ? "" : RegFormParams.InterestedTenders;

                var FormTitle = RegFormParams.FormTitle;

                inqFormUserId = _common.SubmitInquiryRegForms(RegFormParams);
                if (inqFormUserId == 0)
                {
                    msg       = "error";
                    userEmail = "";

                    return(Json(new { msg, userEmail, inqFormUserId, InquiryTypeId, tenderId, tYear, encryptedOurRefNo, encryptedtYear, encryptedtUserId },
                                JsonRequestBehavior.AllowGet));
                }

                string country = "";
                string state   = "";
                string city    = "";

                tYear = string.IsNullOrEmpty(coll.Get("TenderYear"))
                    ? DateTime.Now.Year.ToString()
                    : coll.Get("TenderYear").ToString();

                if (RegFormParams.State != 0)
                {
                    var statedet = _tenderInfo.GetState(RegFormParams.State);
                    state = statedet == null ? "" : statedet.StateName;
                }
                if (RegFormParams.Country != 0)
                {
                    var countrydet = _tenderInfo.GetCountry(RegFormParams.Country);
                    country = countrydet == null ? "" : countrydet.CountryName;
                }
                if (RegFormParams.City != 0)
                {
                    var citydet = _tenderInfo.GetCity(RegFormParams.City);
                    city = citydet == null ? "" : citydet.Location;
                }


                string appName = ConfigurationManager.AppSettings["ProjectName"].ToString();

                string messageBody = "";
                string userFormFields;
                string subject = "";
                string title   = "";

                string filepath   = "";
                string filedetail = "";

                subject     = "Your initial request for " + InquiryTypeName + " :: " + appName;
                messageBody = _common.SubscribNowMailFormat();

                //filepath = GetHTMLEmailFormatFileName(CommonController.TenderTypeList.UserInfoDetail);
                //filedetail = string.Empty;
                //using (StreamReader reader = new StreamReader(filepath))
                //{
                //    filedetail = reader.ReadToEnd();
                //}

                //filedetail = filedetail.Replace("{{Name}}", userName);
                //filedetail = filedetail.Replace("{{Email}}", userEmail);
                //filedetail = filedetail.Replace("{{ContactNo}}", userContactNo);
                //filedetail = filedetail.Replace("{{ProductDetails}}", userProductInfo);
                //messageBody = messageBody.Replace("{{UserInfoDetail}}", filedetail);

                messageBody = messageBody.Replace("{{Name}}", userName);

                Utility.SendMail(userEmail, "", "", subject, messageBody, "");


                #region SEND MAIL TO ADMIN

                subject = appName + " : request to register for Tenders Subscription ";

                messageBody = _common.SubscribNowMailFormat_Admin();
                messageBody = messageBody.Replace("{{Name}}", RegFormParams.Name);
                messageBody = messageBody.Replace("{{Designation}}", RegFormParams.Designation);
                messageBody = messageBody.Replace("{{CompanyName}}", RegFormParams.CompName);
                messageBody = messageBody.Replace("{{Address}}", RegFormParams.Address);
                messageBody = messageBody.Replace("{{MobileNo}}", RegFormParams.MobNo);
                messageBody = messageBody.Replace("{{PhoneNo}}", RegFormParams.PhoneNo);
                messageBody = messageBody.Replace("{{Country}}", country);
                messageBody = messageBody.Replace("{{State}}", state);
                messageBody = messageBody.Replace("{{City}}", city);
                messageBody = messageBody.Replace("{{InterestedTenders}}", !string.IsNullOrEmpty(RegFormParams.InterestedTenders) ? RegFormParams.InterestedTenders.Replace("#-#", "; ") : "");
                messageBody = messageBody.Replace("{{EmailID}}", RegFormParams.EmailID);
                messageBody = messageBody.Replace("{{Website}}", RegFormParams.Website);

                Utility.SendMail(adminFromId, "", ConfigurationManager.AppSettings["Director_FromEmailId"], subject, messageBody, "");

                #endregion
            }
            catch (Exception errorex)
            {
                msg         = "error" + errorex.InnerException;
                userEmail   = "";
                LoginUserId = 0;
            }
            return(Json(new
            {
                msg,
                userEmail,
                inqFormUserId,
                InquiryTypeId,
                tenderId,
                tYear,
                encryptedOurRefNo,
                encryptedtYear,
                encryptedtUserId,
                isDowloadDoc,
                isExportExcelDoc,
                DownloadDocumentUrl,
                LoginUserId
            }, JsonRequestBehavior.AllowGet));
        }