Esempio n. 1
0
        public PihakKetigaModel GetData(string id)
        {
            PihakKetigaModel result = null;
            var sSql = @"
                SELECT
                    aa.PihakKetigaName
                FROM
                    PihakKetiga aa
                WHERE
                    aa.PihakKetigaID = @PihakKetigaID ";

            using (var conn = new SqlConnection(_connString))
                using (var cmd = new SqlCommand(sSql, conn))
                {
                    cmd.AddParam("@PihakKetigaID", id);
                    conn.Open();
                    using (var dr = cmd.ExecuteReader())
                    {
                        if (dr.HasRows)
                        {
                            dr.Read();
                            result = new PihakKetigaModel
                            {
                                PihakKetigaID   = id,
                                PihakKetigaName = dr["PihakKetigaName"].ToString()
                            };
                        }
                    }
                }
            return(result);
        }
Esempio n. 2
0
        public IEnumerable <PihakKetigaModel> Search(string keyword)
        {
            List <PihakKetigaModel> result = null;
            var sSql = @"
                SELECT
                    aa.PihakKetigaID, aa.PihakKetigaName
                FROM
                    PihakKetiga aa 
                WHERE
                    PihakKetigaName LIKE @PihakKetigaName ";

            using (var conn = new SqlConnection(_connString))
                using (var cmd = new SqlCommand(sSql, conn))
                {
                    cmd.AddParam("@PihakKetigaName", string.Format("%{0}%", keyword));
                    conn.Open();
                    using (var dr = cmd.ExecuteReader())
                    {
                        if (dr.HasRows)
                        {
                            result = new List <PihakKetigaModel>();
                            while (dr.Read())
                            {
                                var item = new PihakKetigaModel
                                {
                                    PihakKetigaID   = dr["PihakKetigaID"].ToString(),
                                    PihakKetigaName = dr["PihakKetigaName"].ToString()
                                };
                                result.Add(item);
                            }
                        }
                    }
                }
            return(result);
        }
Esempio n. 3
0
        public IEnumerable <PihakKetigaModel> ListData()
        {
            List <PihakKetigaModel> result = null;
            var sSql = @"
                SELECT
                    aa.PihakKetigaID, aa.PihakKetigaName
                FROM
                    PihakKetiga aa ";

            using (var conn = new SqlConnection(_connString))
                using (var cmd = new SqlCommand(sSql, conn))
                {
                    conn.Open();
                    using (var dr = cmd.ExecuteReader())
                    {
                        if (dr.HasRows)
                        {
                            result = new List <PihakKetigaModel>();
                            while (dr.Read())
                            {
                                var item = new PihakKetigaModel
                                {
                                    PihakKetigaID   = dr["PihakKetigaID"].ToString(),
                                    PihakKetigaName = dr["PihakKetigaName"].ToString()
                                };
                                result.Add(item);
                            }
                        }
                    }
                }
            return(result);
        }
        PihakKetigaModel PihakKetiga2DataFactory()
        {
            var result = new PihakKetigaModel
            {
                PihakKetigaID   = "A2",
                PihakKetigaName = "B2"
            };

            return(result);
        }
Esempio n. 5
0
        public void Insert(PihakKetigaModel pihakKetiga)
        {
            var sSql = @"
                INSERT INTO
                    PihakKetiga (
                        PihakKetigaID, PihakKetigaName)
                VALUES (
                        @PihakKetigaID, @PihakKetigaName) ";

            using (var conn = new SqlConnection(_connString))
                using (var cmd = new SqlCommand(sSql, conn))
                {
                    cmd.AddParam("@PihakKetigaID", pihakKetiga.PihakKetigaID);
                    cmd.AddParam("@PihakKetigaName", pihakKetiga.PihakKetigaName);
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
        }
Esempio n. 6
0
        public void Update(PihakKetigaModel pihakKetiga)
        {
            var sSql = @"
                UPDATE
                    PihakKetiga 
                SET
                    PihakKetigaName = @PihakKetigaName
                WHERE
                    PihakKetigaID = @PihakKetigaID ";

            using (var conn = new SqlConnection(_connString))
                using (var cmd = new SqlCommand(sSql, conn))
                {
                    cmd.AddParam("@PihakKetigaID", pihakKetiga.PihakKetigaID);
                    cmd.AddParam("@PihakKetigaName", pihakKetiga.PihakKetigaName);
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
        }
Esempio n. 7
0
 public PihakKetigaModel Save(PihakKetigaModel pihakKetiga)
 {
     throw new NotImplementedException();
 }