private void Get_KH()
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         string cmd = string.Format("EXEC ChungNT.CSKH_KhachHang_Search '{0}', {1}, {2}, '{3}', '{4}'",
             ddDonVi.SelectedValue, ddGiaoDichVien.SelectedValue, rbNgayGQ.SelectedValue,
             ob.dateFormat(tbTuNgay.Text), ob.dateFormat(tbDenNgay.Text));
         DataSet ds = ob.fillDataset(cmd);
         gvKhachHang.DataSource = ds.Tables[0];
         gvKhachHang.DataBind();
         lbError.Text = "Số lượng khách hàng: " + ds.Tables[0].Rows.Count;
         hlPrint.NavigateUrl = string.Format("CSKH_TraCuu_LS_Print.aspx?DV={0}&ID={1}&GQ={2}&D1={3}&D2={4}",
             ddDonVi.SelectedValue, ddGiaoDichVien.SelectedValue, rbNgayGQ.SelectedValue,
             ob.dateFormat(tbTuNgay.Text), ob.dateFormat(tbDenNgay.Text));
         DataView dv = ds.Tables[1].DefaultView;
         GridView gvDichVu;
         foreach (GridViewRow dr in gvKhachHang.Rows)
         {
             gvDichVu = (GridView)dr.FindControl("gvDichVu");
             dv.RowFilter = "IDGiaoDich = " + dr.Cells[1].Text;
             gvDichVu.DataSource = dv;
             gvDichVu.DataBind();
         }
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
 }
        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; }
        }
        private void Load_Data()
        {
            try
            {
                execSQL.connectionClass ob = new execSQL.connectionClass();
                string sql = string.Format("EXEC ChungNT.cv_spCongVan_NgayHetHan_TongHop '{0}', '{1}', {2}, '{3}'",
                    ob.dateFormat(tbTuNgay.Text), ob.dateFormat(tbDenNgay.Text), dlLanhDao.SelectedValue, dlPhongBan.SelectedValue);
                DataSet ds = ob.fillDataset(sql);
                gvCongVan.DataSource = ds.Tables[0];
                gvCongVan.DataBind();
                lbError.Text = string.Format("Danh sách <b>{0}</b> công văn", ds.Tables[0].Rows.Count);
                TreeView tree;
                TreeNode node;
                TreeNode child;
                string txt;
                foreach (GridViewRow dr in gvCongVan.Rows)
                    try
                    {
                        tree = (TreeView)dr.FindControl("tvThucHien");
                        sql = "EXEC ChungNT.cv_spCongVan_NgayHetHan_ChiTiet " + dr.Cells[0].Text;
                        ds = ob.fillDataset(sql);
                        dr.CssClass = ds.Tables[1].Rows[0][0].ToString();

                        int i = 0;
                        int j = 0;
                        while (i < ds.Tables[0].Rows.Count)
                            try
                            {
                                if (ds.Tables[0].Rows[i]["SX"].ToString() == "3")
                                {
                                    txt = string.Format("<span class='{0}'>{1}{2}</span>", ds.Tables[0].Rows[i]["Class_HH"].ToString(),
                                        ds.Tables[0].Rows[i]["DisplayName"].ToString(), ds.Tables[0].Rows[i]["Ngay_HH"].ToString());
                                    node = new TreeNode(txt);
                                    node.SelectAction = TreeNodeSelectAction.Expand;
                                    j = i + 1;
                                    while (j < ds.Tables[0].Rows.Count && ds.Tables[0].Rows[j]["SX"].ToString() != "3")
                                    {
                                        txt = string.Format("<span class='{0}'>{1}{2}</span>", ds.Tables[0].Rows[j]["Class_HH"].ToString(),
                                            ds.Tables[0].Rows[j]["Ngay_GQ"].ToString(), ds.Tables[0].Rows[j]["DisplayName"].ToString());
                                        child = new TreeNode(txt);
                                        child.SelectAction = TreeNodeSelectAction.None;
                                        node.ChildNodes.Add(child);
                                        j++;
                                    }
                                    tree.Nodes.Add(node);
                                    i = j;
                                }
                                else i++;
                                //tree.ExpandAll();
                            }
                            catch { }
                    }
                    catch { }
            }
            catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
        }
 protected void btTimKiem_Click(object sender, EventArgs e)
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         string cmd = string.Format("EXEC LuuTru.TaiLieu_Search N'{0}', '{1}', '{2}', N'{3}'",
             tbKyHieu.Text, ob.dateFormat(tbTuNgay.Text), ob.dateFormat(tbDenNgay.Text), tbTrichYeu.Text);
         gvTaiLieu.DataSource = ob.fillDataset(cmd).Tables[0];
         gvTaiLieu.DataBind();
         lbError.Text = "Danh sách: " + gvTaiLieu.Rows.Count;
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình cập nhật. " + ex.Message; }
 }
 protected void btTimKiem_Click(object sender, EventArgs e)
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass();
         class_BaoCao_Tuan ob2 = new class_BaoCao_Tuan();
         DateTime d = ob2.thisMonth(tbNgayThang.Text);
         lbThoiGian.Text = d.ToString("yyyy-MM-01");
         string cmd = string.Format("EXEC ChungNT.BaoCaoTuan_CongViec_Import '{0}', '{1}', {2}",
             ob.dateFormat(tbTuNgay.Text), ob.dateFormat(tbDenNgay.Text), UserId);
         gvCongViec.DataSource = ob.fillDataset(cmd);
         gvCongViec.DataBind();
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
 }
