protected void load_data() { if (lbID.Text == "0") { tbBatDau.Text = ""; tbKetThuc.Text = ""; tbNoiDung.Text = ""; tbKetQua.Text = ""; tbGhiChu.Text = ""; lbError.Text = ""; ibSave.Visible = true; ibDelete.Visible = true; } else try { classCORE ob = new classCORE(); string txt = string.Format("exec CNT_CORE_getByID {0}, {1}", lbID.Text, UserId); DataSet ds = ob.fillDataset(txt); lbID.Text = ds.Tables[0].Rows[0][0].ToString(); ddDanhMuc.SelectedValue = ds.Tables[0].Rows[0][2].ToString(); tbBatDau.Text = ds.Tables[0].Rows[0][4].ToString(); tbKetThuc.Text = ds.Tables[0].Rows[0][5].ToString(); tbNoiDung.Text = ds.Tables[0].Rows[0][6].ToString(); ddLyDo.SelectedValue = ds.Tables[0].Rows[0][3].ToString(); tbKetQua.Text = ds.Tables[0].Rows[0][7].ToString(); tbGhiChu.Text = ds.Tables[0].Rows[0][8].ToString(); tbNgayThang.Text = ds.Tables[0].Rows[0][10].ToString(); lbError.Text = string.Format("{0}, {1}", ds.Tables[0].Rows[0][1].ToString(), ds.Tables[0].Rows[0][11].ToString()); ibSave.Visible = (ds.Tables[0].Rows[0][9].ToString() == "1"); ibDelete.Visible = (ds.Tables[0].Rows[0][9].ToString() == "1"); } catch { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu"; } load_label(); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; hlThemMoi.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "EDIT", "mid/" + ModuleId); //hlBaoCao.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "EXCEL", "mid/" + ModuleId); classCORE ob = new classCORE(); ddNgayThang.DataSource = ob.fillDataset("exec CNT_CORE_getDate"); ddNgayThang.DataBind(); show_data(); }
protected void btXem_Click(object sender, EventArgs e) { try { string cmd = string.Format("EXEC CNT_CORE_getExcel {0}, {1}, {2}, '{3}', '{4}'", ddDanhMuc.SelectedValue, ddLyDo.SelectedValue, ddNhanVien.SelectedValue, convertDate(tbTuNgay.Text), convertDate(tbDenNgay.Text)); classCORE ob = new classCORE(); gvCore.DataSource = ob.fillDataset(cmd); gvCore.DataBind(); } catch { } }
protected void show_data() { tbTen1.Text = ""; tbNhiet1.Text = ""; tbTen2.Text = ""; tbNhiet2.Text = ""; tbTen3.Text = ""; tbNhiet3.Text = ""; classCORE ob = new classCORE(); string txt = string.Format("exec CNT_CORE_getByDate '{0}', {1}", ddNgayThang.SelectedValue, cbIsMe.Checked ? UserId : 0); DataSet ds = ob.fillDataset(txt); foreach (DataRow dr in ds.Tables[0].Rows) if (dr[1].ToString() == "1") { tbTen1.Text = dr[2].ToString(); tbNhiet1.Text = dr[3].ToString(); } else if (dr[1].ToString() == "2") { tbTen2.Text = dr[2].ToString(); tbNhiet2.Text = dr[3].ToString(); } else if (dr[1].ToString() == "3") { tbTen3.Text = dr[2].ToString(); tbNhiet3.Text = dr[3].ToString(); } DataColumn dc = new DataColumn("viewID"); ds.Tables[1].Columns.Add(dc); ds.Tables[1].AcceptChanges(); foreach (DataRow dr in ds.Tables[1].Rows) { dr.BeginEdit(); dr["viewID"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "EDIT", "mid/" + ModuleId, "ID/" + dr[0].ToString()); dr.EndEdit(); } DataView dv = ds.Tables[1].DefaultView; dv.RowFilter = "DanhMuc = 1"; GridView1.DataSource = dv.Table; GridView1.DataBind(); dv.RowFilter = "DanhMuc = 2"; GridView2.DataSource = dv.Table; GridView2.DataBind(); dv.RowFilter = "DanhMuc = 3"; GridView3.DataSource = dv.Table; GridView3.DataBind(); dv.RowFilter = "DanhMuc = 4"; GridView4.DataSource = dv.Table; GridView4.DataBind(); }
protected void btSave_Click(object sender, EventArgs e) { try { classCORE ob = new classCORE(); string cmd = string.Format("EXEC CNT_CORE_setCa '{0}', 1, N'{1}', N'{2}', {3}", ddNgayThang.SelectedValue, tbTen1.Text, tbNhiet1.Text, UserId); ob.fillDataset(cmd); cmd = string.Format("EXEC CNT_CORE_setCa '{0}', 2, N'{1}', N'{2}', {3}", ddNgayThang.SelectedValue, tbTen2.Text, tbNhiet2.Text, UserId); ob.fillDataset(cmd); cmd = string.Format("EXEC CNT_CORE_setCa '{0}', 3, N'{1}', N'{2}', {3}", ddNgayThang.SelectedValue, tbTen3.Text, tbNhiet3.Text, UserId); ob.fillDataset(cmd); } catch { } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) return; tbTuNgay.Text = DateTime.Today.ToString("01/MM/yyyy"); tbDenNgay.Text = DateTime.Today.ToString("dd/MM/yyyy"); try { classCORE ob = new classCORE(); ddNhanVien.DataSource = ob.fillDataset("EXEC CNT_CORE_getNhanVien"); ddNhanVien.DataBind(); } catch { } }
protected void ibDelete_Click(object sender, ImageClickEventArgs e) { try { string cmdTxt = string.Format("exec CNT_CORE_set {0}, {1}, 0, 0, '', '', '', '', '', ''", lbID.Text, UserId); classCORE ob = new classCORE(); DataSet ds = ob.fillDataset(cmdTxt); if (ds.Tables[0].Rows[0][0].ToString() == "1") Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId)); else lbError.Text = "Xóa dữ liệu thất bại"; } catch { lbError.Text = "Có lỗi trong quá trình xóa dữ liệu"; } }
protected void ibSave_Click(object sender, ImageClickEventArgs e) { try { string cmdTxt = string.Format("exec CNT_CORE_set {0}, {1}, {2}, {3}, '{9}', '{4}', '{5}', N'{6}', N'{7}', N'{8}'", lbID.Text, UserId, ddDanhMuc.SelectedValue, ddLyDo.SelectedValue, tbBatDau.Text, tbKetThuc.Text, tbNoiDung.Text, tbKetQua.Text, tbGhiChu.Text, convertDate(tbNgayThang.Text)); classCORE ob = new classCORE(); DataSet ds = ob.fillDataset(cmdTxt); if (ds.Tables[0].Rows[0][0].ToString() == "1") { load_data(); lbError.Text = "Cập nhật dữ liệu thành công"; } else lbError.Text = "Cập nhật dữ liệu thất bại"; } catch { lbError.Text = "Có lỗi trong quá trình ghi dữ liệu"; } }