示例#1
0
        public JenisArsipModel GetData(IJenisArsipKey key)
        {
            JenisArsipModel result = null;

            var sql = @"
                SELECT 
                    JenisArsipName
                FROM 
                    OFTA_JenisArsip
                WHERE
                    JenisArsipID = @JenisArsipID";

            using (var conn = new SqlConnection(ConnStringHelper.Get()))
                using (var cmd = new SqlCommand(sql, conn))
                {
                    cmd.AddParam("@JenisArsipID", key.JenisArsipID, SqlDbType.VarChar);
                    conn.Open();
                    using (var dr = cmd.ExecuteReader())
                    {
                        if (!dr.HasRows)
                        {
                            return(null);
                        }
                        dr.Read();
                        result = new JenisArsipModel
                        {
                            JenisArsipID   = key.JenisArsipID,
                            JenisArsipName = dr["JenisArsipName"].ToString()
                        };
                    }
                }
            return(result);
        }
示例#2
0
        public void Delete(IJenisArsipKey key)
        {
            //      INPUT VALIDATION
            if (key is null)
            {
                throw new ArgumentException("JENIS ARSIP ID empty");
            }

            //      REPO-OP
            _jenisArsipDal.Delete(key);
        }
示例#3
0
        public JenisArsipModel GetData(IJenisArsipKey key)
        {
            //      INPUT VALIDATION
            if (key is null)
            {
                throw new ArgumentException("JENIS ARSIP ID empty");
            }

            //      REPO-OP
            var result = _jenisArsipDal.GetData(key);

            //      RETURN
            return(result);
        }
示例#4
0
        public void Delete(IJenisArsipKey key)
        {
            var sql = @"
                DELETE 
                    OFTA_JenisArsip
                WHERE
                    JenisArsipID = @JenisArsipID";

            using (var conn = new SqlConnection(ConnStringHelper.Get()))
                using (var cmd = new SqlCommand(sql, conn))
                {
                    cmd.AddParam("@JenisArsipID", key.JenisArsipID, SqlDbType.VarChar);
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
        }