0

Laporan dan Aplikasi rental menggunakan C sharp/ C# (3)

Posted by Jujur Sitanggang on 3:23 PM
Psoude-Code



Class kon

============
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using System.Data;


namespace index
{
   class kon
   {
       private MySqlCommand com = null;
       private string konf = "server=127.0.0.1;UID=root;PWD=;Database=rental";
       private MySqlConnection koneksi = null;
       
       


       private void open_kon()
       {
           koneksi = new MySqlConnection(konf);
           koneksi.Open();
           
       }


       private void close_kon(){
          koneksi.Close();
          koneksi=null;
       }


      public DataTable  tampil_data(string x)
       {
           DataTable dt = new DataTable();
           try
           {
               
               open_kon();
               com = new MySqlCommand();
               com.Connection = koneksi;
               com.CommandType = CommandType.Text;
               com.CommandText = x;
               MySqlDataReader mdr = com.ExecuteReader();
               dt.Load(mdr);
               close_kon();
              
           }
           catch (MySqlException)
           {
           }
           com = null;
           return dt;
       }
       public void dml(string x)
       {
           open_kon();
           com = new MySqlCommand();
           com.Connection = koneksi;
           com.CommandType = CommandType.Text;
           com.CommandText = x;
           com.ExecuteNonQuery();
           com = null;
           close_kon();
      }
   }
}

class kripto

===============
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;


namespace index
{
   class kripto
   {
       private MD5 enc = null;
       private StringBuilder chiper = null;
       private Byte[] hasil;


       public string enkripsi(string x){
           enc = new MD5CryptoServiceProvider();
           chiper = new StringBuilder();
           enc.ComputeHash(ASCIIEncoding.ASCII.GetBytes(x));
           hasil = enc.Hash;
           for(int i =0; i< hasil.Length;i++){
               chiper.Append(hasil[i].ToString("x2"));
           }
           return chiper.ToString();
       }
   }
}

class user

=============
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace index
{
   class user
   {
       private string name, _pass, id, alamat, telp, hak_akses;


       public user()
       {
           name = "";
           _pass = "";
       }


       public string nama
       {
           get { return name; }
           set { name = value; }
       }
       public string password
       {
           get { return _pass; }
           set { _pass = value; }
       }


       public string Id
       {
           get { return id; }
           set { id = value; }
       }


       public string Alamat
       {
           get { return alamat; }
           set { alamat = value; }
       }


       public string Telp
       {
           get { return telp; }
           set { telp = value; }
       }


       public string Hak_akses
       {
           get { return hak_akses; }
           set { hak_akses = value; }
       }
   }

}



NEXT


0 Comments

Copyright Jujur Soaloon Sitangang Lipan All rights reserved. Theme by Sitanggang. | Bloggerized by Soalparna.