Ejemplo n.º 1
0
        static void InsertBusinessNote(Business_Note business_note)
        {
            using (SqlConnection con = new SqlConnection(contact_connectionString))
            {
                SqlCommand cmd = new SqlCommand("AddBusinessNote", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@business_id", business_note.Business_ID);
                cmd.Parameters.AddWithValue("@note_text", business_note.Note_Text);
                cmd.Parameters.AddWithValue("@note_user", ReplaceEmpty(business_note.Note_User));
                cmd.Parameters.AddWithValue("@note_date", ReplaceEmpty(business_note.Note_Date));


                con.Open();
                int j = cmd.ExecuteNonQuery();
                con.Close();

                if (j >= 1)
                {
                    Console.WriteLine("Sucessfully wrote Business Note with ID: " + business_note.Business_ID);
                }
                else
                {
                    Console.WriteLine("Error writing Business Note with ID: " + business_note.Business_ID);
                }
            }
        }
Ejemplo n.º 2
0
        static void ProcessBusiness(EnerGovSource source)
        {
            string[] split = source.BTR_IDs.Split(";");
            Console.WriteLine("Processing Business Object with Contact ID of " + source.Contact_ID + " and " + split[0]);

            using (SqlConnection bus_con = new SqlConnection(contact_connectionString))
            {
                SqlCommand bus_command = new SqlCommand("GetBusinessInfo", bus_con);
                bus_command.CommandType = CommandType.StoredProcedure;

                bus_command.Parameters.AddWithValue("@refnum", split[0]);

                bus_con.Open();

                SqlDataReader bus_rdr = bus_command.ExecuteReader();

                while (bus_rdr.Read())
                {
                    Globals.counter = Globals.counter + 1;
                    Business business = new Business()
                    {
                        Business_ID          = ReturnFormattedID(Globals.counter),
                        Contact_ID           = source.Contact_ID,
                        Ownership_Type       = bus_rdr["Ownership"].ToString(),
                        Location_Type        = "Commercial",
                        Business_Status      = "Active",
                        District             = bus_rdr["district"].ToString(),
                        Open_Date            = bus_rdr["open_date"].ToString(),
                        Business_Description = "",
                        Closed_Date          = "",
                        Federal_ID_Number    = bus_rdr["federal_id_number"].ToString(),
                        State_ID_Number      = "",
                        DBA = "",
                        Legacy_Data_Source_Name = "BTR"
                    };

                    Console.WriteLine("New Business Object created with ID: " + ReturnFormattedID(Globals.counter));

                    Business_Address business_address = new Business_Address()
                    {
                        Business_ID       = ReturnFormattedID(Globals.counter),
                        Main_Address      = true,
                        Address_Type      = "Location",
                        Street_Number     = bus_rdr["street_number"].ToString(),
                        Pre_Direction     = bus_rdr["pre_direction"].ToString(),
                        Street_Name       = bus_rdr["street_name"].ToString(),
                        Street_Type       = bus_rdr["street_type"].ToString(),
                        Post_Direction    = "",
                        Unit_Suite_Number = bus_rdr["unit_suite_number"].ToString(),
                        Address_Line_3    = "",
                        PO_Box            = "",
                        City             = bus_rdr["city"].ToString(),
                        State_Code       = "FL",
                        Zip              = bus_rdr["zip"].ToString(),
                        County_Code      = "",
                        Country_Code     = "",
                        Country_Type     = "US",
                        Last_Update_Date = "",
                        Last_Update_User = ""
                    };



                    Business_Note business_note = new Business_Note()
                    {
                        Business_ID = ReturnFormattedID(Globals.counter),
                        Note_Text   = bus_rdr["note_text"].ToString(),
                        Note_User   = "",
                        Note_Date   = ""
                    };



                    /*
                     * Business_Parcel business_parcel = new Business_Parcel()
                     * {
                     *  Business_ID = ReturnFormattedID(Globals.counter),
                     *  Parcel_Number = bus_rdr["note_text"].ToString(),
                     *  Main_Parcel = true
                     * };*/

                    /*
                     * //Business Additional Fields
                     * Business_Additional_Fields business_additional_fields = new Business_Additional_Fields
                     * {
                     *  Business_ID = ReturnFormattedID(Globals.counter),
                     *  Exemptions = bus_rdr["Exemption"].ToString(),
                     *  NewHomeBasedBusiness  = bus_rdr["NewHomeBasedBusiness"].ToString(),
                     *  NotForProfitBusiness = bus_rdr["NotForProfitBusiness"].ToString(),
                     *  OfAdditionalClassifications = Convert.ToDecimal(bus_rdr["OfAdditionalClassifications"])
                     * };*/

                    InsertBusiness(business);
                    InsertBusinessAddress(business_address);
                    // InsertBusinessParcel(business_parcels);
                    InsertBusinessNote(business_note);
                    // InsertBusinessAdditionalFields(business_additional_fields);
                }
            }
        }