Beispiel #1
0
        public IEnumerable <branch> getbranch()
        {
            SqlConnection getbranch = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Second"].ConnectionString);

            getbranch.Open();
            List <branch> branches = new List <branch>();
            string        d        = " ";

            // d = "select origin_code from gdexpdb.dbo.station WHERE  status = '1'";
            d = "select origin_code,( origin_desc) description from gdexpdb.dbo.station order by origin_code";
            SqlCommand connect = new SqlCommand(d, getbranch);

            using (SqlDataReader read = connect.ExecuteReader())
            {
                while (read.Read())
                {
                    branch getbranch1 = new branch();
                    getbranch1.origin_code = read["origin_code"].ToString();
                    getbranch1.description = read["description"].ToString();
                    branches.Add(getbranch1);
                }
            }
            getbranch.Close();
            return(branches);
        }
Beispiel #2
0
        public IEnumerable <branch> regforRM(string username)
        {
            SqlConnection con4 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Second"].ConnectionString);

            con4.Open();
            List <branch> RMdat = new List <branch>();
            string        RM    = "";

            RM = "select * from gdexpdb..station where region = '" + username + "' and status=1";
            SqlCommand com4 = new SqlCommand(RM, con4);

            using (SqlDataReader reader = com4.ExecuteReader())
            {
                while (reader.Read())
                {
                    branch data = new branch();
                    data.description = reader["origin_desc"].ToString();
                    data.origin_code = reader["origin_code"].ToString();
                    RMdat.Add(data);
                }
            }
            con4.Close();
            return(RMdat);
        }