예제 #1
0
        public void Update(clsSupport obj)
        {
            try
            {
                this.obj.Update(obj);
            }
            catch (Exception)
            {

                throw;
            }
        }
예제 #2
0
        public int Insert(clsSupport obj)
        {
            try
            {
                return this.obj.Insert(obj);
            }
            catch (Exception)
            {

                throw;
            }
        }
예제 #3
0
        public List<clsSupport> GetAll()
        {
            try
            {
                List<clsSupport> list = new List<clsSupport>();
                string str = "select * from tblSupport";
                SqlCommand com = new SqlCommand(str, con.getCon());
                con.openCon();
                SqlDataReader dr = com.ExecuteReader();
                if (dr.Read())
                {
                    clsSupport obj = new clsSupport();
                    if (dr["name"] != DBNull.Value)
                    {
                        obj.Name = dr["name"].ToString();
                    }
                    if (dr["dienthoai"] != DBNull.Value)
                    {
                        obj.Dienthoai = dr["dienthoai"].ToString();
                    }
                    if (dr["nick"] != DBNull.Value)
                    {
                        obj.Nick = dr["nick"].ToString();
                    }
                    if (dr["id"] != DBNull.Value)
                    {
                        obj.Id = Convert.ToInt32(dr["id"].ToString());
                    }
                    list.Add(obj);
                }
                return list;
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                con.closeCon();
            }
        }
예제 #4
0
        public clsSupport GetById(int id)
        {
            try
            {
                clsSupport obj = new clsSupport();
                string str = "select * from tblSupport where id=@id";
                SqlCommand com = new SqlCommand(str, con.getCon());
                com.Parameters.AddWithValue("@id", id);
                con.openCon();
                SqlDataReader dr = com.ExecuteReader();
                if (dr.Read())
                {
                    obj.Id = id;
                    if (dr["name"] != DBNull.Value)
                    {
                        obj.Name = dr["name"].ToString();
                    }
                    if (dr["dienthoai"] != DBNull.Value)
                    {
                        obj.Dienthoai = dr["dienthoai"].ToString();
                    }
                    if (dr["nick"] != DBNull.Value)
                    {
                        obj.Nick = dr["nick"].ToString();
                    }
                }
                return obj;
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                con.closeCon();
            }
        }
예제 #5
0
        public void Update(clsSupport obj)
        {
            try
            {
                string str = "Update tblsupport set name=@name,dienthoai=@dienthoai,nick=@nick where id=@id";
                SqlCommand com = new SqlCommand(str, con.getCon());
                com.Parameters.AddWithValue("@name", obj.Name);
                com.Parameters.AddWithValue("@dienthoai", obj.Dienthoai);
                com.Parameters.AddWithValue("@nick", obj.Nick);
                com.Parameters.AddWithValue("@id", obj.Id);
                con.openCon();
                com.ExecuteNonQuery();
                con.closeCon();
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                con.closeCon();
            }
        }
예제 #6
0
        public int Insert(clsSupport obj)
        {
            try
            {
                string str = "insert into tblsupport(name,dienthoai,nick) values(@name,@dienthoai,@nick)";
                SqlCommand com = new SqlCommand(str, con.getCon());
                com.Parameters.AddWithValue("@name", obj.Name);
                com.Parameters.AddWithValue("@dienthoai", obj.Dienthoai);
                com.Parameters.AddWithValue("@nick", obj.Nick);
                con.openCon();
                com.ExecuteNonQuery();
                con.closeCon();
                return clsDAStaticMethod.getIDIdentity("tblsupport");
            }
            catch (Exception)
            {

                throw;
            }
            finally
            {
                con.closeCon();
            }
        }