Пример #6
0
 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; }
 }
Пример #7
0
        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();
        }
Пример #8
0
 protected void btTimKiem_Click(object sender, EventArgs e)
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         string cmd = string.Format("EXEC [CSKH].[GiaoDich_Search] 1, {0}, N'{1}', {2}, 0, '{3}', '{4}'",
             dlDonVi.SelectedValue, tbHoTen.Text, dlDichVu.SelectedValue, ob.dateFormat(tbTuNgay.Text),
             ob.dateFormat(tbDenNgay.Text) == "1900-01-01" ? DateTime.Today.ToString("yyyy-MM-dd") : ob.dateFormat(tbDenNgay.Text));
         gvKhachHang.DataSource = ob.fillDataset(cmd);
         gvKhachHang.DataBind();
     }
     catch (Exception ex)
     {
         lbError.Text = "Có lỗi xảy ra trong quá trình đọc dữ liệu. " + ex.Message;
     }
 }
Пример #9
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; }
 }
Пример #10
0
 protected void btXem_Click(object sender, EventArgs e)
 {
     pnUpdate.CssClass = "none";
     pnBack.CssClass = "none";
     execSQL.connectionClass ob = new execSQL.connectionClass();
     lbNgayThang.Text = ob.dateFormat(tbNgayThang.Text);
     Load_Data();
 }
 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'{1}', '{2}', '{3}', '{4}', '{5}', {6}",
             lbID.Text, tbTieuDe.Text, ob.dateFormat(tbBatDau.Text), ob.dateFormat(tbKetThuc.Text), ob.dateFormat(tbCanhBao.Text), lbChuTri.Text, UserId);
         DataSet ds = ob.fillDataset(sql);
         lbID.Text = ds.Tables[0].Rows[0][1].ToString();
         int ok = 0, trongSo;
         DataSet dsTemp;
         TextBox txt_TrongSo, txt_BatDau, txt_KetThuc, txt_CanhBao, txt_NoiDung;
         foreach (GridViewRow dr in gvPhanCong.Rows)
         {
             txt_TrongSo = (TextBox)dr.FindControl("tbTrongSo");
             try
             {
                 trongSo = Int32.Parse(txt_TrongSo.Text);
             }
             catch { trongSo = 0; }
             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}'",
                 lbID.Text, txt_NoiDung.Text, ob.dateFormat(txt_BatDau.Text), ob.dateFormat(txt_KetThuc.Text),
                 dr.Cells[0].Text, UserId, trongSo, ob.dateFormat(txt_CanhBao.Text));
             dsTemp = ob.fillDataset(sql);
             if (dsTemp.Tables[0].Rows[0][0].ToString() == "1")
                 ok++;
         }
         if (ds.Tables[0].Rows[0][0].ToString() == "1" || ok > 0)
         {
             Load_CongViec();
             lbError.Text = "Cập nhật 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 cập nhật. " + ex.Message; }
 }
