コード例 #1
0
 public IList <AppointmentSheet> AppointmentQueue(int said, Boolean reschedule)
 {
     assignableAppointments.Clear();
     using (Npgsql.NpgsqlConnection conn = new Npgsql.NpgsqlConnection(Infrastructure.ConfigReader.ConnectionString.ToString()))
     {
         conn.Open();
         using (Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(GetAppointmentQueueQuery, conn))
         {
             command.Parameters.Add(new Npgsql.NpgsqlParameter(":salesagent", NpgsqlTypes.NpgsqlDbType.Integer));
             command.Parameters.Add(new Npgsql.NpgsqlParameter(":reschedule", NpgsqlTypes.NpgsqlDbType.Boolean));
             command.Prepare();
             command.Parameters[0].Value = said;
             command.Parameters[1].Value = reschedule;
             using (Npgsql.NpgsqlDataReader dr = command.ExecuteReader())
             {
                 while (dr.Read())
                 {
                     AppointmentSheet newAppointment = populateAppointmentFromDB(dr);
                     assignableAppointments.Add(newAppointment);
                 }
             }
         }
     }
     return(assignableAppointments);
 }
コード例 #2
0
        public IEnumerable <AppointmentSheet> GetAppointmentByLeadId(int leadId)
        {
            //Please see section on using prepared statements in npgsql user manual for explanation on params and query structure
            IList <Domain.AppointmentSheet> leadAppointments = new List <Domain.AppointmentSheet>();

            using (Npgsql.NpgsqlConnection conn = new Npgsql.NpgsqlConnection(Infrastructure.ConfigReader.ConnectionString.ToString()))
            {
                conn.Open();
                using (Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(AppointmentSelectonLeadIDQuery, conn))
                {
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("leadid", NpgsqlTypes.NpgsqlDbType.Integer));
                    command.Prepare();
                    command.Parameters[0].Value = leadId;

                    using (Npgsql.NpgsqlDataReader dr = command.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            AppointmentSheet newAppointment = populateAppointmentFromDB(dr);
                            leadAppointments.Add(newAppointment);
                        }
                    }
                }
            }

            return(leadAppointments);
        }
コード例 #3
0
        public void DeleteAppointmentSheet(AppointmentSheet appointment)
        {
            var temp = fakeAppointment.ToList();

            temp.RemoveAll(row => row.AppointmentSheetId == appointment.AppointmentSheetId);
            //temp.RemoveAll(row => row.AppointmentSheetId == appointment.AppointmentSheetId && row.ParentLeadId == row.ParentLeadId);
            //temp.RemoveAll(row => row.ParentLeadId == appointment.ParentLeadId);
            fakeAppointment = temp;
        }
