示例#1
0
        public static TinMember Insert(TinMember Inserted)
        {
            TinMember Item = new TinMember();

            SqlParameter[] obj = new SqlParameter[3];
            obj[0] = new SqlParameter("TM_T_ID", Inserted.T_ID);
            obj[1] = new SqlParameter("TM_MEM_ID", Inserted.MEM_ID);
            if (Inserted.NgayTao > DateTime.MinValue)
            {
                obj[2] = new SqlParameter("TM_NgayTao", Inserted.NgayTao);
            }
            else
            {
                obj[2] = new SqlParameter("TM_NgayTao", DBNull.Value);
            }

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssTinMember_Insert_InsertNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
示例#2
0
        public static TinMember SelectById(Int64 TM_ID)
        {
            TinMember Item = new TinMember();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("TM_ID", TM_ID);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssTinMember_Select_SelectById_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
示例#3
0
        public static TinMember Update(Int64?id, Int32?t_id, Int32?mem_id, DateTime?ngaytao)
        {
            TinMember Item = new TinMember();

            SqlParameter[] obj = new SqlParameter[4];
            if (id != null)
            {
                obj[0] = new SqlParameter("TM_ID", id);
            }
            else
            {
                obj[0] = new SqlParameter("TM_ID", DBNull.Value);
            }
            if (t_id != null)
            {
                obj[1] = new SqlParameter("TM_T_ID", t_id);
            }
            else
            {
                obj[1] = new SqlParameter("TM_T_ID", DBNull.Value);
            }
            if (mem_id != null)
            {
                obj[2] = new SqlParameter("TM_MEM_ID", mem_id);
            }
            else
            {
                obj[2] = new SqlParameter("TM_MEM_ID", DBNull.Value);
            }
            if (ngaytao != null)
            {
                obj[3] = new SqlParameter("TM_NgayTao", ngaytao);
            }
            else
            {
                obj[3] = new SqlParameter("TM_NgayTao", DBNull.Value);
            }

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssTinMember_Update_UpdateNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
示例#4
0
        public static TinMember InsertByUsername(Int32?t_id, string Username, DateTime?ngaytao)
        {
            TinMember Item = new TinMember();

            SqlParameter[] obj = new SqlParameter[3];
            if (t_id != null)
            {
                obj[0] = new SqlParameter("TM_T_ID", t_id);
            }
            else
            {
                obj[0] = new SqlParameter("TM_T_ID", DBNull.Value);
            }
            if (Username != null)
            {
                obj[1] = new SqlParameter("Username", Username);
            }
            else
            {
                obj[1] = new SqlParameter("Username", DBNull.Value);
            }
            if (ngaytao != null)
            {
                obj[2] = new SqlParameter("TM_NgayTao", ngaytao);
            }
            else
            {
                obj[2] = new SqlParameter("TM_NgayTao", DBNull.Value);
            }

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssTinMember_Insert_InsertByUsername_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
示例#5
0
        public static TinMember getFromReader(IDataReader rd)
        {
            TinMember Item = new TinMember();

            if (rd.FieldExists("TM_ID"))
            {
                Item.ID = (Int64)(rd["TM_ID"]);
            }
            if (rd.FieldExists("TM_T_ID"))
            {
                Item.T_ID = (Int32)(rd["TM_T_ID"]);
            }
            if (rd.FieldExists("TM_MEM_ID"))
            {
                Item.MEM_ID = (Int32)(rd["TM_MEM_ID"]);
            }
            if (rd.FieldExists("TM_NgayTao"))
            {
                Item.NgayTao = (DateTime)(rd["TM_NgayTao"]);
            }
            return(Item);
        }