Пример #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            hlQuayLai.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId, "BAN", "mid/" + ModuleId);

            execSQL.connectionClass ob = new execSQL.connectionClass(); 
            tbThoiGian.Text = DateTime.Today.ToString("dd/MM/yyyy");
            lbThoiGian.Text = ob.dateFormat(tbThoiGian.Text);
            Load_Data();
        }
Пример #13
0
        private DataSet tim_kiem(string key)
        {
            string maDV = UserInfo.Profile.GetPropertyValue("MaDonVi");

            execSQL.connectionClass ob = new execSQL.connectionClass();
            string sql = @"EXEC dbo.CV_spCongVanDen_Search @USerID, @MaDonVi, @MaDonViQL, -1, @Nam, -1, -1, 
            @TuSo, @TuSo, @TuNgay, @TuNgay, @KyHieu, -1, -1, @MaNoiGoi, NULL, NULL, @TrichYeu, 0, 0, -1, -1";
            SqlParameter[] pa = new SqlParameter[9];
            if (dlLoaiCV.SelectedValue == "1")
            {
                pa[0] = new SqlParameter("@USerID", UserId);
                pa[1] = new SqlParameter("@MaDonVi", maDV);
                pa[2] = new SqlParameter("@MaDonViQL", maDV.Substring(0, maDV.Length - 3));
                pa[3] = new SqlParameter("@Nam", dlNam.SelectedValue);
                pa[4] = new SqlParameter("@TuSo", tbSo.Text);
                if (tbNgay.Text == "")
                    pa[5] = new SqlParameter("@TuNgay", "NULL");
                else
                    pa[5] = new SqlParameter("@TuNgay", ob.dateFormat(tbNgay.Text));
                pa[6] = new SqlParameter("@KyHieu", tbKyHieu.Text);
                pa[7] = new SqlParameter("@MaNoiGoi", dlNoiSoan.SelectedValue);
                pa[8] = new SqlParameter("@TrichYeu", key);
            }
            else
            {
                sql = @"EXEC dbo.CV_spCongVanDi_Search @USerID, @MaDonVi, @MaDonViQL, -1, @Nam, -1, -1, 
                @TuSo, @TuSo, @TuNgay, @TuNgay, @KyHieu, -1, @MaNoiSoanThao, @TrichYeu, 0, 0, -1, -1";
                pa[0] = new SqlParameter("@USerID", UserId);
                pa[1] = new SqlParameter("@MaDonVi", maDV);
                pa[2] = new SqlParameter("@MaDonViQL", maDV.Substring(0, maDV.Length - 3));
                pa[3] = new SqlParameter("@Nam", dlNam.SelectedValue);
                pa[4] = new SqlParameter("@TuSo", tbSo.Text);
                if (tbNgay.Text == "")
                    pa[5] = new SqlParameter("@TuNgay", "NULL");
                else
                    pa[5] = new SqlParameter("@TuNgay", ob.dateFormat(tbNgay.Text));
                pa[6] = new SqlParameter("@KyHieu", tbKyHieu.Text);
                pa[7] = new SqlParameter("@MaNoiSoanThao", dlNoiSoan.SelectedValue);
                pa[8] = new SqlParameter("@TrichYeu", key);
            }
            return ob.bindDataset(sql, pa);
        }
        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 btTimKiem_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         string cmdTxt = string.Format("exec DA_BC_getTimKiem {0}, {1}, '{2}', '{3}'",
             ddNhomBC.SelectedValue, ddLoaiBC.SelectedValue, ob.dateFormat(tbTuNgay.Text), ob.dateFormat(tbDenNgay.Text));
         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, "BAOCAO", "mid/" + ModuleId, "ID/" + dr[0].ToString());
             dr.EndEdit();
         }
         lbError.Text = string.Format("Kết quả tìm kiếm: {0} báo cáo", ds.Tables[0].Rows.Count);
         gvBaoCao.DataSource = ds.Tables[0];
         gvBaoCao.DataBind();
     }
     catch { lbError.Text = "Có lỗi xảy ra trong quá trình tìm kiếm"; }
 }
        private void Load_ViPham()
        {
            try
            {
                execSQL.connectionClass ob = new execSQL.connectionClass(); 
                string cmd = string.Format("EXEC LichLV.HanhLang_ViPham_DonVi '{0}', '', {1}", ob.dateFormat(tbNgayThang.Text), UserId);
                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();
                gvGiamThieu.DataSource = ds.Tables[1];
                gvGiamThieu.DataBind();

            }
            catch (Exception ex) { lbError.Text = "Có lỗi xảy ra trong quá trình đọc dữ liệu. " + ex.Message; }
        }
