Esempio n. 1
0
        public ActionResult UpcomingRenewalExportToCsv()
        {
            try
            {
                ConvertToCSV objCSV = new ConvertToCSV();

                string FilePath = "~/Content/Resources/Reports/csvData.csv";
                objCSV.fncDeleteFile(FilePath);

                ReportsHelper objLedgerHelper             = new ReportsHelper();
                UpcomingRenewalReportModel objLedgerModel = new UpcomingRenewalReportModel
                {
                    PageNumber = 1,
                    PageSize   = 100000000
                };

                List <UpcomingRenewalReportModel> listLedgerModel = objLedgerHelper.GetUpcomingRenewalReport(objLedgerModel);
                DataTable dt = new DataTable();
                dt.Columns.Add("Name");
                dt.Columns.Add("Email address");
                dt.Columns.Add("Strata name");
                dt.Columns.Add("Contact number");
                dt.Columns.Add("Register on");
                dt.Columns.Add("Unique name");
                dt.Columns.Add("Subscription expiring on");
                if (listLedgerModel.Count() != 0)
                {
                    foreach (var item in listLedgerModel)
                    {
                        DataRow row = dt.NewRow();
                        row["Name"]                     = item.FirstName + " " + item.LastName;
                        row["Email address"]            = item.EmailId;
                        row["Strata name"]              = item.StratasBoardName;
                        row["Contact number"]           = item.ContactNumber;
                        row["Register on"]              = AppLogic.GetDateFromatForCsv(item.CreatedOn);
                        row["Unique name"]              = item.PortalLink;
                        row["Subscription expiring on"] = AppLogic.GetDateFromatForCsv(item.ExpiryDate);
                        dt.Rows.Add(row);
                    }
                }

                if (dt.Rows.Count > 0)
                {
                    objCSV.CreateCSVFile(dt, Server.MapPath("~/Content/Resources/Reports/") + "csvData.csv");
                    objCSV.FncDownLoadFiles("UpcomingRenewal_" + DateTime.Now.ToShortDateString() + ".csv", FilePath);
                }
            }
            catch (Exception Ex)
            {
                string Err = Ex.Message.ToString();
            }
            return(Redirect(Url.Content("~/securehost/rootlogin/report/upcomingrenewal")));
        }
Esempio n. 2
0
        public ActionResult ContactUsExportToCsv()
        {
            try
            {
                ConvertToCSV objCSV = new ConvertToCSV();

                string FilePath = "~/Content/Resources/Reports/csvData.csv";
                objCSV.fncDeleteFile(FilePath);

                ReportsHelper        objLedgerHelper = new ReportsHelper();
                ContactUsReportModel objLedgerModel  = new ContactUsReportModel
                {
                    PageNumber = 1,
                    PageSize   = 100000000
                };

                List <ContactUsReportModel> listLedgerModel = objLedgerHelper.GetContactUsReport(objLedgerModel);

                DataTable dt = new DataTable();
                dt.Columns.Add("Name");
                dt.Columns.Add("Email Address");
                dt.Columns.Add("Message");
                dt.Columns.Add("Created On");


                if (listLedgerModel.Count() != 0)
                {
                    foreach (var item in listLedgerModel)
                    {
                        DataRow row = dt.NewRow();
                        row["Name"]          = item.FirstName;
                        row["Email Address"] = item.EmailAddress;
                        row["Message"]       = item.Message;
                        row["Created On"]    = StratasFair.Business.CommonHelper.AppLogic.GetDateFromatForCsv(item.CreatedOn);
                        dt.Rows.Add(row);
                    }
                }



                if (dt.Rows.Count > 0)
                {
                    objCSV.CreateCSVFile(dt, Server.MapPath("~/Content/Resources/Reports/") + "csvData.csv");

                    objCSV.FncDownLoadFiles("ContactUs_" + DateTime.Now.ToShortDateString() + ".csv", FilePath);
                }
            }
            catch (Exception Ex)
            {
                string Err = Ex.Message.ToString();
            }
            return(Redirect(Url.Content("~/securehost/rootlogin/report/contactus")));
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            try
            {
                if (args == null || args.Count() < 1)
                {
                    Console.WriteLine("WebImportReport <input dir>");
                    Console.WriteLine("\n\rPress enter to exit");
                    Console.ReadLine();
                    return;
                }

                var inputDir = args[0];
                if (!Directory.Exists(args[0]))
                {
                    Console.WriteLine($"Input dir {inputDir} does not exist");
                    Console.WriteLine("\n\rPress enter to exit");
                    Console.ReadLine();
                    return;
                }

                var converter = new ConvertToCSV();
                var statuses  = converter.ConvertFiles(inputDir, "paamelding*.xml");
                if (statuses.Any())
                {
                    var outputStatuses = string.Join("\n\r", statuses);
                    Console.WriteLine("\n\r");
                    Console.WriteLine(outputStatuses);
                }
                Console.WriteLine("\n\rPress enter to exit");
                Console.ReadLine();
            }
            catch (Exception exception)
            {
                Console.WriteLine("Error occured.");
                Console.WriteLine(exception.Message);
                Console.WriteLine("\n\rPress enter to exit");
                Console.ReadLine();
            }
        }
