예제 #1
0
    protected bool InitDDLInventaris()
    {
        SqlConnection conn  = Common.getConnection();
        string        query = "";
        bool          val   = false;
        SqlCommand    cmd   = new SqlCommand();

        cmd.Connection  = conn;
        cmd.CommandType = System.Data.CommandType.Text;

        query           = "select id_inventaris, nama_inventaris from m_inventaris order by nama_inventaris asc";
        cmd.CommandText = query;

        conn.Open();
        SqlDataReader reader = cmd.ExecuteReader();

        if (reader.HasRows)
        {
            val = true;
            DDLInventaris.DataSource     = reader;
            DDLInventaris.DataValueField = "id_inventaris";
            DDLInventaris.DataTextField  = "nama_inventaris";
            DDLInventaris.DataBind();
            //   DDLHarga.DataBind();
        }


        conn.Close();


        return(val);
    }
예제 #2
0
    protected bool InitInsertDDLInventaris()
    {
        SqlConnection conn  = Common.getConnection();
        string        query = "";
        bool          val   = false;
        SqlCommand    cmd   = new SqlCommand();

        cmd.Connection  = conn;
        cmd.CommandType = System.Data.CommandType.Text;


        query = "select id_inventaris, nama_inventaris, harga from m_inventaris where id_inventaris not in(select id_inventaris from "
                + " t_pengajuan_service_detail where id_pengajuan_service = '" + HiddenIDPengajuan.Value + "') order by nama_inventaris asc";
        System.Diagnostics.Debug.WriteLine("Query " + query);

        cmd.CommandText = query;

        conn.Open();
        SqlDataReader reader = cmd.ExecuteReader();

        if (reader.HasRows)
        {
            val = true;
            DDLInventaris.DataSource     = reader;
            DDLInventaris.DataValueField = "id_inventaris";
            DDLInventaris.DataTextField  = "nama_inventaris";
            DDLInventaris.DataBind();
            //   DDLHarga.DataBind();
        }


        conn.Close();
        return(val);
    }
    protected bool InitInsertDDLInventaris()
    {
        SqlConnection conn  = Common.getConnection();
        string        query = "";
        bool          val   = false;
        SqlCommand    cmd   = new SqlCommand();

        cmd.Connection  = conn;
        cmd.CommandType = System.Data.CommandType.Text;

        if (HiddenType.Equals("barang"))
        {
            query = "select id, nama_inventaris, harga from m_inventaris where id not in(select id_inventaris from "
                    + " t_pengajuan_inventaris_detail where id_pengajuan = " + HiddenIDPengajuan.Value + ") order by id asc";
        }
        else if (HiddenType.Equals("service"))
        {
            query = "select id, nama_inventaris, harga from m_inventaris where id not in(select id_inventaris from "
                    + " t_service_inventaris_detail where id_pengajuan = " + HiddenIDPengajuan.Value + ") order by id asc";
        }
        else
        {
            query = "select id, nama_inventaris from m_inventaris";
        }

        cmd.CommandText = query;

        conn.Open();
        SqlDataReader reader = cmd.ExecuteReader();

        if (reader.HasRows)
        {
            val = true;
            DDLInventaris.DataSource     = reader;
            DDLInventaris.DataValueField = "id";
            DDLInventaris.DataTextField  = "nama_inventaris";
            DDLInventaris.DataBind();
            //   DDLHarga.DataBind();
        }


        conn.Close();


        return(val);
    }
예제 #4
0
    private void InitDDLPenugasanInv()
    {
        SqlCommand    cmd  = new SqlCommand();
        SqlConnection conn = Common.getConnection();

        cmd.CommandType = CommandType.Text;
        cmd.CommandText = "select distinct id, nama_inventaris from m_inventaris order by nama_inventaris";

        cmd.Connection = conn;
        conn.Open();

        DDLInventaris.DataSource     = cmd.ExecuteReader();
        DDLInventaris.DataValueField = "id";
        DDLInventaris.DataTextField  = "nama_inventaris";
        DDLInventaris.DataBind();

        conn.Close();
    }
예제 #5
0
    private void GenerateDDLInventaris()
    {
        SqlConnection conn  = Common.getConnection();
        string        query = "";
        SqlCommand    cmd   = new SqlCommand();

        cmd.Connection  = conn;
        cmd.CommandType = System.Data.CommandType.Text;

        query           = "select id, nama_inventaris from m_inventaris where id not in(select id_inventaris from t_stock_inventaris)";
        cmd.CommandText = query;

        conn.Open();
        SqlDataReader reader = cmd.ExecuteReader();

        DDLInventaris.DataSource     = reader;
        DDLInventaris.DataValueField = "id";
        DDLInventaris.DataTextField  = "nama_inventaris";
        DDLInventaris.DataBind();

        conn.Close();
    }
예제 #6
0
    private void GenerateDDLInventaris()
    {
        SqlConnection conn  = Common.getConnection();
        string        query = "";
        SqlCommand    cmd   = new SqlCommand();

        cmd.Connection  = conn;
        cmd.CommandType = System.Data.CommandType.Text;
        cmd.Parameters.AddWithValue("@IdRuangan", HiddenId.Value);

        query           = "select id_inventaris, nama_inventaris from m_inventaris where id_inventaris not in(select id_inventaris from t_inventaris_ruangan where id_ruangan = @IdRuangan)";
        cmd.CommandText = query;

        conn.Open();
        SqlDataReader reader = cmd.ExecuteReader();

        DDLInventaris.DataSource     = reader;
        DDLInventaris.DataValueField = "id_inventaris";
        DDLInventaris.DataTextField  = "nama_inventaris";
        DDLInventaris.DataBind();

        conn.Close();
    }