Ejemplo n.º 1
0
        public bool EditCategoryPost(CategoryVM cat)
        {
            cat.ModifiedBy   = 1;
            cat.ModifiedDate = DateTime.Now;

            if (cat.ParentCategoryId == null)
            {
                cat.ParentCategoryId = 0;
            }
            bool flag = false;

            if (cat.CategoryURL == null)
            {
                var caturl = ExcellentMarketResearch.Areas.Admin.Models.Common.GenerateSlug(cat.CategoryName);
                // cat.CategoryURL = caturl + "-" + cat.CategoryId;
                cat.CategoryURL = caturl;
                if (IsSameCategoryDetails(cat) || !IsCategoryNameExist(cat))
                {
                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    var            s    = serializer.Serialize(cat);
                    CategoryMaster catm = serializer.Deserialize <CategoryMaster>(s);
                    db.Entry(catm).State = EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    flag = true;
                }
            }
            else
            {
                if (IsSameCategoryDetails(cat) || !IsCategoryNameExist(cat))
                {
                    JavaScriptSerializer serializer = new JavaScriptSerializer();
                    var            s    = serializer.Serialize(cat);
                    CategoryMaster catm = serializer.Deserialize <CategoryMaster>(s);
                    db.Entry(catm).State = EntityState.Modified;
                    db.SaveChanges();
                }
                else
                {
                    flag = true;
                }
            }
            return(flag);
        }
Ejemplo n.º 2
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"));
        }
Ejemplo n.º 3
0
        public void PublisherEdit(PublisherVM pub)
        {
            pub.ModifiedBy   = 1;
            pub.ModifiedDate = DateTime.Now;
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            var             publish         = serializer.Serialize(pub);
            PublisherMaster pubmast         = serializer.Deserialize <PublisherMaster>(publish);

            db.Entry(pubmast).State = EntityState.Modified;
            db.SaveChanges();
        }
Ejemplo n.º 4
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();
        }
Ejemplo n.º 5
0
        public void EditpostNews(NewsVM z)
        {
            NewsMaster news = new NewsMaster();

            news.ModifiedBy      = 1;
            news.ModifiedDate    = DateTime.Now;
            news.CategoryId      = z.CategoryId;
            news.NewsDescription = z.NewsDetail;
            news.NewsId          = z.NewsId;
            news.PublishingDate  = z.NewsPublishingDate;
            news.NewsTitle       = z.NewsTitle;
            news.NewsUrl         = z.NewsURL;
            news.IsActive        = z.IsActive;
            news.CreatedBy       = z.CreatedBy;
            news.CreatedDate     = z.CreatedDate;
            news.Keywords        = z.MetaKeywords;
            news.MetaTitle       = z.MetaTitle;
            news.MetaDescritpion = z.MetaDescription;
            //JavaScriptSerializer serializer = new JavaScriptSerializer();
            //var s = serializer.Serialize(news);
            //NewsMaster newsmaster = serializer.Deserialize<NewsMaster>(s);
            try
            {
                db.Entry(news).State = EntityState.Modified;
                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);
                    }
                }
            }
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
0
        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();
        }
Ejemplo n.º 8
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());
        }
Ejemplo n.º 9
0
        public ActionResult paypalprocess(PayPalResponse response)
        {
            var      mailbody      = new ExcellentMarketResearch.Models.PaymentGateway.Emailsending();
            string   paymentstatus = string.Empty;
            BuyingVM buy           = new BuyingVM();
            var      userdata      = (from b in db.BuyingInfoes
                                      where b.GuId == response.guid
                                      select b).FirstOrDefault();
            var userreport = (from r in db.ReportMasters
                              where r.ReportId == userdata.ReportId
                              select new { r.ReportTitle, r.ReportUrl }).FirstOrDefault();

            buy.Name        = userdata.Name;
            buy.ReportTitle = userreport.ReportTitle.ToString();
            buy.ReportUrl   = userreport.ReportUrl.ToString();
            buy.Company     = userdata.Company;
            buy.EmailId     = userdata.EmailId;
            buy.Country     = userdata.Country;
            buy.IPAddress   = userdata.IPAddress;
            buy.PhoneNumber = userdata.PhoneNumber;
            buy.Designation = userdata.Designation;


            var updatestatus = db.BuyingInfoes.Where(x => x.GuId == response.guid).FirstOrDefault();

            // b.PaymentTransaction = true;
            //updatestatus.PaymentTransaction = response.PaymentTransaction;
            updatestatus.PaymentStatus   = response.PaymentStatus;
            updatestatus.Intent          = response.Intent;
            updatestatus.PaymentId       = response.PaymentID;
            updatestatus.PayerId         = response.PAYERID;
            updatestatus.OrderId         = Convert.ToInt32(response.OrderID);
            updatestatus.Token           = response.TOKEN;
            updatestatus.ACK             = response.ACK;
            db.Entry(updatestatus).State = EntityState.Modified;
            db.SaveChanges();


            if (response.PaymentStatus == "Success")
            {
                paymentstatus = "dear admin, payment made for <br /><br />";

                //auto mailer
                objEmailsending.SendEmail("*****@*****.**", "sales", userdata.EmailId, "", "*****@*****.**", "Excellent Market Research :payment confirmation ", mailbody.GenerateMailBody_PaymentMade(paymentstatus, buy));

                //to company
                objEmailsending.SendEmail("*****@*****.**", userdata.Name, "*****@*****.**", "*****@*****.**", ".com", "Excellent Market Research " + " :payment confirmation(paypal) ", mailbody.GenerateMailBody_PaymentMade_AutoReply(userdata.Name.ToString(), userreport.ReportTitle.ToString()));

                return(Json(new
                {
                    msg = "sucess"
                          //return RedirectToAction("Index", "InquiryForm", new { reportid = ObjBuy.ReportId });
                }));
                // return RedirectToAction("sucess", "paymentprocess");
            }
            else if (response.PaymentStatus == "Cancel")
            {
                return(Json(new
                {
                    msg = "Cancel"
                          //return RedirectToAction("Index", "InquiryForm", new { reportid = ObjBuy.ReportId });
                }));
            }
            else
            {
                paymentstatus = "dear admin, payment canceled or unapproved for report<br /><br />";


                //to buyer
                objEmailsending.SendEmail("*****@*****.**", "sales", userdata.EmailId, "", "", "Excellent Market Research : " + " : payment cancel(pay pal)", mailbody.GenerateMailBody_PaypalError_AutoReply(buy.Name, buy.ReportTitle, buy.ReportUrl));

                //to company
                objEmailsending.SendEmail("*****@*****.**", userdata.Name, "*****@*****.**", "*****@*****.**", "", "Excellent Market Research" + " : payment cancel(pay pal)", mailbody.GenerateMailBody_PaypalError_AutoReply(userdata.Name.ToString(), userreport.ReportTitle.ToString(), userreport.ReportUrl.ToString()));

                return(Json(new
                {
                    msg = "failure"
                          //return RedirectToAction("Index", "InquiryForm", new { reportid = ObjBuy.ReportId });
                }));
                //return RedirectToAction("failure", "paymentprocess");
            }
        }