Пример #17
0
 private void Load_Data()
 {
     execSQL.connectionClass ob = new execSQL.connectionClass();
     string dt = ob.dateFormat(tbNgayThang.Text);
     hlPrint.NavigateUrl = string.Format("Print.aspx?DV={0}&TG={1}", dlDonVi.SelectedValue, dt);
     try
     {
         string cmd = string.Format("EXEC ChamCong.ChamCong '{0}', {1}, '{2}'", dlDonVi.SelectedValue, dlNhanVien.SelectedValue, dt);
         gvChamCong.DataSource = ob.fillDataset(cmd).Tables[0];
         gvChamCong.DataBind();
         foreach (GridViewRow dr in gvChamCong.Rows)
             dr.CssClass = dr.Cells[0].Text;
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
 }
        protected void btLuu_Click(object sender, EventArgs e)
        {
            try
            {
                execSQL.connectionClass ob = new execSQL.connectionClass();
                string sql = string.Format("EXEC ChungNT.cv_spCongVan_HanPheDuyet_Update {0}, '{1}', {2}", lbMaCV.Text, ob.dateFormat(tbHanPD.Text), UserId);
                DataSet ds = ob.fillDataset(sql);

                if (ds.Tables[0].Rows[0][0].ToString() == "1")
                    lbError.Text = "Cập nhật 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 cập nhật. " + ex.Message; }
        }
Пример #19
0
 protected void btXem_Click(object sender, EventArgs e)
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         string cmd = string.Format("EXEC LichLV.CongViec_Home_Count '{0}', '{1}', '{2}'",
             dlDienLuc.SelectedValue, ob.dateFormat(tbTuNgay.Text), ob.dateFormat(tbDenNgay.Text));
         DataSet ds = ob.fillDataset(cmd);
         DataList1.DataSource = ds.Tables[0];
         DataList1.DataBind();
         lbTong.Text = string.Format("Tổng số {0}.", ds.Tables[1].Rows[0][0].ToString());
         lbHuy.Text = string.Format("Đã hủy {0}.", ds.Tables[1].Rows[0][1].ToString());
         lbKiemTra.Text = string.Format("Đã kiểm tra {0}.", ds.Tables[1].Rows[0][2].ToString());
         // Bind data
         cmd = string.Format("EXEC LichLV.CongViec_Home '{0}', '{1}', '{2}'",
             dlDienLuc.SelectedValue, ob.dateFormat(tbTuNgay.Text), ob.dateFormat(tbDenNgay.Text));
         DataView dv = ob.fillDataset(cmd).Tables[0].DefaultView;
         GridView gv;
         foreach (DataListItem dli in DataList1.Items)
         {
             cmd = string.Format("MaDV = '{0}'", ((Label)dli.FindControl("lbDonVi")).Text);
             dv.RowFilter = cmd;
             gv = (GridView)dli.FindControl("gvCongViec");
             gv.DataSource = dv;
             gv.DataBind();
         }
         lbError.Text = "";
     }
     catch (Exception ex)
     {
         lbError.Text = ex.Message;
         lbTong.Text = "";
         lbHuy.Text = "";
         lbKiemTra.Text = "";
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            hlQuayLai.NavigateUrl = DotNetNuke.Common.Globals.NavigateURL(TabId);

            tbThoiGian.Text = DateTime.Today.ToString("dd/MM/yyyy");
            try
            {
                execSQL.connectionClass ob = new execSQL.connectionClass(); 
                lbThoiGian.Text = ob.dateFormat(tbThoiGian.Text);
                dlDonVi.DataSource = ob.fillDataset("EXEC VHDN.PhongBan_Select").Tables[0];
                dlDonVi.DataBind();
            }
            catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
            Load_Data();
        }