Esempio n. 4
0
        public ActionResult ClientExportToCsv(string dfrom, string dto, string kw)
        {
            try
            {
                ConvertToCSV objCSV = new ConvertToCSV();

                string FilePath = "~/Content/Resources/Reports/csvData.csv";
                objCSV.fncDeleteFile(FilePath);

                StrataBoardHelper objLedgerHelper = new StrataBoardHelper();
                StrataBoardModel  objLedgerModel  = new StrataBoardModel
                {
                    PageNumber = 1,
                    PageSize   = 100000000
                };

                objLedgerModel.ExpiredOnFrom = DateTime.Parse(dfrom);
                objLedgerModel.ExpiredOnTo   = DateTime.Parse(dto);
                objLedgerModel.Keyword       = kw;


                List <StrataBoardModel> listLedgerModel = objLedgerHelper.GetAll(objLedgerModel);

                DataTable dt = new DataTable();
                dt.Columns.Add("Stratasboard name");
                dt.Columns.Add("Unique name");
                dt.Columns.Add("Name");
                dt.Columns.Add("Email address");

                dt.Columns.Add("Contact number");
                dt.Columns.Add("Created on");
                dt.Columns.Add("Subscription name");
                dt.Columns.Add("Validity");
                dt.Columns.Add("Expiration date");
                dt.Columns.Add("Allowed user");
                dt.Columns.Add("IsSmsForAlert");
                dt.Columns.Add("IsSmsForReminder");
                dt.Columns.Add("Status");

                if (listLedgerModel.Count() != 0)
                {
                    foreach (var item in listLedgerModel)
                    {
                        DataRow row = dt.NewRow();
                        row["Stratasboard name"] = item.StratasBoardName;
                        row["Unique name"]       = item.PortalLink;
                        row["Name"]          = item.FirstName + " " + item.LastName;
                        row["Email address"] = item.EmailId;

                        row["Contact number"]    = item.ContactNumber;
                        row["Created on"]        = AppLogic.GetDateFromatForCsv(Convert.ToDateTime(item.CreatedOn));
                        row["Subscription name"] = item.SubscriptionName;
                        row["Validity"]          = item.ValidityText;
                        row["Expiration date"]   = AppLogic.GetDateFromatForCsv(Convert.ToDateTime(item.ExpiryDate));
                        row["Allowed user"]      = item.AllowedUser;
                        row["IsSmsForAlert"]     = AppLogic.GetYesNo(item.IsSmsForAlert);
                        row["IsSmsForReminder"]  = AppLogic.GetYesNo(item.IsSmsForReminder);
                        row["Status"]            = AppLogic.GetStatus(item.Status.ToString());
                        dt.Rows.Add(row);
                    }
                }

                if (dt.Rows.Count > 0)
                {
                    objCSV.CreateCSVFile(dt, Server.MapPath("~/Content/Resources/Reports/") + "csvData.csv");

                    objCSV.FncDownLoadFiles("stratasboard_" + DateTime.Now.ToShortDateString() + ".csv", FilePath);
                }
            }
            catch (Exception Ex)
            {
                string Err = Ex.Message.ToString();
            }
            return(Redirect(Url.Content(ConfigurationManager.AppSettings["WebsiteRootPath"] + "securehost/rootlogin/client")));
        }