public void Update(LaporanDinasModel entity) { var sql = @" UPDATE OFTA_LaporanDinas SET TglJamCreate = @TglJamCreate, ReportedPegID = @ReportedPegID, SuratDinasID = @SuratDinasID, TglSelesai = @TglSelesai, HasilKerja = @HasilKerja, KMAkhir = @KMAkhir, DiketahuiPegID = @DiketahuiPegID, IsSignedDiketahui = @IsSignedDiketahui WHERE LaporanDinasID = @LaporanDinasID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@LaporanDinasID", entity.LaporanDinasID, SqlDbType.VarChar); cmd.AddParam("@TglJamCreate", entity.TglJamCreate, SqlDbType.DateTime); cmd.AddParam("@PegID", entity.PegID, SqlDbType.VarChar); cmd.AddParam("@SuratDinasID", entity.SuratDinasID, SqlDbType.VarChar); cmd.AddParam("@TglSelesai", entity.TglSelesai, SqlDbType.DateTime); cmd.AddParam("@HasilKerja", entity.HasilKerja, SqlDbType.VarChar); cmd.AddParam("@KMAkhir", entity.KMAkhir, SqlDbType.BigInt); conn.Open(); cmd.ExecuteNonQuery(); } }
public TransportModel GetData(ITransportKey key) { TransportModel result = null; var sql = @" SELECT TransportName FROM OFTA_Transport WHERE TransportID = @TransportID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@TransportID", key.TransportID, SqlDbType.VarChar); conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { return(null); } dr.Read(); result = new TransportModel { TransportID = key.TransportID, TransportName = dr["TransportName"].ToString() }; } } return(result); }
public IParamNoModel GetData(IParamNoKey key) { ParamNoModel result = null; var sql = @" SELECT ParamValue FROM OFTA_ParamNo WHERE ParamID = @ParamID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@ParamID", key.ParamID, SqlDbType.VarChar); conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { return(null); } dr.Read(); result = new ParamNoModel() { ParamID = key.ParamID, ParamValue = dr["ParamValue"].ToString() }; } } return(result); }
public ApprovalTypeModel GetData(IApprovalTypeKey key) { ApprovalTypeModel result = null; var sql = @" SELECT ApprovalTypeName FROM OFTA_ApprovalType WHERE ApprovalTypeID = @ApprovalTypeID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@ApprovalTypeID", key.ApprovalTypeID, SqlDbType.VarChar); conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { return(null); } dr.Read(); result = new ApprovalTypeModel { ApprovalTypeID = key.ApprovalTypeID, ApprovalTypeName = dr["ApprovalTypeName"].ToString() }; } } return(result); }
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); }
public IEnumerable <JenisKontrakModel> ListData() { List <JenisKontrakModel> result = null; var sql = @" SELECT JenisKontrakID, JenisKontrakName FROM OFTA_JenisKontrak "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { return(null); } result = new List <JenisKontrakModel>(); while (dr.Read()) { var item = new JenisKontrakModel { JenisKontrakID = dr["JenisKontrakID"].ToString(), JenisKontrakName = dr["JenisKontrakName"].ToString() }; result.Add(item); } } } return(result); }
public IEnumerable <IParamNoModel> ListData() { List <ParamNoModel> result = null; var sql = @" SELECT ParamID, ParamValue FROM OFTA_ParamNo "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { return(null); } result = new List <ParamNoModel>(); while (dr.Read()) { var itemResult = new ParamNoModel() { ParamID = dr["ParamID"].ToString(), ParamValue = dr["ParamValue"].ToString() }; result.Add(itemResult); } } } return(result); }
public KotaModel GetData(IKotaKey key) { KotaModel result = null; var sql = @" SELECT KotaName FROM OFTA_Kota WHERE KotaID = @KotaID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@KotaID", key.KotaID, SqlDbType.VarChar); conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { return(null); } dr.Read(); result = new KotaModel { KotaID = key.KotaID, KotaName = dr["KotaName"].ToString() }; } } return(result); }
public IEnumerable <ApprovalTypeModel> ListData() { List <ApprovalTypeModel> result = null; var sql = @" SELECT ApprovalTypeID, ApprovalTypeName FROM OFTA_ApprovalType "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { return(null); } result = new List <ApprovalTypeModel>(); while (dr.Read()) { var itemResult = new ApprovalTypeModel { ApprovalTypeID = dr["ApprovalTypeID"].ToString(), ApprovalTypeName = dr["ApprovalTypeName"].ToString() }; result.Add(itemResult); } } } return(result); }
public void Insert(LaporanDinasModel entity) { var sql = @" INSERT INTO OFTA_LaporanDinas ( LaporanDinasID, TglJamCreate, ReportedPegID, SuratDinasID, TglSelesai, HasilKerja, KMAkhir, DiketahuiPegID, IsSignedDiketahui) VALUES ( @LaporanDinasID, @TglJamCreate, @ReportedPegID, @SuratDinasID, @TglSelesai, @HasilKerja, @KMAkhir, @DiketahuiPegID, @IsSignedDiketahui)"; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@LaporanDinasID", entity.LaporanDinasID, SqlDbType.VarChar); cmd.AddParam("@TglJamCreate", entity.TglJamCreate, SqlDbType.DateTime); cmd.AddParam("@ReportedPegID", entity.PegID, SqlDbType.VarChar); cmd.AddParam("@SuratDinasID", entity.SuratDinasID, SqlDbType.VarChar); cmd.AddParam("@TglSelesai", entity.TglSelesai, SqlDbType.DateTime); cmd.AddParam("@HasilKerja", entity.HasilKerja, SqlDbType.VarChar); cmd.AddParam("@KMAkhir", entity.KMAkhir, SqlDbType.BigInt); conn.Open(); cmd.ExecuteNonQuery(); } }
public SuratDinasModel GetData(ISuratDinasKey key) { SuratDinasModel result = null; var sql = @" SELECT aa.SuratDinasID, aa.TglJamCreate, aa.PegID, aa.NoSurat, aa.NoKontrak, aa.TglMulai, aa.TglSelesai, aa.Keperluan, aa.TransportID, aa.KMAwal, aa.RSID, aa.JenisBiayaID, aa.KasBon, ISNULL(bb.PegName, '') PegName, ISNULL(cc.TransportName, '') TransportName, ISNULL(dd.RSName, '') RSName, ISNULL(ee.JenisBiayaName, '') JenisBiayaName FROM OFTA_SuratDinas aa LEFT JOIN OFTA_Peg bb ON aa.PegID = bb.PegID LEFT JOIN OFTA_Transport cc oN aa.TransportID = cc.TransportID LEFT JOIN OFTA_RS dd ON aa.RSID = dd.RSID LEFT JOIN OFTA_JenisBiaya ee ON aa.JenisBiayaID = ee.JenisBiayaID WHERE SuratDinasID = @SuratDinasID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@SuratDinasID", key.SuratDinasID, SqlDbType.VarChar); conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { return(null); } dr.Read(); result = new SuratDinasModel { SuratDinasID = dr["SuratDinasID"].ToString(), TglJamCreate = Convert.ToDateTime(dr["TglJamCreate"]), PegID = dr["PegID"].ToString(), PegName = dr["PegName"].ToString(), NoSurat = dr["NoSurat"].ToString(), NoKontrak = dr["NoKontrak"].ToString(), TglMulai = Convert.ToDateTime(dr["TglMulai"]), TglSelesai = Convert.ToDateTime(dr["TglSelesai"]), Keperluan = dr["Keperluan"].ToString(), TransportID = dr["TransportID"].ToString(), TransportName = dr["TransportName"].ToString(), KMAwal = Convert.ToInt64(dr["KMAwal"]), RSID = dr["RSID"].ToString(), RSName = dr["RSName"].ToString(), JenisBiayaID = dr["JenisBiayaID"].ToString(), JenisBiayaName = dr["JenisBiayaName"].ToString(), KasBon = Convert.ToDecimal(dr["KasBon"]) }; } } return(result); }
public void Delete(ILaporanDinasKey key) { var sql = @" DELETE OFTA_LaporanDinas WHERE LaporanDinasID = @LaporanDinasID"; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@LaporanDinasID", key.LaporanDinasID, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
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(); } }
public void Delete(IApprovalTypeKey key) { var sql = @" DELETE OFTA_ApprovalType WHERE ApprovalTypeID = @ApprovalTypeID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@ApprovalTypeID", key.ApprovalTypeID, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public IEnumerable<LaporanDinasModel> ListData(DateTime tgl1, DateTime tgl2) { List<LaporanDinasModel> result = null; var sql = @" SELECT aa.LaporanDinasID, aa.TglJamCreate, aa.PegID, aa.SuratDinasID, aa.TglSelesai, aa.HasilKerja, aa.KMAkhir, aa.IsSignedDiketahui, ISNULL(bb.PegName, '') PegName, ISNULL(dd.TglMulai, '1900-01-01T00:00:00') TglMulai FROM OFTA_LaporanDinas aa LEFT JOIN SuratDinas dd ON aa.SuratDinasID = dd.SuratDinasID WHERE aa.TglJamCreate BETWEEN @Tgl1 AND @Tgl2 "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@Tgl1", tgl1, SqlDbType.DateTime); cmd.AddParam("@Tgl2", tgl2, SqlDbType.DateTime); conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) return null; result = new List<LaporanDinasModel>(); while (dr.Read()) { var item = new LaporanDinasModel { LaporanDinasID = dr["LaporanDinasID"].ToString(), TglJamCreate = Convert.ToDateTime(dr["TglJamCreate"]), PegID = dr["ReportedPegID"].ToString(), PegName = dr["ReportedPegName"].ToString(), SuratDinasID = dr["SuratDinasID"].ToString(), TglMulai = Convert.ToDateTime(dr["TglMulai"]), TglSelesai = Convert.ToDateTime(dr["TglSelesai"]), HasilKerja = dr["HasilKerja"].ToString(), KMAkhir = Convert.ToInt64(dr["KMAkhir"]), }; result.Add(item); } } } return result; }
public LaporanDinasModel GetData(ILaporanDinasKey key) { LaporanDinasModel result = null; var sql = @" SELECT aa.LaporanDinasID, aa.TglJamCreate, aa.ReportedPegID, aa.SuratDinasID, aa.TglSelesai, aa.HasilKerja, aa.KMAkhir, aa.DiketahuiPegID, aa.IsSignedDiketahui, ISNULL( bb.PegName,'') ReportedPegName, ISNULL( cc.PegName, '') DiketahuiPegName, ISNULL( dd.TglMulai, '1900-01-01T00:00:00') TglMulai FROM OFTA_LaporanDinas aa LEFT JOIN Peg bb ON aa.ReportedPegID = bb.PegID LEFT JOIN Peg cc ON aa.DiketahuiPegID = cc.PegID LEFT JOIN SuratDinas dd ON aa.SuratDinasID = dd.SuratDinasID WHERE LaporanDinasID = @LaporanDinasID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@LaporanDinasID", key.LaporanDinasID, SqlDbType.VarChar); conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) return null; dr.Read(); result = new LaporanDinasModel { LaporanDinasID = dr["LaporanDinasID"].ToString(), TglJamCreate = Convert.ToDateTime(dr["TglJamCreate"]), PegID = dr["ReportedPegID"].ToString(), PegName = dr["ReportedPegName"].ToString(), SuratDinasID = dr["SuratDinasID"].ToString(), TglMulai = Convert.ToDateTime(dr["TglMulai"]), TglSelesai = Convert.ToDateTime(dr["TglSelesai"]), HasilKerja = dr["HasilKerja"].ToString(), KMAkhir = Convert.ToInt64(dr["KMAkhir"]) }; } } return result; }
public void Update(SuratDinasModel entity) { var sql = @" UPDATE OFTA_SuratDinas SET TglJamCreate = @TglJamCreate, PegID = @PegID, NoSurat = @NoSurat, NoKontrak = @NoKontrak, TglMulai = @TglMulai, TglSelesai = @TglSelesai, Keperluan = @Keperluan, TransportID = @TransportID, KMAwal = @KMAwal, RSID = @RSID, JenisBiayaID = @JenisBiayaID, KasBon = @KasBon WHERE SuratDinasID = @SuratDinasID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@SuratDinasID", entity.SuratDinasID, SqlDbType.VarChar); cmd.AddParam("@TglJamCreate", entity.TglJamCreate, SqlDbType.DateTime); cmd.AddParam("@PegID", entity.PegID, SqlDbType.VarChar); cmd.AddParam("@NoSurat", entity.NoSurat, SqlDbType.VarChar); cmd.AddParam("@NoKontrak", entity.NoKontrak, SqlDbType.VarChar); cmd.AddParam("@TglMulai", entity.TglMulai, SqlDbType.DateTime); cmd.AddParam("@TglSelesai", entity.TglSelesai, SqlDbType.DateTime); cmd.AddParam("@Keperluan", entity.Keperluan, SqlDbType.VarChar); cmd.AddParam("@TransportID", entity.TransportID, SqlDbType.VarChar); cmd.AddParam("@KMAwal", entity.KMAwal, SqlDbType.BigInt); cmd.AddParam("@RSID", entity.RSID, SqlDbType.VarChar); cmd.AddParam("@JenisBiayaID", entity.JenisBiayaID, SqlDbType.VarChar); cmd.AddParam("@KasBon", entity.KasBon, SqlDbType.Decimal); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Insert(TransportModel entity) { var sql = @" INSERT INTO OFTA_Transport ( TransportID, TransportName) VALUES( @TransportID, @TransportName)"; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@TransportID", entity.TransportID, SqlDbType.VarChar); cmd.AddParam("@TransportName", entity.TransportName, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Insert(IParamNoModel paramNo) { var sql = @" INSERT INTO OFTA_ParamNo ( ParamID, ParamValue) VALUES ( @ParamID, @ParamValue) "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@ParamID", paramNo.ParamID, SqlDbType.VarChar); cmd.AddParam("@ParamValue", paramNo.ParamValue, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Insert(JenisArsipModel entity) { var sql = @" INSERT INTO OFTA_JenisArsip( JenisArsipID, JenisArsipName) VALUES( @JenisArsipID, @JenisArsipName)"; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@JenisArsipID", entity.JenisArsipID, SqlDbType.VarChar); cmd.AddParam("@JenisArsipName", entity.JenisArsipName, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Insert(ApprovalTypeModel entity) { var sql = @" INSERT INTO OFTA_ApprovalType ( ApprovalTypeID, ApprovalTypeName ) VALUES ( @ApprovalTypeID, @ApprovalTypeName)"; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@ApprovalTypeID", entity.ApprovalTypeID, SqlDbType.VarChar); cmd.AddParam("@ApprovalTypeName", entity.ApprovalTypeName, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Update(JenisArsipModel entity) { var sql = @" UPDATE OFTA_JenisArsip SET JenisArsipName = @JenisArsipName WHERE JenisArsipID = @JenisArsipID"; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@JenisArsipID", entity.JenisArsipID, SqlDbType.VarChar); cmd.AddParam("@JenisArsipName", entity.JenisArsipName, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Update(KotaModel entity) { var sql = @" UPDATE OFTA_Kota SET KotaName = @KotaName WHERE KotaID = @KotaID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@KotaID", entity.KotaID, SqlDbType.VarChar); cmd.AddParam("@KotaName", entity.KotaName, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Update(ApprovalTypeModel entity) { var sql = @" UPDATE OFTA_ApprovalType SET ApprovalTypeName = @ApprovalTypeName WHERE ApprovalTypeID = @ApprovalTypeID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@ApprovalTypeID", entity.ApprovalTypeID, SqlDbType.VarChar); cmd.AddParam("@ApprovalTypeName", entity.ApprovalTypeName, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Update(IParamNoModel paramNo) { var sql = @" UPDATE OFTA_ParamNo SET ParamValue = @ParamValue WHERE ParamID = @ParamID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@ParamID", paramNo.ParamID, SqlDbType.VarChar); cmd.AddParam("@ParamValue", paramNo.ParamValue, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Update(TransportModel entity) { var sql = @" UPDATE OFTA_Transport SET TransportName = @TransportName WHERE TransportID = @TransportID "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@TransportID", entity.TransportID, SqlDbType.VarChar); cmd.AddParam("@TransportName", entity.TransportName, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Insert(SuratDinasApprovalModel entity) { var sql = @" INSERT INTO OFTA_SuratDinasApproval ( SuratDinasID, PegID, ApprovalTypeID) VALUES ( @SuratDinasID, @PegID, @ApprovalTypeID) "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@SuratDinasID", entity.SuratDinasID, SqlDbType.VarChar); cmd.AddParam("@PegID", entity.PegID, SqlDbType.VarChar); cmd.AddParam("@ApprovalTypeID", entity.ApprovalTypeID, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Insert(RSModel entity) { var sql = @" INSERT INTO OFTA_RS ( RSID, RSName, KotaID ) VALUES ( @RSID, @RSName, @KotaID )"; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@RSID", entity.RSID, SqlDbType.VarChar); cmd.AddParam("@RSName", entity.RSName, SqlDbType.VarChar); cmd.AddParam("@KotaID", entity.KotaID, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Insert(SuratDinasModel entity) { var sql = @" INSERT INTO OFTA_SuratDinas ( SuratDinasID, TglJamCreate, PegID, NoSurat, NoKontrak, TglMulai, TglSelesai, Keperluan, TransportID, KMAwal, RSID, JenisBiayaID, KasBon) VALUES ( @SuratDinasID, @TglJamCreate, @PegID, @NoSurat, @NoKontrak, @TglMulai, @TglSelesai, @Keperluan, @TransportID, @KMAwal, @RSID, @JenisBiayaID, @KasBon) "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@SuratDinasID", entity.SuratDinasID, SqlDbType.VarChar); cmd.AddParam("@TglJamCreate", entity.TglJamCreate, SqlDbType.DateTime); cmd.AddParam("@PegID", entity.PegID, SqlDbType.VarChar); cmd.AddParam("@NoSurat", entity.NoSurat, SqlDbType.VarChar); cmd.AddParam("@NoKontrak", entity.NoKontrak, SqlDbType.VarChar); cmd.AddParam("@TglMulai", entity.TglMulai, SqlDbType.DateTime); cmd.AddParam("@TglSelesai", entity.TglSelesai, SqlDbType.DateTime); cmd.AddParam("@Keperluan", entity.Keperluan, SqlDbType.VarChar); cmd.AddParam("@TransportID", entity.TransportID, SqlDbType.VarChar); cmd.AddParam("@KMAwal", entity.KMAwal, SqlDbType.BigInt); cmd.AddParam("@RSID", entity.RSID, SqlDbType.VarChar); cmd.AddParam("@JenisBiayaID", entity.JenisBiayaID, SqlDbType.VarChar); cmd.AddParam("@KasBon", entity.KasBon, SqlDbType.Decimal); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Insert(PegModel entity) { var sql = @" INSERT INTO OFTA_Peg ( PegID, PegName, JabatanID) VALUES ( @PegID, @PegName, @JabatanID) "; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@PegID", entity.PegID, SqlDbType.VarChar); cmd.AddParam("@PegName", entity.PegName, SqlDbType.VarChar); cmd.AddParam("@JabatanID", entity.JabatanID, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }