Ejemplo n.º 1
0
        public void insert(Coustomer obj)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "Insert into [AddCustomer].[dbo].[Customer] values('" + obj.RoomNO + "','" + obj.FirstName + "','" + obj.LastName + "','" + obj.Cnic
                              + "','" + obj.Phone + "')";
            cmd.Connection = conn;

            conn.Open();
            cmd.ExecuteNonQuery();
            conn.Close();
        }
Ejemplo n.º 2
0
        public Coustomer show(int id)
        {
            conn.Open();
            string q = "SELECT * FROM [AddCustomer].[dbo].[Customer] WHERE RoomNo =" + "('" + id + "')";

            SqlCommand cmd = new SqlCommand(q, conn);

            SqlDataReader sdr = cmd.ExecuteReader();
            Coustomer     cs  = new Coustomer();

            sdr.Read();
            cs.RoomNO    = sdr["RoomNO"].ToString();
            cs.FirstName = sdr["FirstName"].ToString();
            cs.LastName  = sdr["LastName"].ToString();
            cs.Cnic      = sdr["Cnic"].ToString();
            cs.Phone     = sdr["Phone"].ToString();

            return(cs);
        }
Ejemplo n.º 3
0
        public List <Coustomer> GetRecord()
        {
            List <Coustomer> stlist = new List <Coustomer>();

            conn.Open();
            SqlCommand    cmd = new SqlCommand("select * from[AddCustomer].[dbo].[Customer]", conn);
            SqlDataReader sdr = cmd.ExecuteReader();

            while (sdr.Read())
            {
                Coustomer cs = new Coustomer();
                cs.RoomNO    = sdr["RoomNO"].ToString();
                cs.FirstName = sdr["FirstName"].ToString();
                cs.LastName  = sdr["LastName"].ToString();
                cs.Cnic      = sdr["Cnic"].ToString();
                cs.Phone     = sdr["Phone"].ToString();
                stlist.Add(cs);
            }

            return(stlist);
        }