コード例 #4
0
        public JsonResult updateEventId(FormCollection updatedCalendarEvent)
        {
            CalendarEventViewModel cevm   = new CalendarEventViewModel();
            CalendarEvent          events = new CalendarEvent();
            string lead   = updatedCalendarEvent[19].Substring(0, 5);
            int    LeadId = Int32.Parse(lead);

            LeadId = Int32.Parse(lead);
            AppointmentSheetViewModel avm  = new AppointmentSheetViewModel();
            AppointmentSheet          asvm = new AppointmentSheet()
            {
                ParentLeadId = LeadId
            };
            string starttemp = updatedCalendarEvent[14].Remove(0, 4);

            starttemp = starttemp.Remove(20);
            string endtemp = updatedCalendarEvent[15].Remove(0, 4);

            endtemp = endtemp.Remove(20);
            DateTime tempstart = DateTime.Parse(starttemp);

            events.start = tempstart.ToString("yyyy-MM-ddTHH':'mm':'ss'.'fff'-'05':'00");
            DateTime tempend = DateTime.Parse(endtemp);

            events.end                   = tempend.ToString("yyyy-MM-ddTHH':'mm':'ss'.'fff'-'05':'00");
            events.id                    = Int32.Parse(updatedCalendarEvent[0]);
            events.title                 = updatedCalendarEvent[1].ToString();
            events.street                = updatedCalendarEvent[6].ToString();
            events.city                  = updatedCalendarEvent[7].ToString();
            events.state                 = updatedCalendarEvent[8].ToString();
            events.Parent_User_Id        = Int32.Parse(updatedCalendarEvent[17]);
            events.Parent_Appointment_Id = Int32.Parse(updatedCalendarEvent[18]);
            events.Appointment_Reference = updatedCalendarEvent[19].ToString();
            events.zipcode               = Int32.Parse(updatedCalendarEvent[10]);
            events.appointment           = Boolean.Parse(updatedCalendarEvent[4]);
            events.creator               = Int32.Parse(updatedCalendarEvent[12]);
            asvm.Street                  = updatedCalendarEvent[6].ToString();;
            asvm.City                    = updatedCalendarEvent[7].ToString();
            asvm.State                   = updatedCalendarEvent[8].ToString();
            asvm.Event_Reference         = updatedCalendarEvent[19].ToString();
            asvm.ZipCode                 = Int32.Parse(updatedCalendarEvent[10]);
            asvm.AssignedSalesAgent      = Int32.Parse(updatedCalendarEvent[17]);
            asvm.AppointmentDateFrom     = tempstart;
            asvm.AppointmentDateTo       = tempend;
            asvm.AppointmentSheetId      = events.Parent_Appointment_Id;
            string parentlead = events.Appointment_Reference.Substring(0, 5);

            asvm.ParentLeadId     = Int32.Parse(parentlead);
            asvm.DayOfAppointment = tempstart;
            asvm.LastUpdated      = Convert.ToDateTime(DateTime.Now);
            asvm.CreatorId        = events.creator;
            avm.appointmentSheet  = asvm;
            cevm.calendarEvent    = events;
            _eventsRepository.SaveCalendarEvent(cevm.calendarEvent);
            _appointmentsRepository.SaveAppointmentSheetFromCalendar(avm.appointmentSheet);
            return(null);
        }
コード例 #5
0
 public void DeleteAppointmentSheet(AppointmentSheet appointment)
 {
     using (Npgsql.NpgsqlConnection conn = new Npgsql.NpgsqlConnection(Infrastructure.ConfigReader.ConnectionString.ToString()))
     {
         conn.Open();
         using (Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(AppointmentDeleteQuery, conn))
         {
             command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentid", NpgsqlTypes.NpgsqlDbType.Integer));
             command.Prepare();
             command.Parameters[0].Value = appointment.AppointmentSheetId;
             int rowsAffected = command.ExecuteNonQuery();
         }
     }
 }
コード例 #6
0
 public void SaveAppointmentSheet(AppointmentSheet appointment)
 {
     // If it's a new appointment, just add it to the list
     if (appointment.AppointmentSheetId == 0)
     {
         appointment.AppointmentSheetId = counter;
         counter += 1;
         fakeAppointment.Add(appointment);
     }
     else if (fakeAppointment.Count(row => row.AppointmentSheetId == appointment.AppointmentSheetId) == 1)
     {
         //This is an update. Remove old one, insert new one
         DeleteAppointmentSheet(appointment);
         fakeAppointment.Add(appointment);
     }
 }