Пример #21
0
 private void load_kehoach()
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         string cmd = string.Format("EXEC LichLV.Duyet_Select '{0}', '{1}', {2}",
             ddDienLuc.SelectedValue, ob.dateFormat(tbNgayThang.Text), cbMoiNhap.Checked ? 1 : 0);
         gvKeHoach.DataSource = ob.fillDataset(cmd);
         gvKeHoach.DataBind();
     }
     catch (Exception ex)
     {
         lbError.Text = "Có lỗi trong quá trình lấy dữ liệu. " + ex.Message;
         lbError0.Text = lbError.Text;
     }
 }
 protected void btLuu_Click(object sender, EventArgs e)
 {
     if (fileUpload.HasFile)
         try
         {
             // UPLOAD FILE
             string fileName = DateTime.Now.ToString("yyMMdd_HHmmss_") + UserId + fileUpload.FileName.Remove(0, fileUpload.FileName.LastIndexOf("."));
             string savePath = DateTime.Today.ToString("yyyy-MM");
             string filePath = Server.MapPath(@"DesktopModules\PHLT\") + savePath;
             if (!Directory.Exists(filePath))
                 Directory.CreateDirectory(filePath);
             filePath = filePath + @"\" + fileName;
             savePath = Request.ApplicationPath + "/DesktopModules/PHLT/" + savePath + "/" + fileName;
             fileUpload.SaveAs(filePath);
             // CAP HS
             execSQL.connectionClass ob = new execSQL.connectionClass();
             string sql, hosoID;
             DataSet ds;
             if (lbThem.Text == "THEM")
             {
                 sql = "EXEC LuuTru.CaNhan_CapHoSo_Update 0, @TenHoSo, @NguoiTao, 1, 0";
                 SqlParameter[] pa = new SqlParameter[2];
                 pa[0] = new SqlParameter("@TenHoSo", tbCapHS.Text);
                 pa[1] = new SqlParameter("@NguoiTao", UserId);
                 ds = ob.bindDataset(sql, pa);
                 hosoID = ds.Tables[0].Rows[0][1].ToString();
             }
             else hosoID = dlCapHS.SelectedValue;
             // VAN BAN
             sql = string.Format("EXEC LuuTru.CaNhan_VanBan_Update 0, N'{0}', '{1}', N'{2}', N'{3}', N'{4}', '{5}', N'{6}', {7}, {8}, 0",
                 tbKyHieu.Text, ob.dateFormat(tbNgayThang.Text), tbNoiSoan.Text, tbMoTa.Text, tbGhiChu.Text,
                 savePath, fileUpload.FileName, hosoID, UserId);
             ds = ob.fillDataset(sql);
             if (ds.Tables[0].Rows[0][0].ToString() == "1")
             {
                 lbError.Text = "Lưu văn bản thành công";
                 btLuu.Enabled = false;
             }
             else lbError.Text = "Không thể lưu văn bản";
         }
         catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình ghi dữ liệu. " + ex.Message; }
     else lbError.Text = "Chưa có file đính kèm";
 }
 private void Load_TimKiem()
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         lbThang.Text = dlThang.SelectedValue;
         lbThoiGian.Text = ob.dateFormat(tbThoiGian.Text);
         string cmd = string.Format("EXEC ChungNT.BaoCaoTuan_TimKiem {0}, {1}, {2}, '{3}', '{4}'",
            lbThang.Text, dlLevel.SelectedValue, dlUsers.SelectedValue, lbThoiGian.Text, UserInfo.Profile.GetPropertyValue("MaDonVi"));
         DataSet ds = ob.fillDataset(cmd);
         gvCongViec.DataSource = ds.Tables[0];
         gvCongViec.DataBind();
         foreach (GridViewRow dr in gvCongViec.Rows)
             dr.CssClass = dr.Cells[5].Text;
         gvCongViec.Columns[9].Visible = is_admin();
         lbTrangThai.Text = string.Format("Tổng số <b>{0}</b> công việc", ds.Tables[0].Rows.Count);
         lbError.Text = "";
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
 }
