private void LOAD_NKVH()
 {
     if (lbID.Text == "0")
     {
         tbNgayThang.Text = DateTime.Today.ToString("dd/MM/yyyy");
         tbKetThuc.Text = DateTime.Today.ToString("dd/MM/yyyy");
         tbGioBD.Text = DateTime.Now.AddHours(-1).ToString("HH:00");
         tbGioKT.Text = DateTime.Now.ToString("HH:00");
     }
     else
         try
         {
             class_NKVH ob = new class_NKVH();
             DataSet ds = ob.fillDataset("EXEC dbo.CNT_NKVH_VanHanh_ID " + lbID.Text);
             lbID.Text = ds.Tables[0].Rows[0][0].ToString();
             ddPhanHe.SelectedValue = ds.Tables[0].Rows[0][1].ToString();
             tbNgayThang.Text = ds.Tables[0].Rows[0][2].ToString();
             tbGioBD.Text = ds.Tables[0].Rows[0][3].ToString();
             tbLienHe.Text = ds.Tables[0].Rows[0][4].ToString();
             tbDienThoai.Text = ds.Tables[0].Rows[0][5].ToString();
             tbEmail.Text = ds.Tables[0].Rows[0][6].ToString();
             tbDonViLH.Text = ds.Tables[0].Rows[0][7].ToString();
             tbNoiDung.Text = ds.Tables[0].Rows[0][8].ToString();
             tbKetQua.Text = ds.Tables[0].Rows[0][9].ToString();
             tbTonTai.Text = ds.Tables[0].Rows[0][10].ToString();
             tbKetThuc.Text = ds.Tables[0].Rows[0][11].ToString();
             tbGioKT.Text = ds.Tables[0].Rows[0][12].ToString();
             cbHoanThanh.Checked = ds.Tables[0].Rows[0][13].ToString() == "1";
             lbError.Text = ds.Tables[0].Rows[0][14].ToString() + ", " + ds.Tables[0].Rows[0][15].ToString();
         }
         catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
 }
Exemplo n.º 2
0
 protected void phanhe_Load()
 {
     try
     {
         class_NKVH ob = new class_NKVH();
         gvPhanHe.DataSource = ob.fillDataset("exec CNT_NKVH_getPhanHe ''");
         gvPhanHe.DataBind();
         tbPhanHe.Text = "";
     }
     catch { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu"; }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            class_NKVH ob = new class_NKVH();
            ddPhanHe.DataSource = ob.fillDataset("EXEC dbo.CNT_NKVH_getPhanHe 'VIEW'");
            ddPhanHe.DataBind();

            int i = DayOfWeek.Monday - DateTime.Today.DayOfWeek;
            tbTuNgay.Text = DateTime.Today.AddDays(i).ToString("dd/MM/yyyy");
            tbDenNgay.Text = DateTime.Today.AddDays(i + 6).ToString("dd/MM/yyyy");
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) return;
     if (UserId < 1) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL("Login"));
     if (Request["ID"] == null) lbID.Text = "0";
     else lbID.Text = Request["ID"];
     class_NKVH ob = new class_NKVH();
     ddPhanHe.DataSource = ob.fillDataset("exec CNT_NKVH_getPhanHe 'ADD'");
     ddPhanHe.DataBind();
     load_data();
     change_type();
 }
Exemplo n.º 5
0
 protected void btUpdate_Click(object sender, System.Web.UI.ImageClickEventArgs e)
 {
     try
     {
         class_NKVH ob = new class_NKVH();
         string cmdTxt = string.Format("exec CNT_NKVH_getBaoCao {0}, {1}, '{2}', '{3}'",
             ddQuanLy.SelectedValue, ddPhanHe.SelectedValue, ob.convertDate(tbBatDau.Text), ob.convertDate(tbKetThuc.Text));
         gvBaoCao.DataSource = ob.fillDataset(cmdTxt);
         gvBaoCao.DataBind();
     }
     catch { }
 }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) return;
     string cmdTxt = "exec CNT_NKVH_getQuanLy " + UserId;
     class_NKVH ob = new class_NKVH();
     ddQuanLy.DataSource = ob.fillDataset(cmdTxt);
     ddQuanLy.DataBind();
     cmdTxt = string.Format("exec CNT_NKVH_getPhanHe {0}, 0", UserId);
     ddPhanHe.DataSource = ob.fillDataset(cmdTxt);
     ddPhanHe.DataBind();
     tbBatDau.Text = DateTime.Today.AddDays(-7).ToString("dd/MM/yyyy");
     tbKetThuc.Text = DateTime.Today.ToString("dd/MM/yyyy");
 }
