예제 #1
0
        void bindFind()
        {
            using (var ctx = new dsSPDDataContext())
            {
                string filter = !string.IsNullOrEmpty(txtTglBerangkat.Text.Trim()) ? "tglBerangkat" : string.Empty;
                string param  = txtTglBerangkat.Text;
                //var data = ctx.sp_GetApprovalSPDAtasanLangsung(karyawan.nrp, filter, param).ToList();
                var data = ctx.sp_GetApprovalSPDAtasanLangsung(ConfigurationManager.AppSettings["NRPAtasan"].ToString(), filter, param).ToList();
                gvViewSPD.DataSource = data;
                gvViewSPD.DataBind();

                if (!data.Any())
                {
                    gvViewSPD.Visible  = false;
                    lblMessage.Visible = true;
                    lblMessage.Text    = "No data";
                }
                else
                {
                    gvViewSPD.Visible = true;
                }
            }
        }
예제 #2
0
        //add by martha
        protected void btncari_Click(object sender, EventArgs e)
        {
            string paramField = DropDownList1.Text.Trim() == "--Select--" ? "" : DropDownList1.Text.Trim();
            string a          = DropDownList1.SelectedValue;


            if (a == "No")
            {
                using (var ctx = new dsSPDDataContext())
                {
                    string filter = !string.IsNullOrEmpty(txtcari.Text.Trim()) ? "noSPD" : string.Empty;
                    string param  = txtcari.Text;
                    var    data   = ctx.sp_GetApprovalSPDAtasanLangsung(karyawan.nrp, filter, param).ToList();
                    gvViewSPD.DataSource = data;
                    gvViewSPD.DataBind();
                }
            }
            else if (a == "Nama")
            {
                using (var ctx = new dsSPDDataContext())
                {
                    string filter = !string.IsNullOrEmpty(txtcari.Text.Trim()) ? "namaLengkap" : string.Empty;
                    string param  = txtcari.Text;
                    var    data   = ctx.sp_GetApprovalSPDAtasanLangsung(karyawan.nrp, filter, param).ToList();

                    gvViewSPD.DataSource = data;
                    gvViewSPD.DataBind();
                }
            }
            else if (a == "BPHUM")
            {
                using (var ctx = new dsSPDDataContext())
                {
                    string filter = !string.IsNullOrEmpty(txtcari.Text.Trim()) ? "BPHUM" : string.Empty;
                    string param  = txtcari.Text;
                    var    data   = ctx.sp_GetApprovalSPDAtasanLangsung(karyawan.nrp, filter, param).ToList();
                    gvViewSPD.DataSource = data;
                    gvViewSPD.DataBind();
                }
            }
            else if (a == "ErrorBPHUM")
            {
                using (var ctx = new dsSPDDataContext())
                {
                    string filter = !string.IsNullOrEmpty(txtcari.Text.Trim()) ? "ErrorBPHUM" : string.Empty;
                    string param  = txtcari.Text;
                    var    data   = ctx.sp_GetApprovalSPDAtasanLangsung(karyawan.nrp, filter, param).ToList();
                    gvViewSPD.DataSource = data;
                    gvViewSPD.DataBind();
                }
            }
            else
            {
                using (var ctx = new dsSPDDataContext())
                {
                    var data = ctx.sp_GetApprovalSPDAtasanLangsung(karyawan.nrp, string.Empty, string.Empty).ToList();
                    gvViewSPD.DataSource = data;
                    gvViewSPD.DataBind();
                }
            }
        }