void BindCom() { string sql = "Select * from tbl_claim_com_working where detail_com_id = '" + Session["CodePK"].ToString() + "'"; MySqlDataAdapter da = function.MySqlSelectDataSet(sql); System.Data.DataSet ds = new System.Data.DataSet(); da.Fill(ds); ComGridView.DataSource = ds.Tables[0]; ComGridView.DataBind(); LabelCom.Text = "พนักงานคอมที่ปฏิบัติ " + ds.Tables[0].Rows.Count + " คน"; }
void BindData(string key) { string sql = ""; string sqlPlus = ""; if (Session["UserCpoint"].ToString() != "0") { sqlPlus = "WHERE c.cpoint_id = '" + Session["UserCpoint"].ToString() + "'"; } if (key != "") { sqlPlus = "WHERE c.cpoint_id = '" + key + "'"; } try { sql = "SELECT * FROM tbl_cm_detail cm JOIN tbl_device d ON cm.cm_detail_driver_id = d.device_id JOIN tbl_cpoint c ON cm.cm_cpoint = c.cpoint_id " + sqlPlus + " ORDER BY cm_cpoint,cm_point,cm_detail_channel,STR_TO_DATE(cm.cm_detail_sdate, '%d-%m-%Y'), cm.cm_detail_stime, cm_detail_status_id ASC"; MySqlDataAdapter da = function.MySqlSelectDataSet(sql); System.Data.DataSet ds = new System.Data.DataSet(); da.Fill(ds); CMGridView.DataSource = ds.Tables[0]; CMGridView.DataBind(); if (ds.Tables[0].Rows.Count == 0) { DivCMGridView.Visible = false; } else { DivCMGridView.Visible = true; } //lbCMNull.Text = "พบข้อมูลจำนวน " + ds.Tables[0].Rows.Count + " แถว"; } catch { } }
void BindData(string txtSearch) { string sql = ""; try { if (Session["UserCpoint"].ToString() == "0") { sql = "SELECT * FROM tbl_claim c JOIN tbl_cpoint ON claim_cpoint = cpoint_id JOIN tbl_status ON status_id = claim_status LEFT JOIN tbl_user ON username=claim_user_start_claim JOIN tbl_status_detail sd ON sd.detail_claim_id = c.claim_id AND sd.detail_status_id = c.claim_status WHERE claim_delete = '0' AND (cpoint_name LIKE '%" + txtSearch + "%' OR claim_cpoint_note LIKE '%" + txtSearch + "%' OR claim_equipment LIKE '%" + txtSearch + "%' ) ORDER BY status_id ASC, STR_TO_DATE(claim_cpoint_date, '%d-%m-%Y') ASC"; Session["sql"] = sql; } else { sql = "SELECT * FROM tbl_claim c JOIN tbl_cpoint ON claim_cpoint = cpoint_id JOIN tbl_status ON status_id = claim_status LEFT JOIN tbl_user ON username=claim_user_start_claim JOIN tbl_status_detail sd ON sd.detail_claim_id = c.claim_id AND sd.detail_status_id = c.claim_status WHERE claim_delete = '0' AND (cpoint_name LIKE '%" + txtSearch + "%' OR claim_cpoint_note LIKE '%" + txtSearch + "%' OR claim_equipment LIKE '%" + txtSearch + "%' ) AND claim_cpoint = '" + Session["UserCpoint"].ToString() + "' ORDER BY status_id ASC, STR_TO_DATE(claim_cpoint_date, '%d-%m-%Y') ASC"; Session["sql"] = sql; } MySqlDataAdapter da = function.MySqlSelectDataSet(sql); System.Data.DataSet ds = new System.Data.DataSet(); da.Fill(ds); ClaimGridView.DataSource = ds.Tables[0]; ClaimGridView.DataBind(); lbClaimNull.Text = "พบข้อมูลจำนวน " + ds.Tables[0].Rows.Count + " แถว"; } catch { } }
public void bindAllClaim() { string ss = "SELECT cpoint_name,COUNT(claim_id),claim_budget_year AS amount FROM tbl_cpoint LEFT JOIN tbl_claim ON claim_cpoint = cpoint_id WHERE claim_budget_year = '2561' GROUP BY claim_cpoint"; MySqlDataAdapter AllClaim = function.MySqlSelectDataSet(ss); DataGrid dt = new DataGrid(); GridViewTest.DataSource = dt; GridViewTest.DataBind(); }
void BindConpaney() { string sql = "SELECT * FROM tbl_quotations q JOIN tbl_company c ON q.quotations_company_id = c.company_id WHERE quotations_claim_id = '" + Session["codePK"].ToString() + "'"; MySqlDataAdapter da = function.MySqlSelectDataSet(sql); System.Data.DataSet ds = new System.Data.DataSet(); da.Fill(ds); QuotationsGridView.DataSource = ds.Tables[0]; QuotationsGridView.DataBind(); QuotaGridView.DataSource = ds.Tables[0]; QuotaGridView.DataBind(); }
void BindData(string key) { string sql = ""; try { sql = "SELECT * FROM tbl_device WHERE davice_delete <> 1 AND device_name Like '%" + key + "%' ORDER BY device_name ASC"; MySqlDataAdapter da = function.MySqlSelectDataSet(sql); System.Data.DataSet ds = new System.Data.DataSet(); da.Fill(ds); DeviceGridView.DataSource = ds.Tables[0]; DeviceGridView.DataBind(); lbDeviceNull.Text = "พบข้อมูลจำนวน " + ds.Tables[0].Rows.Count + " แถว"; } catch { } }
void BindData() { txtUser.Text = ""; txtName.Text = ""; txtCodeCpoint.Text = ""; string sql = ""; //string search = ""; if (Session["UserPrivilegeId"].ToString() != "0") { sql = "SELECT * FROM tbl_user where level <> 0 and delete_status = '0' and username <> '" + Session["User"].ToString() + "' AND (username LIKE '%" + TextBox1.Text + "%' OR NAME LIKE '%" + TextBox1.Text + "%' OR LEVEL LIKE '%" + TextBox1.Text + "%' OR user_cpoint LIKE '%" + TextBox1.Text + "%')"; } else { sql = "SELECT * FROM tbl_user where delete_status = '0' AND username <> '" + Session["User"].ToString() + "' AND (username LIKE '%" + TextBox1.Text + "%' OR NAME LIKE '%" + TextBox1.Text + "%' OR LEVEL LIKE '%" + TextBox1.Text + "%' OR user_cpoint LIKE '%" + TextBox1.Text + "%')"; } MySqlDataAdapter da = function.MySqlSelectDataSet(sql); System.Data.DataSet ds = new System.Data.DataSet(); da.Fill(ds); UserGridView.DataSource = ds.Tables[0]; UserGridView.DataBind(); lbUserNull.Text = "พบข้อมูลจำนวน " + ds.Tables[0].Rows.Count + " แถว"; }