Example #1
0
        JsonResult IBase <MAkun> .Save(Models.Dto.MAkun obj)
        {
            JsonResult hasil = new JsonResult {
                JSONResult = false, JSONMessage = "Data tidak ditemukan", JSONRows = 0, JSONValue = null
            };
            List <MAkun> list = new List <MAkun>();

            using (NpgsqlConnection conn = GetConnection())
            {
                using (NpgsqlCommand com = new NpgsqlCommand())
                {
                    using (NpgsqlDataAdapter oDA = new NpgsqlDataAdapter())
                    {
                        try
                        {
                            conn.Open();
                            com.Connection     = conn;
                            com.CommandTimeout = conn.ConnectionTimeout;

                            com.CommandText = "insert into makun (id,kode,nama,idparent,iddepartemen,keterangan,idtype,isdebet,iskasbank,norekening,atasnamarekening,idtypebank,isneraca)" +
                                              "values (@id,@kode,@nama,@idparent,@iddepartemen,@keterangan,@idtype,@isdebet,@iskasbank,@norekening,@atasnamarekening,@idtypebank,@isneraca)";
                            com.Parameters.Clear();
                            com.Parameters.Add("@id", NpgsqlTypes.NpgsqlDbType.Bigint).Value                = obj.id;
                            com.Parameters.Add("@kode", NpgsqlTypes.NpgsqlDbType.Varchar).Value             = obj.kode.Trim();
                            com.Parameters.Add("@nama", NpgsqlTypes.NpgsqlDbType.Varchar).Value             = obj.nama.Trim();
                            com.Parameters.Add("@idparent", NpgsqlTypes.NpgsqlDbType.Integer).Value         = obj.idparent;
                            com.Parameters.Add("@iddepartemen", NpgsqlTypes.NpgsqlDbType.Integer).Value     = obj.iddepartemen;
                            com.Parameters.Add("@keterangan", NpgsqlTypes.NpgsqlDbType.Varchar).Value       = obj.keterangan.Trim();
                            com.Parameters.Add("@idtype", NpgsqlTypes.NpgsqlDbType.Integer).Value           = obj.idtype;
                            com.Parameters.Add("@isdebet", NpgsqlTypes.NpgsqlDbType.Boolean).Value          = obj.isdebet;
                            com.Parameters.Add("@iskasbank", NpgsqlTypes.NpgsqlDbType.Boolean).Value        = obj.iskasbank;
                            com.Parameters.Add("@norekening", NpgsqlTypes.NpgsqlDbType.Varchar).Value       = obj.norekening.Trim();
                            com.Parameters.Add("@atasnamarekening", NpgsqlTypes.NpgsqlDbType.Varchar).Value = obj.atasnamarekening.Trim();
                            com.Parameters.Add("@idtypebank", NpgsqlTypes.NpgsqlDbType.Integer).Value       = obj.idtypebank;
                            com.Parameters.Add("@isneraca", NpgsqlTypes.NpgsqlDbType.Boolean).Value         = obj.isneraca;

                            com.ExecuteNonQuery();
                            hasil = new JsonResult
                            {
                                JSONMessage = "Data tersimpan",
                                JSONResult  = true,
                                JSONRows    = 1,
                                JSONValue   = obj
                            };
                        }
                        catch (Exception ex)
                        {
                            hasil = new JsonResult
                            {
                                JSONMessage = ex.StackTrace,
                                JSONResult  = false,
                                JSONRows    = 0,
                                JSONValue   = null
                            };
                        }
                    }
                }
            }
            return(hasil);
        }
Example #2
0
 JsonResult IBase <MAkun> .Delete(Models.Dto.MAkun obj)
 {
     throw new NotImplementedException();
 }
Example #3
0
 JsonResult IAkun.Update(Models.Dto.MAkun obj, ref ValidationError validationError)
 {
     throw new NotImplementedException();
 }