Пример #24
0
        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();
            tbNgayThang.Text = DateTime.Today.AddDays(-1).ToString("dd/MM/yyyy");
            lbNgayThang.Text = ob.dateFormat(tbNgayThang.Text);
            try
            {
                lbMaDV.Text = UserInfo.Profile.GetPropertyValue("MaDonVi");
                string cmd = string.Format("EXEC EOFFICE_NPC.ChungNT.B4_SuCo_NgungGiam_DonVi '{0}'", lbMaDV.Text);
                dlDonVi.DataSource = ob.fillDataset(cmd).Tables[0];
                dlDonVi.DataBind();

                Load_Data();
                Load_DuongDay();
            }
            catch { }
        }
Пример #25
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         string dt = Request["DT"] == null ? DateTime.Today.ToString("dd/MM/yyyy") : Request["DT"];
         string dv = Request["DV"] == null ? "F01P11" : Request["DV"];
         string lenhCT = Request["L"] == null ? "2" : Request["L"];
         lbNgayThang.Text = dt;
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         string cmd = string.Format("EXEC LichLV.DonVi_Print '{0}'", dv);
         DataSet ds = ob.fillDataset(cmd);
         lbCongTy.Text = ds.Tables[0].Rows[0][0].ToString();
         lbCongTy2.Text = ds.Tables[0].Rows[0][0].ToString();
         lbDienLuc.Text = ds.Tables[0].Rows[0][1].ToString();
         cmd = string.Format("EXEC LichLV.KeHoach_Home_O1 '{0}', '{1}', {2}", dv, ob.dateFormat(dt), lenhCT);
         lastDV = "";
         dlKeHoach.DataSource = ob.fillDataset(cmd).Tables[0];
         dlKeHoach.DataBind();
     }
     catch { }
 }