コード例 #7
0
        private static AppointmentSheet populateAppointmentFromDB(Npgsql.NpgsqlDataReader dr)
        {
            AppointmentSheet newAppointment = new AppointmentSheet();

            newAppointment.AppointmentSheetId  = Helper.ConvertFromDBVal <int>(dr[0]);
            newAppointment.AddingServices      = Helper.ConvertFromDBVal <bool>(dr[1]);
            newAppointment.AppointmentLocation = dr[2].ToString();
            newAppointment.AssignedSalesAgent  = Helper.ConvertFromDBVal <int>(dr[3]);
            newAppointment.City      = dr[4].ToString();
            newAppointment.Comment   = dr[5].ToString();
            newAppointment.CreatedAt = Helper.ConvertFromDBVal <DateTime>(dr[6]);
            newAppointment.CurrentlyAcceptingCards = Helper.ConvertFromDBVal <bool>(dr[7]);
            newAppointment.CurrentProcessor        = dr[8].ToString();
            newAppointment.DayOfAppointment        = Helper.ConvertFromDBVal <DateTime>(dr[9]);
            newAppointment.HowManyLocations        = Helper.ConvertFromDBVal <int>(dr[10]);
            newAppointment.Internet            = Helper.ConvertFromDBVal <bool>(dr[11]);
            newAppointment.LastUpdated         = Helper.ConvertFromDBVal <DateTime>(dr[12]);
            newAppointment.Moto                = Helper.ConvertFromDBVal <bool>(dr[13]);
            newAppointment.MultiLocation       = Helper.ConvertFromDBVal <bool>(dr[14]);
            newAppointment.NewEquipment        = Helper.ConvertFromDBVal <bool>(dr[15]);
            newAppointment.NewSetUp            = Helper.ConvertFromDBVal <Boolean>(dr[16]);
            newAppointment.Price               = Helper.ConvertFromDBVal <Boolean>(dr[17]);
            newAppointment.Score               = dr[18].ToString();
            newAppointment.SingleLocation      = Helper.ConvertFromDBVal <Boolean>(dr[19]);
            newAppointment.State               = dr[20].ToString();
            newAppointment.Street              = dr[21].ToString();
            newAppointment.Swipe               = Helper.ConvertFromDBVal <bool>(dr[22]);
            newAppointment.Unhappy             = Helper.ConvertFromDBVal <bool>(dr[23]);
            newAppointment.Volume              = dr[24].ToString();
            newAppointment.ZipCode             = Helper.ConvertFromDBVal <int>(dr[25]);
            newAppointment.CreatorId           = Helper.ConvertFromDBVal <int>(dr[26]);
            newAppointment.ParentLeadId        = Helper.ConvertFromDBVal <int>(dr[27]);
            newAppointment.Location            = dr[28].ToString();
            newAppointment.AppointmentDateFrom = Helper.ConvertFromDBVal <DateTime>(dr[29]);
            newAppointment.AppointmentDateTo   = Helper.ConvertFromDBVal <DateTime>(dr[30]);
            newAppointment.Reschedule          = Helper.ConvertFromDBVal <bool>(dr[31]);
            newAppointment.CreatorName         = dr[32].ToString();
            newAppointment.SingleLocCheck      = Helper.ConvertFromDBVal <bool>(dr[33]);
            newAppointment.Event_Reference     = (dr[34]).ToString();

            return(newAppointment);
        }
コード例 #8
0
 public IList <AppointmentSheet> AssignAppointments(int appointmentid)
 {
     assignableAppointments.Clear();
     using (Npgsql.NpgsqlConnection conn = new Npgsql.NpgsqlConnection(Infrastructure.ConfigReader.ConnectionString.ToString()))
     {
         conn.Open();
         using (Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(GetAppointmentQuery, conn))
         {
             command.Parameters.Add(new Npgsql.NpgsqlParameter(":appointmentsheetid", NpgsqlTypes.NpgsqlDbType.Integer));
             command.Prepare();
             command.Parameters[0].Value = appointmentid;
             using (Npgsql.NpgsqlDataReader dr = command.ExecuteReader())
             {
                 while (dr.Read())
                 {
                     AppointmentSheet newAppointment = populateAppointmentFromDB(dr);
                     assignableAppointments.Add(newAppointment);
                 }
             }
         }
     }
     return(assignableAppointments);
 }
