private void Load_KiemSoat() { connectionBN ob = new connectionBN(); DataSet ds = ob.YCAU_GDOAN_FULL_TBA(ddDonVi.SelectedValue); DataColumn dc = new DataColumn("COLOR"); ds.Tables[0].Columns.Add(dc); ds.Tables[0].AcceptChanges(); int ok, ngayQH; foreach (DataRow dr in ds.Tables[0].Rows) { ok = Check_TH(1, dr[3].ToString(), dr[4].ToString(), out ngayQH); ok = ok * Check_TH(2, dr[5].ToString(), dr[6].ToString(), out ngayQH); ok = ok * Check_TH(3, dr[7].ToString(), dr[8].ToString(), out ngayQH); ok = ok * Check_TH(4, dr[9].ToString(), dr[10].ToString(), out ngayQH); ok = ok * Check_TH(5, dr[11].ToString(), dr[12].ToString(), out ngayQH); dr.BeginEdit(); if (ok == 0) dr["COLOR"] = "QUA"; else if (ok == 1) dr["COLOR"] = "DAT"; else dr["COLOR"] = "DANG"; dr.EndEdit(); } gvKhachHang.DataSource = ds.Tables[0]; gvKhachHang.DataBind(); foreach (GridViewRow dr in gvKhachHang.Rows) dr.CssClass = dr.Cells[4].Text; gvKetQua.DataSource = null; gvKetQua.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; hlKiemSoat.Visible = UserInfo.IsInRole("admin") || UserInfo.IsInRole("GiaoDichVien"); hlKiemSoat.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "KIEMSOAT", "mid/" + ModuleId); connectionBN ob = new connectionBN(); ddDonVi.DataSource = ob.DVI_QLY(); ddDonVi.DataBind(); }
private void Load_Data() { string nextCV, firstCV, firstTC, lastCV, lastTC; int ngayTH; switch (dlGiaiDoan.SelectedValue) { case "1": nextCV = "KS"; firstCV = "TN"; firstTC = "TH"; lastCV = "TN"; lastTC = "CH"; ngayTH = 1; break; case "2": nextCV = "DDN"; firstCV = "KS"; firstTC = "TH"; lastCV = "KS"; lastTC = "CH"; ngayTH = 2; break; case "3": nextCV = "TTK"; firstCV = "DDN"; firstTC = "TH"; lastCV = "DN"; lastTC = "CH"; ngayTH = 3; break; case "4": nextCV = "TVB"; firstCV = "TTK"; firstTC = "TH"; lastCV = "GTK"; lastTC = "CH"; ngayTH = 3; break; case "5": nextCV = "KT"; firstCV = "TVB"; firstTC = "TH"; lastCV = "TT"; lastTC = "CH"; ngayTH = 10; break; default: // 0 nextCV = "KT"; firstCV = "TN"; firstTC = "TH"; lastCV = "TT"; lastTC = "CH"; ngayTH = 10000; break; } connectionBN ob = new connectionBN(); gvKhachHang.DataSource = ob.YCAU_GDOAN(ddDonVi.SelectedValue, nextCV, firstCV, firstTC, lastCV, lastTC, ngayTH); gvKhachHang.DataBind(); gvKetQua.DataSource = null; gvKetQua.DataBind(); foreach (GridViewRow dr in gvKhachHang.Rows) dr.CssClass = dr.Cells[6].Text; }
protected void gvKhachHang_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "XEM") try { int i = Convert.ToInt32(e.CommandArgument); foreach (GridViewRow dr in gvKhachHang.Rows) dr.CssClass = "none"; gvKhachHang.Rows[i].CssClass = "show"; string cmd = string.Format(@"select KQUA_ID, MA_CVIEC, NDUNG_XLY, NGAY_THIEN from CMIS01.DV_KQUA_XLY kq inner join (select MAX(KQUA_ID) MAX_ID from CMIS01.DV_KQUA_XLY where MA_YCAU_KNAI='{0}' group by MA_CVIEC) gr on gr.MAX_ID=kq.KQUA_ID order by kq.KQUA_ID", gvKhachHang.Rows[i].Cells[0].Text); connectionBN ob = new connectionBN(); gvKetQua.DataSource = ob.fillDataset(cmd); gvKetQua.DataBind(); lbError.Text = "Kết quả thực hiện: <b>" + gvKetQua.Rows.Count + "</b> bước"; } catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; if (UserInfo.IsInRole("admin") || UserInfo.IsInRole("GiaoDichVien")) { hlBack.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId); connectionBN ob = new connectionBN(); DataSet ds = ob.DVI_QLY(); DataRow dr = ds.Tables[0].NewRow(); dr[0] = "PA22"; dr[1] = "--"; ds.Tables[0].Rows.InsertAt(dr, 0); ddDonVi.DataSource = ds.Tables[0]; ddDonVi.DataBind(); //Load_Data(); Load_KiemSoat(); } else Response.Redirect(DotNetNuke.Common.Globals.NavigateURL("Login")); }
protected void btTimKiem_Click(object sender, EventArgs e) { if (tbMaYC.Text.Length == 0 && tbTenKH.Text.Length == 0) { lbError.Text = "Chưa nhập thông tin khách hàng"; return; } else try { string cmd = string.Format(@"select MA_YCAU_KNAI, TEN_NGUOIYCAU, DCHI_NGUOIYCAU, NGAY_TNHAN, NOI_DUNG_YCAU from CMIS01.DV_YCAU_KNAI where (substr(MA_YCAU_KNAI, 0, 2)='GK' and MA_YCAU_KNAI='{0}') or (substr(MA_YCAU_KNAI, 0, 2)='GK' and MA_DVIQLY='{1}' and upper(TEN_NGUOIYCAU) like upper('%{2}%'))", tbMaYC.Text, ddDonVi.SelectedValue, tbTenKH.Text); connectionBN ob = new connectionBN(); gvKhachHang.DataSource = ob.fillDataset(cmd); gvKhachHang.DataBind(); gvKetQua.DataSource = null; gvKetQua.DataBind(); lbError.Text = "Kết quả tìm kiếm: <b>" + gvKhachHang.Rows.Count + "</b> khách hàng"; } catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; } }
protected void gvKhachHang_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "XEM") try { int i = Convert.ToInt32(e.CommandArgument); foreach (GridViewRow dr in gvKhachHang.Rows) dr.CssClass = "none"; gvKhachHang.Rows[i].CssClass = "show"; connectionBN ob = new connectionBN(); DataSet ds = ob.YCAU_CTIET(gvKhachHang.Rows[i].Cells[1].Text); DataColumn dc = new DataColumn("QuaHan"); ds.Tables[0].Columns.Add(dc); ds.Tables[0].AcceptChanges(); foreach (DataRow dr in ds.Tables[0].Rows) { int step = Convert.ToInt32(dr[0].ToString().Substring(0, 1)); int ngayQH; int ok = Check_TH(step, dr[1].ToString(), dr[2].ToString(), out ngayQH); dr.BeginEdit(); if (ok == 0) { dr[4] = "QUA"; dr["QuaHan"] = ngayQH; } else if (ok == 1) dr[4] = "DAT"; else dr[4] = "DANG"; dr.EndEdit(); } gvKetQua.DataSource = ds.Tables[0]; gvKetQua.DataBind(); foreach (GridViewRow dr in gvKetQua.Rows) dr.CssClass = dr.Cells[4].Text; } catch { } }