Ejemplo n.º 1
0
        protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();
            var cs = this.Page.ClientScript;

            #region Tham số

            HttpContext c       = HttpContext.Current;
            var         listRow = new List <jgridRow>();
            #endregion
            switch (subAct)
            {
            case "get":
                #region lấy dữ liệu cho grid

                foreach (var item in KhachHangDal.SelectCongNo(false.ToString()))
                {
                    listRow.Add(new jgridRow(item.ID.ToString(), new string[]
                    {
                        item.ID.ToString()
                        , item.Ten
                        , Lib.TienVietNam(item.CongNo)
                    }));
                }
                var gridSpAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage
                                          , "1"
                                          , "1000"
                                          , listRow);
                sb.Append(JavaScriptConvert.SerializeObject(gridSpAdm));
                break;

                #endregion
            case "scpt":
                #region Nạp js
                sb.AppendFormat(@"{0}"
                                , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.baoCaoCong.JScript1.js"));
                //sb.AppendFormat(@"{0}"
                //    , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.baoCaoCong.Publish.js"));
                break;

                #endregion
            default:
                #region nạp
                var listFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "baoCaoCong.mdl.htm"));
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.baoCaoCong.JScript1.js")
                                , "{baoCaoCongFn.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 2
0
        protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();
            var cs = this.Page.ClientScript;

            #region Tham số

            HttpContext c         = HttpContext.Current;
            var         TuNgay    = c.Request["TuNgay"];
            var         DenNgay   = c.Request["DenNgay"];
            var         dNow      = DateTime.Now;
            var         dauThang  = new DateTime(dNow.Year, 1, 1).ToString("yyyy-MM-dd");
            var         cuoiThang = new DateTime(dNow.Year, dNow.Month, 1).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");

            TuNgay  = string.IsNullOrEmpty(TuNgay) ? dauThang : Convert.ToDateTime(TuNgay, new CultureInfo("vi-Vn")).ToString("yyyy-MM-dd");
            DenNgay = string.IsNullOrEmpty(DenNgay) ? cuoiThang : Convert.ToDateTime(DenNgay, new CultureInfo("vi-Vn")).ToString("yyyy-MM-dd");


            var             _q               = c.Request["q"];
            List <jgridRow> ListRow          = new List <jgridRow>();
            var             danhMucKyHieuChi = DanhMucDal.SelectByMa("TC-CHI");
            var             danhMucKyHieuThu = DanhMucDal.SelectByMa("TC-THU");
            #endregion
            switch (subAct)
            {
            case "get":
                #region lấy dữ liệu cho grid

                var pagerGet    = ThuChiReportDal.SelectTuNgayDenNgay(TuNgay, DenNgay);
                var prefixMaChi = danhMucKyHieuChi.KyHieu;
                var prefixMaThu = danhMucKyHieuThu.KyHieu;
                foreach (var item in pagerGet)
                {
                    ListRow.Add(new jgridRow(item.ma.ToString(), new string[]
                    {
                        item.ma.ToString()
                        ,
                        item.sophieu == "0" ? "" : string.Format("{0}{1}",
                                                                 (item.isthu
                                                                                                ? prefixMaThu
                                                                                                : prefixMaChi),
                                                                 item.sophieu)
                        , item.diengiai
                        , Lib.TienVietNam(item.thu_tk)
                        , Lib.TienVietNam(item.thu_tm)
                        , Lib.TienVietNam(item.thu_t)
                        , Lib.TienVietNam(item.chi_tk)
                        , Lib.TienVietNam(item.chi_tm)
                        , Lib.TienVietNam(item.chi_t)
                        , Lib.TienVietNam(item.tt_tk)
                        , Lib.TienVietNam(item.tt_tm)
                        , Lib.TienVietNam(item.tt_t)
                        , Lib.TienVietNam(item.sodu_tk)
                        , Lib.TienVietNam(item.sodu_tm)
                        , Lib.TienVietNam(item.sodu_t)
                        , item.loaiquy.ToString()
                        , item.isthu.ToString()
                        , item.isCandoi.ToString()
                        , item.ngay
                        , item.NguoiTao
                    }));
                }
                jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage
                                            , "1"
                                            , pagerGet.Count.ToString()
                                            , ListRow);
                sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm));
                break;

                #endregion
            case "scpt":
                #region Nạp js
                sb.AppendFormat(@"{0}"
                                , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.baoCaoThuChi.JScript1.js"));
                //sb.AppendFormat(@"{0}"
                //    , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.baoCaoThuChi.Publish.js"));
                break;

                #endregion
            default:
                #region nạp
                var listFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "baoCaoThuChi.mdl.htm"));
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.baoCaoThuChi.JScript1.js")
                                , "{baoCaoThuChiFn.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 3
