protected void ddDonVi_SelectedIndexChanged(object sender, EventArgs e)
 {
     execSQL.connectionClass ob = new execSQL.connectionClass();
     string cmd = string.Format("EXEC ChungNT.BC_getUsers '{0}'", ddDonVi.SelectedValue);
     ddNguoiNhan.DataSource = ob.fillDataset(cmd).Tables[0];
     ddNguoiNhan.DataBind();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) return;
     hlQuayLai.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId);
     if (UserInfo.IsInRole("Administrators") || UserInfo.IsInRole("Admin_DonVi"))
         try
         {
             execSQL.connectionClass ob = new execSQL.connectionClass(); 
             DataSet ds = ob.fillDataset("EXEC ChungNT.Password_Admin");
             string tab = ds.Tables[1].Rows[0]["TabID"].ToString();
             string module = ds.Tables[1].Rows[0]["ModuleID"].ToString();
             DataColumn dc = new DataColumn("Link");
             ds.Tables[0].Columns.Add(dc);
             ds.Tables[0].AcceptChanges();
             foreach (DataRow dr in ds.Tables[0].Rows)
             {
                 dr.BeginEdit();
                 dr["Link"] = DotNetNuke.Common.Globals.NavigateURL(int.Parse(tab), "Edit", "mid/" + module, "UserId/" + dr["UserID"].ToString());
                 dr.EndEdit();
             }
             gvNhanVien.DataSource = ds.Tables[0];
             gvNhanVien.DataBind();
             int d = 0;
             foreach (GridViewRow dr in gvNhanVien.Rows)
             {
                 dr.CssClass = dr.Cells[6].Text;
                 if (dr.Cells[6].Text != "OK") d++;
             }
             lbError.Text = string.Format("Mật khẩu quá hạn: <b>{0}</b> / {1} tài khoản", d, gvNhanVien.Rows.Count);
         }
         catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
     else Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId));
 }
 protected void btChuyen_Click(object sender, EventArgs e)
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         DataSet ds;
         CheckBox cb;
         string cmd;
         int ok = 0;
         foreach (GridViewRow row in gvKeHoach.Rows)
         {
             cb = (CheckBox)row.FindControl("cbSelect");
             if (cb.Checked)
                 try
                 {
                     cmd = string.Format("EXEC ChungNT.KeHoach_ChuyenTiep_Update {0}, {1}, '{2}', {3}", row.Cells[1].Text, rbKeHoach.SelectedValue, ob.dateFormat(tbTime.Text), UserId);
                     ds = ob.fillDataset(cmd);
                     if (ds.Tables[0].Rows[0][0].ToString() == "1")
                         ok++;
                 }
                 catch { }
         }
         gvKeHoach.DataSource = null;
         gvKeHoach.DataBind();
         lbError.Text = string.Format("Chuyển tiếp thành công <b>{0}</b> kế hoạch", ok);
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình cập nhật. " + ex.Message; }
 }
 private void Load_Ke()
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         DataSet ds = ob.fillDataset("EXEC LuuTru.Ke_Select_2015 " + lbGiaID.Text);
         DataColumn dc = new DataColumn("Link");
         ds.Tables[0].Columns.Add(dc);
         ds.Tables[0].AcceptChanges();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             dr.BeginEdit();
             dr["Link"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "CAP", "mid/" + ModuleId, "ID/" + dr[2].ToString());
             dr.EndEdit();
         }
         gvCap.DataSource = ds.Tables[0];
         gvCap.DataBind();
         string last = "";
         int last_i = 0, count = 0;
         for (int i = 0; i < gvCap.Rows.Count; i++)
             if (last == gvCap.Rows[i].Cells[1].Text)
                 count++;
             else
             {
                 //gvCap.Rows[last_i].Cells[1].RowSpan = count;
                 last = gvCap.Rows[i].Cells[1].Text;
                 last_i = i;
                 count = 1;
             }
     }
     catch (Exception ex) { lbErrorGia.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
 }
        protected void btCapNhat_Click(object sender, EventArgs e)
        {
            if (fileUpload.HasFile) btDinhKem_Click(sender, e);
            try
            {
                execSQL.connectionClass ob = new execSQL.connectionClass();
                string sql = string.Format("EXEC TrongTam.CongViec_Update 0, N'{0}', '{1}', '{2}', '{3}', '{4}', {5}",
                     tbTieuDe.Text, ob.dateFormat(tbBatDau.Text), ob.dateFormat(tbKetThuc.Text), ob.dateFormat(tbCanhBao.Text), lbChuTri.Text, UserId);
                DataSet ds = ob.fillDataset(sql);
                string newID = ds.Tables[0].Rows[0][1].ToString();
                int trongSo;
                TextBox txt_TrongSo, txt_BatDau, txt_KetThuc, txt_CanhBao, txt_NoiDung;
                CheckBox cbPhanCong;
                foreach (GridViewRow dr in gvPhanCong.Rows)
                {
                    cbPhanCong = (CheckBox)dr.FindControl("cbPhanCong");

                    txt_BatDau = (TextBox)dr.FindControl("tbBatDau");
                    if (txt_BatDau.Text == "") txt_BatDau.Text = tbBatDau.Text;
                    txt_KetThuc = (TextBox)dr.FindControl("tbKetThuc");
                    if (txt_KetThuc.Text == "") txt_KetThuc.Text = tbKetThuc.Text;
                    txt_CanhBao = (TextBox)dr.FindControl("tbCanhBao");
                    if (txt_CanhBao.Text == "") txt_CanhBao.Text = txt_KetThuc.Text;
                    txt_NoiDung = (TextBox)dr.FindControl("tbNoiDung");
                    sql = string.Format("EXEC TrongTam.CongViec_PhanCong {0}, N'{1}', '{2}', '{3}', '{4}', {5}, {6}, '{7}'",
                        newID, txt_NoiDung.Text, ob.dateFormat(txt_BatDau.Text), ob.dateFormat(txt_KetThuc.Text), dr.Cells[0].Text, UserId,
                        cbPhanCong.Checked ? 3 : 0,
                        ob.dateFormat(txt_CanhBao.Text));
                    ob.fillDataset(sql);
                }
                Response.Redirect(hlQuayLai.NavigateUrl);
            }
            catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình cập nhật. " + ex.Message; }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) return;
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass();
         string sql = string.Format("EXEC ThongtinMHTB.dbo.Lay_Thongbao_tonghop_new '{0}', '{1}'", UserInfo.Username, UserInfo.Profile.GetPropertyValue("MaDonVi"));
         DataSet ds = ob.fillDataset(sql);
         ds.Tables[0].AcceptChanges();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             dr.BeginEdit();
             dr["noidung"] = HttpUtility.HtmlDecode(dr["noidung"].ToString());
             dr.EndEdit();
         }
         gvThongBao.DataSource = ds.Tables[0];
         gvThongBao.DataBind();
         DataView dv = ds.Tables[1].DefaultView;
         GridView gvDinhKem;
         foreach (GridViewRow dr in gvThongBao.Rows)
         {
             gvDinhKem = (GridView)dr.FindControl("gvDinhKem");
             dv.RowFilter = "ma_tb = " + dr.Cells[0].Text;
             gvDinhKem.DataSource = dv.Table;
             gvDinhKem.DataBind();
         }
     }
     catch { }
 }
 private void BindDuLieuDanhMucGia()
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         DataSet ds = ob.fillDataset("EXEC LuuTru.Ke_Select " + lbID.Text + ", 0");
         lbID.Text = ds.Tables[0].Rows[0][2].ToString();
         lbTieuDe.Text = ds.Tables[0].Rows[0][1].ToString();
         lbMoTa.Text = ds.Tables[0].Rows[0][3].ToString();
         DataColumn dc = new DataColumn("LinkID");
         ds.Tables[0].Columns.Add(dc);
         ds.Tables[0].AcceptChanges();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             dr.BeginEdit();
             dr["LinkID"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "KE", "mid/" + ModuleId, "ID/" + dr[4].ToString());
             dr.EndEdit();
         }
         if (ds.Tables[0].Rows.Count == 0)
         {
             DataRow dr = ds.Tables[0].NewRow();
             dr[4] = 0;
             ds.Tables[0].Rows.Add(dr);
         }
         gvKho.DataSource = ds.Tables[0];
         gvKho.DataBind();
         gvKho.Columns[4].Visible = UserInfo.IsInRole("Administrators") || UserInfo.IsInRole("Admin_DonVi") || UserInfo.IsInRole("VANTHU") || UserInfo.IsInRole("NHANVIENLUUTRU");
         lbError.Text = "Danh sách: " + ds.Tables[0].Rows.Count;
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
 }
 private void show_phongban()
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         DataSet ds = ob.fillDataset("EXEC ChungNT.KeHoach_TongHop_DonVi");
         DataView dv = ds.Tables[0].DefaultView;
         TreeNode child;
         foreach (TreeNode node in tvPhongBan.Nodes)
         {
             dv.RowFilter = string.Format("GroupID = '{0}'", node.Value);
             for (int i = 0; i < dv.Count; i++)
             {
                 child = new TreeNode();
                 child.Value = dv[i][0].ToString();
                 child.Text = dv[i][1].ToString();
                 child.ShowCheckBox = true;
                 child.SelectAction = TreeNodeSelectAction.None;
                 node.ChildNodes.Add(child);
             }
         }
         lbError.Text = "";
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
 }
 protected void gvLoaiCV_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "SUA")
     {
         int id = Convert.ToInt32(e.CommandArgument);
         tbLoaiCV.Text = HttpUtility.HtmlDecode(gvLoaiCV.Rows[id].Cells[2].Text);
         cbCV_Den.Checked = ((CheckBox)gvLoaiCV.Rows[id].FindControl("cbCVDen")).Checked;
         lbID.Text = gvLoaiCV.Rows[id].Cells[0].Text;
         btCapNhat.Text = "Cập nhật";
     }
     if (e.CommandName == "XOA")
         try
         {
             execSQL.connectionClass ob = new execSQL.connectionClass();
             int id = Convert.ToInt32(e.CommandArgument);
             string sql = string.Format("EXEC ChungNT.cv_spDMLoaiCV_Edit {0}, '', 0, 1, {1}", gvLoaiCV.Rows[id].Cells[0].Text, UserId);
             DataSet ds = ob.fillDataset(sql);
             if (ds.Tables[0].Rows[0][0].ToString() == "1")
             {
                 Load_Data();
                 lbError.Text = "Xóa thành công";
             }
             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 < 0) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL("Login"));

            txtNgayBatKy.Text = DateTime.Today.ToString("dd/MM/yyyy");
            lbDonVi.Text = "F01";
            try
            {
                lbDonVi.Text = UserInfo.Profile.City.ToString();
            }
            catch { }
            btQuayLai.Enabled = lbDonVi.Text.Length == 6;

            try
            {
                execSQL.connectionClass ob = new execSQL.connectionClass(); 
                string cmd = string.Format("EXEC [BaoCao].[DonVi_Select] '{0}'", lbDonVi.Text);
                lbTenDonVi.Text = ob.fillDataset(cmd).Tables[0].Rows[0][1].ToString();

                btnKiemTraDuLieuTuan_Click(sender, e);
            }
            catch (Exception ex)
            {
                lbMessage.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message;
                lbMessage2.Text = lbMessage.Text;
            }
        }
 private void load_data()
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         string cmd = string.Format("EXEC BCPLAN_APR_ThongKe {0}, {1}", rbWeek.SelectedValue, rbTime.SelectedValue);
         DataSet ds = ob.fillDataset(cmd);
         dlThongKe.DataSource = ds.Tables[0];
         dlThongKe.DataBind();
         DataView dv = ds.Tables[1].DefaultView;
         Label lbThoiGian, lbDonVi, lbDem;
         int dem;
         foreach (DataListItem dr in dlThongKe.Items)
         {
             lbThoiGian = (Label)dr.FindControl("lbThoiGian");
             dv.RowFilter = string.Format("NgayThang = '{0}'", lbThoiGian.Text);
             lbDonVi = (Label)dr.FindControl("lbDonVi");
             dem = 0;
             foreach (DataRow row in dv.ToTable().Rows)
             {
                 dem++;
                 lbDonVi.Text += row[2].ToString() + "; ";
             }
             lbDem = (Label)dr.FindControl("lbDem");
             lbDem.Text = dem.ToString();
         }
     }
     catch { }
 }
 protected void bindData()
 {
     if (lbKey.Text == "0") blank();
     else try
         {
             execSQL.connectionClass ob = new execSQL.connectionClass(); 
             string cmdTxt = string.Format("exec bcPlan_getItem @id={0}, @userID={1}", lbKey.Text, UserId);
             DataSet ds = ob.fillDataset(cmdTxt);
             //lbKey.Text = ds.Tables[0].Rows[0][0].ToString();
             lbThangNam.Text = ds.Tables[0].Rows[0][1].ToString();
             tbSapXep.Text = ds.Tables[0].Rows[0][3].ToString();
             tbTT.Text = ds.Tables[0].Rows[0][4].ToString();
             tbNoiDung.Text = ds.Tables[0].Rows[0][5].ToString();
             tbDV.Text = ds.Tables[0].Rows[0][6].ToString();
             tbKeHoach.Text = ds.Tables[0].Rows[0][7].ToString();
             tbThucHien.Text = ds.Tables[0].Rows[0][8].ToString();
             tbLuyKe.Text = ds.Tables[0].Rows[0][9].ToString();
             tbChuTri.Text = ds.Tables[0].Rows[0][10].ToString();
             tbDanhGia.Text = ds.Tables[0].Rows[0][11].ToString();
             tbNhanXet.Text = ds.Tables[0].Rows[0][12].ToString();
             lbModify.Text = string.Format("Cập nhật thông tin : {0}", ds.Tables[0].Rows[0][13].ToString());
             lbNhanXet.Text = string.Format("Tự đánh giá : {0}", ds.Tables[0].Rows[0][15].ToString());
         }
         catch (Exception ex)
         {
             blank();
             lbError.Text = "Không thể cập nhật kế hoạch này. " + ex.Message;
         }
 }
 protected void treeView_SelectedNodeChanged(object sender, EventArgs e)
 {
     lbLoaiBC.Text = treeView.SelectedNode.Text;
     gvBaoCao.DataSource = null;
     gvBaoCao.DataBind();
     if (treeView.SelectedNode.Depth > 0)
         try
         {
             string cmdTxt = string.Format("exec DA_BC_getListBC {0}, {1}", treeView.SelectedNode.Parent.Value, treeView.SelectedNode.Value);
             execSQL.connectionClass ob = new execSQL.connectionClass(); 
             DataSet ds = ob.fillDataset(cmdTxt);
             DataColumn dc = new DataColumn("ViewLink");
             ds.Tables[0].Columns.Add(dc);
             dc = new DataColumn("LinkDV");
             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, "BAOCAO", "mid/" + ModuleId, "ID/" + dr[0].ToString());
                 if (dr[5].ToString().Length > 0)
                     dr["LinkDV"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "DUAN", "mid/" + ModuleId, "ID/" + dr[0].ToString(), "DV/" + dr[5].ToString());
                 dr.EndEdit();
             }
             gvBaoCao.DataSource = ds;
             gvBaoCao.DataBind();
         }
         catch { }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            if (UserId < 0) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL("Login"));

            hlChamDiem_Ban.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "BAN", "mid/" + ModuleId);
            hlDuyetTB.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "DUYET", "mid/" + ModuleId);
            hlPhucTra.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "PHUCTRA", "mid/" + ModuleId);

            execSQL.connectionClass ob = new execSQL.connectionClass(); 
            try
            {
                string sql = string.Format("SELECT VHDN.Quyen_CheckUser(2, {0})", UserId);
                DataSet ds = ob.fillDataset(sql);
                hlChamDiem_Ban.Visible = ds.Tables[0].Rows[0][0].ToString() == "1";
                hlDuyetTB.Visible = ds.Tables[0].Rows[0][0].ToString() == "1";
                sql = string.Format("SELECT VHDN.Quyen_CheckUser(1, {0})", UserId);
                ds = ob.fillDataset(sql);
                hlChamDiem_Ban.Visible = ds.Tables[0].Rows[0][0].ToString() == "1";
                hlPhucTra.Visible = ds.Tables[0].Rows[0][0].ToString() == "1";
            }
            catch { }

            tbThoiGian.Text = DateTime.Today.ToString("dd/MM/yyyy");
            lbThoiGian.Text = ob.dateFormat(tbThoiGian.Text);
            Load_Data();
        }
        private void Load_Data()
        {
            try
            {
                string sql = string.Format("EXEC VHDN.BangDiem_Select_CaNhan 1, {0}, '{1}'", Request["ID"], Request["DT"]);
                execSQL.connectionClass ob = new execSQL.connectionClass(); 
                DataSet ds = ob.fillDataset(sql);
                gvData.DataSource = ds.Tables[0];
                gvData.DataBind();

                int diemC, diem, diemTB, diemPT;
                diemC = 0; diem = 0; diemTB = 0; diemPT = 0;
                foreach (DataRow dr in ds.Tables[0].Rows)
                    try
                    {
                        diemC += int.Parse(dr["DiemChuan"].ToString());
                        diem += int.Parse(dr["Diem"].ToString());
                        diemTB += int.Parse(dr["DiemTB"].ToString());
                        diemPT += int.Parse(dr["DiemPT"].ToString());
                    }
                    catch { }
                gvData.FooterRow.CssClass = "group";
                gvData.FooterRow.Cells[1].Text = "Tổng cộng :";
                gvData.FooterRow.Cells[2].Text = diemC.ToString();
                gvData.FooterRow.Cells[3].Text = diem.ToString();
                gvData.FooterRow.Cells[4].Text = diemTB.ToString();
                gvData.FooterRow.Cells[5].Text = diemPT.ToString();

                sql = string.Format("EXEC VHDN.TongHop_TieuDe {0}, '{1}'", Request["ID"], Request["DT"]);
                ds = ob.fillDataset(sql);
                lbThang.Text = ds.Tables[0].Rows[0][0].ToString();
                lbBan.Text = ds.Tables[1].Rows[0][0].ToString();
            }
            catch { }
        }
        private void fileCreate()
        {
            try
            {
                execSQL.connectionClass ob = new execSQL.connectionClass();
                string sql = string.Format("EXEC ChungNT.cv_spFiles_ByPrimaryKey {0}, {1}", Request["id"], Request["cv"]);
                DataSet ds = ob.fillDataset(sql);
                string fID = ds.Tables[0].Rows[0]["FileID"].ToString();
                string fName = ds.Tables[0].Rows[0]["FileName"].ToString();
                string fType = ds.Tables[0].Rows[0]["FileType"].ToString();
                string fSize = ds.Tables[0].Rows[0]["FileSize"].ToString();
                byte[] fData = (byte[])ds.Tables[0].Rows[0]["FileData"];

                string folder = "0";
                if (fID.Length > 2) folder = fID.Substring(0, fID.Length - 2);
                string filePath = Server.MapPath("") + "\\" + folder;
                if (!Directory.Exists(filePath)) Directory.CreateDirectory(filePath);
                int last = fName.LastIndexOf(".");
                string fileName = fID + fName.Substring(last, fName.Length - last);
                filePath = filePath + @"\" + fileName;
                if (!File.Exists(filePath)) File.WriteAllBytes(filePath, fData);

                string iframe = string.Format("<iframe src=\"http://docs.google.com/gview?url=http://eoffice.npc.com.vn{0}/DesktopModules/CongVan_CNT/{1}/{2}&embedded=true\" style=\"width:100%; height:100%;\" frameborder=\"0\"></iframe>",
                    Request.ApplicationPath, folder, fileName);
                iGoogle.InnerHtml = iframe;
            }
            catch (Exception ex) { Response.Write("Không thể tải văn bản này. " + ex.Message); }
        }