Exemplo n.º 7
0
 protected void btUpdate_Click(object sender, ImageClickEventArgs e)
 {
     if (UserInfo.IsInRole("TRUONGPHONG") || UserInfo.IsInRole("PHOPHONG"))
         try
         {
             string cmdTxt = string.Format("exec CNT_NKVH_setPhanHe 0, {0}, N'{1}'", UserId, tbPhanHe.Text);
             class_NKVH ob = new class_NKVH();
             ob.fillDataset(cmdTxt);
             phanhe_Load();
         }
         catch { lbError.Text = "Có lỗi trong quá trình ghi dữ liệu"; }
     else lbError.Text = "Tài khoản không có quyền ghi dữ liệu";
 }
 protected void btXoa_Click(object sender, EventArgs e)
 {
     try
     {
         string cmdTxt = string.Format("EXEC dbo.CNT_NKVH_VanHanh_Update_A1 {0}, -1, '', '', '', '', '', '', '', '', '', 0, {1}",
             lbID.Text, UserId);
         class_NKVH ob = new class_NKVH();
         DataSet ds = ob.fillDataset(cmdTxt);
         if (ds.Tables[0].Rows[0][0].ToString() == "1")
             Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId));
         else lbError.Text = "Không thể xóa dữ liệu";
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình xóa dữ liệu. " + ex.Message; }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            if (UserId < 1) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL("Login"));
            try
            {
                class_NKVH ob = new class_NKVH();
                ddPhanHe.DataSource = ob.fillDataset("EXEC dbo.CNT_NKVH_getPhanHe 'ADD'");
                ddPhanHe.DataBind();

                lbID.Text = Request["ID"] == null ? "0" : Request["ID"];
                LOAD_NKVH();
            }
            catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
        }
 protected void btCapNhat_Click(object sender, EventArgs e)
 {
     try
     {
         class_NKVH ob = new class_NKVH();
         string cmdTxt = string.Format("EXEC dbo.CNT_NKVH_VanHanh_Update_A1 {0}, {1}, N'{2}', N'{3}', '{4}', '{5}', N'{6}', N'{7}', N'{8}', '{9}', '{10}', {11}, {12}",
             lbID.Text, ddPhanHe.SelectedValue, tbLienHe.Text, tbDonViLH.Text, tbDienThoai.Text, tbEmail.Text,
             tbNoiDung.Text, tbKetQua.Text, tbTonTai.Text, ob.dateFormat(tbNgayThang.Text) + " " + tbGioBD.Text,
             ob.dateFormat(tbKetThuc.Text) + " " + tbGioKT.Text, cbHoanThanh.Checked ? "1" : "0", UserId);
         DataSet ds = ob.fillDataset(cmdTxt);
         if (ds.Tables[0].Rows[0][0].ToString() == "1")
             lbError.Text = "Cập nhật dữ liệu thành công";
         else lbError.Text = "Không thể cập nhật";
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình ghi dữ liệu. " + ex.Message; }
 }
 protected void btXem_Click(object sender, EventArgs e)
 {
     class_NKVH ob = new class_NKVH();
     string cmdTxt = string.Format("EXEC dbo.CNT_NKVH_VanHanh_Select {0}, '{1}', '{2}', {3}, {4}",
         ddPhanHe.SelectedValue, ob.dateFormat(tbTuNgay.Text),
         ob.dateFormat(tbDenNgay.Text), cbChuaHT.Checked ? 0 : 1, cbThucHien.Checked ? UserId : 0);
     DataSet ds = ob.fillDataset(cmdTxt);
     DataColumn dc = new DataColumn("viewID");
     ds.Tables[0].Columns.Add(dc);
     ds.Tables[0].AcceptChanges();
     foreach (DataRow dr in ds.Tables[0].Rows)
     {
         dr.BeginEdit();
         dr["viewID"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "VANHANH", "mid/" + ModuleId, "ID/" + dr[0]);
         dr.EndEdit();
     }
     gvVanHanh.DataSource = ds;
     gvVanHanh.DataBind();
 }
Exemplo n.º 12
0
 protected void btSearch_Click(object sender, ImageClickEventArgs e)
 {
     class_NKVH ob = new class_NKVH();
     string cmdTxt = string.Format("exec CNT_NKVH_getBaoCao {0}, {1}, '{2}', '{3}', '{4}', '{5}'",
         rbHoTro.SelectedValue, ddPhanHe.SelectedValue, ob.convertDate(tbTuNgay.Text), ob.convertDate(tbDenNgay.Text),
         cbThucHien.Checked ? UserInfo.Username : "", Request.ApplicationPath.Remove(0, 1));
     DataSet ds = ob.fillDataset(cmdTxt);
     DataColumn dc = new DataColumn("viewID");
     ds.Tables[0].Columns.Add(dc);
     ds.Tables[0].AcceptChanges();
     foreach (DataRow dr in ds.Tables[0].Rows)
     {
         dr.BeginEdit();
         dr["viewID"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "VANHANH", "mid/" + ModuleId, "ID/" + dr[0]);
         dr.EndEdit();
     }
     gvVanHanh.DataSource = ds;
     gvVanHanh.DataBind();
 }
 protected void load_data()
 {
     if (lbID.Text == "0")
     {
         //rbHoTro.Enabled = true;
         tbNgayThang.Text = DateTime.Today.ToString("dd/MM/yyyy");
         tbDienThoai.Text = "";
         tbEmail.Text = "";
         tbNoiDung.Text = "";
         tbKetQua.Text = "";
         tbTonTai.Text = "";
         tbKetThuc.Text = "";
     }
     else
         try
         {
             //rbHoTro.Enabled = false;
             class_NKVH ob = new class_NKVH();
             DataSet ds = ob.fillDataset("exec CNT_NKVH_getVanHanh " + lbID.Text);
             lbID.Text = ds.Tables[0].Rows[0][0].ToString();
             rbHoTro.SelectedValue = ds.Tables[0].Rows[0][1].ToString();
             ddPhanHe.SelectedValue = ds.Tables[0].Rows[0][2].ToString();
             tbNgayThang.Text = ds.Tables[0].Rows[0][3].ToString();
             tbLienHe.Text = ds.Tables[0].Rows[0][4].ToString();
             tbDienThoai.Text = ds.Tables[0].Rows[0][5].ToString();
             tbEmail.Text = ds.Tables[0].Rows[0][6].ToString();
             tbDonViLH.Text = ds.Tables[0].Rows[0][7].ToString();
             tbHoTro.Text = ds.Tables[0].Rows[0][8].ToString();
             tbDonViHT.Text = ds.Tables[0].Rows[0][9].ToString();
             tbNoiDung.Text = ds.Tables[0].Rows[0][10].ToString();
             tbKetQua.Text = ds.Tables[0].Rows[0][11].ToString();
             tbTonTai.Text = ds.Tables[0].Rows[0][12].ToString();
             tbKetThuc.Text = ds.Tables[0].Rows[0][13].ToString();
         }
         catch { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu"; }
 }
Exemplo n.º 14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) return;
     hlBaoCao.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "BAOCAO", "mid/" + ModuleId);
     hlThemMoi.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "VANHANH", "mid/" + ModuleId);
     try
     {
         string cmdTxt = string.Format("exec CNT_NKVH_getVanHanh {0}, 0", UserId);
         class_NKVH ob = new class_NKVH();
         DataSet ds = ob.fillDataset(cmdTxt);
         DataColumn dc = new DataColumn("ViewLink");
         ds.Tables[0].Columns.Add(dc);
         ds.Tables[0].AcceptChanges();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             dr.BeginEdit();
             dr["ViewLink"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "VANHANH", "mid/" + ModuleId, "ID/" + dr[0].ToString());
             dr.EndEdit();
         }
         gvVanHanh.DataSource = ds;
         gvVanHanh.DataBind();
     }
     catch { }
 }
 protected void btUpdate_Click(object sender, System.Web.UI.ImageClickEventArgs e)
 {
     try
     {
         class_NKVH ob = new class_NKVH();
         string cmdTxt = string.Format("exec CNT_NKVH_setVanHanh {0}, {1}, {2}, '{3}', N'{4}', '{14}', '{15}', N'{5}', N'{6}', N'{7}', N'{8}', N'{9}', N'{10}', N'{11}', '{12}', '{13}'",
                lbID.Text, rbHoTro.SelectedValue, ddPhanHe.SelectedValue, ob.convertDate(tbNgayThang.Text),
                tbLienHe.Text, tbDonViLH.Text, tbHoTro.Text, tbDonViHT.Text, tbNoiDung.Text, tbKetQua.Text,
                tbTonTai.Text, tbKetThuc.Text, UserInfo.Username, Request.ApplicationPath.Remove(0, 1), tbDienThoai.Text, tbEmail.Text);
         DataSet ds = ob.fillDataset(cmdTxt);
         if (ds.Tables[0].Rows[0][0].ToString() == "1")
         {
             load_data();
             change_type();
             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"; }
 }
 protected void btDelete_Click(object sender, System.Web.UI.ImageClickEventArgs e)
 {
     try
     {
         string cmdTxt = string.Format("exec CNT_NKVH_setVanHanh {0}, {1}, -1, '', '', '', '', '', '', '', '', '', '', '', '{2}', '{3}'",
             lbID.Text, rbHoTro.SelectedValue, UserInfo.Username, Request.ApplicationPath.Remove(0, 1));
         class_NKVH ob = new class_NKVH();
         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"; }
 }