0
        protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;

            #region Tham số
            string _ID     = Request["ID"];
            string _Ten    = Request["Ten"];
            string _Ma     = Request["Ma"];
            string _KyHieu = Request["KyHieu"];
            string _ThuTu  = Request["STT"];
            string _q      = Request["q"];
            #endregion
            switch (subAct)
            {
            case "get":
                #region lấy dữ liệu cho grid
                if (string.IsNullOrEmpty(jgrsidx))
                {
                    jgrsidx = "ID";
                }
                if (string.IsNullOrEmpty(jgrsord))
                {
                    jgrsord = "asc";
                }

                var listRow = LoaiDanhMucDal.SelectAll().Select(ldm => new jgridRow(ldm.ID.ToString(), new string[]
                {
                    ldm.ID.ToString(), ldm.ThuTu.ToString(), ldm.Ma, ldm.KyHieu, ldm.Ten, string.Format("{0:dd/MM/yy}", ldm.NgayCapNhat), ldm.NguoiTao + "/" + ldm.NguoiSua
                })).ToList();
                var grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, "0", "0", listRow);
                sb.Append(JavaScriptConvert.SerializeObject(grid));
                break;

                #endregion
            case "getAll":
                #region lấy toàn bộ loai danh mục
                var listGetPid = LoaiDanhMucDal.SelectAll();
                listGetPid.Add(new LoaiDanhMuc()
                {
                    Ten = "Chọn"
                });
                sb.Append(JavaScriptConvert.SerializeObject(listGetPid));
                break;

                #endregion
            case "save":
                #region lưu
                var ItemSave = new LoaiDanhMuc();
                if (string.IsNullOrEmpty(_Ten))
                {
                    sb.Append("0");
                    break;
                }
                if (!string.IsNullOrEmpty(_ID))
                {
                    ItemSave = LoaiDanhMucDal.SelectById(new Guid(_ID));
                }
                ItemSave.Ten         = _Ten;
                ItemSave.Ma          = _Ma;
                ItemSave.KyHieu      = _KyHieu;
                ItemSave.ThuTu       = Int32.Parse(_ThuTu);
                ItemSave.NgayCapNhat = DateTime.Now;
                ItemSave.NguoiTao    = Security.Username;
                ItemSave.NguoiSua    = Security.Username;
                if (!string.IsNullOrEmpty(_ID))
                {
                    ItemSave = LoaiDanhMucDal.Update(ItemSave);
                }
                else
                {
                    ItemSave.NgayTao = DateTime.Now;
                    ItemSave.RowId   = Guid.NewGuid();
                    ItemSave.ID      = Guid.NewGuid();
                    ItemSave         = LoaiDanhMucDal.Insert(ItemSave);
                }
                sb.Append("1");
                break;

                #endregion
            case "edit":
                #region chỉnh sửa
                if (!string.IsNullOrEmpty(_ID))
                {
                    sb.Append("(" + JavaScriptConvert.SerializeObject(LoaiDanhMucDal.SelectById(new Guid(_ID))) + ")");
                }
                break;

                #endregion
            case "del":
                #region xóa
                if (!string.IsNullOrEmpty(_ID))
                {
                    LoaiDanhMucDal.DeleteById(new Guid(_ID));
                }
                break;

                #endregion
            case "scpt":
                #region Nạp js
                sb.AppendFormat(@"{0}"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.loaidanhmuc.JScript1.js"));
                break;

                #endregion
            default:
                #region nạp
                FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "mdl.htm"));
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.loaidanhmuc.JScript1.js")
                                , "{loaidanhmuc.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 4
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder       sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            string _ID             = Request["ID"];
            string _CQ_ID          = Request["CQ_ID"];
            string _Ten            = Request["Ten"];
            string _q        = Request["q"];
            string _Loai_Ten = Request["Loai_Ten"];
            string _Loai_ID  = Request["Loai_ID"];
            var    _HomeUrl  = Request["HomeUrl"];

            switch (subAct)
            {
            case "get":
                #region Lấy danh sách
                if (string.IsNullOrEmpty(jgrsidx))
                {
                    jgrsidx = "ID";
                }
                if (string.IsNullOrEmpty(jgrsord))
                {
                    jgrsord = "asc";
                }
                RoleCollection  ListGet = RoleDal.TreeByUsername(Security.Username, _q, _CQ_ID, "ROLE_" + jgrsidx + " " + jgrsord);
                List <jgridRow> ListRow = new List <jgridRow>();
                foreach (Role item in ListGet)
                {
                    ListRow.Add(new jgridRow(item.ID.ToString()
                                             , new string[] {
                        item.ID.ToString(),
                        item.Ten,
                        item.Loai_Ten,
                        item._CoQuan.Ten
                    }));
                }
                jgrid grid = new jgrid("1", "1", ListGet.Count.ToString(), ListRow);
                sb.Append(JavaScriptConvert.SerializeObject(grid));
                break;

                #endregion
            case "del":
                #region Xóa
                if (!string.IsNullOrEmpty(_ID))
                {
                    RoleDal.DeleteById(_ID);
                }
                break;

                #endregion
            case "edit":
                #region chỉnh sửa
                if (!string.IsNullOrEmpty(_ID))
                {
                    sb.Append("(" + JavaScriptConvert.SerializeObject(RoleDal.SelectById(Convert.ToInt32(_ID))) + ")");
                }
                break;

                #endregion
            case "save":
                #region Lưu
                var ItemSave = new Role();
                if (!string.IsNullOrEmpty(_ID))
                {
                    ItemSave = RoleDal.SelectById(Convert.ToInt32(_ID));
                }
                ItemSave.Ten         = _Ten;
                ItemSave.HomeUrl     = _HomeUrl;
                ItemSave.CQ_ID       = Convert.ToInt32(_CQ_ID);
                ItemSave.NgayCapNhat = DateTime.Now;
                ItemSave.Active      = true;
                ItemSave.HeThong     = true;
                if (!string.IsNullOrEmpty(_Loai_ID))
                {
                    ItemSave.Loai_ID = new Guid(_Loai_ID);
                }
                ItemSave.Loai_Ten = _Loai_Ten;
                if (!string.IsNullOrEmpty(_ID))
                {
                    ItemSave = RoleDal.Update(ItemSave);
                }
                else
                {
                    ItemSave.NgayTao  = DateTime.Now;
                    ItemSave.NguoiTao = Security.Username;
                    ItemSave.RowId    = Guid.NewGuid();
                    ItemSave          = RoleDal.Insert(ItemSave);
                }
                sb.Append("1");
                break;

                #endregion
            case "getFunction":
                #region Lấy function theo role
                if (!string.IsNullOrEmpty(_ID))
                {
                    FunctionCollection ListFnByRole = FunctionDal.SelectAllFunctionByRole(_ID);
                    if (ListFnByRole.Count > 0)
                    {
                        sb.Append(getTop(ListFnByRole));
                    }
                    else
                    {
                        sb.Append("0");
                    }
                }
                break;

                #endregion
            case "updateFunction":
                #region Cập nhật thay đổi
                RoleFunctionDal.UpdateByRoleIdFunctionList(_ID, Request["UpdateList"], Security.Username);
                sb.Append("1");
                break;

                #endregion
            case "getUserByRole":
                #region Lấy thành viên trong nhóm
                if (!string.IsNullOrEmpty(_ID))
                {
                    MemberCollection ListUserByRole = MemberDal.SelectByRole(_ID);
                    if (ListUserByRole.Count > 0)
                    {
                        foreach (Member item in ListUserByRole)
                        {
                            sb.AppendFormat(@"<input type=""checkbox"" _username=""{0}"" {2} > <b>{0}</b> [ {1} ] <br/>"
                                            , item.Username, item.Ten, item.Khoa ? @"checked=""checked""" : "");
                        }
                    }
                    else
                    {
                        sb.Append("0");
                    }
                }
                break;

                #endregion
            case "updateUsers":
                #region Lưu thay đổi thành viên trong nhóm
                if (!string.IsNullOrEmpty(_ID))
                {
                    MemberRoleDal.UpdateUserListRole(Request["UpdateList"], _ID, Security.Username);
                    sb.AppendFormat("1");
                }
                break;

                #endregion
            default:
                #region nạp
                FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(@"<div class=""mdl-head"">
<span class=""mdl-head-searchPnl ui-state-default ui-corner-all"">
<a href=""javascript:;"" class=""mdl-head-clearSearch""></a>
<input type=""text"" class=""mdl-head-txt mdl-head-search mdl-head-search-quanLyQuyen"" />
</span>
<a class=""mdl-head-btn mdl-head-add"" id=""quanLyQuyenMdl-addBtn"" href=""javascript:quanLyQuyen.add();"">Thêm</a>
<a class=""mdl-head-btn mdl-head-edit"" id=""quanLyQuyenMdl-editBtn"" href=""javascript:quanLyQuyen.edit();"">Sửa</a>
<a class=""mdl-head-btn mdl-head-del"" id=""quanLyQuyenMdl-delBtn"" href=""javascript:quanLyQuyen.del();"">Xóa</a>
<span class=""mdl-head-filterPnl ui-state-default ui-corner-all"">
<a href=""javascript:;"" class=""mdl-head-clearSearch""></a>
<input type=""text"" _value="""" class=""mdl-head-filter mdl-head-filterQuanLyQuyenByCQID""/>
</span>
</div>
<table id=""quanLyQuyenMdl-List"" class=""mdl-list"">
</table>
<div id=""quanLyQuyenMdl-Pager""></div>

<div class=""sub-mdl quanLyQuyenMdl-subMdl"">
    <ul>
        <li>
            <a id=""quanLyQuyenMdl-functionmdl-subMdlBtn"" href=""#quanLyQuyenMdl-subMdl-mdl1"">Quyền</a>
        </li>
        <li>
            <a id=""quanLyQuyenMdl-usermdl-subMdlBtn"" href=""#quanLyQuyenMdl-subMdl-mdl2"">Người dùng thuộc nhóm</a>
        </li>
    </ul>
    <div id=""quanLyQuyenMdl-subMdl-mdl1"">
        <div id=""quanLyQuyenMdl-functionmdl-roleFnMdl"">
        </div>
    </div>
    <div id=""quanLyQuyenMdl-subMdl-mdl2"">
        <div id=""quanLyQuyenMdl-functionmdl-UserInRoleMdl"">
        </div>
    </div>
</div>

");
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.hethong.quanLyQuyen.JScript1.js")
                                , "{quanLyQuyen.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 5
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder       sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            string _ID             = Request["ID"];
            string _PID            = Request["PID"];
            string _Ten            = Request["Ten"];
            string _Mota           = Request["Mota"];
            string _Ma             = Request["Ma"];
            string _Url            = Request["Url"];
            string _GiaTriMacDinh  = Request["GiaTriMacDinh"];
            string _Loai           = Request["Loai"];
            string _ThuTu          = Request["ThuTu"];
            string _Publish        = Request["Publish"];
            string _Anh            = Request["Anh"];
            string _Desk           = Request["Desk"];
            string _DeskMacDinh    = Request["DeskMacDinh"];

            switch (subAct)
            {
            case "get":
                #region lấy danh sách
                List <Function> ListGet = getTree(FunctionDal.SelectTree(Request["q"]));
                List <jgridRow> ListRow = new List <jgridRow>();
                foreach (Function item in ListGet)
                {
                    ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                        item.ID.ToString()
                        , item.Ten
                        , item.Loai != 3 ? string.Format("<img class=\"adm-fn-icon\" src=\"../up/i/{0}\" />", string.IsNullOrEmpty(item.Anh) ? "fn-icon.jpg" :item.Anh) : ""
                        , item.Ma
                        , item.Url
                        , item.ThuTu.ToString()
                        , item.Loai.ToString()
                        , item.Publish.ToString()
                        , item.GiaTriMacDinh.ToString()
                        , item.Level.ToString(), item.PID.ToString(), "true", "false"
                    }));
                }
                jgrid grid = new jgrid("1", "1", ListGet.Count.ToString(), ListRow);
                sb.Append(JavaScriptConvert.SerializeObject(grid));
                break;

                #endregion
            case "getPid":
                #region danh sách chọn sẵn
                FunctionCollection ListGetPid = FunctionDal.SelectTree(Request["q"]);
                sb.Append(JavaScriptConvert.SerializeObject(ListGetPid));
                break;

                #endregion
            case "del":
                #region Xóa
                if (!string.IsNullOrEmpty(_ID))
                {
                    FunctionDal.DeleteById(Convert.ToInt32(_ID));
                }
                break;

                #endregion
            case "edit":
                #region chỉnh sửa
                if (!string.IsNullOrEmpty(_ID))
                {
                    sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(FunctionDal.SelectById(Convert.ToInt32(_ID))));
                }
                break;

                #endregion
            case "save":
                #region lưu dữ liệu
                Function ItemSave = new Function();
                if (!string.IsNullOrEmpty(_ID))
                {
                    ItemSave = FunctionDal.SelectById(Convert.ToInt32(_ID));
                }
                ItemSave.NgayCapNhat = DateTime.Now;
                ItemSave.Ten         = _Ten;
                ItemSave.MoTa        = _Mota;
                ItemSave.Loai        = Convert.ToInt16(_Loai);
                ItemSave.Ma          = _Ma;
                ItemSave.Anh         = string.Empty;
                int ThuTu = 0;
                if (!string.IsNullOrEmpty(_ThuTu))
                {
                    ThuTu = Convert.ToInt32(_ThuTu);
                }
                ItemSave.Publish       = Convert.ToBoolean(_Publish);
                ItemSave.PID           = string.IsNullOrEmpty(_PID) ? 0 : Convert.ToInt32(_PID);
                ItemSave.ThuTu         = ThuTu;
                ItemSave.Url           = _Url;
                ItemSave.NguoiTao      = Security.Username;
                ItemSave.GiaTriMacDinh = Convert.ToBoolean(_GiaTriMacDinh);
                ItemSave.Anh           = _Anh;
                ItemSave.Desk          = Convert.ToBoolean(_Desk);
                ItemSave.DeskMacDinh   = Convert.ToBoolean(_DeskMacDinh);
                if (ItemSave.Desk)
                {
                    try
                    {
                        //ItemSave.Doc = ;
                        XmlDocument doc  = new XmlDocument();
                        XmlNode     node = doc.ImportNode(PlugHelper.RenderXml(ItemSave.Url), true);
                        doc.AppendChild(node);
                        string _DocValue = linh.common.Lib.GetXmlString(doc);
                        ItemSave.Doc = _DocValue;
                    }
                    catch (Exception ex)
                    {
                        ItemSave.Doc  = string.Empty;
                        ItemSave.Desk = false;
                        sb.Append("Loi + " + ex.Message);
                    }
                }
                else
                {
                    ItemSave.Doc = string.Empty;
                }
                if (!string.IsNullOrEmpty(_ID))
                {
                    ItemSave = FunctionDal.Update(ItemSave);
                }
                else
                {
                    ItemSave.NgayTao = DateTime.Now;
                    ItemSave.Level   = 0;
                    ItemSave.PIDList = string.Empty;
                    ItemSave.RowId   = Guid.NewGuid();
                    ItemSave         = FunctionDal.Insert(ItemSave);
                }
                sb.Append("1");
                break;

                #endregion
            default:
                #region nạp
                FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                //<input type=""text"" class=""mdl-head-txt mdl-head-search"" />
                sb.Append(@"<div class=""mdl-head"">
<span class=""mdl-head-searchPnl ui-state-default ui-corner-all"">
<a href=""javascript:;"" class=""mdl-head-clearSearch""></a>
<input type=""text"" class=""mdl-head-txt mdl-head-search mdl-head-search-functions"" />
</span>
<a class=""mdl-head-btn mdl-head-add"" id=""functionsmdl-addBtn"" href=""javascript:functions.add();"">Thêm</a>
<a class=""mdl-head-btn mdl-head-edit"" id=""functionsmdl-editBtn"" href=""javascript:functions.edit();"">Sửa</a>
<a class=""mdl-head-btn mdl-head-del"" id=""functionsmdl-delBtn"" href=""javascript:functions.del();"">Xóa</a>
</div>
<table id=""functionsmdl-List"" class=""mdl-list"">
</table>
<div id=""functionsmdl-Pager""></div>");
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.hethong.functions.JScript1.js")
                                , "{functions.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 6
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder       sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;

            #region Tham số
            string _ID          = Request["ID"];
            string _CQ_ID       = Request["CQ_ID"];
            string _Username    = Request["Username"];
            string _Password    = Request["Password"];
            string _Pwd         = Request["Pwd"];
            string _Ten         = Request["Ten"];
            string _Khoa        = Request["Khoa"];
            string _Luong       = Request["Luong"];
            string _q           = Request["q"];
            string _Anh         = Request["Anh"];
            string _Loai        = Request["Loai"];
            string _ThuKy       = Request["ThuKy"];
            string _refUsername = Request["refUsername"];
            string _Email       = Request["Email"];
            string _Captcha     = Request["Captcha"];
            string _Mobile      = Request["Mobile"];
            string _DiaChi      = Request["DiaChi"];
            string _MoTa        = Request["MoTa"];
            string _Loai_Ten    = Request["Loai_Ten"];
            string _CQ_Ma       = Request["CQ_Ma"];
            string TVDV_ID      = Request["TVDV_ID"];
            string _Lang        = Request["Lang"];
            #endregion
            //if (!Security.IsAuthenticated())
            //{
            //    Response.End();
            //}
            switch (subAct)
            {
            case "get":
                #region lấy danh sách
                if (string.IsNullOrEmpty(jgrsidx))
                {
                    jgrsidx = "ID";
                }
                if (string.IsNullOrEmpty(jgrsord))
                {
                    jgrsord = "asc";
                }
                Pager <Member>  PagerGet = MemberDal.pagerAllChildByUsername("", false, "MEM_" + jgrsidx + " " + jgrsord, Security.Username, _CQ_ID, _q, Request["rows"]);
                List <jgridRow> ListRow  = new List <jgridRow>();
                foreach (Member item in PagerGet.List)
                {
                    ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                        item.ID.ToString()
                        , item.Ten
                        , item._CoQuan.Ten
                        , item.Loai_Ten
                        , item.Email
                        , item.Mobile
                        , item.Username
                        , item.Password.Length > 2 ? item.Password.Substring(0, item.Password.Length - 2) : ""
                        , item.Active.ToString()
                        , item.NguoiTao
                    }));
                }
                jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGet.TotalPages.ToString(), PagerGet.Total.ToString(), ListRow);
                sb.Append(JavaScriptConvert.SerializeObject(grid));
                break;

                #endregion
            case "getpid":
                #region lấy danh sách cho autocomplete
                Pager <Member> PagerGetPid = MemberDal.pagerAllChildByUsername("", true, null, string.IsNullOrEmpty(Security.Username) ? "sspa" : Security.Username, null, _q, "20");
                sb.Append(JavaScriptConvert.SerializeObject(PagerGetPid.List));
                break;

                #endregion
            case "GetLamDichVuList":
                #region lấy danh sách cho autocomplete
                var listLamDichVu = MemberDal.SelectLamDichVu(TVDV_ID, "sspa");
                sb.Append(JavaScriptConvert.SerializeObject(listLamDichVu));
                break;

                #endregion
            case "getpuse":
                #region lấy danh sách cho autocomplete
                Pager <Member> PagerGetPues = MemberDal.pagerAllByUsername("", true, null, Security.Username, null, _q, "20");
                sb.Append(JavaScriptConvert.SerializeObject(PagerGetPues.List));
                break;

                #endregion
            case "SelectByNodeAndWfId":
                #region lấy danh sách cho autocomplete
                string Username = Security.Username;
                //if (Request["WF_ID"] == "4" && string.IsNullOrEmpty(Request["NODE_ID"]))
                //{
                //    sb.Append(JavaScriptConvert.SerializeObject(MemberDal.SelectLanhDaoByCQMa("1")));
                //}
                //else
                //{
                //    if (!string.IsNullOrEmpty(_CQ_ID))
                //    {
                //        MemberCollection mem = MemberDal.SelectLanhDaoByCQMa(_CQ_ID);
                //        foreach (Member m in mem)
                //        {
                //            Username = m.Username;
                //            break;
                //        }
                //    }
                sb.Append(JavaScriptConvert.SerializeObject(MemberDal.SelectByNodeAndWfId(Request["NODE_ID"], Request["WF_ID"], _q, "20", Username)));
                //}
                break;

                #endregion
            case "del":
                #region xóa
                MemberDal.DeleteByIdList(Request["ID"]);
                break;

                #endregion
            case "edit":
                #region chỉnh sửa
                if (!string.IsNullOrEmpty(_ID))
                {
                    sb.Append("(" + JavaScriptConvert.SerializeObject(MemberDal.SelectById(Convert.ToInt32(_ID))) + ")");
                }
                break;

                #endregion
            case "editX":
                #region editX
                if (!string.IsNullOrEmpty(_ID))
                {
                    sb.Append(MemberDal.SelectById(Convert.ToInt32(_ID)).Loai.ToString());
                }
                break;

                #endregion
            case "save":
                #region lưu
                Member ItemSave = new Member();
                if (string.IsNullOrEmpty(_Username))
                {
                    sb.Append("0");
                    break;
                }
                if (!string.IsNullOrEmpty(_ID))
                {
                    ItemSave = MemberDal.SelectById(Convert.ToInt32(_ID));
                }
                else
                {
                    if (MemberDal.ValidEmailUsername(_Email, _Username) != "-1" ||
                        MemberDal.ValidEmailUsername(_Email, _Username) != (string.IsNullOrEmpty(_ID) ? "-1" : _ID))
                    {
                        sb.Append("0");
                        break;
                    }
                }
                ItemSave.Luong       = Convert.ToDouble(_Luong);
                ItemSave.Anh         = _Anh;
                ItemSave.CQ_ID       = Convert.ToInt32(_CQ_ID);
                ItemSave.DiaChi      = string.Empty;
                ItemSave.Email       = _Email;
                ItemSave.Ho          = string.Empty;
                ItemSave.Khoa        = Convert.ToBoolean(_Khoa);
                ItemSave.Loai        = Convert.ToInt32("0");
                ItemSave.Mobile      = _Mobile;
                ItemSave.Mota        = string.Empty;
                ItemSave.NgayCapNhat = DateTime.Now;
                ItemSave.NguoiTao    = Security.Username;
                ItemSave.RefUsername = _refUsername;
                ItemSave.Ten         = _Ten;
                ItemSave.Loai_Ten    = _Loai_Ten;
                ItemSave.ThuKy       = Convert.ToBoolean(_ThuKy);
                ItemSave.XacNhan     = false;
                if (!string.IsNullOrEmpty(_ID))
                {
                    if (!string.IsNullOrEmpty(_Password))
                    {
                        //ItemSave.Password = maHoa.EncryptString(_Password, _Username);
                        ItemSave.Password = maHoa.MD5Encrypt(_Password);
                    }
                    ItemSave = MemberDal.Update(ItemSave);
                }
                else
                {
                    ItemSave.NgayTao = DateTime.Now;
                    //ItemSave.Password = maHoa.EncryptString(_Password, _Username);
                    ItemSave.Password = maHoa.MD5Encrypt(_Password);
                    ItemSave.RowId    = Guid.NewGuid();
                    ItemSave.Username = _Username;
                    ItemSave          = MemberDal.Insert(ItemSave);
                }
                sb.Append("1");
                break;

                #endregion
            case "sendmail":
                #region gửi email
                if (!string.IsNullOrEmpty(_Email))
                {
                    string[]          _email = _Email.Split(new char[] { ',' });
                    sendEmailDelegate _send  = new sendEmailDelegate(sendMail);
                    //_send.BeginInvoke(_email, _Ten, _MoTa, null, null);
                    sb.Append("1");
                }
                else
                {
                    sb.Append("0");
                }
                break;

                #endregion
            case "getRoles":
                #region lấy quyền của thành viên
                if (!string.IsNullOrEmpty(_Username))
                {
                    sb.AppendFormat(getRoleByUsername(_Username));
                }
                break;

                #endregion
            case "saveRoles":
                #region lưu quyền
                if (!string.IsNullOrEmpty(_Username))
                {
                    string roleList = Request["roleList"];
                    if (!string.IsNullOrEmpty(roleList))
                    {
                        MemberRoleDal.UpdateRoleListUsername(roleList, _Username);
                    }
                }
                break;

                #endregion
            case "SelectLanhDaoByCQID":
                #region lấy lãnh đạo theo cơ quan
                if (!string.IsNullOrEmpty(_CQ_ID))
                {
                    MemberCollection PG = MemberDal.SelectLanhDaoByCQID(_CQ_ID);
                    sb.Append(JavaScriptConvert.SerializeObject(PG));
                }
                break;

                #endregion
            case "SelectLanhDaoVanBanDi":
                #region lấy lãnh đạo theo cơ quan
                MemberCollection _SelectLanhDaoVanBanDi = MemberDal.SelectLanhDaoVanBanDi();
                sb.Append(JavaScriptConvert.SerializeObject(_SelectLanhDaoVanBanDi));
                break;

                #endregion
            case "SelectLanhDaoByMaCQ":
                #region tim lanh dao theo ma co quan
                MemberCollection _SelectLanhDaoByMaCoQuan = MemberDal.SelectLanhDaoByCQMa(_CQ_Ma);
                sb.Append(JavaScriptConvert.SerializeObject(_SelectLanhDaoByMaCoQuan));
                break;

                #endregion
            case "ValidateEmail":
                #region tim lanh dao theo ma co quan
                if (!string.IsNullOrEmpty(_Email))
                {
                    if (MemberDal.ValidEmail(_Email))
                    {
                        sb.Append("1");
                    }
                    else
                    {
                        sb.Append("0");
                    }
                }
                break;

                #endregion
            case "ValidateCaptcha":
                #region tim lanh dao theo ma co quan
                if (!string.IsNullOrEmpty(_Captcha))
                {
                    if (Session["capcha"] != null)
                    {
                        if (Session["capcha"].ToString() == _Captcha)
                        {
                            sb.Append("1");
                        }
                        else
                        {
                            sb.Append("0");
                        }
                    }
                    else
                    {
                        sb.Append("0");
                    }
                }
                else
                {
                    sb.Append("0");
                }
                break;

                #endregion
            case "cungDonVi":
                #region cungDonVi : Lấy thành viên cùng đơn vị
                sb.Append(JavaScriptConvert.SerializeObject(MemberDal.SelectCungDonVi(Security.Username)));
                break;
                #endregion

            case "dangKyCaNhan":
                #region dangKyCaNhan
                using (SqlConnection con = DAL.con())
                {
                    con.Open();
                    SqlTransaction tran = con.BeginTransaction();
                    try
                    {
                        CoQuan ItemCq = CoQuanDal.SelectByMa(tran, "RAOVAT");
                        //Member ItemMe = MemberDal.Insert(tran, ItemCq.ID, _Ten, _Email, _Mobile, _DiaChi, maHoa.EncryptString(_Pwd, _Email));
                        Member     ItemMe = MemberDal.Insert(tran, ItemCq.ID, _Ten, _Email, _Mobile, _DiaChi, maHoa.MD5Encrypt(_Password));
                        MemberRole ItemMR = MemberRoleDal.InsertDangKyCaNhan(tran, ItemCq.ID, _Email);
                        Security.Login(_Email, "true");
                        sb.Append("1");
                        tran.Commit();
                    }
                    catch (Exception ex)
                    {
                        tran.Rollback();
                        Security.LogOut();
                        sb.Append(ex.ToString());
                    }
                    finally
                    {
                        con.Close();
                    }
                }

                break;

                #endregion
            case "dangKyGh":
                #region dangKyGh
                using (SqlConnection con = DAL.con())
                {
                    con.Open();
                    SqlTransaction tran = con.BeginTransaction();
                    try
                    {
                        CoQuan ItemCqP = CoQuanDal.SelectByMa(tran, "GIANHANG");
                        CoQuan ItemCq  = CoQuanDal.Insert(tran, ItemCqP.ID, _Ten, _Email);
                        //Member ItemMe = MemberDal.Insert(tran, ItemCq.ID, _Ten, _Email, _Mobile, _DiaChi, maHoa.EncryptString(_Pwd, _Email));
                        Member ItemMe = MemberDal.Insert(tran, ItemCq.ID, _Ten, _Email, _Mobile, _DiaChi, maHoa.MD5Encrypt(_Pwd));
                        MemberRoleDal.InsertDangKyGianHang(tran, ItemCq.ID, _Email, _Ten, _Lang);
                        //LienHe itemLH = LienHeDal.InsertLH(tran, ItemMe.RowId.ToString());
                        Security.Login(_Email, "true");
                        sb.Append("1");
                        tran.Commit();
                    }
                    catch (Exception ex)
                    {
                        tran.Rollback();
                        Security.LogOut();
                        sb.Append(ex.ToString());
                    }
                    finally
                    {
                        con.Close();
                    }
                }

                break;

                #endregion
            case "scpt":
                #region Nạp js
                sb.AppendFormat(@"{0}"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.hethong.thanhvien.JScript1.js"));
                break;

                #endregion
            default:    //Session["capcha"]
                #region nạp
                FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(@"<div class=""mdl-head"">
<span class=""mdl-head-searchPnl ui-state-default ui-corner-all"">
<a href=""javascript:;"" class=""mdl-head-clearSearch""></a>
<input type=""text"" class=""mdl-head-txt mdl-head-search mdl-head-search-thanhvien"" />
</span>
<a class=""mdl-head-btn mdl-head-add"" id=""thanhvienmdl-addBtn"" href=""javascript:thanhvien.add();"">Thêm</a>
<a class=""mdl-head-btn mdl-head-edit"" id=""thanhvienmdl-editBtn"" href=""javascript:thanhvien.edit();"">Sửa</a>
<a class=""mdl-head-btn mdl-head-del"" id=""thanhvienmdl-delBtn"" href=""javascript:thanhvien.del();"">Xóa</a>
<a class=""mdl-head-btn mdl-head-sendmail"" id=""thanhvienmdl-emailBtn"" href=""javascript:thanhvien.sendmail();"">Email</a>
<a class=""mdl-head-btn mdl-head-resetPwd"" id=""thanhvienmdl-reSendPwdBtn"" href=""javascript:thanhvien.resendPwd();"">Cấp mật khẩu</a>
<span class=""mdl-head-filterPnl ui-state-default ui-corner-all"">
<a href=""javascript:;"" class=""mdl-head-clearSearch""></a>
<input type=""text"" _value="""" class=""mdl-head-filter mdl-head-filterThanhVienByCQID""/>
</span>
</div>
<table id=""thanhvienmdl-List"" class=""mdl-list"">
</table>
<div id=""thanhvienmdl-Pager""></div><div class=""sub-mdl""><ul><li><a id=""thanhvienmdl-rolemdl-subMdlBtn"" href=""#mdl-1"">Quyền</a></li></ul><div id=""mdl-1"">
<div class=""sub-mdl-list"" id=""thanhvienmdl-rolemdl-mdl""></div>
</div></div>");
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.hethong.thanhvien.JScript1.js")
                                , "{thanhvien.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 7
0
        protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();
            var cs = this.Page.ClientScript;

            #region Tham số

            HttpContext     c                   = HttpContext.Current;
            var             ID                  = c.Request["ID"];
            var             NDTC_ID             = c.Request["NDTC_ID"];
            var             SoPhieu             = c.Request["SoPhieu"];
            var             SoTien              = c.Request["SoTien"];
            var             Mota                = c.Request["Mota"];
            var             NgayTao             = c.Request["NgayTao"];
            var             NguoiTao            = c.Request["NguoiTao"];
            var             NgaySua             = c.Request["NgaySua"];
            var             NguoiSua            = c.Request["NguoiSua"];
            var             LoaiQuy             = c.Request["LoaiQuy"];
            var             LoaiCandoi          = c.Request["LoaiCandoi"];
            var             isCandoi            = c.Request["isCandoi"];
            var             Thu                 = c.Request["Thu"];
            var             XN_ID               = c.Request["XN_ID"];
            var             P_ID                = c.Request["P_ID"];
            var             DV_ID               = c.Request["DV_ID"];
            var             TuNgay              = c.Request["TuNgay"];
            var             DenNgay             = c.Request["DenNgay"];
            var             _q                  = c.Request["q"];
            List <jgridRow> ListRow             = new List <jgridRow>();
            var             danhMucKyHieu       = DanhMucDal.SelectByMa("TC-THU");
            var             danhMucReportHeader = DanhMucDal.SelectByMa("BAOCAO-HEADER-THUCHI");
            var             danhMucReportFooter = DanhMucDal.SelectByMa("BAOCAO-FOOTER-THUCHI");
            var             draff               = Request["draff"];
            var             isThu               = true;
            #endregion
            switch (subAct)
            {
            case "get":
                #region lấy dữ liệu cho grid

                var pagerGet = ThuChiDal.pagerTuNgayDenNgay(jgrsidx + " " + jgrsord, _q, Convert.ToInt32(jgRows),
                                                            isThu, TuNgay, DenNgay, NDTC_ID, null, true);
                string prefixMas = danhMucKyHieu.KyHieu;
                foreach (var item in pagerGet.List)
                {
                    ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                        item.ID.ToString()
                        , item.NDTC_Ten
                        , prefixMas + item.SoPhieu
                        , item.P_Ten
                        , item.Mota
                        , item.NgayTao.ToString("dd-MM-yyyy")
                        , Lib.TienVietNam(item.SoTien)
                        , item.NguoiTao_Ten
                        , (item.NguoiTao == Security.Username).ToString()
                        , (item.XN_ID != Guid.Empty).ToString()
                        , (item.DV_ID != Guid.Empty).ToString()
                    }));
                }
                jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage
                                            , pagerGet.TotalPages.ToString()
                                            , pagerGet.Total.ToString()
                                            , ListRow);
                sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm));
                break;

                #endregion
            case "del":
                #region xóa
                if (!string.IsNullOrEmpty(ID))
                {
                    ThuChiDal.DeleteById(new Guid(ID));
                }
                break;

                #endregion
            case "edit":
                #region chỉnh sửa
                if (!string.IsNullOrEmpty(ID))
                {
                    var    item     = ThuChiDal.SelectById(new Guid(ID));
                    string prefixMa = danhMucKyHieu.KyHieu;
                    item.SoPhieu = prefixMa + item.SoPhieu;
                    sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(item));
                }
                break;

                #endregion
            case "draff":
                #region draff
                if (Security.IsAuthenticated())
                {
                    var    item     = ThuChiDal.SelectByDraff(isThu);
                    string prefixMa = danhMucKyHieu.KyHieu;
                    item.SoPhieu = prefixMa + item.SoPhieu;
                    sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(item));
                }
                break;

                #endregion
            case "save":
                #region save
                if (Security.IsAuthenticated())
                {
                    var item     = draff == "1" ? new ThuChi() : ThuChiDal.SelectById(new Guid(ID));
                    var prefixMa = danhMucKyHieu.KyHieu;
                    SoPhieu      = SoPhieu.Replace(prefixMa, "");
                    item.SoPhieu = SoPhieu;
                    if (!string.IsNullOrEmpty(DV_ID))
                    {
                        item.DV_ID = new Guid(DV_ID);
                    }
                    item.LoaiCandoi = Convert.ToInt32(LoaiCandoi);
                    item.LoaiQuy    = Convert.ToInt32(LoaiQuy);
                    item.Mota       = Mota;
                    if (!string.IsNullOrEmpty(NDTC_ID))
                    {
                        item.NDTC_ID = new Guid(NDTC_ID);
                    }
                    item.NgaySua  = DateTime.Now;
                    item.NguoiSua = Security.Username;
                    if (!string.IsNullOrEmpty(P_ID))
                    {
                        item.P_ID = new Guid(P_ID);
                    }
                    item.SoTien = Convert.ToDouble(SoTien);
                    item.Thu    = isThu;
                    if (!string.IsNullOrEmpty(XN_ID))
                    {
                        item.XN_ID = new Guid(XN_ID);
                    }
                    item.isCandoi = true;
                    item.NgayTao  = Convert.ToDateTime(NgayTao, new CultureInfo("vi-Vn"));

                    if (draff == "1")
                    {
                        item.ID       = new Guid(ID);
                        item.NguoiTao = NguoiTao;
                        item          = ThuChiDal.Insert(item);
                    }
                    else
                    {
                        item = ThuChiDal.Update(item);
                    }
                    // TODO: Tiếp tục phần thu chi
                    sb.Append("1");
                }
                break;

                #endregion
            case "reports":
                #region bao cao
                if (!string.IsNullOrEmpty(ID))
                {
                    var itemIn = Lib.GetResource(Assembly.GetExecutingAssembly(), "quanLyThuDauKy.in-natural.htm");
                    var item   = ThuChiDal.SelectById(new Guid(ID));
                    sb.AppendFormat(itemIn
                                    , string.Format("Ng&agrave;y {4}{0} th&aacute;ng {3}{1} năm {2}", item.NgayTao.Day, item.NgayTao.Month, item.NgayTao.Year, item.NgayTao.Month < 10 ? "0" : "", item.NgayTao.Day < 10 ? "0" : "")
                                    , item.NDTC_Ten
                                    , string.Format("{0}{1}", danhMucKyHieu.KyHieu, item.SoPhieu)
                                    , (item.LoaiQuy == 1 ? "Tài khoản" : "Tiền mặt")
                                    , Lib.TienVietNam(item.SoTien)
                                    , Lib.So_chu(item.SoTien)
                                    , item.P_Ten
                                    , item.NguoiTao_Ten
                                    , item.Mota
                                    , domain
                                    , danhMucReportHeader.Description
                                    , danhMucReportFooter.Description);
                }

                break;

                #endregion
            case "scpt":
                #region Nạp js
                sb.AppendFormat(@"{0}"
                                , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.quanLyThuDauKy.JScript1.js"));
                //sb.AppendFormat(@"{0}"
                //    , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.quanLyThuDauKy.Publish.js"));
                break;

                #endregion
            default:
                #region nạp
                var listFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "quanLyThuDauKy.mdl.htm"));
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.quanLyThuDauKy.JScript1.js")
                                , "{quanLyThuDauKyDauKyFn.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 8
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder       sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;

            #region Tham số
            string _ID           = Request["ID"];
            string _PID          = Request["PID"];
            string _LDMID        = Request["LDMID"];
            string _Lang         = Request["Lang"];
            string _Ten          = Request["Ten"];
            string _Alias        = Request["Alias"];
            string _Ma           = Request["Ma"];
            string _KyHieu       = Request["KyHieu"];
            string _GiaTri       = Request["GiaTri"];
            string _KeyWords     = Request["KeyWords"];
            string _Description  = Request["Description"];
            string _LangBased_ID = Request["LangBased_ID"];
            string _ThuTu        = Request["ThuTu"];
            string _Anh          = Request["Anh"];
            string _LangBased    = Request["LangBased"];
            string _q            = Request["q"];
            string _LDM_Ma       = Request["LDM_Ma"];
            if (_PID == "0")
            {
                _PID = string.Empty;
            }
            DanhMuc        Item;
            List <DanhMuc> List = new List <DanhMuc>();
            #endregion

            switch (subAct)
            {
            case "get":
                #region lấy dữ liệu cho grid
                List = getTree(DanhMucDal.SelectByLDMID(_LDMID));
                var listRow = List.Select(dm => new jgridRow(dm.ID.ToString(), new string[]
                {
                    dm.ID.ToString(), dm.LangBased.ToString(), dm.ID.ToString(), dm.Lang, dm.ThuTu.ToString(), dm.LDM_Ten, dm.Ma, dm.KyHieu, dm.GiaTri, string.Format("<img class=\"adm-fn-icon\" src=\"../up/i/{0}?ref=\" />", string.IsNullOrEmpty(dm.Anh) ? "fn-icon.jpg" : dm.Anh, Guid.NewGuid().ToString().Replace("-", "")), dm.Ten, string.Format("{0:dd/MM/yy}", dm.NgayCapNhat), dm.NguoiTao + "/" + dm.NguoiSua, dm.Level.ToString(), dm.PID.ToString(), "true", "true"
                })).ToList();
                var grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, List.Count.ToString(), List.Count.ToString(), listRow);
                sb.Append(JavaScriptConvert.SerializeObject(grid));
                break;

                #endregion
            case "getByMa":
                #region lấy dữ liệu cho grid
                List = getTree(DanhMucDal.SelectByLDMMa(_LDM_Ma));
                var listRowByMa = List.Select(dm => new jgridRow(dm.ID.ToString(), new string[]
                {
                    dm.ID.ToString(), dm.LangBased.ToString(), dm.ID.ToString(), dm.Lang, dm.ThuTu.ToString(), dm.LDM_Ten, dm.Ma, dm.KyHieu, dm.GiaTri, string.Format("<img class=\"adm-fn-icon\" src=\"../up/i/{0}?ref=\" />", string.IsNullOrEmpty(dm.Anh) ? "fn-icon.jpg" : dm.Anh, Guid.NewGuid().ToString().Replace("-", "")), dm.Ten, string.Format("{0:dd/MM/yy}", dm.NgayCapNhat), dm.NguoiTao + "/" + dm.NguoiSua, dm.Level.ToString(), dm.PID.ToString(), "true", "true"
                })).ToList();
                var gridByMa = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, List.Count.ToString(), List.Count.ToString(), listRowByMa);
                sb.Append(JavaScriptConvert.SerializeObject(gridByMa));
                break;

                #endregion
            case "del":
                #region xóa
                if (!string.IsNullOrEmpty(_ID))
                {
                    DanhMucDal.DeleteById(new Guid(_ID));
                }
                break;

                #endregion
            case "autoCompleteLangBased":
                #region xóa
                sb.Append(JavaScriptConvert.SerializeObject(getTree(DanhMucDal.SelectByLDMMa(_LDM_Ma))));
                break;

                #endregion
            case "autoCompleteLdmMa":
                #region xóa
                sb.Append(JavaScriptConvert.SerializeObject(getTree(DanhMucDal.SelectByLDMMa(_LDM_Ma))));
                break;

                #endregion
            case "edit":
                #region chỉnh sửa
                if (!string.IsNullOrEmpty(_ID))
                {
                    sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(DanhMucDal.SelectById(new Guid(_ID))));
                }
                break;

                #endregion
            case "save":
                #region lưu
                if (!string.IsNullOrEmpty(_ID))
                {
                    Item = DanhMucDal.SelectById(new Guid(_ID));
                }
                else
                {
                    Item = new DanhMuc();
                }
                Item.Ten         = _Ten;
                Item.Ma          = _Ma;
                Item.LDM_ID      = new Guid(_LDMID);
                Item.KyHieu      = _KyHieu;
                Item.NgayCapNhat = DateTime.Now;
                Item.NguoiTao    = Security.Username;
                Item.GiaTri      = _GiaTri;
                Item.ThuTu       = Convert.ToInt32(_ThuTu);
                Item.NguoiSua    = Security.Username;
                Item.KeyWords    = _KeyWords;
                Item.Description = _Description;
                Item.Alias       = _Alias;
                Item.Lang        = _Lang;
                Item.Anh         = _Anh;
                Item.LangBased   = Convert.ToBoolean(_LangBased);
                if (!string.IsNullOrEmpty(_LangBased_ID))
                {
                    Item.LangBased_ID = new Guid(_LangBased_ID);
                }
                if (!string.IsNullOrEmpty(_PID))
                {
                    Item.PID = new Guid(_PID);
                }
                if (!string.IsNullOrEmpty(_ID))
                {
                    Item = DanhMucDal.Update(Item);
                }
                else
                {
                    Item.NgayTao = DateTime.Now;
                    Item.RowId   = Guid.NewGuid();
                    Item.ID      = Guid.NewGuid();
                    if (!string.IsNullOrEmpty(_LangBased_ID))
                    {
                        Item.LangBased_ID = Item.ID;
                    }
                    Item = DanhMucDal.Insert(Item);
                }
                sb.Append("1");
                break;

                #endregion
            case "scpt":
                #region Nạp js
                sb.AppendFormat(@"{0}"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.danhmuc.JScript1.js"));
                break;

                #endregion
            default:
                #region nạp
                FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "mdl.htm"));
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.danhmuc.JScript1.js")
                                , "{danhmuc.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 9
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder       sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;

            #region Tham số
            string   _ID     = Request["ID"];
            string   _Ten    = Request["Ten"];
            string   _Ma     = Request["Ma"];
            string   _KyHieu = Request["KyHieu"];
            string   _ThuTu  = Request["ThuTu"];
            string   _q      = Request["q"];
            string   _Active = Request["Active"];
            Language Item;
            #endregion
            switch (subAct)
            {
            case "get":
                #region lấy dữ liệu cho grid
                if (string.IsNullOrEmpty(jgrsidx))
                {
                    jgrsidx = "ID";
                }
                if (string.IsNullOrEmpty(jgrsord))
                {
                    jgrsord = "asc";
                }

                Pager <Language> PagerGet = LanguageDal.pagerNormal("", false, "L_" + jgrsidx + " " + jgrsord, Request["rows"]);
                List <jgridRow>  ListRow  = new List <jgridRow>();
                foreach (Language item in PagerGet.List)
                {
                    ListRow.Add(new jgridRow(item.ID.ToString(),
                                             new string[] { item.ID.ToString()
                                                            , item.Ma
                                                            , item.Ten
                                                            , item.ThuTu.ToString()
                                                            , item.Active.ToString() }));
                }
                jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGet.TotalPages.ToString(), PagerGet.Total.ToString(), ListRow);
                sb.Append(JavaScriptConvert.SerializeObject(grid));
                break;

                #endregion
            case "save":
                #region lưu
                if (!string.IsNullOrEmpty(_ID))
                {
                    Item = LanguageDal.SelectById(Convert.ToInt32(_ID));
                }
                else
                {
                    Item = new Language();
                }
                Item.Ten    = _Ten;
                Item.Ma     = _Ma;
                Item.ThuTu  = Int32.Parse(_ThuTu);
                Item.Active = Convert.ToBoolean(_Active);
                if (!string.IsNullOrEmpty(_ID))
                {
                    Item = LanguageDal.Update(Item);
                }
                else
                {
                    Item = LanguageDal.Insert(Item);
                }
                sb.Append("1");
                break;

                #endregion
            case "edit":
                #region chỉnh sửa
                if (!string.IsNullOrEmpty(_ID))
                {
                    sb.Append("(" + JavaScriptConvert.SerializeObject(LanguageDal.SelectById(Convert.ToInt32(_ID))) + ")");
                }
                break;

                #endregion
            case "getActive":
                #region chỉnh sửa
                sb.Append(JavaScriptConvert.SerializeObject(LanguageDal.SelectAll()));
                break;

                #endregion
            case "del":
                #region xóa
                if (!string.IsNullOrEmpty(_ID))
                {
                    LanguageDal.DeleteById(Convert.ToInt32(_ID));
                }
                break;

                #endregion
            case "AutoComplete":
                #region xóa
                JavaScriptConvert.SerializeObject(LanguageDal.SelectAll());
                break;

                #endregion
            case "scpt":
                #region Nạp js
                sb.AppendFormat(@"{0}"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.hethong.language.JScript1.js"));
                break;

                #endregion
            default:
                #region nạp
                FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(@"<div class=""mdl-head"">
<span class=""mdl-head-searchPnl ui-state-default ui-corner-all"">
<a href=""javascript:;"" class=""mdl-head-clearSearch""></a>
<input type=""text"" class=""mdl-head-txt mdl-head-search mdl-head-search-languageFn"" />
</span>
<a _resource=""admin.system.label.add"" class=""mdl-head-btn mdl-head-add"" id=""languageMdl-addBtn"" href=""javascript:languageFn.add();"">Thêm</a>
<a _resource=""admin.system.label.edit"" class=""mdl-head-btn mdl-head-edit"" id=""languageMdl-editBtn"" href=""javascript:languageFn.edit();"">Sửa</a>
<a  _resource=""admin.system.label.del"" class=""mdl-head-btn mdl-head-del"" id=""languageMdl-delBtn"" href=""javascript:languageFn.del();"">Xóa</a>
</div>

<table id=""languageMdl-List"" class=""mdl-list""></table>
<div id=""languageMdl-Pager""></div>
");
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.hethong.language.JScript1.js")
                                , "{languageFn.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 10
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder       sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;

            #region các dữ liệu yêu cầu từ client
            string _ID         = Request["ID"];
            string _PID        = Request["PID"];
            string _Ten        = Request["Ten"];
            string _Mota       = Request["Mota"];
            string _ThuTu      = Request["ThuTu"];
            string _CQ_ID      = Request["CQ_ID"];
            string _UpdateList = Request["UpdateList"];
            #endregion
            switch (subAct)
            {
            case "get":
                #region lấy dữ liệu cho grid
                List <CoQuan>   ListCq  = getTree(CoQuanDal.TreeByUsername(Security.Username, Request["q"]));
                List <jgridRow> ListRow = new List <jgridRow>();
                foreach (CoQuan cq in ListCq)
                {
                    ListRow.Add(new jgridRow(cq.ID.ToString(), new string[] {
                        cq.ID.ToString()
                        , cq.ThuTu.ToString()
                        , cq.Ma
                        , cq.Ten
                        , cq.MoTa
                        , cq.NguoiTao
                        , string.Format("{0} {1:dd-MM-yy}/{2} {3:dd/MM/yy}"
                                        , cq.NguoiTao, cq.NgayTao, cq.NguoiCapNhat, cq.NgayCapNhat)
                        , cq.NSD.ToString()
                        , cq.Level.ToString(), cq.PID.ToString(), "true", "false"
                    }));
                }
                jgrid grid = new jgrid("1", "1", ListCq.Count.ToString(), ListRow);
                sb.Append(JavaScriptConvert.SerializeObject(grid));
                break;

                #endregion
            case "getPid":
                #region lấy toàn bộ danh mục
                CoQuanCollection ListCqGetList = CoQuanDal.TreeByUsername(Security.Username, Request["q"]);
                sb.Append(JavaScriptConvert.SerializeObject(ListCqGetList));
                break;

                #endregion
            case "del":
                #region xóa
                if (!string.IsNullOrEmpty(_ID))
                {
                    CoQuanDal.DeleteById(Convert.ToInt32(_ID));
                }
                break;

                #endregion
            case "new":
                break;

            case "edit":
                #region edit
                if (!string.IsNullOrEmpty(_ID))
                {
                    sb.Append(JavaScriptConvert.SerializeObject(CoQuanDal.SelectById(Convert.ToInt32(_ID))));
                }
                break;

                #endregion
            case "save":
                #region lưu
                CoQuan ItemSave = new CoQuan();
                if (!string.IsNullOrEmpty(_ID))
                {
                    ItemSave = CoQuanDal.SelectById(Convert.ToInt32(_ID));
                }
                int ThuTu = 0;
                if (!string.IsNullOrEmpty(_ThuTu))
                {
                    ThuTu = Convert.ToInt32(_ThuTu);
                }
                ItemSave.ThuTu       = ThuTu;
                ItemSave.Ten         = _Ten;
                ItemSave.MoTa        = _Mota;
                ItemSave.PID         = string.IsNullOrEmpty(_PID) ? 0 : Convert.ToInt32(_PID);
                ItemSave.NgayCapNhat = DateTime.Now;
                if (!string.IsNullOrEmpty(_ID))
                {
                    ItemSave = CoQuanDal.Update(ItemSave);
                }
                else
                {
                    ItemSave.NguoiTao = Security.Username;
                    ItemSave.RowId    = Guid.NewGuid();
                    ItemSave.NgayTao  = DateTime.Now;
                    ItemSave.Level    = 0;
                    ItemSave.PIDList  = string.Empty;
                    ItemSave          = CoQuanDal.Insert(ItemSave);
                }
                sb.Append("1");
                break;

                #endregion
            case "getFunction":
                #region lấy quyền theo cq_id
                FunctionCollection ListGetFunction = FunctionDal.SelectAllByCqID(_CQ_ID);
                sb.Append(getTop(ListGetFunction));
                break;

                #endregion
            case "upadteFunction":
                #region Lưu phân tính năng
                sb.Append(CoQuanFunctionDal.UpdateByUpdateListAndCQID(_CQ_ID, _UpdateList, Security.Username));
                break;

                #endregion
            default:
                #region mặc định - trả về module ban đầu
//<input type=""text"" class=""mdl-head-txt mdl-head-search"" />
                FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(@"<div class=""mdl-head"">
<span class=""mdl-head-searchPnl ui-state-default ui-corner-all"">
<a href=""javascript:;"" class=""mdl-head-clearSearch""></a>
<input type=""text"" class=""mdl-head-txt mdl-head-search mdl-head-search-coQuanSuper"" />
</span>
<a class=""mdl-head-btn mdl-head-add"" id=""coquanSuperMdl-addBtn"" href=""javascript:coquanSuper.add();"">Thêm</a>
<a class=""mdl-head-btn mdl-head-edit"" id=""coquanSuperMdl-editBtn"" href=""javascript:coquanSuper.edit();"">Sửa</a>
<a class=""mdl-head-btn mdl-head-del"" id=""coquanSuperMdl-delBtn"" href=""javascript:coquanSuper.del();"">Xóa</a>
</div>
<table id=""coquanSupermdl-List"" class=""mdl-list"">
</table>
<div id=""coquanSuperMdl-Pager""></div>
<div class=""sub-mdl"">

<ul>
<li>
<a id=""coquanSuperMdl-functionmdl-subMdlBtn"" href=""#coquanSuperMdl-SubMdl-Mdl1"">Tính năng</a>
</li>
</ul>
<div id=""coquanSuperMdl-SubMdl-Mdl1"">
<div id=""coquanSuperMdl-functionmdl-coQuanFnMdl"">
</div>
</div>

</div>");
                sb.AppendFormat(@"<script src=""{0}"" type=""text/javascript""></script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.hethong.coquan.super.JScript1.js"));
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 11
0
        protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();
            var cs = this.Page.ClientScript;

            #region Tham số

            var _ID = Request["ID"];
            if (string.IsNullOrEmpty(_ID))
            {
                _ID = Guid.Empty.ToString();
            }
            var         No      = Request["No"];
            HttpContext c       = HttpContext.Current;
            var         listRow = new List <jgridRow>();
            #endregion
            switch (subAct)
            {
            case "get":
                #region lấy dữ liệu cho grid

                foreach (var item in KhachHangDal.SelectCongNo(No))
                {
                    listRow.Add(new jgridRow(item.ID.ToString(), new string[]
                    {
                        item.ID.ToString()
                        , item.Ten
                        , Lib.TienVietNam(item.CongNoDauKy)
                        , Lib.TienVietNam(item.TongNhap)
                        , Lib.TienVietNam(item.TongXuat)
                        , Lib.TienVietNam(item.TongThu)
                        , Lib.TienVietNam(item.TongChi)
                        , Lib.TienVietNam(item.TongDichVu)
                        , Lib.TienVietNam(item.CongNo)
                    }));
                }
                var gridSpAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage
                                          , "1"
                                          , "1000"
                                          , listRow);
                sb.Append(JavaScriptConvert.SerializeObject(gridSpAdm));
                break;

                #endregion
            case "getSubXuat":
                #region getSubXuat
                if (!string.IsNullOrEmpty(_ID))
                {
                    var danhMucLoaiXuatNhap = DanhMucDal.SelectByMa("LXN-X");
                    var pagerGet            = XuatNhapDal.pagerXuatNhap(true.ToString(), false.ToString(), false.ToString(), false.ToString(), _ID,
                                                                        jgrsidx + " " + jgrsord, string.Empty,
                                                                        Convert.ToInt32(jgRows));
                    string prefixMas = danhMucLoaiXuatNhap.KyHieu;
                    foreach (var item in pagerGet.List)
                    {
                        listRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                            item.ID.ToString()
                            , item.LOAI_Ten
                            , prefixMas + item.Ma
                            , item.KH_Ten
                            , item.NgayHoaDon.ToString("dd-MM-yyyy")
                            , Lib.TienVietNam(item.CongTienHang)
                            , Lib.TienVietNam(item.VAT)
                            , Lib.TienVietNam(item.ChietKhau)
                            , Lib.TienVietNam(item.CongTienHang + item.VAT - item.ChietKhau)
                            , Lib.TienVietNam(item.ThanhToan)
                            , Lib.TienVietNam(item.ConNo)
                            , string.Format("{0:dd/MM/yy}", item.NgayCapNhat)
                        }));
                    }
                    jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage
                                                , pagerGet.TotalPages.ToString()
                                                , pagerGet.Total.ToString()
                                                , listRow);
                    sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm));
                }
                break;

                #endregion
            case "getSubNhap":
                #region getSubNhap
                if (!string.IsNullOrEmpty(_ID))
                {
                    var danhMucLoaiXuatNhap = DanhMucDal.SelectByMa("LXN-N");
                    var pagerGet            = XuatNhapDal.pagerXuatNhap(false.ToString(), false.ToString(), false.ToString(), false.ToString(), _ID,
                                                                        jgrsidx + " " + jgrsord, string.Empty,
                                                                        Convert.ToInt32(jgRows));
                    string prefixMas = danhMucLoaiXuatNhap.KyHieu;
                    foreach (var item in pagerGet.List)
                    {
                        listRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                            item.ID.ToString()
                            , item.LOAI_Ten
                            , prefixMas + item.Ma
                            , item.KH_Ten
                            , item.NgayHoaDon.ToString("dd-MM-yyyy")
                            , Lib.TienVietNam(item.CongTienHang)
                            , Lib.TienVietNam(item.VAT)
                            , Lib.TienVietNam(item.ChietKhau)
                            , Lib.TienVietNam(item.CongTienHang + item.VAT - item.ChietKhau)
                            , Lib.TienVietNam(item.ThanhToan)
                            , Lib.TienVietNam(item.ConNo)
                            , string.Format("{0:dd/MM/yy}", item.NgayCapNhat)
                        }));
                    }
                    jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage
                                                , pagerGet.TotalPages.ToString()
                                                , pagerGet.Total.ToString()
                                                , listRow);
                    sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm));
                }
                break;

                #endregion
            case "getSubThu":
                #region getSubThu
                if (!string.IsNullOrEmpty(_ID))
                {
                    var pagerGet = ThuChiDal.pagerTuNgayDenNgay(jgrsidx + " " + jgrsord, null,
                                                                Convert.ToInt32(jgRows),
                                                                true, null, null, null, _ID);
                    var    danhMucKyHieu = DanhMucDal.SelectByMa("TC-THU");
                    string prefixMas     = danhMucKyHieu.KyHieu;
                    foreach (var item in pagerGet.List)
                    {
                        listRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                            item.ID.ToString()
                            , item.NDTC_Ten
                            , prefixMas + item.SoPhieu
                            , item.P_Ten
                            , item.Mota
                            , item.NgayTao.ToString("dd-MM-yyyy")
                            , Lib.TienVietNam(item.SoTien)
                            , item.NguoiTao_Ten
                            , (item.NguoiTao == Security.Username).ToString()
                            , (item.XN_ID != Guid.Empty).ToString()
                            , (item.DV_ID != Guid.Empty).ToString()
                        }));
                    }
                    jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage
                                                , pagerGet.TotalPages.ToString()
                                                , pagerGet.Total.ToString()
                                                , listRow);
                    sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm));
                }

                break;

                #endregion
            case "getSubChi":
                #region lấy dữ liệu cho getSubThu
                if (!string.IsNullOrEmpty(_ID))
                {
                    var pagerGet = ThuChiDal.pagerTuNgayDenNgay(jgrsidx + " " + jgrsord, null,
                                                                Convert.ToInt32(jgRows),
                                                                false, null, null, null, _ID);
                    var    danhMucKyHieu = DanhMucDal.SelectByMa("TC-CHI");
                    string prefixMas     = danhMucKyHieu.KyHieu;
                    foreach (var item in pagerGet.List)
                    {
                        listRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                            item.ID.ToString()
                            , item.NDTC_Ten
                            , prefixMas + item.SoPhieu
                            , item.P_Ten
                            , item.Mota
                            , item.NgayTao.ToString("dd-MM-yyyy")
                            , Lib.TienVietNam(item.SoTien)
                            , item.NguoiTao_Ten
                            , (item.NguoiTao == Security.Username).ToString()
                            , (item.XN_ID != Guid.Empty).ToString()
                            , (item.DV_ID != Guid.Empty).ToString()
                        }));
                    }
                    jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage
                                                , pagerGet.TotalPages.ToString()
                                                , pagerGet.Total.ToString()
                                                , listRow);
                    sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm));
                }

                break;

                #endregion
            case "scpt":
                #region Nạp js
                sb.AppendFormat(@"{0}"
                                , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.baoCaoNo.JScript1.js"));
                //sb.AppendFormat(@"{0}"
                //    , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.baoCaoNo.Publish.js"));
                break;

                #endregion
            default:
                #region nạp
                var listFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "baoCaoNo.mdl.htm"));
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.baoCaoNo.JScript1.js")
                                , "{baoCaoNoFn.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 12