Example #17
0
 private void Load_Data()
 {
     execSQL.connectionClass ob = new execSQL.connectionClass();
     lbNgayThang.Text = ob.dateFormat(tbNgayThang.Text);
     try
     {
         string cmd = string.Format("EXEC ChamCong.Reason_Select '{0}', {1}, '{2}'", lbMaDV.Text, dlNhanVien.SelectedValue, lbNgayThang.Text);
         gvChamCong.DataSource = ob.fillDataset(cmd).Tables[0];
         gvChamCong.DataBind();
         DataSet ds = ob.fillDataset("ChamCong.Type_Select");
         DropDownList dlLoai;
         foreach (GridViewRow dr in gvChamCong.Rows)
         {
             dlLoai = (DropDownList)dr.FindControl("dlLoai");
             dlLoai.DataSource = ds.Tables[0];
             dlLoai.DataBind();
             try
             {
                 dlLoai.SelectedValue = dr.Cells[2].Text;
             }
             catch { }
             dr.CssClass = dr.Cells[1].Text;
         }
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
 }
        protected void gvLoai_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "XEM")
                try
                {
                    int index = Convert.ToInt32(e.CommandArgument);
                    string cmd = string.Format("EXEC ChungNT.BaoCao_Home_BaoCao {0}, {1}", gvLoai.Rows[index].Cells[1].Text, gvLoai.Rows[index].Cells[3].Text);
                    execSQL.connectionClass ob = new execSQL.connectionClass(); 
                    DataSet ds = ob.fillDataset(cmd);
                    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, "BAOCAO", "mid/" + ModuleId, "ID/" + dr[0].ToString());
                        dr.EndEdit();
                    }
                    gvBaoCao.DataSource = ds.Tables[0];
                    gvBaoCao.DataBind();
                    lbLoai.Text = ds.Tables[1].Rows[0][0].ToString();

                    Panel1.Visible = true;
                    gvLoai.Visible = false;
                    lbError.Text = "";
                }
                catch (Exception ex) { lbError.Text = "Có lỗi xảy ra trong quá trình đọc báo cáo. " + ex.Message; }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) return;
     execSQL.connectionClass ob = new execSQL.connectionClass(); 
     GridView1.DataSource = ob.fillDataset("EXEC bcPlan_getPhanQuyen " + UserId);
     GridView1.DataBind();
 }
        protected void btCapNhat_Click(object sender, EventArgs e)
        {
            execSQL.connectionClass ob = new execSQL.connectionClass(); 
            string dienap, dieu1, dieu2, dieu3, dieu5, dieu14, bienphap;
            foreach (GridViewRow row in gvGiamThieu.Rows)
                try
                {
                    dienap = row.Cells[1].Text.Replace(" kV", "");
                    dieu1 = ((TextBox)row.FindControl("tbDieu1")).Text;
                    dieu2 = ((TextBox)row.FindControl("tbDieu2")).Text;
                    dieu3 = ((TextBox)row.FindControl("tbDieu3")).Text;
                    dieu5 = ((TextBox)row.FindControl("tbDieu5")).Text;
                    dieu14 = ((TextBox)row.FindControl("tbDieu14")).Text;
                    bienphap = ((TextBox)row.FindControl("tbBienPhap")).Text;
                    try { int.Parse(dieu1); }
                    catch { dieu1 = "0"; }
                    try { int.Parse(dieu2); }
                    catch { dieu2 = "0"; }
                    try { int.Parse(dieu3); }
                    catch { dieu3 = "0"; }
                    try { int.Parse(dieu5); }
                    catch { dieu5 = "0"; }
                    try { int.Parse(dieu14); }
                    catch { dieu14 = "0"; }
                    string cmd = string.Format("EXEC LichLV.HanhLang_GiamThieu_Update '{9}', '{0}', {1}, {2}, {3}, {4}, {5}, {6}, N'{7}', 1, {8}",
                        lbThoiGian.Text, dienap, dieu1, dieu2, dieu3, dieu5, dieu14, bienphap, UserId, lbDonVi.Text);
                    ob.fillDataset(cmd);
                }
                catch { }

            Load_GiamThieu();
            lbError.Text = "Cập nhật lúc " + DateTime.Now.ToString("HH:mm dd/MM");
        }
 private void load_congviec()
 {
     if (lbID.Text == "0")
     {
         tbNgayThang.Text = DateTime.Today.ToString("dd/MM/yyyy");
         try
         {
             execSQL.connectionClass ob = new execSQL.connectionClass(); 
             DataSet ds = ob.fillDataset("EXEC LichLV.User_DonVi " + UserId);
             lbDonVi.Text = ds.Tables[0].Rows[0][3].ToString();
             lbTrangThai.Text = "Mới nhập";
         }
         catch (Exception ex) { lbTrangThai.Text = ex.Message; }
     }
     else try
         {
             execSQL.connectionClass ob = new execSQL.connectionClass(); 
             DataSet ds = ob.fillDataset("EXEC LichLV.CongViec_ID " + lbID.Text);
             tbNgayThang.Text = ds.Tables[0].Rows[0][1].ToString();
             tbNoiDung.Text = ds.Tables[0].Rows[0][2].ToString();
             tbDonVi.Text = ds.Tables[0].Rows[0][3].ToString();
             tbDiaDiem.Text = ds.Tables[0].Rows[0][4].ToString();
             tbThoiGian.Text = ds.Tables[0].Rows[0][5].ToString();
             lbDonVi.Text = ds.Tables[0].Rows[0][6].ToString();
             lbTrangThai.Text = ds.Tables[0].Rows[0][7].ToString();
         }
         catch (Exception ex) { lbError.Text = ex.Message; }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            if (UserId < 0) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL("Login"));

            lbMaDV.Text = "F01";
            try
            {
                lbMaDV.Text = UserInfo.Profile.City;
            }
            catch { }
            if (lbMaDV.Text.Length > 6) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(TabId, "UPDATE", "mid/" + ModuleId));
            btTongHop.Enabled = lbMaDV.Text != "F01P11";

            ddlNam.Items.Add(DateTime.Today.AddYears(1).ToString("yyyy"));
            ddlNam.Items.Add(DateTime.Today.ToString("yyyy"));
            ddlNam.Items.Add(DateTime.Today.AddYears(-1).ToString("yyyy"));
            ddlNam.Items.Add(DateTime.Today.AddYears(-2).ToString("yyyy"));
            ddlNam.SelectedIndex = 1;
            ddlThang.SelectedIndex = DateTime.Today.Month - 1;

            try
            {
                execSQL.connectionClass ob = new execSQL.connectionClass(); 
                string cmd = string.Format("select TenDonVi from dbo.TTAT_DM_DonVi where MaDonVi='{0}'", lbMaDV.Text);
                lbDonVi.Text = ob.fillDataset(cmd).Tables[0].Rows[0][0].ToString();

                btnKiemTra_Click(sender, e);
            }
            catch (Exception ex)
            {
                lbMessage.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message;
            }
        }
        protected void btThucHien_Click(object sender, EventArgs e)
        {
            execSQL.connectionClass ob = new execSQL.connectionClass();
            class_BaoCao_Tuan ob2 = new class_BaoCao_Tuan();
            DateTime d;
            if (lbThang.Text == "1")
                d = ob2.thisMonth(lbThoiGian.Text);
            else
                d = ob2.thisMonday(lbThoiGian.Text);
            TextBox tbPhanTram;
            string cmd;
            foreach (GridViewRow row in gvCongViec.Rows)
                try
                {
                    tbPhanTram = (TextBox)row.FindControl("tbThucHien");
                    if (tbPhanTram.Text.Length > 0)
                    {
                        cmd = string.Format("EXEC ChungNT.BaoCaoTuan_ThucHien_Update {0}, '{1}', {2}, {3}",
                            row.Cells[1].Text, d.ToString("yyyy-MM-dd"), tbPhanTram.Text, UserId);
                        ob.fillDataset(cmd);
                    }
                }
                catch { }

            Load_TimKiem();
            lbError.Text = "Cập nhật lúc " + DateTime.Now.ToString("HH:mm dd/MM/yyyy");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            hlThemMoi.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "CONGVIEC", "mid/" + ModuleId);
            hlKiemTra.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "KIEMTRA", "mid/" + ModuleId);
            hlDuyet.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "DUYET", "mid/" + ModuleId);
            try
            {
                hlDuyet.Visible = UserInfo.Profile.City.Substring(0, 4) == "F01F";
                hlThemMoi.Visible = UserInfo.Profile.City.Length == 9;
                hlKiemTra.Visible = UserInfo.Profile.City.Length == 9;
            }
            catch { }
            try
            {
                string cmd = string.Format("EXEC LichLV.DonVi_List 1, {0}, ''", UserId);
                execSQL.connectionClass ob = new execSQL.connectionClass(); 
                dlCongTy.DataSource = ob.fillDataset(cmd);
                dlCongTy.DataBind();

                load_dienluc();
            }
            catch (Exception ex) { lbError.Text = ex.Message; }
            tbTuNgay.Text = DateTime.Today.ToString("dd/MM/yyyy");
            tbDenNgay.Text = DateTime.Today.ToString("dd/MM/yyyy");
        }
        private void Load_Data()
        {
            try
            {
                string sent = Request["SENT"] == null ? "2" : Request["SENT"];
                lbTieuDe.Text = sent == "2" ? "THÔNG BÁO TRỰC TIẾP" : sent == "1" ? hlThongBaoGui.Text : hlThongBaoDen.Text;

                string sql = "EXEC EOFFICE_NPC.ChungNT.ThongBao_NoiDung_Get @userID, @userDV, @sent, @search";
                SqlParameter[] pa = new SqlParameter[4];
                pa[0] = new SqlParameter("@userID", UserId);
                pa[1] = new SqlParameter("@userDV", UserInfo.Profile.GetPropertyValue("MaDonVi"));
                pa[2] = new SqlParameter("@sent", sent);
                pa[3] = new SqlParameter("@search", tbNoiDung.Text);
                execSQL.connectionClass ob = new execSQL.connectionClass();
                DataSet ds = ob.bindDataset(sql, pa);
                DataColumn dc = new DataColumn("Link");
                ds.Tables[0].Columns.Add(dc);
                ds.Tables[0].AcceptChanges();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    dr.BeginEdit();
                    dr["Link"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "SOAN", "mid/" + ModuleId, "ID/" + dr["ID"].ToString());
                    dr.EndEdit();
                }
                gvThongBao.DataSource = ds.Tables[0];
                gvThongBao.DataBind();
                foreach (GridViewRow dr in gvThongBao.Rows)
                    if (dr.Cells[0].Text == "0")
                        dr.CssClass = "new";
            }
            catch (Exception ex) { Response.Write("Có lỗi trong quá trình đọc dữ liệu. " + ex.Message); }
        }
 private void Load_Data()
 {
     try
     {
         lbTieuDe.Text = lbThoiGian.Text.Substring(5, 2) + "/" + lbThoiGian.Text.Substring(0, 4);
         string sql = string.Format("EXEC VHDN.BangDiem_Select_PhucTra_Ban '{0}'", lbThoiGian.Text);
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         DataSet ds = ob.fillDataset(sql);
         DataColumn dc = new DataColumn("Links");
         ds.Tables[0].Columns.Add(dc);
         ds.Tables[0].AcceptChanges();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             dr.BeginEdit();
             dr["Links"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "BANPHUCTRA2", "mid/" + ModuleId, "ID/" + dr[0].ToString());
             dr.EndEdit();
         }
         gvNhanVien.DataSource = ds.Tables[0];
         gvNhanVien.DataBind();
         foreach (GridViewRow dr in gvNhanVien.Rows)
             if (dr.Cells[1].Text == "0" || dr.Cells[4].Text != dr.Cells[6].Text)
                 dr.CssClass = "show";
     }
     catch (Exception ex)
     {
         lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message;
         lbError2.Text = lbError.Text;
     }
 }
        private void Load_GiamThieu()
        {
            try
            {
                execSQL.connectionClass ob = new execSQL.connectionClass(); 
                string cmd = string.Format("EXEC LichLV.HanhLang_GiamThieu_DonVi '{0}', '', {1}", ob.dateFormat(tbNgayThang.Text), UserId);
                if (ddThaoTac.SelectedValue != "ALL")
                    cmd = string.Format("EXEC LichLV.HanhLang_GiamThieu_DonVi '{0}', '{1}', 0", ob.dateFormat(tbNgayThang.Text), ddThaoTac.SelectedValue);
                DataSet ds = ob.fillDataset(cmd);
                lbThoiGian.Text = ds.Tables[0].Rows[0][0].ToString();
                tbThoiGian.Text = "Đến ngày " + ds.Tables[0].Rows[0][1].ToString();
                if (ddThaoTac.SelectedValue == "ALL")
                {
                    gvGiamThieu.DataSource = ds.Tables[1];
                    gvGiamThieu.DataBind();
                }
                else
                {
                    DataView dv = ds.Tables[1].DefaultView;
                    dv.RowFilter = "MaDV <> 'Z01'";
                    gvGiamThieu.DataSource = dv;
                    gvGiamThieu.DataBind();
                }

            }
            catch (Exception ex) { lbError.Text = "Có lỗi xảy ra trong quá trình đọc dữ liệu. " + ex.Message; }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack) return;
     string ngayThang = Request["DT"] == null ? DateTime.Today.ToString("yyyy-MM-dd") : Request["DT"];
     string donVi = Request["DV"] == null ? "F01P11" : Request["DV"];
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         string cmd = string.Format("EXEC LichLV.HanhLang_ViPham_DonVi '{0}', '{1}', 0", ngayThang, donVi);
         DataSet ds = ob.fillDataset(cmd);
         lbNgayThang.Text = ds.Tables[0].Rows[0][1].ToString();
         lbCongTy.Text = ds.Tables[0].Rows[0][2].ToString();
         string lastDV = "";
         ds.Tables[1].AcceptChanges();
         foreach (DataRow dr in ds.Tables[1].Rows)
             if (dr[1].ToString() == lastDV)
             {
                 dr.BeginEdit();
                 dr[2] = "";
                 dr.EndEdit();
             }
             else
             {
                 lastDV = dr[1].ToString();
                 if (dr[1].ToString() == "Z01") dr[2] = "Cộng theo cấp điện áp";
             }
         dlGiamThieu.DataSource = ds.Tables[1];
         dlGiamThieu.DataBind();
     }
     catch { }
 }
 private void load_kehoach()
 {
     string isWeek = Request["W"] == null ? "1" : Request["W"];
     string date = Request["D"];
     try
     {
         Convert.ToDateTime(date);
     }
     catch
     {
         date = DateTime.Today.ToString("yyyy-MM-01");
     }
     try
     {
         lbTieuDe.Text = string.Format("BẢNG TỔNG HỢP KẾ HOẠCH {0}: {1}", isWeek == "1" ? "TUẦN" : "THÁNG",
             isWeek == "1" ? Convert.ToDateTime(date).ToString("dd/MM") + " - " + Convert.ToDateTime(date).AddDays(6).ToString("dd/MM") : Convert.ToDateTime(date).ToString("MM/yyyy"));
         lbTuan.Text = isWeek == "1" ? "tuần" : "tháng";
         string cmd = string.Format("EXEC BCPLAN_LinhVuc_Print {0}, '{1}'", isWeek, date);
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         DataSet ds = ob.fillDataset(cmd);
         dlKeHoach.DataSource = ds.Tables[0];
         dlKeHoach.DataBind();
     }
     catch { }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            if (UserId < 1) Response.Redirect(DotNetNuke.Common.Globals.NavigateURL("Login"));
            execSQL.connectionClass ob = new execSQL.connectionClass();
            DataSet ds = ob.fillDataset("EXEC ChungNT.BC_getUsers 'ALL'");
            ddNguoiNhan.DataSource = ds.Tables[0];
            ddNguoiNhan.DataBind();
            ddDonVi.DataSource = ds.Tables[1];
            ddDonVi.DataBind();

            if (Request["reply"] != null) tbNguoiNhan.Text = Request["reply"];
            if (Request["forward"] != null)
                try
                {
                    lbForward.Text = Request["forward"];
                    string cmdText = string.Format("EXEC ChungNT.BC_getChiTiet {0}, {1}", lbForward.Text, UserId);
                    ds = ob.fillDataset(cmdText);
                    tbTieuDe.Text = ds.Tables[0].Rows[0][3].ToString();
                    tbNoiDung.Text = ds.Tables[0].Rows[0][4].ToString();
                    cmdText = string.Format("EXEC ChungNT.BC_getFiles {0}, {1}", lbForward.Text, UserId);
                    gvDinhKem.DataSource = ob.fillDataset(cmdText);
                    gvDinhKem.DataBind();

                    tbNoiDung.Enabled = false;
                    tbTieuDe.Enabled = false;
                    fileUpload.Enabled = false;
                    btThemFile.Visible = false;
                }
                catch { }
        }