コード例 #9
0
        public void SaveAppointmentSheet(AppointmentSheet appointment)
        {
            string query;
            bool   isUpdate = false;

            // Want to know right off the bat if we're doing a insert or update
            if (appointment.AppointmentSheetId > 0)
            {
                query    = AppointmentUpdateQuery;
                isUpdate = true;
            }
            else
            {
                query = AppointmentInsertQuery;
            }

            using (Npgsql.NpgsqlConnection conn = new Npgsql.NpgsqlConnection(Infrastructure.ConfigReader.ConnectionString.ToString()))
            {
                conn.Open();
                using (Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(query, conn))
                {
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("addingservices", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentlocation", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("assignedsalesagent", NpgsqlTypes.NpgsqlDbType.Integer));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("city", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("comment", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("createdat", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("currentlyacceptedcards", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("currentprocessor", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("dateofappointment", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("howmanylocations", NpgsqlTypes.NpgsqlDbType.Integer));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("internet", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("lastupdated", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("moto", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("multilocation", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("newequipment", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("newsetup", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("price", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("score", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("singlelocation", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("state", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("street", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("swipe", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("unhappy", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("volume", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("zipcode", NpgsqlTypes.NpgsqlDbType.Integer));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("creator", NpgsqlTypes.NpgsqlDbType.Integer));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("parentlead", NpgsqlTypes.NpgsqlDbType.Integer));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("location", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentdatefrom", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentdateto", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("reschedule", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("creatorname", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("singleloccheck", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("event_reference", NpgsqlTypes.NpgsqlDbType.Text));
                    //command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentzone", NpgsqlTypes.NpgsqlDbType.Integer));

                    if (isUpdate)
                    {
                        command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentid", NpgsqlTypes.NpgsqlDbType.Integer));
                    }

                    command.Prepare();

                    command.Parameters[0].Value  = appointment.AddingServices;
                    command.Parameters[1].Value  = appointment.AppointmentLocation;
                    command.Parameters[2].Value  = appointment.AssignedSalesAgent;
                    command.Parameters[3].Value  = appointment.City;
                    command.Parameters[4].Value  = appointment.Comment;
                    command.Parameters[5].Value  = appointment.CreatedAt;
                    command.Parameters[6].Value  = appointment.CurrentlyAcceptingCards;
                    command.Parameters[7].Value  = appointment.CurrentProcessor;
                    command.Parameters[8].Value  = appointment.DayOfAppointment;
                    command.Parameters[9].Value  = appointment.HowManyLocations;
                    command.Parameters[10].Value = appointment.Internet;
                    command.Parameters[11].Value = appointment.LastUpdated;
                    command.Parameters[12].Value = appointment.Moto;
                    command.Parameters[13].Value = appointment.MultiLocation;
                    command.Parameters[14].Value = appointment.NewEquipment;
                    command.Parameters[15].Value = appointment.NewSetUp;
                    command.Parameters[16].Value = appointment.Price;
                    command.Parameters[17].Value = appointment.Score;
                    command.Parameters[18].Value = appointment.SingleLocation;
                    command.Parameters[19].Value = appointment.State;
                    command.Parameters[20].Value = appointment.Street;
                    command.Parameters[21].Value = appointment.Swipe;
                    command.Parameters[22].Value = appointment.Unhappy;
                    command.Parameters[23].Value = appointment.Volume;
                    command.Parameters[24].Value = appointment.ZipCode;
                    command.Parameters[25].Value = appointment.CreatorId;
                    command.Parameters[26].Value = appointment.ParentLeadId;
                    command.Parameters[27].Value = appointment.Location;
                    command.Parameters[28].Value = appointment.AppointmentDateFrom;
                    command.Parameters[29].Value = appointment.AppointmentDateTo;
                    command.Parameters[30].Value = appointment.Reschedule;
                    command.Parameters[31].Value = appointment.CreatorName;
                    command.Parameters[32].Value = appointment.SingleLocCheck;
                    command.Parameters[33].Value = appointment.Event_Reference;
                    //command.Parameters[34].Value = appointment.AppointmentZone;



                    //command.Parameters[10].Value = card.Creator;



                    if (isUpdate)
                    {
                        command.Parameters[34].Value = appointment.AppointmentSheetId;
                    }

                    int rowsAffected = command.ExecuteNonQuery();
                }
            }
        }
コード例 #10
0
        public void SaveAppointmentSheetFromCalendar(AppointmentSheet appointment)
        {
            string query;
            bool   isUpdate = false;

            // Want to know right off the bat if we're doing a insert or update
            if (appointment.AppointmentSheetId > 0)
            {
                query    = CalendarAppointmentUpdateQuery;
                isUpdate = true;
            }
            else
            {
                query = AppointmentInsertQuery;
            }

            using (Npgsql.NpgsqlConnection conn = new Npgsql.NpgsqlConnection(Infrastructure.ConfigReader.ConnectionString.ToString()))
            {
                conn.Open();
                using (Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(query, conn))
                {
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("city", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("dateofappointment", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("lastupdated", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("state", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("street", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("zipcode", NpgsqlTypes.NpgsqlDbType.Integer));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentdatefrom", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentdateto", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("event_reference", NpgsqlTypes.NpgsqlDbType.Text));

                    if (isUpdate)
                    {
                        command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentid", NpgsqlTypes.NpgsqlDbType.Integer));
                    }

                    command.Prepare();
                    command.Parameters[0].Value = appointment.City;
                    command.Parameters[1].Value = appointment.DayOfAppointment;
                    command.Parameters[2].Value = appointment.LastUpdated;
                    command.Parameters[3].Value = appointment.State;
                    command.Parameters[4].Value = appointment.Street;
                    command.Parameters[5].Value = appointment.ZipCode;
                    command.Parameters[6].Value = appointment.AppointmentDateFrom;
                    command.Parameters[7].Value = appointment.AppointmentDateTo;
                    command.Parameters[8].Value = appointment.Event_Reference;



                    //command.Parameters[10].Value = card.Creator;



                    if (isUpdate)
                    {
                        command.Parameters[9].Value = appointment.AppointmentSheetId;
                    }

                    int rowsAffected = command.ExecuteNonQuery();
                }
            }
        }
コード例 #11
0
 public void SaveAppointmentSheetFromCalendar(AppointmentSheet lead)
 {
 }
コード例 #12
0
        public void SaveAssignedAppointments(AppointmentSheet appointment, int userid)
        {
            using (Npgsql.NpgsqlConnection conn = new Npgsql.NpgsqlConnection(Infrastructure.ConfigReader.ConnectionString.ToString()))
            {
                conn.Open();
                using (Npgsql.NpgsqlCommand command = new Npgsql.NpgsqlCommand(AppointmentUpdateQuery, conn))
                {
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("addingservices", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentlocation", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("assignedsalesagent", NpgsqlTypes.NpgsqlDbType.Integer));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("city", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("comment", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("createdat", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("currentlyacceptedcards", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("currentprocessor", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("dateofappointment", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("howmanylocations", NpgsqlTypes.NpgsqlDbType.Integer));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("internet", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("lastupdated", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("moto", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("multilocation", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("newequipment", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("newsetup", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("price", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("score", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("singlelocation", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("state", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("street", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("swipe", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("unhappy", NpgsqlTypes.NpgsqlDbType.Boolean));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("volume", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("zipcode", NpgsqlTypes.NpgsqlDbType.Integer));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("creator", NpgsqlTypes.NpgsqlDbType.Integer));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("parentlead", NpgsqlTypes.NpgsqlDbType.Integer));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("location", NpgsqlTypes.NpgsqlDbType.Text));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentdatefrom", NpgsqlTypes.NpgsqlDbType.Timestamp));
                    command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentdateto", NpgsqlTypes.NpgsqlDbType.Timestamp));

                    command.Parameters.Add(new Npgsql.NpgsqlParameter("appointmentid", NpgsqlTypes.NpgsqlDbType.Integer));

                    command.Prepare();

                    command.Parameters[0].Value  = appointment.AddingServices;
                    command.Parameters[1].Value  = appointment.AppointmentLocation;
                    command.Parameters[2].Value  = userid;
                    command.Parameters[3].Value  = appointment.City;
                    command.Parameters[4].Value  = appointment.Comment;
                    command.Parameters[5].Value  = appointment.CreatedAt;
                    command.Parameters[6].Value  = appointment.CurrentlyAcceptingCards;
                    command.Parameters[7].Value  = appointment.CurrentProcessor;
                    command.Parameters[8].Value  = appointment.DayOfAppointment;
                    command.Parameters[9].Value  = appointment.HowManyLocations;
                    command.Parameters[10].Value = appointment.Internet;
                    command.Parameters[11].Value = appointment.LastUpdated;
                    command.Parameters[12].Value = appointment.Moto;
                    command.Parameters[13].Value = appointment.MultiLocation;
                    command.Parameters[14].Value = appointment.NewEquipment;
                    command.Parameters[15].Value = appointment.NewSetUp;
                    command.Parameters[16].Value = appointment.Price;
                    command.Parameters[17].Value = appointment.Score;
                    command.Parameters[18].Value = appointment.SingleLocation;
                    command.Parameters[19].Value = appointment.State;
                    command.Parameters[20].Value = appointment.Street;
                    command.Parameters[21].Value = appointment.Swipe;
                    command.Parameters[22].Value = appointment.Unhappy;
                    command.Parameters[23].Value = appointment.Volume;
                    command.Parameters[24].Value = appointment.ZipCode;
                    command.Parameters[25].Value = appointment.CreatorId;
                    command.Parameters[26].Value = appointment.ParentLeadId;
                    command.Parameters[27].Value = appointment.Location;
                    command.Parameters[28].Value = appointment.AppointmentDateFrom;
                    command.Parameters[29].Value = appointment.AppointmentDateTo;

                    command.Parameters[30].Value = appointment.AppointmentSheetId;

                    int rowsAffected = command.ExecuteNonQuery();
                }
            }
        }