0
        protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();
            var cs = this.Page.ClientScript;

            #region Tham số
            var             ID           = Request["ID"];
            var             DM_ID        = Request["DM_ID"];
            var             GH_ID        = Request["GH_ID"];
            var             Lang         = Request["Lang"];
            var             LangBased_ID = Request["LangBased_ID"];
            var             LangBased    = Request["LangBased"];
            var             Alias        = Request["Alias"];
            var             Ten          = Request["Ten"];
            var             Ma           = Request["Ma"];
            var             Keywords     = Request["Keywords"];
            var             Description  = Request["Description"];
            var             MoTa         = Request["MoTa"];
            var             NoiDung      = Request["NoiDung"];
            var             GNY          = Request["GNY"];
            var             GiaNhap      = Request["GiaNhap"];
            var             DonVi_ID     = Request["DonVi_ID"];
            var             SoLuong      = Request["SoLuong"];
            var             RowId        = Request["RowId"];
            var             NgayTao      = Request["NgayTao"];
            var             NguoiTao     = Request["NguoiTao"];
            var             NgayCapNhat  = Request["NgayCapNhat"];
            var             NguoiCapNhat = Request["NguoiCapNhat"];
            var             Anh          = Request["Anh"];
            var             Publish      = Request["Publish"];
            var             Active       = Request["Active"];
            var             Home         = Request["Home"];
            var             Hot1         = Request["Hot1"];
            var             Hot2         = Request["Hot2"];
            var             Hot3         = Request["Hot3"];
            var             Hot4         = Request["Hot4"];
            var             HetHang      = Request["HetHang"];
            var             TonDinhMuc   = Request["TonDinhMuc"];
            var             Draff        = Request["Draff"];
            var             _q           = Request["q"];
            var             draff        = Request["draff"];
            var             Loai         = Request["Loai"];
            var             Rep_Ten      = Request["Rep_Ten"];
            var             Rep_Ngay     = Request["Rep_Ngay"];
            var             _F_ID        = Request["F_ID"];
            List <jgridRow> ListRow      = new List <jgridRow>();

            //List<DanhMuc> ListDanhMucBG = new List<DanhMuc>();
            #endregion
            switch (subAct)
            {
            case "get":
                #region lấy dữ liệu cho grid
                var pagerGet = HangHoaDal.ByDm("", false, jgrsidx + " " + jgrsord, _q, Convert.ToInt32(jgRows), DM_ID);
                foreach (HangHoa item in pagerGet.List)
                {
                    ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                        item.ID.ToString()
                        , item.DM_Ten
                        , item.Ma
                        , item.Ten
                        , Lib.TienVietNam(item.GiaNhap)
                        , Lib.TienVietNam(item.GNY)
                        , item.SoLuong.ToString()
                        , item.DonVi_Ten
                        , string.Format("{0:dd/MM/yy}", item.NgayCapNhat)
                    }));
                }
                jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage
                                            , pagerGet.TotalPages.ToString()
                                            , pagerGet.Total.ToString()
                                            , ListRow);
                sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm));
                break;

                #endregion
            case "del":
                #region xóa
                if (!string.IsNullOrEmpty(ID))
                {
                    HangHoaDal.DeleteByMultiId(ID);
                }
                break;

                #endregion
            case "edit":
                #region chỉnh sửa
                if (!string.IsNullOrEmpty(ID))
                {
                    var hhitem = HangHoaDal.SelectById(new Guid(ID));
                    hhitem.ListFiles = FilesDal.SelectByPRowId(hhitem.ID);
                    sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(hhitem));
                }
                break;

                #endregion
            case "draff":
                #region draff
                sb.Append(Guid.NewGuid().ToString());
                break;

                #endregion
            case "autoCompleteByQ":
                #region lấy dữ liệu cho grid
                var pagerByQ = HangHoaDal.ByDm("", false, "HH_NgayTao asc", _q, 10, string.Empty);
                sb.Append(JavaScriptConvert.SerializeObject(pagerByQ.List));
                break;

                #endregion
            case "save":
                #region save
                if (Security.IsAuthenticated())
                {
                    var item = draff == "1" ? new HangHoa() : HangHoaDal.SelectById(new Guid(ID));
                    item.DM_ID        = new Guid(DM_ID);
                    item.Ten          = Ten;
                    item.Ma           = Ma;
                    item.Keywords     = Keywords;
                    item.MoTa         = MoTa;
                    item.NoiDung      = NoiDung;
                    item.GNY          = Convert.ToDouble(GNY);
                    item.GiaNhap      = Convert.ToDouble(GiaNhap);
                    item.DonVi_ID     = new Guid(DonVi_ID);
                    item.SoLuong      = Convert.ToDouble(SoLuong);
                    item.Anh          = Anh;
                    item.HetHang      = Convert.ToBoolean(HetHang);
                    item.TonDinhMuc   = Convert.ToDouble(TonDinhMuc);
                    item.NguoiCapNhat = Security.Username;
                    item.NgayCapNhat  = DateTime.Now;
                    if (draff == "1")
                    {
                        item.ID       = new Guid(ID);
                        item.NgayTao  = DateTime.Now;
                        item.NguoiTao = Security.Username;
                        item.RowId    = Guid.NewGuid();
                        item          = HangHoaDal.Insert(item);
                    }
                    else
                    {
                        item = HangHoaDal.Update(item);
                    }
                    sb.Append("1");
                }
                break;

                #endregion
            case "DeleteDoc":
                #region Xóa tài liệu đính kèm
                if (!string.IsNullOrEmpty(_F_ID))
                {
                    Files  item   = FilesDal.SelectById(Convert.ToInt32(_F_ID));
                    string _files = Server.MapPath("~/lib/up/sanpham/") + item.ThuMuc + @"\";
                    string _file1 = _files + @"\" + item.Ten + item.MimeType;
                    string _file2 = _files + @"\" + item.Ten + "400x400" + item.MimeType;
                    if (Directory.Exists(_files))
                    {
                        File.Delete(_file1);
                        File.Delete(_file2);
                        Directory.Delete(_files);
                    }
                    FilesDal.DeleteById(item.ID);
                }
                break;

                #endregion
            case "reports":
                #region bao cao
                var pagerGetReport = HangHoaDal.ByDm("", false, jgrsidx + " " + jgrsord, _q, Convert.ToInt32(jgRows), DM_ID);

                break;

                #endregion
            case "scpt":
                #region Nạp js
                sb.AppendFormat(@"{0}"
                                , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.hangHoaMgr.JScript1.js"));
                //sb.AppendFormat(@"{0}"
                //    , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.hangHoaMgr.Publish.js"));
                break;

                #endregion
            default:
                #region nạp
                var listFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "mdl.htm"));
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.hangHoaMgr.JScript1.js")
                                , "{hangHoaMgrFn.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 13
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            StringBuilder       sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            string _userName       = Request["UserName"];
            string _IP             = Request["IPTruyCap"];

            switch (subAct)
            {
            case "get":
                #region lấy dữ liệu cho grid
                if (string.IsNullOrEmpty(jgrsidx))
                {
                    jgrsidx = "ID";
                }
                if (string.IsNullOrEmpty(jgrsord))
                {
                    jgrsord = "asc";
                }

                Pager <Log> PagerGet = LogDal.pagerNormal("", false, "LOG_" + jgrsidx + " " + jgrsord, _userName, Convert.ToInt32(jgRows), null);

                List <jgridRow> ListRow = new List <jgridRow>();
                foreach (Log log in PagerGet.List)
                {
                    ListRow.Add(new jgridRow(log.ID.ToString(), new string[] { log.ID.ToString(), log.LLOG_ID.ToString(), log.NgayTao.ToString(), log.Username, log.RawUrl, log.RequestIp }));
                }
                jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGet.TotalPages.ToString(), PagerGet.Total.ToString(), ListRow);
                sb.Append(JavaScriptConvert.SerializeObject(grid));
                break;

                #endregion
            case "scpt":
                #region Nạp js
                sb.AppendFormat(@"{0}"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.hethong.quanlyLog.JScript1.js"));
                break;

                #endregion
            default:
                #region nạp
                FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                sb.Append(@"
            <div id=""mdl-head"">
<input type=""text"" _value="""" class=""admtxt UserName""/><button class=""admfilter-btn""></button>
<input type=""text"" class=""admtxt-medium ui-corner-all IPTruyCap"" /><button class=""admSearch-btn""></button> 

     
            </div>
<table id=""quanlylogmdl-List"" class=""mdl-list""></table>
<div id=""quanlylogmdl-Pager""></div>");
                sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                                , cs.GetWebResourceUrl(typeof(Class1), "docsoft.plugin.hethong.quanlyLog.JScript1.js")
                                , "{quanlylog.loadgrid();}");
                sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                break;
                #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Ejemplo n.º 14
0
 protected override void Render(HtmlTextWriter writer)
 {
     StringBuilder sb = new StringBuilder();
     ClientScriptManager cs = this.Page.ClientScript;
      switch (subAct)
     {
         case "get":
             #region Lấy danh sách
             string sbg = Request["sobanghi"];
             if (string.IsNullOrEmpty(sbg)) sbg = "5";
             MemberCollection mcMember = MemberDal.UserOnline(Security.Username, Convert.ToInt32(sbg.ToString()));
             List<jgridRow> ListRow = new List<jgridRow>();
             foreach (Member item in mcMember)
             {
                 ListRow.Add(new jgridRow(item.ID.ToString()
                     , new string[] {
                     item.Username,
                     item.SLOnline.ToString()
                     }));
             }
             jgrid grid = new jgrid(jgrpage, sbg.ToString(), sbg.ToString(), ListRow);
             sb.Append(JavaScriptConvert.SerializeObject(grid));
             break;
             #endregion
         default:
             #region nạp
             FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
             sb.Append(@"
     <table class=""userOnlineMdl-List"">
     </table>
     <div class=""userOnlineMdl-Pager""></div><input type=""hidden"" value=""" + SoBanGhi.ToString() + @""" id=""userOnlineMdl-SoBanGhi"" />");
             sb.AppendFormat(@"<script src=""{0}"" type=""text/javascript""></script>"
                 , cs.GetWebResourceUrl(typeof(UserOnline), "docsoft.plugin.desktop.JScript2.js"));
             sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
             break;
             #endregion
     }
      writer.Write(sb.ToString());
      base.Render(writer);
 }
Ejemplo n.º 15
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            string _ID = Request["ID"];

            string _q = Request["q"];
            switch (subAct)
            {
                case "get":
                    #region Lấy danh sách
                    if(string.IsNullOrEmpty(jgRows)) jgRows="20";
                    if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "ID";
                    if (string.IsNullOrEmpty(jgrsord)) jgrsord = "asc";

                    Pager<VanBan> pagerGet = VanBanDal.PagerByUser("", false, "VB_" + jgrsidx + " " + jgrsord
                        , jgRows, Security.Username, Request["VB_Draff"], Request["VB_TrangThai"]
                        , Request["VB_CQ_ID"], Request["VB_MEM_Username"], Request["VB_PhanLoai_ID"]
                        , Request["VB_NoiGui_ID"], Request["VB_LoaiVanBan_ID"], _q);
                    List<jgridRow> ListRow = new List<jgridRow>();
                    foreach (VanBan item in pagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString()
                            , new string[] {
                            item.ID.ToString(),
                            string.Format("<a href=\"javascript:dvanBanDen.getVanBanNode('{1}');\">{0}</a>",item.SoDen,item.ID),
                            item.SoKyHieu,
                            string.Format("{0:dd/MM/yy}",item.NgayTrenVanBan),
                            item.Doc ? string.Format(@"<a class=""vanBan-list-item"" href=""javascript:dvanBanDen.getVanBan('{1}');"">{0}</a>",item.TrichYeu,item.ID) : string.Format(@"<a class=""vanBan-list-item vanBan-list-item-bold"" href=""javascript:dvanBanDen.getVanBan('{1}');"">{0}</a>",item.TrichYeu,item.ID),
                            item.TrichYeu,
                            item.MEM_Ten,
                            }));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, pagerGet.TotalPages.ToString(), pagerGet.Total.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "GetVanBan":
                    #region chỉnh sửa node
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        VanBan itemGetVanBan = VanBanDal.SelectByIdView(Convert.ToInt32(_ID), Security.Username);
                        if (itemGetVanBan.Filelist.Count > 0)
                        {
                            if (itemGetVanBan.Filelist[0].ID != 0)
                            {
                                foreach (Files item in itemGetVanBan.Filelist)
                                {
                                    itemGetVanBan.FileListStr += string.Format(@"<a href=""../Default.aspx?act=download&ID={0}"" class=""adm-token-item"">{1}</a>"
                                        , item.ID, item.Ten);
                                }
                            }
                        }
                        sb.Append(string.Format("({0})", JavaScriptConvert.SerializeObject(itemGetVanBan)));
                    }
                    break;
                    #endregion
                case "GetVanBanXuLy":
                    #region chỉnh sửa node
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        VanBan itemGetVanBan = VanBanDal.SelectByIdXuLy(Convert.ToInt32(_ID), Security.Username);
                        if (itemGetVanBan.Filelist.Count > 0)
                        {
                            if (itemGetVanBan.Filelist[0].ID != 0)
                            {
                                foreach (Files item in itemGetVanBan.Filelist)
                                {
                                    itemGetVanBan.FileListStr += string.Format(@"<a href=""../Default.aspx?act=download&ID={0}"" class=""adm-token-item"">{1}</a>"
                                        , item.ID, item.Ten);
                                }
                            }
                        }
                        sb.Append(string.Format("({0})", JavaScriptConvert.SerializeObject(itemGetVanBan)));
                    }
                    break;
                    #endregion
                case "getNode":
                    #region Lấy node theo WFID
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        NodesCollection ListByWf = NodesDal.SelectAll();
                        List<jgridRow> ListRowNodes = new List<jgridRow>();
                        foreach (Nodes item in ListByWf)
                        {
                            ListRowNodes.Add(new jgridRow(item.ID.ToString()
                                , new string[] {
                            item.ID.ToString(),
                            item.Ten,
                            item.MoTa,
                            item.BatDau ? "Bắt đầu" : (item.KetThuc ? "Kết thúc" : "Bước"),
                            item.ThuTu.ToString()
                            }));
                        }
                        jgrid gridNodes = new jgrid("1", "1", ListByWf.Count.ToString(), ListRowNodes);
                        sb.Append(JavaScriptConvert.SerializeObject(gridNodes));
                    }
                    break;
                    #endregion
                default:
                    #region nạp
                    FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                    sb.Append(@"
            <table class=""dvanBanDenMdl-List"" class=""mdl-list"">
            </table>
            <div class=""dvanBanDenMdl-Pager""></div>
            <div class=""sub-mdl"">
            <ul>
            <li><a id=""dvanBanDenMdl-ChiTietMdl-subMdlViewBtn"" href=""#dvanBanDenMdl-chiTietMdl-ViewMdl"">Thông tin văn bản đến</a></li>
            <li><a id=""dvanBanDenMdl-ChiTietMdl-subMdlLogsBtn"" href=""#dvanBanDenMdl-chiTietMdl-LogsMdl"">Lịch sử</a></li>
            </ul>
            <div id=""dvanBanDenMdl-chiTietMdl-ViewMdl"">
            </div>
            <div id=""dvanBanDenMdl-chiTietMdl-LogsMdl"">
            </div>
            </div>
            ");
                    sb.AppendFormat(@"<script src=""{0}"" type=""text/javascript""></script>"
                        , cs.GetWebResourceUrl(typeof(dVanBanDen), "docsoft.plugin.desktop.JScript1.js"));
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }