public void InsertPublisher(PublisherVM pub)
        {
            pub.CreatedBy   = 1;
            pub.CreatedDate = DateTime.Now;
            if (pub.PublisherUrl == null)
            {
                var url = ExcellentMarketResearch.Areas.Admin.Models.Common.GenerateSlug(pub.PublisherName);
                pub.PublisherUrl = url;
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            var             c         = serializer.Serialize(pub);
            PublisherMaster pubmaster = serializer.Deserialize <PublisherMaster>(c);

            try
            {
                db.PublisherMasters.Add(pubmaster);
                db.SaveChanges();
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                    }
                }
            }
        }
Exemple #2
0
        public void InsertAction(ViewModel.ActionVM actionvm)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            var          s            = serializer.Serialize(actionvm);
            ActionMaster actionmaster = serializer.Deserialize <ActionMaster>(s);

            db.ActionMasters.Add(actionmaster);
            db.SaveChanges();
        }
Exemple #3
0
        public ActionResult NewsDelete1(int id)
        {
            var n = db.NewsMasters.Where(x => x.NewsId == id).Select(x => x).FirstOrDefault();

            n.IsActive        = false;
            db.Entry(n).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("NewsIndex"));
        }
Exemple #4
0
        public void InsertCategory(CategoryVM catvm)
        {
            CategoryMaster cat = new CategoryMaster();

            if (catvm.ParentCategoryId == null)
            {
                catvm.ParentCategoryId = 0;
            }
            //JavaScriptSerializer serializer = new JavaScriptSerializer();
            //var c=serializer.Serialize(catvm);
            //CategoryMaster cat =serializer.Deserialize<CategoryMaster>(c);
            cat.ParentCategoryId = catvm.ParentCategoryId;
            cat.CategoryName     = catvm.CategoryName;
            cat.CategoryUrl      = catvm.CategoryURL;
            // cat.CategoryIcon = catvm.CategoryIcon;
            cat.ShortDescription = catvm.ShortDescription;
            cat.MetaTitle        = catvm.MetaTitle;
            cat.Keywords         = catvm.Keywords;
            cat.LongDescription  = catvm.LongDescription;
            cat.MetaDescription  = catvm.MetaDescription;
            cat.IsActive         = catvm.IsActive;
            cat.CreatedBy        = catvm.CreatedBy;
            cat.CreatedDate      = catvm.CreatedDate;
            try
            {
                db.CategoryMasters.Add(cat);
                db.SaveChanges();
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                    }
                }
            }
            //var categoryUrl = cat.CategoryUrl + "-" + cat.CategoryId;
            //cat.CategoryUrl = categoryUrl;
            //db.Entry(cat).State = EntityState.Modified;
            //db.SaveChanges();
        }
Exemple #5
0
        public void InsertNews(NewsVM news)
        {
            if (news.NewsURL == null)
            {
                var newsurl = ExcellentMarketResearch.Areas.Admin.Models.Common.GenerateSlug(news.NewsTitle);
                news.NewsURL = newsurl;
            }
            news.CreatedBy             = 1;
            news.CreatedDate           = DateTime.Now;
            newsmaster.NewsImage       = news.NewsImage;
            newsmaster.CreatedBy       = 1;
            newsmaster.CreatedDate     = DateTime.Now;
            newsmaster.NewsTitle       = news.NewsTitle;
            newsmaster.NewsUrl         = news.NewsURL;
            newsmaster.NewsDescription = news.NewsDetail;
            newsmaster.MetaDescritpion = news.MetaDescription;
            newsmaster.Keywords        = news.MetaKeywords;
            newsmaster.PublishingDate  = news.NewsPublishingDate;
            newsmaster.MetaTitle       = news.MetaTitle;
            newsmaster.CategoryId      = news.CategoryId;
            newsmaster.IsActive        = news.IsActive;


            //JavaScriptSerializer serializer = new JavaScriptSerializer();
            //var n = serializer.Serialize(news);
            //NewsMaster newsmaster = serializer.Deserialize<NewsMaster>(n);
            try
            {
                db.NewsMasters.Add(newsmaster);
                db.SaveChanges();
            }
            catch (DbEntityValidationException ex)
            {
                foreach (var validationError in ex.EntityValidationErrors)
                {
                    foreach (var validationerrors in validationError.ValidationErrors)
                    {
                        System.Console.WriteLine("property name{0}", validationerrors.PropertyName);
                    }
                }
            }
        }
Exemple #6
0
        public void InsertReport(ReportVM r)
        {
            r.CreatedBy   = 1;
            r.CreatedDate = DateTime.Now;

            JavaScriptSerializer serializer = new JavaScriptSerializer();
            var          s  = serializer.Serialize(r);
            ReportMaster re = serializer.Deserialize <ReportMaster>(s);

            re.LongDescritpion      = r.FullDescription;
            re.SinglePrice          = r.PriceSingleUser;
            re.MultiUserPrice       = r.PriceMultiUser;
            re.CorporateUserPrice   = r.PriceCUL;
            re.NumberOfPages        = r.NumberOfPage;
            re.PublishereId         = r.PublisherId;
            re.ReportDeliveryTypeId = r.DeliveryTypeId;
            db.ReportMasters.Add(re);
            db.SaveChanges();
            re.ReportUrl       = re.ReportUrl + "-" + re.ReportId;
            db.Entry(re).State = EntityState.Modified;
            db.SaveChanges();
        }
        public void InsertAction(RoleActionVM Roleaction, int[] actions)
        {
            db.spRoleActionInsert(
                Roleaction.RoleId,
                Roleaction.RoleName,
                Roleaction.IsActive,
                Roleaction.CreatedBy = 1,                          //(int)HttpContext.Current.Session["userid"],
                Roleaction.ModifiedBy,
                Roleaction.CreatedDate = DateTime.Now,
                Roleaction.ModifiedDate,
                string.Join(",", actions)
                );

            db.SaveChanges();
        }
Exemple #8
0
 public void InsertUserRole(UserRoleVM userrole, int[] Roles)
 {
     try
     {
         db.spUserRoleInsert(
             userrole.UserId,
             userrole.UserFName,
             userrole.UserLName,
             userrole.CurrentAddress,
             userrole.State,
             userrole.City,
             userrole.MobileNumber,
             userrole.PermanentAddress,
             userrole.Gender,
             userrole.CompanyName,
             userrole.EmailId,
             userrole.PWD,
             userrole.IsActive,
             userrole.CreatedBy = 10,
             userrole.ModifiedBy,
             userrole.CreatedDate = DateTime.Now,
             userrole.ModifiedDate,
             string.Join(",", Roles));
         db.SaveChanges();
     }
     catch (DbEntityValidationException dbEx)
     {
         foreach (var validationErrors in dbEx.EntityValidationErrors)
         {
             foreach (var validationError in validationErrors.ValidationErrors)
             {
                 System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
             }
         }
     }
 }
Exemple #9
0
        public static bool PayPalProcess(PaymentLibrary.PayPal.PayPalResponse paypalResponse)
        {
            ExcellentMarketResearchEntities db = new ExcellentMarketResearchEntities();

            if (paypalResponse != null && (!string.IsNullOrEmpty(paypalResponse.PAYERID) || !string.IsNullOrEmpty(paypalResponse.guid)))
            {
                BuyingInfo b = new BuyingInfo();

                if (string.IsNullOrEmpty(paypalResponse.PAYERID))
                {
                    log4net.LogManager.GetLogger("Error").Error("PayerID not found OR Response is null OR guid is not found.\nData - " + Newtonsoft.Json.JsonConvert.SerializeObject(paypalResponse));
                }

                //TODO: Get buyer from table using guid

                var buyer = GetBuyerByGuId(paypalResponse.guid);

                //bool IsBuyerExist= buyer.Count(x=>x.GuId==paypalResponse.guid)>0?true:false;
                bool IsBuyerExist = buyer != null ? true : false;

                //TODO: Check buyer if exist or not
                if (IsBuyerExist == null)
                {
                    // log4net.logmanager.getlogger("error").error("buyer not found.\ndata - " + newtonsoft.json.jsonconvert.serializeobject(paypalresponse));
                    return(false);
                }


                ValidResponse vResponse = PaymentLibrary.PayPal.PayPal.IsPaymentValid(paypalResponse,
                                                                                      PayPalConfig.GetConfiguration(HttpContext.Current.Server.MapPath("/paypalconfig/paypal.config"), false), false);

                if (vResponse.IsValid)
                {
                    //TODO: update status of payment transaction to success

                    var updatestatus = db.BuyingInfoes.Where(x => x.GuId == paypalResponse.guid).FirstOrDefault();
                    b.PaymentTransaction            = true;
                    updatestatus.PaymentTransaction = b.PaymentTransaction;
                    db.Entry(updatestatus).State    = EntityState.Modified;
                    db.SaveChanges();
                    return(true);
                }
                Newtonsoft.Json.JsonSerializer serializer = new Newtonsoft.Json.JsonSerializer();
                Stream     s = new MemoryStream();
                TextWriter t = new StreamWriter(s);

                serializer.Serialize(t, paypalResponse);
                TextReader r = new StreamReader(s);

                //TODO: Save error to db

                //_saveStatus(, 'f', vResponse.Reason + "|ErrorCode - " + vResponse.ErrorCode + "|PaypalResponse - " + r.ReadToEnd());

                var saveError = db.BuyingInfoes.Where(x => x.GuId == paypalResponse.guid).FirstOrDefault();
                b.PaymentTransaction         = false;
                saveError.PaymentTransaction = b.PaymentTransaction;
                saveError.ErrorReason        = vResponse.Reason;
                saveError.ErrorCode          = vResponse.ErrorCode;
                db.Entry(saveError).State    = EntityState.Modified;
                db.SaveChanges();

                return(false);
            }
            return(false);
        }
        public void CreateReport(DataSet ds)
        {
            DataTable           dtReport   = CreateDataSet();
            DataSet             dsReport   = new DataSet();
            ReportMaster        r          = new ReportMaster();
            List <ReportMaster> reportlist = new List <ReportMaster>();

            string HTMLTable = "<table border='1'>";

            for (int tables = 0; tables < ds.Tables.Count; tables++)
            {
                #region rowdata
                for (int rows = 0; rows < ds.Tables[tables].Rows.Count; rows++)
                {
                    int      _SerialNumber;
                    int      SerialNumber = 0;
                    int      _CategoryID;
                    int      _PublisherID;
                    int      _DeliveryFormatID;
                    DateTime _PublishedDate;
                    int      _NumberOfPages;
                    Decimal  _SingleUserPrice;
                    Decimal  _MultiUserPrice;
                    Decimal  _CorporateUserPrice;
                    bool     IsVaidate       = true;
                    string   Message         = "";
                    string   ReportTitleTemp = string.Empty;

                    for (int columns = 0; columns < ds.Tables[tables].Columns.Count; columns++)
                    {
                        if (ds.Tables[tables].Columns[columns].ToString() == "Serial Number")
                        {
                            if (Int32.TryParse(ds.Tables[tables].Rows[rows][columns].ToString().Trim(), out _SerialNumber))
                            {
                                SerialNumber = _SerialNumber;
                            }
                            else
                            {
                                IsVaidate = false; Message += "Serial Number<br />";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Category ID")
                        {
                            if (Int32.TryParse(ds.Tables[tables].Rows[rows][columns].ToString().Trim(), out _CategoryID))
                            {
                                r.CategoryId = _CategoryID;
                            }
                            else
                            {
                                IsVaidate = false; Message += "Category ID <br />";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Publisher ID")
                        {
                            if (Int32.TryParse(ds.Tables[tables].Rows[rows][columns].ToString().Trim(), out _PublisherID))
                            {
                                r.PublishereId = _PublisherID;
                            }
                            else
                            {
                                IsVaidate = false; Message += "Publisher ID <br />";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Delivery Format ID")
                        {
                            if (Int32.TryParse(ds.Tables[tables].Rows[rows][columns].ToString().Trim(), out _DeliveryFormatID))
                            {
                                r.ReportDeliveryTypeId = _DeliveryFormatID;
                            }
                            else
                            {
                                IsVaidate = false; Message += "Delivery Format ID <br />";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Title")
                        {
                            ReportTitleTemp = Convert.ToString(ds.Tables[tables].Rows[rows][columns].ToString().Trim());
                            if (db.ReportMasters.Count(g => g.ReportTitle == ReportTitleTemp) > 0 ? true : false)

                            {
                                IsVaidate = false; Message += "Title <br />";
                            }
                            else
                            {
                                r.ReportTitle = ds.Tables[tables].Rows[rows][columns].ToString().Trim().Replace("   ", " ").Replace("  ", " ").Replace("  ", " ");
                            }

                            r.ReportUrl = ExcellentMarketResearch.Areas.Admin.Models.Common.GenerateSlug(ds.Tables[tables].Rows[rows][columns].ToString().Trim());

                            if (db.ReportMasters.Count(url => url.ReportUrl == r.ReportUrl.ToLower()) > 0 ? true : false)
                            {
                                r.ReportUrl = ""; IsVaidate = false; Message += "Long URL <br />";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Published Date")
                        {
                            if (DateTime.TryParse(ds.Tables[tables].Rows[rows][columns].ToString().Trim(), out _PublishedDate))
                            {
                                r.PublishingDate = _PublishedDate;
                            }
                            else
                            {
                                IsVaidate = false; Message += "Published Date <br />";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Number Of Pages")
                        {
                            if (Int32.TryParse(ds.Tables[tables].Rows[rows][columns].ToString().Trim(), out _NumberOfPages))
                            {
                                r.NumberOfPages = _NumberOfPages;
                            }
                            else
                            {
                                IsVaidate = false; Message += "Number Of Pages <br />";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Long Description")
                        {
                            if (ds.Tables[tables].Rows[rows][columns].ToString().Trim() != "")
                            {
                                r.LongDescritpion = "<pre>" + ds.Tables[tables].Rows[rows][columns].ToString().Trim() + "</pre>";
                            }
                            else
                            {
                                IsVaidate = false; Message += "Long Description \n";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Long Table Of Content")
                        {
                            r.TableOfContent = "<pre>" + ds.Tables[tables].Rows[rows][columns].ToString().Trim() + "</pre>";
                        }

                        else if (ds.Tables[tables].Columns[columns].ToString() == "Single User Price")
                        {
                            if (Decimal.TryParse(ds.Tables[tables].Rows[rows][columns].ToString().Trim() == "" ? "0" : ds.Tables[tables].Rows[rows][columns].ToString().Trim(), out _SingleUserPrice))
                            {
                                r.SinglePrice = _SingleUserPrice;
                            }
                            else
                            {
                                IsVaidate = false; Message += "Single User Price <br />";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Multi User Price")
                        {
                            if (Decimal.TryParse(ds.Tables[tables].Rows[rows][columns].ToString().Trim() == "" ? "0" : ds.Tables[tables].Rows[rows][columns].ToString().Trim(), out _MultiUserPrice))
                            {
                                r.MultiUserPrice = _MultiUserPrice;
                            }
                            else
                            {
                                IsVaidate = false; Message += "Multi User Price <br />";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Corporate User Price")
                        {
                            if (Decimal.TryParse(ds.Tables[tables].Rows[rows][columns].ToString().Trim() == "" ? "0" : ds.Tables[tables].Rows[rows][columns].ToString().Trim(), out _CorporateUserPrice))
                            {
                                r.CorporateUserPrice = _CorporateUserPrice;
                            }
                            else
                            {
                                IsVaidate = false; Message += "Corporate User Price <br />";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Meta Title")
                        {
                            r.MetaTitle = ds.Tables[tables].Rows[rows][columns].ToString().Trim();
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Meta Description")
                        {
                            r.MetaDescription = ds.Tables[tables].Rows[rows][columns].ToString().Trim();
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "Meta Keywords")
                        {
                            r.Keywords = ds.Tables[tables].Rows[rows][columns].ToString().Trim();
                        }
                    }

                    if (r.SinglePrice <= 0 && r.MultiUserPrice <= 0 && r.CorporateUserPrice <= 0)
                    {
                        IsVaidate = false; Message += "Add Atleast one Price <br />";
                    }

                    //Save data in Database.
                    if (IsVaidate)
                    {
                        r.ReportImage = null;
                        //  r.ListOfCharts = null;
                        //  r.FreeAnalysis = null;
                        //   r.Summary = "null";
                        //   r.Methodology = null;

                        // r.DiscountPrice = 0;
                        r.IsActive = true;
                        // r.IsUpcomming = true;
                        r.ReportTypeId = r.ReportDeliveryTypeId;
                        r.CreatedBy    = 1;//Convert.ToInt32(QYGroupRepository.Areas.Admin.Models.CommonCode.MySession());
                        r.CreatedDate  = DateTime.Now;
                        reportlist.Add(r);
                        db.ReportMasters.Add(r);
                        db.SaveChanges();
                        var repturl = r.ReportUrl + ".html";
                        r.ReportUrl       = repturl;
                        db.Entry(r).State = EntityState.Modified;
                        db.SaveChanges();

                        //PriceMaster p = new PriceMaster();

                        //p.PriceType = "Single User Price ";
                        //p.Price = r.PriceSingleUser;
                        //db.PriceMasters.Add(p);
                        //db.SaveChanges();

                        //p.PriceType = "Multi User Price ";
                        //p.Price = r.PriceMultiUser;
                        //db.PriceMasters.Add(p);
                        //db.SaveChanges();

                        //p.PriceType = "Corporate User Price ";
                        //p.Price = r.PriceCUL;
                        //db.PriceMasters.Add(p);
                        //db.SaveChanges();

                        Message += "Inserted <br/>";
                    }
                    HTMLTable += "<tr><td>" + SerialNumber + "</td><td>" + ReportTitleTemp + "</td><td>" + r.ReportUrl + "</td><td>" + Message + "</td></tr>";
                }
                HTMLTable += "</table>";

                ViewData.Add("HTMLTable", HTMLTable);
                #endregion rows
            }
            //return View();
        }
Exemple #11
0
        public ActionResult InquiryForm(InquiryVM eq)
        {
            Emailsending objEmailsending = new Emailsending();
            var          response        = Request["g-recaptcha-response"];
            var          catptchastatus  = false;
            string       secreatekey     = "6LdU_nUUAAAAAD6JiuKTysnVW6Aa4D5SU0z1Fl4u";
            var          client          = new WebClient();
            string       resstring       = string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secreatekey, response);
            var          result          = client.DownloadString(resstring);

            if (result.ToLower().Contains("false"))
            {
                catptchastatus = false;
            }
            else
            {
                catptchastatus = true;
            }
            // ViewBag.Message = status ? "Google recaptcha validation success" : "Google recaptcha validation fails";
            CustomerInquiry e        = new CustomerInquiry();
            var             Formname = string.Empty;
            int             FormTypeId;
            string          Publisher = string.Empty;

            if (catptchastatus == true)
            {
                if (ModelState.IsValid)
                {
                    // cap = Session["Captcha"].ToString();
                    cap = ExcellentMarketResearch.Areas.Admin.Models.Common.Decrypt(eq.RealCaptcha);

                    if (eq.ReportId > 0)
                    {
                        var Publish = (from l in db.ReportMasters
                                       join p in db.PublisherMasters on l.PublishereId equals p.PublisherId
                                       where l.ReportId == eq.ReportId
                                       select p).FirstOrDefault();
                        Publisher = Publish.PublisherName;
                    }
                    else
                    {
                        Publisher = "!";
                    }

                    //if (eq.CaptchaCode == cap)
                    //{
                    CustomerInquiry cst       = new CustomerInquiry();
                    var             IpAddress = ExcellentMarketResearch.Models.PaymentGateway.IPAddress.GetIPAddress();
                    cst.Company         = eq.Company;
                    cst.Country         = eq.Country;
                    cst.CustomerMessage = eq.CustomerMessage;
                    cst.Designation     = eq.Designation;
                    cst.EmailId         = eq.EmailId;
                    cst.Name            = eq.Name;
                    eq.AreaCode        += "-" + eq.PhoneNumber;
                    cst.PhoneNumber     = eq.AreaCode;
                    cst.ReportId        = eq.ReportId;
                    cst.CaptchaCode     = eq.CaptchaCode;
                    cst.FormType        = eq.FormType;
                    cst.CaptchaCode     = "121321";
                    if (eq.FormType == "InquiryForm")
                    {
                        Formname   = "Inquiry";
                        FormTypeId = 1;
                    }
                    else if (eq.FormType == "SampleRequestForm")
                    {
                        Formname   = "Request Sample";
                        FormTypeId = 2;
                    }
                    else if (eq.FormType == "ContactUs")
                    {
                        FormTypeId = 4;
                    }
                    else
                    {
                        // Checkout page

                        FormTypeId = 3;
                    }

                    try
                    {
                        db.CustomerInquiries.Add(cst);
                        //db.Entry(cst).State = EntityState.Added;
                        db.SaveChanges();

                        // QYGroupRepository.PaymentGateway.Emailsending objEmailsending = new QYGroupRepository.PaymentGateway.Emailsending();
                        // string ipAddress = QYGroupRepository.PaymentGateway.IPAddress.GetIPAddress();
                        // Task.Run(() => new CRMWebService.WebServiceSoapClient().InsertUpdateKey(0, eq.ReportId, eq.ReportTitle, FormTypeId, 34, 1, 1, eq.ReportUrl, ipAddress, eq.Name, eq.EmailId, eq.AreaCode, eq.Company, eq.Designation, "!", "!", eq.Country, "!", eq.CustomerMessage, 1, "!", "!", "!", Publisher, 38, "BW&Zk^HfZ44P339nEzqrrawY4HL_VXw-5f+%8b4Hdw?$?m$G*!+kCGLK%3JjDn-74NY*LyhdJr6RAte&8MBWy6F2j82+qn7ap&DB@z-*q3sdH*#D-kwACucyaM7vzet4pSa?m^xnP@3zN5K9=*L6WLpDurTSuVTR3Hd&3XLHJnCcR!h*dL#fQhp^*#25LEFrMTt@z&8RWdf^CQcj!QrQU^WkdC5$Ub$8qnu!g7?*$$4%%M9?8spAugyCzZg5@dLGBNS_^7?x3VczR75J&=+9yFDVg*Qpd@R^_Jz-GtWgHxv4Kf$=2pxT@bqhx%aqgzZAN6RzZZ%rNX7km3fu$h?Z=+V3b_MQPLAxJBVT!=Ta+7Xd?CF3#4w44L@HU%nf4m#y-d2vgn6Gp2t7w!qFY%kN#y6DNAy#TbrZnqnjMtgeAd%BHSm9H29z4G_?qnBHE5J2EyutZ2RSh?P2fUE-sF8bNFdre@G^qQ??JzJuDCT3hby2py#+yfg*jC%&YBkrutHs"));

                        //Auto Mailer
                        Task.Run(() => objEmailsending.SendEmail("*****@*****.**", "Sales", cst.EmailId, "", "*****@*****.**", "excellentmarketresearch.com : " + eq.ReportTitle, objEmailsending.GenerateMailBody_RequestSample_AutoReply(cst.Name, eq.ReportTitle)));

                        //To company
                        // Task.Run(() => objEmailsending.SendEmail("*****@*****.**", "Sales", "*****@*****.**", "", "", "ExcellentMarketResearch.com" + " : " + Formname,objEmailsending.GenerateMailBody_RequestSample(eq.ReportTitle, cst.Name, cst.EmailId, cst.PhoneNumber, cst.Company, cst.Country, cst.Designation, cst.CustomerMessage)));
                        Task.Run(() => objEmailsending.SendEmail("*****@*****.**", "Sales", "*****@*****.**", "", "", "excellentMarketResearch.com" + " : " + Formname, objEmailsending.GenerateMailBody_RequestSample(eq.ReportTitle, cst.Name, cst.EmailId, cst.PhoneNumber, cst.Company, cst.Country, cst.Designation, cst.CustomerMessage, IpAddress)));

                        Session["Name"] = cst.Name;

                        return(RedirectToAction("Index", "InquiryForm", new { reporrtid = cst.ReportId }));
                    }
                    catch (DbEntityValidationException dbEx)
                    {
                        foreach (var validationErrors in dbEx.EntityValidationErrors)
                        {
                            foreach (var validationError in validationErrors.ValidationErrors)
                            {
                                System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                            }
                        }
                    }
                    //}
                    //Return the if model not valid
                    return(View(eq));
                }
                return(View(eq));
            }
            return(View(eq));
        }
Exemple #12
0
        public ActionResult CheckoutForm(BuyingVM ObjBuy)
        {
            //  var MailbodyMethodCall = new QYGroupRepository.PaymentGateway.Emailsending();

            if (ModelState.IsValid)
            {
                string realCaptcha = Session["Captchacode"].ToString();
                string Publisher   = string.Empty;
                if (ObjBuy.ReportId > 0)
                {
                    var publish = (from l in db.ReportMasters
                                   join p in db.PublisherMasters on l.PublishereId equals p.PublisherId
                                   where l.ReportId == ObjBuy.ReportId
                                   select p).FirstOrDefault();
                    Publisher = publish.PublisherName;
                }
                if (ObjBuy.CaptchaCode == realCaptcha)
                {
                    //JavaScriptSerializer serializer = new JavaScriptSerializer();
                    //var s = serializer.Serialize(Enquiredata);
                    //BuyingInfo cst = serializer.Deserialize<BuyingInfo>(s);
                    //CategoryMaster categorymaster = serializer.Deserialize<CategoryMaster>(s);

                    ObjBuy.GuId      = System.Guid.NewGuid().ToString();
                    ObjBuy.IPAddress = ExcellentMarketResearch.Models.PaymentGateway.IPAddress.GetIPAddress();


                    BuyingInfo binfo = new BuyingInfo();

                    binfo.Address         = ObjBuy.Address;
                    binfo.Name            = ObjBuy.Name;
                    binfo.AreaCode        = ObjBuy.AreaCode;
                    binfo.CustomerMessage = ObjBuy.CustomerMessage;
                    binfo.ReportTitle     = ObjBuy.ReportTitle;
                    binfo.ReportUrl       = ObjBuy.ReportUrl;
                    binfo.EmailId         = ObjBuy.EmailId;
                    binfo.Company         = ObjBuy.Company;
                    binfo.CaptchaCode     = ObjBuy.CaptchaCode;
                    binfo.Country         = ObjBuy.Country;
                    binfo.Designation     = ObjBuy.Designation;
                    binfo.State           = ObjBuy.State;
                    binfo.City            = ObjBuy.City;
                    binfo.Price           = ObjBuy.Price;
                    binfo.PhoneNumber     = ObjBuy.PhoneNumber;
                    binfo.Type            = ObjBuy.Type;
                    binfo.ReportId        = ObjBuy.ReportId;
                    binfo.Zipcode         = ObjBuy.Zipcode;
                    binfo.Paymentmode     = ObjBuy.Paymentmode;
                    binfo.GuId            = ObjBuy.GuId;
                    binfo.IPAddress       = ObjBuy.IPAddress;
                    try
                    {
                        db.BuyingInfoes.Add(binfo);
                        //  db.Entry(cst).State = EntityState.Added;
                        db.SaveChanges();

                        //The lead information goes to CRM here......
                        //  new CRMWebService.WebServiceSoapClient().InsertUpdateKey(0, ObjBuy.ReportId, ObjBuy.ReportTitle, 3, 34, 1, 1, ObjBuy.ReportUrl, QYGroupRepository.PaymentGateway.IPAddress.GetIPAddress(), ObjBuy.Name, ObjBuy.EmailId, ObjBuy.AreaCode, ObjBuy.Company, ObjBuy.Designation, "!", ObjBuy.State, ObjBuy.Country, ObjBuy.Zipcode, ObjBuy.CustomerMessage, 1, ObjBuy.GuId, "!", "!", Publisher, 38, "BW&Zk^HfZ44P339nEzqrrawY4HL_VXw-5f+%8b4Hdw?$?m$G*!+kCGLK%3JjDn-74NY*LyhdJr6RAte&8MBWy6F2j82+qn7ap&DB@z-*q3sdH*#D-kwACucyaM7vzet4pSa?m^xnP@3zN5K9=*L6WLpDurTSuVTR3Hd&3XLHJnCcR!h*dL#fQhp^*#25LEFrMTt@z&8RWdf^CQcj!QrQU^WkdC5$Ub$8qnu!g7?*$$4%%M9?8spAugyCzZg5@dLGBNS_^7?x3VczR75J&=+9yFDVg*Qpd@R^_Jz-GtWgHxv4Kf$=2pxT@bqhx%aqgzZAN6RzZZ%rNX7km3fu$h?Z=+V3b_MQPLAxJBVT!=Ta+7Xd?CF3#4w44L@HU%nf4m#y-d2vgn6Gp2t7w!qFY%kN#y6DNAy#TbrZnqnjMtgeAd%BHSm9H29z4G_?qnBHE5J2EyutZ2RSh?P2fUE-sF8bNFdre@G^qQ??JzJuDCT3hby2py#+yfg*jC%&YBkrutHs");

                        if (ObjBuy.Paymentmode == "wireTransfer")
                        {
                            //Auto Mailer
                            //  objEmailsending.SendEmail("*****@*****.**", "Sales", ObjBuy.EmailId, "", "*****@*****.**", "Payment Initiated : " + ObjBuy.ReportTitle, MailbodyMethodCall.GenerateMailBody_PaymentInitiated_AutoReply(ObjBuy.ReportTitle, ObjBuy.Name));
                            //To company
                            //                            objEmailsending.SendEmail(ObjBuy.EmailId, ObjBuy.Name, "*****@*****.**", "", "[email protected],[email protected]", "xyz.com" + " : Payment Initiated(Wire Transfer)", MailbodyMethodCall.GenerateMailBody_PaymentInitiated(ObjBuy.ReportTitle, ObjBuy.Name, ObjBuy.EmailId, ObjBuy.PhoneNumber, ObjBuy.Company, "", "", ObjBuy.Country, ""));
                        }
                        else
                        {
                            //Auto Mailer
                            //                          objEmailsending.SendEmail("*****@*****.**", "Sales", ObjBuy.EmailId, "", "*****@*****.**", "Payment Initiated : " + ObjBuy.ReportTitle, GenerateMailBody_PaymentInitiated_AutoReply(ObjBuy.ReportTitle, ObjBuy.Name));

                            //To company
                            //                        objEmailsending.SendEmail(ObjBuy.EmailId, ObjBuy.Name, "*****@*****.**", "", "[email protected],[email protected]", "xyz.com" + " : Payment Initiated(pay pal )", GenerateMailBody_PaymentInitiated(ObjBuy.ReportTitle, ObjBuy.Name, ObjBuy.EmailId, ObjBuy.PhoneNumber, ObjBuy.Company, "", "", ObjBuy.Country, ""));



                            //The paypalpage will appear to the user or buer ....
                            //Paypal._PayPal(ObjBuy);

                            PaymentWithPaypal(ObjBuy, null);
                            //return RedirectToAction("PaymentWithPaypal", "ReportBuying", new {ObjBuy, Cancel = false });
                            //return RedirectToAction("PaymentWithPaypal");
                        }



                        //  return RedirectToAction("Index");
                    }
                    catch (DbEntityValidationException dbEx)
                    {
                        foreach (var validationErrors in dbEx.EntityValidationErrors)
                        {
                            foreach (var validationError in validationErrors.ValidationErrors)
                            {
                                System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                            }
                        }
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Verification Code is Incorrect");
                }
            }
            Session["Name"] = ObjBuy.Name;
            return(RedirectToAction("Index", "InquiryForm", new { reportid = ObjBuy.ReportId }));
        }
Exemple #13
0
        // [CustomAuthentication("ReportUploader", "Create,Edit,Delete")]
        public ActionResult Import(HttpPostedFileBase excelfile)
        {
            string Value = string.Empty;
            List <ReportMaster> reportlist = new List <ReportMaster>();

            //   Excelimport (excelfile);
            if (excelfile == null || excelfile.ContentLength == 0)
            {
                ViewBag.Error = "Upload the excel file !....";
                return(View("Index"));
            }

            else
            {
                if (excelfile.FileName.EndsWith("xsl") || excelfile.FileName.EndsWith("xlsx"))
                {
                    string path = "";
                    //   string path = Server.MapPath("~/Content/" + excelfile.FileName + DateTime.Now.ToString("MM.dd.yyyy-hh.mm.ss"));
                    try
                    {
                        //path = Server.MapPath("~/UploadSheet/" + excelfile.FileName + DateTime.Now.ToString("MM.dd.yyyy"));
                        path = Server.MapPath("~/UploadSheet/");
                        if (System.IO.File.Exists(path))
                        {
                            System.IO.File.Delete(path);
                        }
                        excelfile.SaveAs(path + Path.GetFileName(excelfile.FileName));
                        path = path + Path.GetFileName(excelfile.FileName);
                        string sFileExtention = Path.GetExtension(path);
                        ISheet sheet;

                        using (var stream = new FileStream(path, FileMode.Open))
                        {
                            stream.Position = 0;
                            if (sFileExtention == ".xls")
                            {
                                HSSFWorkbook hSSFWorkbook = new HSSFWorkbook(stream);
                                sheet = hSSFWorkbook.GetSheetAt(0);
                            }
                            else
                            {
                                XSSFWorkbook sSFWorkbook = new XSSFWorkbook(stream);
                                sheet = sSFWorkbook.GetSheetAt(0);
                            }
                            IRow   hrow      = sheet.GetRow(0);
                            int    lastcell  = hrow.LastCellNum;
                            string HTMLTable = "<table border='1'>";
                            for (int i = 1; i <= sheet.LastRowNum; i++)
                            {
                                IRow         row1 = sheet.GetRow(i);
                                ReportMaster r    = new ReportMaster();

                                int      _SerialNumber;
                                int      SerialNumber = 0;
                                int      _CategoryID;
                                int      _PublisherID;
                                int      _DeliveryFormatID;
                                DateTime _PublishedDate;
                                int      _NumberOfPages;
                                Decimal  _SingleUserPrice;
                                Decimal  _MultiUserPrice;
                                Decimal  _CorporateUserPrice;
                                bool     IsVaidate       = true;
                                string   _MetaTitle      = "";
                                string   Message         = "";
                                string   ReportTitleTemp = string.Empty;
                                for (int j = 0; j < lastcell; j++)
                                {
                                    if (Convert.ToString(hrow.Cells[j]) == "Serial Number")
                                    {
                                        if (Int32.TryParse(row1.Cells[j].ToString().Trim(), out _SerialNumber))
                                        {
                                            SerialNumber = _SerialNumber;
                                        }
                                        else
                                        {
                                            IsVaidate = false; Message += "Serial Number<br />";
                                        }
                                    }
                                    else if (Convert.ToString(hrow.Cells[j]) == "Category ID")
                                    {
                                        if (Int32.TryParse(row1.Cells[j].ToString().Trim(), out _CategoryID))
                                        {
                                            r.CategoryId = _CategoryID;
                                        }
                                        else
                                        {
                                            IsVaidate = false; Message += "Category ID <br />";
                                        }
                                    }
                                    else if (hrow.Cells[j].ToString() == "Publisher ID")
                                    {
                                        if (Int32.TryParse(row1.Cells[j].ToString().Trim(), out _PublisherID))
                                        {
                                            r.PublishereId = _PublisherID;
                                        }
                                        else
                                        {
                                            IsVaidate = false; Message += "Publisher ID <br />";
                                        }
                                    }
                                    else if (hrow.Cells[j].ToString() == "Delivery Format ID")
                                    {
                                        if (Int32.TryParse(row1.Cells[j].ToString().Trim(), out _DeliveryFormatID))
                                        {
                                            r.ReportDeliveryTypeId = _DeliveryFormatID;
                                        }
                                        else
                                        {
                                            IsVaidate = false; Message += "Delivery Format ID <br />";
                                        }
                                    }
                                    else if (hrow.Cells[j].ToString() == "Title")
                                    {
                                        ReportTitleTemp = Convert.ToString(row1.Cells[j].ToString().Trim());
                                        if (db.ReportMasters.Count(g => g.ReportTitle == ReportTitleTemp) > 0 ? true : false)

                                        {
                                            IsVaidate = false; Message += "Title <br />";
                                        }
                                        else
                                        {
                                            r.ReportTitle = row1.Cells[j].ToString().Trim().Replace("   ", " ").Replace("  ", " ").Replace("  ", " ");
                                        }

                                        r.ReportUrl = ExcellentMarketResearch.Areas.Admin.Models.Common.GenerateSlug(row1.Cells[j].ToString().Trim());

                                        if (db.ReportMasters.Count(url => url.ReportUrl == r.ReportUrl.ToLower()) > 0 ? true : false)
                                        {
                                            r.ReportUrl = ""; IsVaidate = false; Message += "Long URL <br />";
                                        }
                                    }
                                    else if (hrow.Cells[j].ToString() == "Published Date")
                                    {
                                        if (DateTime.TryParse(row1.Cells[j].ToString().Trim(), out _PublishedDate))
                                        {
                                            r.PublishingDate = _PublishedDate;
                                        }
                                        else
                                        {
                                            IsVaidate = false; Message += "Published Date <br />";
                                        }
                                    }
                                    else if (hrow.Cells[j].ToString() == "Number Of Pages")
                                    {
                                        if (Int32.TryParse(row1.Cells[j].ToString().Trim(), out _NumberOfPages))
                                        {
                                            r.NumberOfPages = _NumberOfPages;
                                        }
                                        else
                                        {
                                            IsVaidate = false; Message += "Number Of Pages <br />";
                                        }
                                    }
                                    else if (hrow.Cells[j].ToString() == "Long Description")
                                    {
                                        if (row1.Cells[j].ToString().Trim() != "")
                                        {
                                            r.LongDescritpion = "<pre>" + row1.Cells[j].ToString().Trim() + "</pre>";
                                        }
                                        else
                                        {
                                            IsVaidate = false; Message += "Long Description \n";
                                        }
                                    }
                                    else if (hrow.Cells[j].ToString() == "Long Table Of Content")
                                    {
                                        r.TableOfContent = "<pre>" + row1.Cells[j].ToString().Trim() + "</pre>";
                                    }

                                    else if (hrow.Cells[j].ToString() == "Single User Price")
                                    {
                                        if (Decimal.TryParse(row1.Cells[j].ToString().Trim() == "" ? "0" : row1.Cells[j].ToString().Trim(), out _SingleUserPrice))
                                        {
                                            r.SinglePrice = _SingleUserPrice;
                                        }
                                        else
                                        {
                                            IsVaidate = false; Message += "Single User Price <br />";
                                        }
                                    }
                                    else if (hrow.Cells[j].ToString() == "Multi User Price")
                                    {
                                        if (Decimal.TryParse(row1.Cells[j].ToString().Trim() == "" ? "0" : row1.Cells[j].ToString().Trim(), out _MultiUserPrice))
                                        {
                                            r.MultiUserPrice = _MultiUserPrice;
                                        }
                                        else
                                        {
                                            IsVaidate = false; Message += "Multi User Price <br />";
                                        }
                                    }
                                    else if (hrow.Cells[j].ToString() == "Corporate User Price")
                                    {
                                        if (Decimal.TryParse(row1.Cells[j].ToString().Trim() == "" ? "0" : row1.Cells[j].ToString().Trim(), out _CorporateUserPrice))
                                        {
                                            r.CorporateUserPrice = _CorporateUserPrice;
                                        }
                                        else
                                        {
                                            IsVaidate = false; Message += "Corporate User Price <br />";
                                        }
                                    }
                                }
                                if (r.SinglePrice <= 0 && r.MultiUserPrice <= 0 && r.CorporateUserPrice <= 0)
                                {
                                    IsVaidate = false; Message += "Add Atleast one Price <br />";
                                }

                                if (IsVaidate)
                                {
                                    r.ReportImage = null;

                                    r.IsActive = true;

                                    r.ReportTypeId = r.ReportDeliveryTypeId;
                                    r.CreatedBy    = 1; //Convert.ToInt32(QYGroupRepository.Areas.Admin.Models.CommonCode.MySession());
                                    r.CreatedDate  = DateTime.Now;
                                    //reportlist.Add(r);
                                    db.ReportMasters.Add(r);
                                    db.SaveChanges();
                                    var repturl = r.ReportUrl + ".html";
                                    r.ReportUrl       = repturl;
                                    db.Entry(r).State = EntityState.Modified;
                                    db.SaveChanges();
                                    Message += "Inserted <br/>";
                                }
                                HTMLTable += "<tr><td>" + SerialNumber + "</td><td>" + ReportTitleTemp + "</td><td>" + r.ReportUrl + "</td><td>" + Message + "</td></tr>";
                            }
                            HTMLTable   += "</table>";
                            ViewBag.Html = HTMLTable;
                            return(View());
                            //ViewData.Add("HTMLTable", HTMLTable);
                            //ViewData["HTMLTable"] = HTMLTable;
                        }
                    }



                    catch (Exception ex)
                    {
                        var x = "<br />Report status: The file could not be processed. The following error occured: " + ex.Message;
                    }
                    finally
                    {
                    }
                }
            }
            return(View());
        }
        public ActionResult Index(ContactUsVM eq)
        {
            InquiryVM    e = new InquiryVM();
            Emailsending objEmailsending = new Emailsending();
            var          response        = Request["g-recaptcha-response"];
            var          catptchastatus  = false;
            string       secreatekey     = "6LdU_nUUAAAAAD6JiuKTysnVW6Aa4D5SU0z1Fl4u";
            var          client          = new WebClient();
            string       resstring       = string.Format("https://www.google.com/recaptcha/api/siteverify?secret={0}&response={1}", secreatekey, response);
            var          result          = client.DownloadString(resstring);

            if (result.ToLower().Contains("false"))
            {
                catptchastatus = false;
            }
            else
            {
                catptchastatus = true;
            }

            //int FormTypeId=4;
            string Publisher = string.Empty;

            if (catptchastatus)
            {
                if (ModelState.IsValid)
                {
                    // cap = Session["Captcha"].ToString();
                    var cap = ExcellentMarketResearch.Areas.Admin.Models.Common.Decrypt(eq.RealCaptcha);

                    Publisher = "!";

                    if (eq.CaptchaCode == cap)
                    {
                        CustomerInquiry cst = new CustomerInquiry();

                        cst.CustomerMessage = eq.CustomerMessage;
                        cst.EmailId         = eq.EmailId;
                        cst.Name            = eq.Name;
                        // eq.AreaCode += "-" + eq.PhoneNumber;
                        cst.PhoneNumber = eq.PhoneNumber;
                        cst.ReportId    = eq.ReportId;
                        cst.Country     = eq.Country;
                        cst.CaptchaCode = eq.CaptchaCode;

                        string ReportTitle = string.Empty;
                        string ReportUrl   = string.Empty;

                        try
                        {
                            db.CustomerInquiries.Add(cst);
                            //db.Entry(cst).State = EntityState.Added;

                            db.SaveChanges();

                            //  QYGroupRepository.PaymentGateway.Emailsending objEmailsending = new QYGroupRepository.PaymentGateway.Emailsending();



                            //Auto Mailer
                            objEmailsending.SendEmail("*****@*****.**", "Sales", cst.EmailId, "", "", "ExcellentMarketResearch.com  : ContactUs" + " ", GenerateMailBody_ContactUs_AutoReply(cst.Name, ReportTitle));

                            //To company
                            objEmailsending.SendEmail("*****@*****.**", "Sales", "[email protected],", "", "*****@*****.**", "ExcellentMarketResearch.com " + " : " + "Contact Us", GenerateMailBody_ContactUs(ReportTitle, cst.Name, cst.EmailId, cst.PhoneNumber, "!", "!", "!", cst.CustomerMessage));

                            Session["Name"] = cst.Name;

                            return(RedirectToAction("ContactusThanks", "ContactUs"));
                            //return RedirectToRoute(new
                            //{
                            //    controller = "InquiryForm",
                            //    action = "Index",
                            //    reporrtid = cst.ReportId
                            //});
                        }
                        catch (DbEntityValidationException dbEx)
                        {
                            foreach (var validationErrors in dbEx.EntityValidationErrors)
                            {
                                foreach (var validationError in validationErrors.ValidationErrors)
                                {
                                    System.Console.WriteLine("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage);
                                }
                            }
                        }
                    }
                    //Return the if model not valid
                    return(View());
                }
            }


            return(View(eq));
        }
        public void CreateCategory(DataSet ds)
        {
            DataTable             dtReport     = CreateDataSet();
            DataSet               dsReport     = new DataSet();
            CategoryMaster        r            = new CategoryMaster();
            List <CategoryMaster> categorylist = new List <CategoryMaster>();

            string HTMLTable = "<table border='1'>";

            for (int tables = 0; tables < ds.Tables.Count; tables++)
            {
                #region rowdata
                for (int rows = 0; rows < ds.Tables[tables].Rows.Count; rows++)
                {
                    int      _SerialNumber;
                    int      SerialNumber = 0;
                    int      _CategoryID;
                    int      _PublisherID;
                    int      _DeliveryFormatID;
                    DateTime _PublishedDate;
                    int      _NumberOfPages;
                    Decimal  _SingleUserPrice;
                    Decimal  _MultiUserPrice;
                    Decimal  _CorporateUserPrice;
                    bool     IsVaidate        = true;
                    string   Message          = "";
                    string   CategoryTempName = string.Empty;

                    for (int columns = 0; columns < ds.Tables[tables].Columns.Count; columns++)
                    {
                        if (ds.Tables[tables].Columns[columns].ToString() == "Sr.No")
                        {
                            if (Int32.TryParse(ds.Tables[tables].Rows[rows][columns].ToString().Trim(), out _SerialNumber))
                            {
                                SerialNumber = _SerialNumber;
                            }
                            else
                            {
                                IsVaidate = false; Message += "Serial Number<br />";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "CategoryName")
                        {
                            CategoryTempName = Convert.ToString(ds.Tables[tables].Rows[rows][columns].ToString().Trim());
                            if (db.CategoryMasters.Count(g => g.CategoryName == CategoryTempName) > 0 ? true : false)

                            {
                                IsVaidate = false; Message += "Title <br />";
                            }
                            else
                            {
                                r.CategoryName = ds.Tables[tables].Rows[rows][columns].ToString().Trim().Replace("   ", " ").Replace("  ", " ").Replace("  ", " ");
                            }

                            r.CategoryUrl = ExcellentMarketResearch.Areas.Admin.Models.Common.GenerateSlug(ds.Tables[tables].Rows[rows][columns].ToString().Trim());

                            if (db.CategoryMasters.Count(url => url.CategoryUrl == r.CategoryUrl.ToLower()) > 0 ? true : false)
                            {
                                r.CategoryUrl = ""; IsVaidate = false; Message += "Long URL <br />";
                            }
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "ParentCategoryId")
                        {
                            r.ParentCategoryId = Convert.ToInt32(ds.Tables[tables].Rows[rows][columns].ToString());
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "ShortDescription")
                        {
                            r.ShortDescription = ds.Tables[tables].Rows[rows][columns].ToString().Trim();
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "LongDescription")
                        {
                            r.LongDescription = ds.Tables[tables].Rows[rows][columns].ToString().Trim();
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "MetaTitle")
                        {
                            r.MetaTitle = ds.Tables[tables].Rows[rows][columns].ToString().Trim();
                        }

                        else if (ds.Tables[tables].Columns[columns].ToString() == "Keywords")
                        {
                            r.Keywords = ds.Tables[tables].Rows[rows][columns].ToString().Trim();
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "IsActive")
                        {
                            r.IsActive = true; //ds.Tables[tables].Rows[rows][columns].ToString().Trim();
                        }
                        else if (ds.Tables[tables].Columns[columns].ToString() == "MetaDescription")
                        {
                            r.MetaDescription = ds.Tables[tables].Rows[rows][columns].ToString().Trim();
                        }
                    }


                    //Save data in Database.
                    if (IsVaidate)
                    {
                        //  r.ReportImage = null;
                        //  r.ListOfCharts = null;
                        //  r.FreeAnalysis = null;
                        //   r.Summary = "null";
                        //   r.Methodology = null;

                        // r.DiscountPrice = 0;
                        r.IsActive = true;
                        // r.IsUpcomming = true;
                        //  r.ReportTypeId = r.ReportDeliveryTypeId;
                        r.CreatedBy   = 1;//Convert.ToInt32(QYGroupRepository.Areas.Admin.Models.CommonCode.MySession());
                        r.CreatedDate = DateTime.Now;
                        categorylist.Add(r);



                        try
                        {
                            db.CategoryMasters.Add(r);
                            db.SaveChanges();
                        }
                        catch (DbEntityValidationException ex)
                        {
                            foreach (var validationError in ex.EntityValidationErrors)
                            {
                                foreach (var validationerrors in validationError.ValidationErrors)
                                {
                                    System.Console.WriteLine("property name{0}", validationerrors.PropertyName);
                                }
                            }
                        }
                        //var repturl = r.ReportUrl + ".html";
                        //  r.ReportUrl = repturl;
                        //// db.Entry(r).State = EntityState.Modified;
                        //db.SaveChanges();

                        //PriceMaster p = new PriceMaster();

                        //p.PriceType = "Single User Price ";
                        //p.Price = r.PriceSingleUser;
                        //db.PriceMasters.Add(p);
                        //db.SaveChanges();

                        //p.PriceType = "Multi User Price ";
                        //p.Price = r.PriceMultiUser;
                        //db.PriceMasters.Add(p);
                        //db.SaveChanges();

                        //p.PriceType = "Corporate User Price ";
                        //p.Price = r.PriceCUL;
                        //db.PriceMasters.Add(p);
                        //db.SaveChanges();

                        Message += "Inserted <br/>";
                    }
                    HTMLTable += "<tr><td>" + SerialNumber + "</td><td>" + CategoryTempName + "</td><td>" + r.CategoryUrl + "</td><td>" + Message + "</td></tr>";
                }
                HTMLTable += "</table>";

                ViewData.Add("HTMLTable", HTMLTable);
                #endregion rows
            }
            //return View();
        }