Exemple #1
0
        static void Main(string[] args)
        {
            SocrataDataDAL    socrataDataDAL = new SocrataDataDAL();
            DatabaseMaxValues result         = socrataDataDAL.GetMaxValues();

            socrataDataDAL.InsertAllMapPluto(result.OBJECTID);
            socrataDataDAL.InsertAllEnergy(result.generation_date);
            socrataDataDAL.InsertAllPermits(result.dobrundate);
            socrataDataDAL.InsertAllViolations(result.issue_date);
            socrataDataDAL.InsertAllEvictions(result.EXECUTED_DATE);
            socrataDataDAL.InsertAllDistricts(result.DistrictOBJECTID);
            socrataDataDAL.InsertAllElevators(result.filing_date);
            socrataDataDAL.InsertAllPropertySales(result.sale_date);
            socrataDataDAL.InsertAllEcbViolations(result.ecb_issue_date);
            socrataDataDAL.InsertAllSafetyFacadesComplianceFilings(result.filing_date_sfcf);
            socrataDataDAL.CheckAlerts(result.OBJECTID);


            //socrataDataDAL.InsertAllDesignations(0);
            //socrataDataDAL.InsertAllConsumerProfiles(2018);
            //socrataDataDAL.ReadTextFile();
            //socrataDataDAL.DownloadAllTextFiles();
            //socrataDataDAL.DownloadBls();


            //socrataDataDAL.hpd_contacts_insert();
            //socrataDataDAL.hpd_registrations_insert();
            //socrataDataDAL.hpd_violations_insert();
        }
        public JsonResult CreateAlert(string AlertName, string AlertFrequency, string AlertQuery, bool IsPlutoSearch, bool IsEnergySearch, bool IsPermitSearch, bool IsViolationSearch, bool IsEvictionSearch, bool IsElevatorSearch, bool IsPropertySalesSearch, string ProjectSearchAdditional)
        {
            string msg = "Alert created successfully";

            try
            {
                DatabaseMaxValues result  = IsPlutoSearch ? mainDAL.GetMaxValues() : new DatabaseMaxValues();
                MyAlert           myAlert = new MyAlert()
                {
                    Username                = GlobalVariables.GetFromCookie("NYCUser", "Username"),
                    AlertName               = AlertName,
                    AlertQuery              = AlertQuery,
                    Frequency               = Convert.ToInt32(AlertFrequency),
                    Last_OBJECTID           = IsPlutoSearch ? result.OBJECTID : null,
                    IsEnergySearch          = IsEnergySearch,
                    IsPermitSearch          = IsPermitSearch,
                    IsViolationSearch       = IsViolationSearch,
                    IsEvictionSearch        = IsEvictionSearch,
                    IsElevatorSearch        = IsElevatorSearch,
                    IsPropertySalesSearch   = IsPropertySalesSearch,
                    ProjectSearchAdditional = ProjectSearchAdditional,
                    DateCreated             = DateTime.Now,
                    Last_DateCheck          = DateTime.Now,
                    Next_DateCheck          = AlertFrequency == "7" ? DateTime.Now.AddDays(7) : DateTime.Now.AddDays(1),
                    IsUnread                = false
                };
                db.MyAlerts.Add(myAlert);
                db.SaveChanges();
                return(Json(new { msg }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return(Json(new { msg }, JsonRequestBehavior.AllowGet));
            }
        }