Ejemplo n.º 1
0
        public List <DropdownListViewModel> ddlSourceData()
        {
            List <DropdownListViewModel> ListData = new List <DropdownListViewModel>();
            var connectionString = context.Database.GetDbConnection().ConnectionString;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                //Declare COnnection
                var        querySstring = "spMKT_POLO_DDL_SOURCE_DATA";
                SqlCommand command      = new SqlCommand(querySstring, connection);
                //open Connection
                command.Connection.Open();

                //PRoses Sp
                SqlDataReader rd = command.ExecuteReader();
                while (rd.Read())
                {
                    DropdownListViewModel data = new DropdownListViewModel();
                    data.Text    = rd[0].ToString();
                    data.Value   = rd[1].ToString();
                    data.Filter  = rd[2].ToString();
                    data.Filter2 = rd[3].ToString();
                    ListData.Add(data);
                }

                //Connection Close
                command.Connection.Close();
            }

            return(ListData);
        }
Ejemplo n.º 2
0
        public List <DropdownListViewModel> ddlPriorityLevel(string source, string emp, string prospec)
        {
            List <DropdownListViewModel> ListData = new List <DropdownListViewModel>();
            var connectionString = context.Database.GetDbConnection().ConnectionString;

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                //Declare COnnection
                var querySstring = "spMKT_POLO_DDL_PRIORITY_LVL";
                //Define Query Parameter
                SqlCommand command = new SqlCommand(querySstring, connection);
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@pSource", source);
                command.Parameters.AddWithValue("@pEmp", emp);
                command.Parameters.AddWithValue("@pProspec", prospec);
                //open Connection
                command.Connection.Open();

                //PRoses Sp
                SqlDataReader rd = command.ExecuteReader();
                while (rd.Read())
                {
                    DropdownListViewModel data = new DropdownListViewModel();
                    data.Text    = rd[0].ToString();
                    data.Value   = rd[1].ToString();
                    data.Filter  = rd[2].ToString();
                    data.Filter2 = rd[3].ToString();
                    data.Filter3 = rd[4].ToString();
                    ListData.Add(data);
                }

                //Connection Close
                command.Connection.Close();
            }

            return(ListData);
        }
Ejemplo n.º 3
0
        public void OnGet()
        {
            // fake Drivers from DB
            var Drivers = new Driver[] {
                new Driver()
                {
                    ID = "id1", FullName = "name1"
                },
                new Driver()
                {
                    ID = "id2", FullName = "name2"
                },
                new Driver()
                {
                    ID = "id3", FullName = "name3"
                },
                new Driver()
                {
                    ID = "id4", FullName = "name4"
                },
                new Driver()
                {
                    ID = "id5", FullName = "name5"
                },
            };

            DriverList = Drivers.Select(a =>
                                        new SelectListItem
            {
                Value = a.ID.ToString(),
                Text  = a.FullName,
                //Selected = false,
            }).ToList();
            DropdownListViewModel = new DropdownListViewModel();

            DropdownListViewModel.Drivers = DriverList;
        }