Пример #26
0
        private void load_kehoach()
        {
            try
            {
                execSQL.connectionClass ob = new execSQL.connectionClass(); 
                string cmd = string.Format("EXEC LichLV.KeHoach_Home_O1 '{0}', '{1}', {2}", ddDienLuc.SelectedValue, ob.dateFormat(tbNgayThang.Text), rbLenhCT.SelectedValue);
                DataSet ds = ob.fillDataset(cmd);
                DataColumn dc = new DataColumn("EditLink");
                ds.Tables[0].Columns.Add(dc);
                ds.Tables[0].AcceptChanges();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    dr.BeginEdit();
                    dr["EditLink"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "KEHOACH", "mid/" + ModuleId, "ID/" + dr[0].ToString());
                    dr.EndEdit();
                }

                lastDV = "";
                dlKeHoach.DataSource = ds.Tables[0];
                dlKeHoach.DataBind();

                hlPrint.NavigateUrl = string.Format("KeHoach_Print.aspx?DT={0}&DV={1}&L={2}", tbNgayThang.Text, ddDienLuc.SelectedValue, rbLenhCT.SelectedValue);

                cmd = string.Format("EXEC LichLV.KeHoach_Count '{0}', '{1}', '{2}'", tbNgayThang.Text, ddCongTy.SelectedValue, ddDienLuc.SelectedValue);
                ds = ob.fillDataset(cmd);
                lbTong.Text = "Tổng số " + ds.Tables[0].Rows[0][0].ToString();
                lbPhieu.Text = ds.Tables[0].Rows[0][1].ToString() + " phiếu công tác";
                lbHuy.Text = "Đã hủy " + ds.Tables[0].Rows[0][2].ToString();
                lbTongCT.Text = "Tổng số " + ds.Tables[1].Rows[0][0].ToString();
                lbPhieuCT.Text = ds.Tables[1].Rows[0][1].ToString() + " phiếu công tác";
                lbHuyCT.Text = "Đã hủy " + ds.Tables[1].Rows[0][2].ToString();
                lbTongDL.Text = "Tổng số " + ds.Tables[2].Rows[0][0].ToString();
                lbPhieuDL.Text = ds.Tables[2].Rows[0][1].ToString() + " phiếu công tác";
                lbHuyDL.Text = "Đã hủy " + ds.Tables[2].Rows[0][2].ToString();
            }
            catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
        }
Пример #27
0
 private void Load_Data()
 {
     execSQL.connectionClass ob = new execSQL.connectionClass();
     string dt = ob.dateFormat(tbNgayThang.Text);
     try
     {
         string cmd = string.Format("EXEC ChamCong.ChamCong_Range '{0}', {1}, '{2}'", dlDonVi.SelectedValue, dlNhanVien.SelectedValue, dt);
         DataSet ds = ob.fillDataset(cmd);
         int i1, i2, i3, o1, o2, o3;
         i1 = 0; i2 = 0; i3 = 0;
         o1 = 0; o2 = 0; o3 = 0;
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             i1 += dr["I1"].ToString() == "x" ? 1 : 0;
             i2 += dr["I2"].ToString() == "x" ? 1 : 0;
             i3 += dr["I3"].ToString() == "x" ? 1 : 0;
             o1 += dr["O1"].ToString() == "x" ? 1 : 0;
             o2 += dr["O2"].ToString() == "x" ? 1 : 0;
             o3 += dr["O3"].ToString() == "x" ? 1 : 0;
         }
         gvChamCong.DataSource = ds.Tables[0];
         gvChamCong.DataBind();
         if (ds.Tables[0].Rows.Count > 0)
         {
             gvChamCong.FooterRow.Cells[1].Text = "Tổng cộng";
             gvChamCong.FooterRow.Cells[3].Text = i1.ToString();
             gvChamCong.FooterRow.Cells[4].Text = i2.ToString();
             gvChamCong.FooterRow.Cells[5].Text = i3.ToString();
             gvChamCong.FooterRow.Cells[7].Text = o1.ToString();
             gvChamCong.FooterRow.Cells[8].Text = o2.ToString();
             gvChamCong.FooterRow.Cells[9].Text = o3.ToString();
         }
         lbError.Text = "";
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình đọc dữ liệu. " + ex.Message; }
 }
Пример #28
0
 protected void btCapNhat_Click(object sender, EventArgs e)
 {
     //if (!UserInfo.IsInRole("LichLV"))
     //{
     //    lbError.Text = "Tài khoản không có quyền sử dụng chức năng này";
     //    return;
     //}
     CheckBox check;
     int nguoiKS = 0, nguoiCP = 0, nguoiCH = 0;
     foreach (GridViewRow dr in gvNhanVien.Rows)
     {
         check = (CheckBox)dr.FindControl("cbKiemSoat");
         if (check.Checked) nguoiKS = Int32.Parse(dr.Cells[1].Text);
         check = (CheckBox)dr.FindControl("cbChoPhep");
         if (check.Checked) nguoiCP = Int32.Parse(dr.Cells[1].Text);
         check = (CheckBox)dr.FindControl("cbChiHuy");
         if (check.Checked) nguoiCH = Int32.Parse(dr.Cells[1].Text);
     }
     if (nguoiKS == 0 && !cbLenhCT.Checked)
     {
         lbError.Text = "Chưa chọn người kiểm soát";
         return;
     }
     if (nguoiCP == 0)
     {
         lbError.Text = "Chưa chọn người cho phép";
         return;
     }
     if (nguoiCH == 0)
     {
         lbError.Text = "Chưa chọn người chỉ huy";
         return;
     }
     try
     {
         Int32.Parse(tbSoNguoi.Text);
     }
     catch
     {
         lbError.Text = "Định dạng số lượng người không đúng";
         return;
     }
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         string[] split = tbSoPhieu.Text.Split('/');
         string cmd = string.Format("EXEC LichLV.KeHoach_Update_O1 {0}, '{14}', {1}, {2}, {3}, N'{4}', N'{5}', N'{6}', N'{7}', '{8}', '{9}', {10}, {11}, {12}, {13}",
             lbID.Text, cbCapPhieu.Checked ? "0" : split[0], cbLenhCT.Checked ? 1 : 0, tbSoNguoi.Text, tbDiaDiem.Text, tbNoiDung.Text,
             tbDieuKien.Text, tbPhuongAn.Text, tbBatDau.Text, tbKetThuc.Text, nguoiKS, nguoiCP, nguoiCH, UserId, ob.dateFormat(tbNgayThang.Text));
         DataSet ds = ob.fillDataset(cmd);
         if (ds.Tables[0].Rows[0][0].ToString() == "0") lbError.Text = "Không thể cập nhật kế hoạch này. Hoặc số phiếu này đã được sử dụng";
         else
         {
             bind_data();
             lbError.Text = "Cập nhật kế hoạch thành công";
         }
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình cập nhật. " + ex.Message; }
 }
 protected void btCapNhat_TH_Click(object sender, EventArgs e)
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass();
         string sql = string.Format("EXEC TrongTam.CongViec_ThucHien {0}, {1}, '{2}', {3}, N'{4}', {5}, 0",
             lbID_TH.Text, lbID.Text, ob.dateFormat(tbNgay_TH.Text), tbTienDo_TH.Text, tbNoiDung_TH.Text, UserId);
         DataSet ds = ob.fillDataset(sql);
         if (ds.Tables[0].Rows.Count > 0)
             if (ds.Tables[0].Rows[0][0].ToString() == "0")
                 lbError_TH.Text = "Không thể lưu thực hiện";
             else
             {
                 Load_ThucHien();
                 pnBack.CssClass = "none";
                 pnUpdate.CssClass = "none";
                 lbError.Text = "Lưu thực hiện thành công";
             }
     }
     catch (Exception ex) { lbError_TH.Text = "Có lỗi trong quá trình cập nhật. " + ex.Message; }
 }
Пример #30
0
 private void bind_kehoach(string maDV)
 {
     try
     {
         execSQL.connectionClass ob = new execSQL.connectionClass(); 
         string cmd = string.Format("EXEC LichLV.KeHoach_Home_O1 '{0}', '{1}', 2", maDV, ob.dateFormat(tbNgayThang.Text));
         DataSet ds = ob.fillDataset(cmd);
         DataColumn dc = new DataColumn("EditLink");
         ds.Tables[0].Columns.Add(dc);
         ds.Tables[0].AcceptChanges();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             dr.BeginEdit();
             dr["EditLink"] = DotNetNuke.Common.Globals.NavigateURL(TabId, "KEHOACH", "mid/" + ModuleId, "ID/" + dr[0].ToString());
             dr.EndEdit();
         }
         gvKeHoach.DataSource = ds.Tables[0];
         gvKeHoach.DataBind();
     }
     catch (Exception ex) { lbError.Text = "Có lỗi trong quá trình lấy danh sách kế hoạch cùng ngày. " + ex.Message; }
 }