Beispiel #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);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            #region Tham số
            string _ID = Request["ID"];
            string _q = Request["q"];
            string _dm = Request["dm"];
            string _active = Request["active"];
            string _publish = Request["publish"];
            string _Lang = Request["Lang"];
            string _dmkv = Request["dmkv"];
            string _LangBased = Request["LangBased"];
            string _LangBased_ID = Request["LangBased_ID"];
            string _ckbMua = Request["ckbMua"];
            string _Anh = Request["Anh"];
            string _Ten = Request["Ten"];
            string _MoTa = Request["MoTa"];
            string _NoiDung = Request["NoiDung"];
            string _NgayHetHan = Request["NgayHetHan"];
            string _XuatXu = Request["XuatXu"];
            string _Active = Request["Active"];
            string _Publish = Request["Publish"];
            string _Hot = Request["Hot"];
            string _Hot1 = Request["Hot1"];
            string _Hot2 = Request["Hot2"];
            string _Hot3 = Request["Hot3"];
            string _Hot4 = Request["Hot4"];
            string _muaban = Request["muaban"];
            string _trangthai = Request["trangthai"];
            GiaoThuong Item;
            List<GiaoThuong> List = new List<GiaoThuong>();
            List<jgridRow> ListRow = new List<jgridRow>();
            #endregion
            switch (subAct)
            {
                case "ListDanhMucID":
                    #region load hỗ trợ đăng ký dịch vụ
                    if (!string.IsNullOrEmpty(_ID)) {
                        sb.Append(JavaScriptConvert.SerializeObject(DanhMucDal.SelectListDanhMucID(_ID)));
                    }
                    break;
                    #endregion
                case "getByLangBasedId":
                    #region lấy dữ liệu ngôn ngữ phụ

                    List<GiaoThuong> listpg = GiaoThuongDal.SelectgetByLangBasedId(Convert.ToInt32(_LangBased_ID));
                    List<jgridRow> ListRowgetByLangBasedId = new List<jgridRow>();
                    foreach (GiaoThuong item in listpg)
                    {
                        ListRowgetByLangBasedId.Add(new jgridRow(item.ID.ToString(), new string[]{
                            item.ID.ToString()
                            ,item.LangBased.ToString()
                            ,item.Lang
                            ,string.Format(@"<img src=""../up/i/{0}"" />",Lib.imgSize(item.Anh,"50x50"))
                            ,item.Ten
                            ,item.NoiDung
                            ,item._DM_Ten
                            ,item.XuatXu
                            ,item.NgayTao.ToString("dd/MM/yyyy")
                            ,item.NguoiTao
                            ,item.Publish.ToString()
                            ,item.Active.ToString()
                        }));
                    }
                    jgrid gridlang = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, "1", listpg.Count.ToString(), ListRowgetByLangBasedId);
                    sb.Append(JavaScriptConvert.SerializeObject(gridlang));
                    break;
                    #endregion
                case "get":
                    #region lấy dữ liệu cho grid

                    Pager<GiaoThuong> PagerGet = GiaoThuongDal.pagerNormal("", false, jgrsidx + " " + jgrsord, _q, _dm,Security.Username, "False", _publish, _Lang, Convert.ToInt32(jgRows), _dmkv, _muaban, "");

                    foreach (GiaoThuong item in PagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[]{
                            item.ID.ToString()
                            ,item.LangBased.ToString()
                            ,item.Lang
                            ,string.Format(@"<img src=""../up/i/{0}"" />",Lib.imgSize(item.Anh,"50x50"))
                            ,item.Ten
                            ,item.NoiDung
                            ,item._DM_Ten
                            ,item.XuatXu
                            ,item.NgayTao.ToString("dd/MM/yyyy")
                            ,item.NguoiTao
                            ,item.Publish.ToString()
                            ,item.Active.ToString()
                        }));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage
                        , List.Count.ToString()
                        , List.Count.ToString()
                        , ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "del":
                    #region xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        GiaoThuongDal.DeleteByIdList(_ID);
                    }
                    break;
                    #endregion
                case "DKDVVIP":
                    #region xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        GiaoThuongDal.DKDVVIP(_ID);
                    }
                    break;
                    #endregion
                case "CountLang":
                    #region
                    //GiaoThuongDal.SelectCountLang(int.Parse(_ID),_Lang);
                    sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(GiaoThuongDal.SelectCountLang(int.Parse(_ID), _Lang)));
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(GiaoThuongDal.SelectById(Convert.ToInt32(_ID))));
                    }
                    break;
                    #endregion
                case "save":
                    #region lưu
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        Item = GiaoThuongDal.SelectById(Convert.ToInt32(_ID));
                    }
                    else
                    {
                        Item = new GiaoThuong();
                    }
                    Item.LangBased = Convert.ToBoolean(_LangBased);
                    if (!string.IsNullOrEmpty(_LangBased_ID))
                    {
                        Item.LangBased_ID = Convert.ToInt32(_LangBased_ID);
                    }
                    if (!string.IsNullOrEmpty(_dm))
                    {
                        Item.DM_ID = Convert.ToInt32(_dm);
                    }
                    if (!string.IsNullOrEmpty(_dmkv))
                    {
                        Item.KV_ID = Convert.ToInt32(_dmkv);
                    }
                    Item.Mua = Convert.ToBoolean(_ckbMua);
                    Item.Lang = _Lang;
                    Item.Ten = _Ten;
                    Item.MoTa = _MoTa;
                    Item.NoiDung = _NoiDung;
                    Item.XuatXu = _XuatXu;
                    Item.Anh = _Anh;
                    Item.NgayHetHan = Convert.ToDateTime(_NgayHetHan, new CultureInfo("vi-vn"));
                    Item.NgayCapNhat = DateTime.Now;
                    Item.NguoiCapNhat = Security.Username;
                    //Item.Active = Convert.ToBoolean(_Active);
                    Item.Publish = Convert.ToBoolean(_Publish);
                    //Item.Hot1 = Convert.ToBoolean(_Hot1);
                    //Item.Hot2 = Convert.ToBoolean(_Hot2);
                    //Item.Hot3 = Convert.ToBoolean(_Hot3);
                    //Item.Hot4 = Convert.ToBoolean(_Hot4);
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        Item = GiaoThuongDal.Update(Item);
                    }
                    else
                    {
                        Item.NgayTao = DateTime.Now;
                        Item.RowId = Guid.NewGuid();
                        Item.NguoiTao = Security.Username;
                        Item = GiaoThuongDal.Insert(Item);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.giaoThuong.User.GiaoThuongMoi.JScript1.js"));
                    break;
                    #endregion
                default:
                    #region Nạp
                    FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                    sb.Append(@"
                 <div id=""UserGiaoThuongMoiFnMdl-main"">
                    <div id=""UserGiaoThuongMoiFnMdl-head"" 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-UserGiaoThuongMoi"" />
                        </span>
                        <a class=""mdl-head-btn mdl-head-add"" id=""UserGiaoThuongMoiFnMdl-addBtn"" href=""javascript:"" onclick=""UserGiaoThuongMoiFn.add();"">Thêm</a>
                        <a class=""mdl-head-btn mdl-head-edit"" id=""UserGiaoThuongMoiFnMdl-editBtn"" href=""javascript:"" onclick=""UserGiaoThuongMoiFn.edit();"">Sửa</a>
                        <a class=""mdl-head-btn mdl-head-del"" id=""UserGiaoThuongMoiFnMdl-delBtn"" href=""javascript:"" onclick=""UserGiaoThuongMoiFn.del();"" >Xóa</a>
                        <select class=""slt"" onchange=""UserGiaoThuongMoiFn.search();"" id=""UserGiaoThuongMoiFnMdl-changeLangSlt""></select>
                        <select class=""muaban"" onchange=""UserGiaoThuongMoiFn.search();"" id=""UserGiaoThuongMoiFnMdl-muaban""></select>

                        <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-filterDanhMucUserGiaoThuongMoi""/>
                        </span>
                        <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-filterKhuVucUserGiaoThuongMoi""/>
                        </span>
                        <a class=""mdl-head-btn mdl-head-del"" id=""UserGiaoThuongMoiFnMdl-delBtn"" href=""javascript:"" onclick=""UserGiaoThuongMoiFn.DKDVVIP();"" >Đăng ký tin nổi bật</a>

                    </div>
                    <table id=""UserGiaoThuongMoiFnMdl-List"" class=""mdl-list""></table>
                    <div id=""UserGiaoThuongMoiFnMdl-Pager""></div>
                    <h3 style=""color: #2E6E9E;"">Ngôn ngữ khác, Thông tin về tin giao thương</h3>
                    <div class=""sub-mdl-list"" id=""UserGiaoThuongMoiFnMdl-subMdl"">
                        <ul>
                            <li><a href=""#UserGiaoThuongMoiFnMdl-subLangMdl"">Ngôn ngữ</a></li>
                            <li><a href=""#UserGiaoThuongMoiFnMdl-subNhomMdl"">Nhóm</a></li>
                            <li><a href=""#UserGiaoThuongMoiFnMdl-subAnhMdl"">Ảnh</a></li>
                        </ul>
                        <div  id=""UserGiaoThuongMoiFnMdl-subLangMdl"" class=""sub-mdl-list-item"">
                            <div class=""mdl-head"">
                                <a class=""mdl-head-btn mdl-head-AddLang"" id=""UserGiaoThuongMoiFnMdl-AddLangBtn"" href=""javascript:"" onclick=""UserGiaoThuongMoiFn.AddLang();"">Thêm ngôn ngữ khác</a>
                                <a class=""mdl-head-btn mdl-head-EditLang"" id=""UserGiaoThuongMoiFnMdl-EditLang"" href=""javascript:"" onclick=""UserGiaoThuongMoiFn.EditLang();"">Sửa</a>
                                <a class=""mdl-head-btn mdl-head-DelLang"" id=""UserGiaoThuongMoiFnMdl-DelLang"" href=""javascript:"" onclick=""UserGiaoThuongMoiFn.DelLang();"">Xóa</a>
                                <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-tinMdl-subTinNhomMdl"" />
                                </span>
                            </div>
                            <table id=""UserGiaoThuongMoiFnMdl-subLangMdl-List"" class=""mdl-list""></table>
                        </div>
                        <div id=""UserGiaoThuongMoiFnMdl-subNhomMdl"" class=""sub-mdl-list-item"">
                            <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-tinMdl-subTinTopicMdl"" />
                                </span>
                            </div>
                            <table id=""UserGiaoThuongMoiFnMdl-subNhomMdl-List"" class=""mdl-list""></table>
                        </div>
                        <div id=""UserGiaoThuongMoiFnMdl-subAnhMdl"" class=""sub-mdl-list-item"">
                            <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-tinMdl-subTinBinhLuanMdl"" />
                                </span>
                            </div>
                            <table id=""UserGiaoThuongMoiFnMdl-subAnhMdl-List"" class=""mdl-list""></table>
                        </div>
                    </div>
                </div>
                    ");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                    , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.giaoThuong.User.GiaoThuongMoi.JScript1.js")
                    , "{UserGiaoThuongMoiFn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #4
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            #region Tham số
            string _ID = Request["ID"];
            string _B_ID = Request["B_ID"];
            string _DM_ID = Request["DM_ID"];
            string _RssUrl = Request["RssUrl"];
            Channel ItemSave;
            #endregion

            switch (subAct)
            {
                case "get":
                    #region lấy dữ liệu cho grid
                    List<jgridRow> ListRow = new List<jgridRow>();
                    ChannelCollection List = ChannelDal.SelectByDmIdByBid(_DM_ID, _B_ID);
                    foreach (Channel dm in List)
                    {
                        ListRow.Add(new jgridRow(dm.ID.ToString(), new string[] {
                             string.Format("{0}",dm.ID)
                            , dm.B_Ten
                            , dm.DM_Ten
                            , dm.RssUrl
                        }));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, List.Count.ToString(), List.Count.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "del":
                    #region xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ChannelDal.DeleteById(Convert.ToInt32(_ID));
                    }
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.Append("(" + JavaScriptConvert.SerializeObject(ChannelDal.SelectById(Convert.ToInt32(_ID))) + ")");
                    }
                    break;
                    #endregion
                case "save":
                    #region lưu
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemSave = ChannelDal.SelectById(Convert.ToInt32(_ID));
                    }
                    else
                    {
                        ItemSave = new Channel();
                    }
                    if (!string.IsNullOrEmpty(_B_ID))
                    {
                        ItemSave.B_ID = Convert.ToInt32(_B_ID);
                    }
                    if (!string.IsNullOrEmpty(_DM_ID))
                    {
                        ItemSave.DM_ID = Convert.ToInt32(_DM_ID);
                    }
                    ItemSave.RssUrl = _RssUrl;
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemSave = ChannelDal.Update(ItemSave);
                    }
                    else
                    {
                        ItemSave = ChannelDal.Insert(ItemSave);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "getautoComplete":
                    #region Lấy danh sách danh mục
                    sb.Append(JavaScriptConvert.SerializeObject(docbao.entitites.DanhMucDal.SelectAll()));
                    break;
                    #endregion
                case "getautoCompletePid":
                    #region Lấy danh sách danh mục
                    sb.Append(JavaScriptConvert.SerializeObject(docbao.entitites.DanhMucDal.SelectPid()));
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "plugin.rss.kenhRss.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-kenhRssMdl"" />
            </span>
            <a class=""mdl-head-btn mdl-head-add"" id=""kenhRssMdl-addBtn"" href=""javascript:kenhRssFn.add();"">Thêm</a>
            <a class=""mdl-head-btn mdl-head-edit"" id=""kenhRssMdl-editBtn"" href=""javascript:kenhRssFn.edit();"">Sửa</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""kenhRssMdl-delBtn"" href=""javascript:kenhRssFn.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-kenhRssFilterByBao""/>
            </span>
            <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-kenhRssFilterByDanhMuc""/>
            </span>
            </div>
            <table id=""kenhRssMdl-List"" class=""mdl-list""></table>
            <div id=""kenhRssMdl-Pager""></div>");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "plugin.rss.kenhRss.JScript1.js")
                        , "{kenhRssFn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #5
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 DM_Ten = Request["DM_Ten"];
            var DV_ID = Request["DV_ID"];
            var DV_Ten = Request["DV_Ten"];
            var SoLuong = Request["SoLuong"];
            var ThuTu = Request["ThuTu"];
            var MoTa = Request["MoTa"];

            string q = Request["q"];
            #endregion
            switch (subAct)
            {
                case "getSub":
                    #region lấy dữ liệu cho grid
                    if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "ID";
                    if (string.IsNullOrEmpty(jgrsord)) jgrsord = "asc";

                    var listSub = TinhTrangDichVuDal.SelectDmId(DM_ID);

                    var listRowSub = listSub.Select(item => new jgridRow(item.ID.ToString(), new string[]
                                                                                                               {
                                                                                                                   item.ID.ToString(),
                                                                                                                   item.ThuTu.ToString(),
                                                                                                                   item.DV_Ten,
                                                                                                                   item.SoLuong.ToString()
                                                                                                               })).ToList();
                    var gridSub = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, "0", "0", listRowSub);
                    sb.Append(JavaScriptConvert.SerializeObject(gridSub));
                    break;
                    #endregion
                case "saveSub":
                    #region lưu
                    var itemSub = new TinhTrangDichVu();
                    if (!string.IsNullOrEmpty(ID))
                    {
                        itemSub = TinhTrangDichVuDal.SelectById(new Guid(ID));
                    }
                    else
                    {
                        itemSub.ID = Guid.NewGuid();
                    }
                    if (!string.IsNullOrEmpty(DM_ID))
                    {
                        itemSub.DM_ID = new Guid(DM_ID);
                    }
                    if (!string.IsNullOrEmpty(DV_ID))
                    {
                        itemSub.DV_ID = new Guid(DV_ID);
                    }
                    itemSub.SoLuong = Convert.ToInt32(SoLuong);
                    itemSub.NgayCapNhat = DateTime.Now;
                    itemSub.NguoiCapNhat = Security.Username;
                    itemSub.ThuTu = Convert.ToInt32(ThuTu);
                    if (!string.IsNullOrEmpty(ID))
                    {
                        itemSub = TinhTrangDichVuDal.Update(itemSub);
                    }
                    else
                    {
                        itemSub.NgayTao = DateTime.Now;
                        itemSub.NguoiTao = Security.Username;
                        itemSub = TinhTrangDichVuDal.Insert(itemSub);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "editSub":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(TinhTrangDichVuDal.SelectById(new Guid(ID))));
                    }
                    break;
                    #endregion
                case "delSub":
                    #region xóa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        TinhTrangDichVuDal.DeleteById(new Guid(ID));
                    }
                    break;
                    #endregion
                case "getByDmId":
                    #region lấy dữ liệu cho grid
                    sb.Append(JavaScriptConvert.SerializeObject(TinhTrangDichVuDal.SelectDmId(DM_ID)));
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "appStore.pmSpa.tinhTrangDichVuMgr.JScript1.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.pmSpa.tinhTrangDichVuMgr.JScript1.js")
                        , "{tinhTrangDichVuMgr.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #6
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 Ten = Request["Ten"];
            var Ma = Request["Ma"];
            var MoTa = Request["MoTa"];
            var GhiChu = Request["GhiChu"];
            var NoiDung = Request["NoiDung"];
            var ThaoTac = Request["ThaoTac"];
            var Anh = Request["Anh"];
            var Gia = Request["Gia"];
            var ThoiGian = Request["ThoiGian"];
            var Active = Request["Active"];
            var KhuyenMai = Request["KhuyenMai"];
            var SoLan = Request["SoLan"];

            var DV_ID = Request["DV_ID"];
            var SoLuong = Request["SoLuong"];
            var ThuTu = Request["ThuTu"];
            var HH_ID = Request["HH_ID"];

            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 pg = DichVuDal.ByDmIdUser(string.Empty, false, jgrsidx + " " + jgrsord, q, DM_ID, Security.Username, Convert.ToInt32(jgRows));

                    var listRow = pg.List.Select(item => new jgridRow(item.ID.ToString(), new string[]
                                                                                                               {
                                                                                                                   item.ID.ToString(),item.DM_Ten, item.Ma, item.Ten, item.MoTa,  item.Gia.ToString("###,###,###"), item.Active.ToString()
                                                                                                               })).ToList();
                    var grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, "0", "0", listRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "autoCompleteByQ":
                    #region lấy dữ liệu cho autoCompleteByQ
                    var pgautoCompleteByQ = DichVuDal.ByDmIdUser(string.Empty, false, "DV_NgayTao desc", q, string.Empty, Security.Username, 100);
                    sb.Append(JavaScriptConvert.SerializeObject(pgautoCompleteByQ.List));
                    break;
                    #endregion
                case "getSub":
                    #region lấy dữ liệu cho grid
                    if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "ID";
                    if (string.IsNullOrEmpty(jgrsord)) jgrsord = "asc";

                    var listSub = DichVuChiTietDal.SelectByDvId(DV_ID);

                    var listRowSub = listSub.Select(item => new jgridRow(item.ID.ToString(), new string[]
                                                                                                               {
                                                                                                                   item.ID.ToString(),
                                                                                                                   item.ThuTu.ToString(),
                                                                                                                   item.HH_Ten,
                                                                                                                   item.Gia.ToString("###,###,###"),
                                                                                                                   item.SoLuong.ToString(),
                                                                                                                   item.Tong.ToString("###,###,###"),
                                                                                                                   item.NgayTao.ToString("dd:mm:yyyy")
                                                                                                               })).ToList();
                    var gridSub = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, "0", "0", listRowSub);
                    sb.Append(JavaScriptConvert.SerializeObject(gridSub));
                    break;
                    #endregion
                case "save":
                    #region lưu
                    var itemSave = new DichVu();
                    if (!string.IsNullOrEmpty(ID))
                    {
                        itemSave = DichVuDal.SelectById(new Guid(ID));
                    }
                    else
                    {
                        itemSave.ID = Guid.NewGuid();
                    }
                    if (string.IsNullOrEmpty(Ten))
                    {
                        sb.Append("0");
                        break;
                    }
                    itemSave.Active = Convert.ToBoolean(Active);
                    itemSave.Anh = Anh;
                    if (!string.IsNullOrEmpty(DM_ID))
                    {
                        itemSave.DM_ID = new Guid(DM_ID);
                    }
                    itemSave.SoLan = Convert.ToInt32(SoLan);
                    itemSave.Gia = Convert.ToInt32(Gia);
                    itemSave.KhuyenMai = Convert.ToBoolean(KhuyenMai);
                    itemSave.Ma = Ma;
                    itemSave.MoTa = MoTa;
                    itemSave.NgayCapNhat = DateTime.Now;
                    itemSave.NguoiCapNhat = Security.Username;
                    itemSave.NoiDung = NoiDung;
                    itemSave.Ten = Ten;
                    itemSave.ThaoTac = ThaoTac;
                    itemSave.GhiChu = GhiChu;
                    itemSave.ThoiGian = Convert.ToInt32(ThoiGian);
                    if (!string.IsNullOrEmpty(ID))
                    {
                        itemSave = DichVuDal.Update(itemSave);
                    }
                    else
                    {
                        itemSave.NgayTao = DateTime.Now;
                        itemSave.NguoiTao = Security.Username;
                        itemSave.NgayTao = DateTime.Now;
                        itemSave.NguoiCapNhat = Security.Username;
                        itemSave = DichVuDal.Insert(itemSave);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(DichVuDal.SelectById(new Guid(ID))));
                    }
                    break;
                    #endregion
                case "del":
                    #region xóa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        DichVuDal.DeleteById(new Guid(ID));
                    }
                    break;
                    #endregion
                case "saveSub":
                    #region lưu
                    var itemSub = new DichVuChiTiet();
                    if (!string.IsNullOrEmpty(ID))
                    {
                        itemSub = DichVuChiTietDal.SelectById(new Guid(ID));
                    }
                    else
                    {
                        itemSub.ID = Guid.NewGuid();
                    }
                    if (!string.IsNullOrEmpty(HH_ID))
                    {
                        itemSub.HH_ID = new Guid(HH_ID);
                    }
                    if (!string.IsNullOrEmpty(DV_ID))
                    {
                        itemSub.DV_ID = new Guid(DV_ID);
                    }
                    itemSub.SoLuong = Convert.ToInt32(SoLuong);
                    itemSub.Gia = Convert.ToDouble(Gia);
                    itemSub.NgayCapNhat = DateTime.Now;
                    itemSub.NguoiCapNhat = Security.Username;
                    itemSub.ThuTu = Convert.ToInt32(ThuTu);
                    if (!string.IsNullOrEmpty(ID))
                    {
                        itemSub = DichVuChiTietDal.Update(itemSub);
                    }
                    else
                    {
                        itemSub.NgayTao = DateTime.Now;
                        itemSub.NguoiTao = Security.Username;
                        itemSub.NgayTao = DateTime.Now;
                        itemSub.NguoiCapNhat = Security.Username;
                        itemSub = DichVuChiTietDal.Insert(itemSub);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "editSub":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(DichVuChiTietDal.SelectById(new Guid(ID))));
                    }
                    break;
                    #endregion
                case "delSub":
                    #region xóa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        DichVuChiTietDal.DeleteById(new Guid(ID));
                    }
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "appStore.pmSpa.danhMucDichVuMgr.JScript1.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.pmSpa.danhMucDichVuMgr.JScript1.js")
                        , "{danhMucDichVuMgr.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #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 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);
        }
Beispiel #8
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            #region Tham số
            string _id = Request["ID"];
            string _gh_id = Request["GH_ID"];
            string _chude_id = Request["ChuDe_ID"];
            string _chude_ten = Request["TenChuDe"];
            string _ten = Request["Ten"];
            string _thutu = Request["Thutu"];
            string _mota = Request["Mota"];
            string _anh = Request["UrlImage"];
            string _duyet = Request["Duyet"];
            string _clip = Request["Url"];
            string _cq_id = Request["CQ_ID"];
            string _active = Request["Active"];
            string _q = Request["q"];

            #endregion
            switch (subAct)
            {
                case "getVideo":
                    #region lấy danh sách

                    string _NguoiTao = Security.Username;
                    if (string.IsNullOrEmpty(jgRows)) jgRows = "5";
                    if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "Thutu";
                    if (string.IsNullOrEmpty(jgrsord)) jgrsord = "asc";
                    Pager<VideoClip> PagerGet = VideoClipDal.pagerNormal("", false, jgrsidx + " " + jgrsord, _q, Request["rows"], _gh_id, _chude_id, _active);
                    List<jgridRow> ListRow = new List<jgridRow>();
                    foreach (VideoClip item in PagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[]{
                            item.ID.ToString()
                             ,string.Format(item.Thutu.ToString()==null?"":item.Thutu.ToString())
                            ,string.Format("<img class=\"adm-pro-icon\" src=\"../up/v/{0}\" />", string.IsNullOrEmpty(item.UrlImage) ? "no-image.png" :item.UrlImage)
                            ,string.Format(item.Ten.ToString()==null?"":item.Ten.ToString())
                            ,string.Format(item.Mota.ToString()==null?"":item.Mota.ToString())
                            ,string.Format(item.SoLuotXem.ToString()==null?"":item.SoLuotXem.ToString())
                            ,DanhMucDal.SelectById(item.ChuDe_ID).Ten.ToString()
                            ,item.Ngaytao.ToString("dd/MM/yy")
                            ,item.NguoiTao
                            ,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 "saveVideo":
                    #region lưu dữ liệu
                    VideoClip ItemSave = new VideoClip();
                    if (!string.IsNullOrEmpty(_id))
                    {
                        ItemSave = VideoClipDal.SelectById(Convert.ToInt32(_id));
                    }

                    ItemSave.Ten = _ten;
                    ItemSave.ChuDe_ID = int.Parse(_chude_id);
                    ItemSave.Mota = string.IsNullOrEmpty(_mota) ? "" : _mota;
                    ItemSave.Active = Convert.ToBoolean(_duyet);
                    ItemSave.UrlImage = _anh;
                    ItemSave.Url = _clip;
                    ItemSave.Thutu = Convert.ToInt16(_thutu);
                    ItemSave.Loai = 1;
                    ItemSave.Keyword = "";
                    ItemSave.CateID = 0;

                    // ItemSave.PID = Convert.ToInt32(_PID);

                    if (!string.IsNullOrEmpty(_id))
                    {
                        ItemSave.NguoiTao = Security.Username;
                        ItemSave.Ngaytao = DateTime.Now;
                        ItemSave = VideoClipDal.Update(ItemSave);
                    }
                    else
                    {
                        ItemSave.SoLuotXem = 0;
                        ItemSave.NguoiTao = Security.Username;
                        ItemSave.Ngaytao = DateTime.Now;
                        ItemSave.RowId = Guid.NewGuid();
                        ItemSave = VideoClipDal.Insert(ItemSave);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "delVideo":
                    #region xóa
                    if (!string.IsNullOrEmpty(_id))
                    {
                        char[] step = { ',' };
                        string[] arrID = _id.Split(step);
                        for (int i = 0; i < arrID.Length; i++)
                        {
                            VideoClip o = new VideoClip();
                            o = VideoClipDal.SelectById(Convert.ToInt32(arrID[i]));
                            try
                            {
                                System.IO.File.Delete(Server.MapPath("~/up/v/" + o.UrlImage));
                                System.IO.File.Delete(Server.MapPath("~/up/v/" + o.Url));
                            }
                            catch { }
                            VideoClipDal.DeleteById(Convert.ToInt32(arrID[i]));
                        }
                    }
                    break;
                    #endregion
                case "duyetVideo":
                    #region Duyệt
                    if (!string.IsNullOrEmpty(_id))
                    {
                        char[] step = { ',' };
                        string[] arrID = _id.Split(step);
                        for (int i = 0; i < arrID.Length; i++)
                        {
                            VideoClip o = new VideoClip();
                            o = VideoClipDal.SelectById(Convert.ToInt32(arrID[i]));
                            o.Active = true;
                            VideoClipDal.Update(o);
                        }
                    }
                    break;
                    #endregion
                case "dungVideo":
                    #region Dừng
                    if (!string.IsNullOrEmpty(_id))
                    {
                        char[] step = { ',' };
                        string[] arrID = _id.Split(step);
                        for (int i = 0; i < arrID.Length; i++)
                        {
                            if (arrID[i] != "")
                            {
                                VideoClip o = new VideoClip();
                                o = VideoClipDal.SelectById(Convert.ToInt32(arrID[i]));
                                o.Active = false;
                                VideoClipDal.Update(o);
                            }
                        }
                    }
                    break;
                    #endregion
                case "editVideo":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_id))
                    {
                        sb.Append("(" + JavaScriptConvert.SerializeObject(VideoClipDal.SelectById(Convert.ToInt32(_id))) + ")");
                    }
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.videoClip.qlVideoClip.JScript1.js"));
                    break;
                    #endregion
                default:
                    #region nạp
                    FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                    sb.Append(@"<div class=""mdl-head"">
             <a class=""mdl-head-btn mdl-head-add"" id=""videoMdl-addBtn"" href=""javascript:qlvideoClipfn.addVideo(); "">Thêm</a>
            <a class=""mdl-head-btn mdl-head-edit"" id=""videoMdl-editBtn"" href=""javascript:qlvideoClipfn.editVideo();"">Sửa</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""videoMdl-delBtn"" href=""javascript:qlvideoClipfn.delVideo();"">Xóa</a>
            <a class=""mdl-head-btn mdl-head-active"" id=""videoMdl-actBtn"" href=""javascript:qlvideoClipfn.duyetVideo();"">Duyệt</a>
            <a class=""mdl-head-btn mdl-head-deactive"" id=""videoMdl-edactBtn"" href=""javascript:qlvideoClipfn.dungVideo();"">Dừng</a>
            </div>

            <div id=""VideoClip-qlVC-head"" class=""mdl-head mdl-headTask ui-accordion-header ui-helper-reset ui-state-default ui-widget ui-corner-all"">
            <span>
                <input type=""text"" _value="""" class=""admtxt-da ui-corner-all mdl-head-qlVC-filterChuDe"" /><button class=""admfilter-btn"" tabindex=""-1""></button>
            </span>
            <span>
                <input type=""text"" class=""admtxt-da ui-corner-all mdl-head-search-qlVC-VideoClipmdl"" /><button class=""admSearch-btn"" tabindex=""-1""></button>
            </span>
              </div>
            </div>

            <table id=""videoClipMdl-qlVideoClip-List"" class=""mdl-list""></table>
            <div id=""videoClipmdl-qlVideoClip-Pager""></div>");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                       , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.videoClip.qlVideoClip.JScript1.js")
                       , "{qlvideoClipfn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #9
0
        protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();
            var cs = this.Page.ClientScript;
            #region Variables
            var ID = Request["ID"];
            var Ma = Request["Ma"];
            var Ten = Request["Ten"];
            var Ho = Request["Ho"];
            var XungHo = Request["XungHo"];
            var NgaySinh = Request["NgaySinh"];
            var GioiTinh = Request["GioiTinh"];
            var Email = Request["Email"];
            var Mobile = Request["Mobile"];
            var Phone = Request["Phone"];
            var CMND = Request["CMND"];
            var Ym = Request["Ym"];
            var FacebookUid = Request["FacebookUid"];
            var LinhVuc_ID = Request["LinhVuc_ID"];
            var NguonGoc_ID = Request["NguonGoc_ID"];
            var NguonGoc_ChiTiet_ID = Request["NguonGoc_ChiTiet_ID"];
            var DiaChi = Request["DiaChi"];
            var KhuVuc_ID = Request["KhuVuc_ID"];
            var NgayTao = Request["NgayTao"];
            var NguoiTao = Request["NguoiTao"];
            var NgayCapNhat = Request["NgayCapNhat"];
            var NguoiCapNhat = Request["NguoiCapNhat"];
            var NgungTheoDoi = Request["NgungTheoDoi"];
            var NoiBat = Request["NoiBat"];
            var ChiaSe = Request["ChiaSe"];
            var DanhGia = Request["DanhGia"];
            var KhongNhanEmail = Request["KhongNhanEmail"];
            var KhongDuocGoiDien = Request["KhongDuocGoiDien"];
            var ThoiGianGoiDien = Request["ThoiGianGoiDien"];
            var NguoiGioiThieu = Request["NguoiGioiThieu"];
            var TuVanVien = Request["TuVanVien"];
            var EmailTitle = Request["EmailTitle"];
            var EmailBody = Request["EmailBody"];

            var _q = Request["q"];
            #endregion

            var ListRow = new List<jgridRow>();
            switch (subAct)
            {
                case "get":
                    #region get
                    var pagerGet = KhachHangDal.pagerNormal("", false, "a.KH_" +  jgrsidx + " " + jgrsord, _q, Convert.ToInt32(jgRows), KhuVuc_ID,NguonGoc_ID);
                    foreach (var item in pagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {

                            item.ID.ToString()
                            , item.Ma
                            , item.Ten
                            , item.Mobile
                            , item.Email
                            , item.GioiTinh ? "Nam" : "Nữ"
                            , item.Ym
                            , item.NgaySinh.ToString("dd/MM/yy")
                            , item.KhuVuc_Ten
                            , item.NguonGoc_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 "save":
                    #region chỉnh sửa
                    if (Security.IsAuthenticated())
                    {
                        var item = new KhachHang();
                        if (!string.IsNullOrEmpty(ID))
                        {
                            item = KhachHangDal.SelectById(new Guid(ID));
                        }
                        else
                        {
                            if(string.IsNullOrEmpty(Ma))
                            {
                                Ma = CaptchaImage.GenerateRandomCode(CaptchaType.Numeric, 10);
                            }
                        }
                        item.CMND = CMND;
                        item.DiaChi = DiaChi;
                        item.Email = Email;
                        item.GioiTinh = Convert.ToBoolean(GioiTinh);
                        if (!string.IsNullOrEmpty(KhuVuc_ID))
                        {
                            item.KhuVuc_ID = new Guid(KhuVuc_ID);

                        }
                        item.Ma = Ma;
                        item.Mobile = Mobile;
                        item.NgayCapNhat = DateTime.Now;
                        if (!string.IsNullOrEmpty(NgaySinh))
                        {
                            item.NgaySinh = Convert.ToDateTime(NgaySinh, new CultureInfo("vi-Vn"));
                        }
                        item.NgungTheoDoi = Convert.ToBoolean(NgungTheoDoi);
                        item.NguoiCapNhat = Security.Username;
                        if (!string.IsNullOrEmpty(NguonGoc_ID))
                        {
                            item.NguonGoc_ID = new Guid(NguonGoc_ID);

                        }
                        item.Phone = Phone;
                        item.Ten = Ten;
                        item.Ym = Ym;

                        if(!string.IsNullOrEmpty(LinhVuc_ID))
                        {
                            item.LinhVuc_ID = new Guid(LinhVuc_ID);
                        }
                        if (!string.IsNullOrEmpty(NguoiGioiThieu))
                        {
                            item.NguoiGioiThieu = new Guid(NguoiGioiThieu);
                        }
                        if (!string.IsNullOrEmpty(ID))
                        {
                            item = KhachHangDal.Update(item);
                        }
                        else
                        {
                            item.ID = Guid.NewGuid();
                            item.NgayTao = DateTime.Now;
                            item.NguoiTao = Security.Username;
                            item = KhachHangDal.Insert(item);
                        }
                        sb.Append(item.ID.ToString());
                    }

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

                    }
                    break;
                    #endregion
                case "del":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        KhachHangDal.DeleteById(new Guid(ID));

                    }
                    break;
                    #endregion
                case "sendmail":
                    #region sendmail
                    if (!string.IsNullOrEmpty(ID))
                    {
                        using (var con = DAL.con())
                        {
                            string[] _email = ID.Split(new char[] { ',' });
                            sendEmailDelegate _send = new sendEmailDelegate(sendMail);
                            foreach (var eitem in _email)
                            {
                                if (eitem != "")
                                {
                                    var kh = KhachHangDal.SelectById(new Guid(eitem), con);
                                    if (!string.IsNullOrEmpty(kh.Email))
                                    {
                                        _send.BeginInvoke(kh.Email, string.Format(EmailTitle,kh.Ten,kh.Email), string.Format(EmailBody,kh.Ten,kh.Email), null, null);
                                    }
                                }
                            }
                        }
                    }
                    break;
                    #endregion
                case "search":
                    #region get
                    var pagerSearch = KhachHangDal.pagerNormal("", false, "a.KH_Ten", _q, 20, null, null);
                    sb.Append(JavaScriptConvert.SerializeObject(pagerSearch.List));
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "appStore.pmSpa.khachHangMgr.DanhSachKhachHang.JScript1.js"));
                    break;
                    #endregion
                default:
                    #region default
                    {
                        var ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                        sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "DanhSachKhachHang.mdl.htm"));
                        sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                            , cs.GetWebResourceUrl(typeof(Class1), "appStore.pmSpa.khachHangMgr.DanhSachKhachHang.JScript1.js")
                            , "{DanhSachKhachHangFn.loadgrid();}");
                        sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                        break;
                    }
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #10
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            #region tham so
            string _ID = Request["ID"];
            string _PRowId = Request["PRowId"];
            string _PID = Request["PID"];
            string _Ten = Request["Ten"];
            string _DiaChi = Request["DiaChi"];
            string _CongTy = Request["CongTy"];
            string _Email = Request["Email"];
            string _DienThoai = Request["DienThoai"];
            //string _Phone = Request["Phone"];
            string _Skype = Request["Skype"];
            string _Ym = Request["Ym"];
            string _Website = Request["Website"];
            string _Active = Request["Active"];
            string _RowId = Request["RowId"];
            string _q = Request["q"];
            #endregion

            switch (subAct)
            {

                case "get":
                    #region Get du lieu cho Grid
                    if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "ID";
                    if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc";
                    Pager<LienHe> PagerGet = LienHeDal.pagerNormal("", false, "LH_" + jgrsidx + " " + jgrsord, _q, Request["rows"]);
                    List<jgridRow> ListRow = new List<jgridRow>();
                    foreach (LienHe lh in PagerGet.List)
                    {
                        ListRow.Add(new jgridRow(lh.ID.ToString(),
                            new string[] {
                                lh.ID.ToString()
                               ,lh.Ten
                               ,lh.DiaChi
                               ,lh.CongTy
                               ,lh.Email
                               ,lh.Mobile
                               ,lh.Skype
                               ,lh.Ym
                               ,lh.Website
                               ,lh.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 "edit":
                    #region Sua mau tin
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.Append("(" + JavaScriptConvert.SerializeObject(LienHeDal.SelectById(Convert.ToInt32(_ID))) + ")");
                    }
                    break;
                    #endregion
                case "del":
                    #region xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        //LienHeDal.DeleteByIdList(_ID);
                        LienHeDal.DeleteById(Convert.ToInt32(_ID));
                    }
                    break;
                    #endregion
                case "save":
                          #region luu thong tin
                    LienHe ItemSave = new LienHe();

                    if (string.IsNullOrEmpty(_Ten))
                    {
                        sb.Append("0");
                        break;
                    }
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemSave = LienHeDal.SelectById(Convert.ToInt32(_ID));
                    }
                    ItemSave.Ten = _Ten;
                    ItemSave.DiaChi = _DiaChi;
                    ItemSave.CongTy = _CongTy;
                    ItemSave.Email = _Email;
                    ItemSave.Mobile = _DienThoai;
                    ItemSave.Skype = _Skype;
                    ItemSave.Ym = _Ym;
                    ItemSave.Website = _Website;
                    ItemSave.Active =Convert.ToBoolean(_Active);
                    ItemSave.PRowId = Guid.NewGuid();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemSave.NguoiCapNhat = Security.Username;
                        ItemSave.NgayCapNhat = DateTime.Now;
                        //ItemSave.NgayTao =ItemSave.NgayTao;
                        ItemSave = LienHeDal.Update(ItemSave);
                    }
                    else
                    {
                        ItemSave.NgayTao = DateTime.Now;
                        ItemSave.NgayCapNhat = DateTime.Now;
                        ItemSave.NguoiTao = Security.Username;
                        ItemSave = LienHeDal.Insert(ItemSave);
                    }
                    sb.Append("1");
                    break;
                #endregion
                default:
                    #region Nap
                    FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId); //Kiem tra quyen
                    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-lienhe"" />
            </span>

            <a class=""mdl-head-btn mdl-head-add"" id=""qllienhemdl-addBtn"" href=""javascript:qllienhefn.add();"">Thêm</a>
            <a class=""mdl-head-btn mdl-head-edit"" id=""qllienhemdl-editBtn"" href=""javascript:qllienhefn.edit();"">Sửa</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""qllienhemdl-delBtn"" href=""javascript:qllienhefn.del();"">Xóa</a>
            </div>

            <table id=""lienhemdl-List"" class=""mdl-list""></table>
            <div id=""lienhePager""></div>

            ");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.QuanLyLienHe.JScript1.js")
                        , "{qllienhefn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));

                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #11
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            #region Tham số
            string _ID = Request["ID"];
            string _Duyet = Request["Duyet"];
            string _Khoa = Request["Khoa"];
            string _q = Request["q"];
            List<jgridRow> ListRow = new List<jgridRow>();
            ThanhToan Item;
            string Username = Security.Username;
            bool logged = Security.IsAuthenticated();
            #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<ThanhToan> PagerGet = ThanhToanDal.pagerYeuCau("T_" + jgrsidx + " " + jgrsord, Convert.ToInt32(jgRows));
                    foreach (ThanhToan item in PagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(),
                            new string[] {
                            item.ID.ToString(),
                            item.NguoiYeuCau,
                            item.SoDu.ToString("C",new CultureInfo("vi-Vn")),
                            item.NgayTao.ToString("hh:mm dd/MM/yy")
                            }));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGet.TotalPages.ToString(), PagerGet.Total.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "duyet":
                    #region duyet
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        using (SqlConnection con = DAL.con())
                        {
                            con.Open();
                            SqlTransaction tran = con.BeginTransaction();
                            try
                            {
                                bool Khoa = Convert.ToBoolean(_Khoa);
                                double total;
                                TaiKhoan tkItem;
                                foreach (string item in _ID.Split(new char[] { ',' }))
                                {
                                    if (item.Length > 0)
                                    {
                                        total = 0;
                                        Item = ThanhToanDal.SelectById(Convert.ToInt32(item), tran);
                                        tkItem = TaiKhoanDal.SelectByUsername(Item.NguoiYeuCau, tran);
                                        if (!string.IsNullOrEmpty(tkItem.Tk))
                                        {
                                            total = Convert.ToDouble(maHoa.DecryptString(tkItem.Tk, tkItem.Username));
                                        }
                                        if (Khoa)
                                        {
                                            if (!Item.Duyet)
                                            {
                                                total = total - Convert.ToDouble(Item.SoDu);
                                            }
                                        }
                                        ThanhToanDal.Duyet(item, _Khoa, tran);
                                        TaiKhoanDal.UpdateTk(tkItem.ID, maHoa.EncryptString(total.ToString(), Item.NguoiYeuCau), tran);
                                    }

                                }
                                tran.Commit();
                            }
                            catch (Exception ex)
                            {
                                tran.Rollback();
                                sb.Append(ex.ToString());
                            }
                            finally
                            {
                                con.Close();
                            }
                        }
                    }
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "seo.plugin.thanhToanMgr.yeuCau.JScript1.js"));
                    break;
                    #endregion
                default:
                    #region nạp
                    FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                    if (!logged)
                    {
                        renderText("un-authorized", "text/plain");
                    }

                    sb.Append(@"
            <div class=""mdl-head"">
            <a class=""mdl-head-btn mdl-head-del"" id=""ThanhToanMgryeuCau-yeuCauBtn"" href=""javascript:;"" onclick=""ThanhToanMgryeuCauFn.duyet(true);"">Duyệt</a>
            </div>
            <table id=""ThanhToanMgryeuCau-List"" class=""mdl-list""></table>
            <div id=""ThanhToanMgryeuCau-Pager""></div>
            ");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "seo.plugin.thanhToanMgr.yeuCau.JScript1.js")
                        , "{ThanhToanMgryeuCauFn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #12
0
        protected override void Render(HtmlTextWriter writer)
        {
            #region biến
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            string _ID = Request["ID"];
            string _F_ID = Request["F_ID"];
            string _Lang = Request["Lang"];
            string _Alias = Request["Alias"];
            string _LangBased_ID = Request["LangBased_ID"];
            string _LangBased = Request["LangBased"];
            string _KeyWords = Request["KeyWords"];
            string _Description = Request["Description"];
            string _PID = Request["DMID"];
            string _PTen = Request["DMTen"];
            string _Ten = Request["Ten"];
            string _Mota = Request["Mota"];
            string _NoiDung_tt = Request["NoiDung_tt"];
            string _ThuTu = Request["ThuTu"];
            string _Anh = Request["Anh"];
            string _Hot = Request["Hot"];
            string _q = Request["q"];
            string _HetHan = Request["HetHan"];
            string _NgayHetHan = Request["NgayHetHan"];
            string _NgayCapNhat = Request["NgayCapNhat"];
            string _Status = Request["Status"];
            string _Nguon = Request["Nguon"];
            List<jgridRow> ListRow;
            #endregion
            switch (subAct)
            {
                case "get":
                    #region lấy danh sách
                    if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "TIN_NgayCapNhat";
                    if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc";
                    string _NguoiTao = Security.Username;
                    var admin = false;

                    var pagerGet = TinDal.PagerQuanTri(string.Empty, false, Convert.ToInt32(jgRows), jgrsidx + " " + jgrsord, _PID, _q, false, Security.Username, true, false);

                    ListRow = new List<jgridRow>();
                    foreach (Tin item in pagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                            item.ID.ToString()
                            ,item.LangBased.ToString()
                            ,item._ID.ToString()
                            ,item.Lang
                            ,item.ThuTu.ToString()
                            ,string.Format("<img src=\"../up/tintuc/{0}?ref=\" style=\"width:50px;height:50px; \"/>",item.Anh, Guid.NewGuid())
                            , string.Format(@"<a target=""_blanks"" href=""{0}/lib/pages/?pages=Tin-tuc-view&TIN-ID={1}"">{2}</a>",domain,item.ID,item.Ten)
                            ,item.MoTa
                            ,item.DM_Ten
                            ,item.Views.ToString()
                            ,item.NguoiTao
                            ,item.NgayTao.ToString("HH:mm dd/MM/yyyy")
                            ,item.Active.ToString()
                            ,item.Hot.ToString()
                            ,item.HetHan.ToString()
                        }));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, pagerGet.TotalPages.ToString(), pagerGet.Total.ToString(), ListRow);
                    //jgrid grid = new jgrid("1", "1", pager.Total.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(TinDal.SelectByIdView(_ID)));
                    }
                    break;
                    #endregion
                case "del":
                    #region Xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        TinDal.DeleteMultiById(_ID, "TIN_TUC");
                    }
                    break;
                    #endregion
                case "duyet":
                    #region Duyệt tin hàng loạt
                    var itemDuyet = new Tin();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        itemDuyet.multiID = _ID;
                        itemDuyet.Active = Convert.ToBoolean(_Status);
                        TinDal.UpdateMulti(itemDuyet);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "yeuCauDuyet":
                    #region Duyệt tin hàng loạt
                    var itemyeuCauDuyet = new Tin();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        itemyeuCauDuyet.multiID = _ID;
                        itemyeuCauDuyet.Publish = Convert.ToBoolean(_Status);
                        TinDal.UpdateMultiYeuCauDuyet(itemyeuCauDuyet);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "hot":
                    #region Chuyển thành tin hot
                    Tin ItemHot = new Tin();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemHot.multiID = _ID;
                        ItemHot.Hot = Convert.ToBoolean(_Status);
                        TinDal.UpdateHotMulti(ItemHot);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "hethan":
                    #region Hết hạn
                    Tin ItemHetHan = new Tin();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemHetHan.multiID = _ID;
                        ItemHetHan.HetHan = Convert.ToBoolean(_Status);
                        if (ItemHetHan.HetHan == true)
                        {
                            ItemHetHan.NgayHetHan = DateTime.Now;
                        }
                        TinDal.UpdateHetHanMulti(ItemHetHan);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "save":
                    #region lưu
                    var itemSave = new Tin();
                    if (string.IsNullOrEmpty(_Ten))
                    {
                        sb.Append("0");
                        break;
                    }
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        itemSave = TinDal.SelectById(_ID);
                    }
                    if (!string.IsNullOrEmpty(_Nguon))
                    {
                        itemSave.Nguon = (_Nguon);
                    }
                    itemSave.Ten = _Ten;
                    itemSave.DM_ID = new Guid(_PID);
                    // ItemSave.DM_Ten = _PTen;
                    itemSave.Anh = _Anh;
                    if (string.IsNullOrEmpty(_ThuTu))
                    {
                        _ThuTu = "0";
                    }
                    var oldNoiDung = itemSave.NoiDung;
                    itemSave.ThuTu = Convert.ToInt32(_ThuTu);
                    itemSave.MoTa = _Mota;
                    itemSave.NoiDung = _NoiDung_tt;
                    itemSave.KeyWords = _KeyWords;
                    itemSave.Description = _Description;
                    itemSave.Alias = _Alias;
                    //itemSave.Lang = _Lang;
                    itemSave.LangBased = Convert.ToBoolean(_LangBased);
                    if (!string.IsNullOrEmpty(_LangBased_ID))
                    {
                        itemSave.LangBased_ID = new Guid(_LangBased_ID);
                    }
                    itemSave.Hot = Convert.ToBoolean(_Hot);
                    itemSave.NgayCapNhat = DateTime.Now;
                    if (_Public == "1")
                    {
                        itemSave.NgayDang = DateTime.Now;
                    }
                    itemSave.NguoiCapNhat = Security.Username;
                    itemSave.HetHan = Convert.ToBoolean(_HetHan);
                    //if (!string.IsNullOrEmpty(_NgayHetHan))
                    //{
                    //    itemSave.NgayHetHan = Convert.ToDateTime(_NgayHetHan, new CultureInfo("vi-Vn"));
                    //}
                    //if (!string.IsNullOrEmpty(_NgayCapNhat))
                    //{
                    //    itemSave.NgayCapNhat = Convert.ToDateTime(_NgayCapNhat, new CultureInfo("vi-Vn"));//.AddHours(dt.Hour).AddMinutes(dt.Minute).AddSeconds(dt.Second);
                    //}

                    var dele = new sendEmailDele(sendmailThongbao);
                        var emailTemp = Lib.GetResource(Assembly.GetExecutingAssembly(), "CongTacVien.DaDuyet.email-post-new.htm");
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        dele.BeginInvoke("*****@*****.**", "Cangtin Update Post - " + Security.Username
                                         ,
                                         string.Format(emailTemp, Security.Username, Request.UserHostAddress,
                                                       DateTime.Now.ToString("HH:mm dd/MM/yyyy")
                                                       , itemSave.Ten, string.Format(@"
            <table width=""100%"" border=""1"">
            <tr>
            <td style=""width: 50%;"" valign=""top"">
            <h1>Cũ</h1><hr/>{0}
            </td>
            <td valign=""top"">
            <h1>Mới</h1><hr/>{1}
            </td>
            </tr>
            </table>", oldNoiDung, itemSave.NoiDung), itemSave.ID, domain)
                                         , null, null);
                        itemSave = TinDal.Update(itemSave);
                    }
                    else
                    {
                        itemSave.NguoiTao = Security.Username;
                        itemSave.NgayTao = DateTime.Now;
                        itemSave.RowId = Guid.NewGuid();
                        itemSave.ID = Guid.NewGuid();

                        dele.BeginInvoke("*****@*****.**", "Cangtin New Post - " + Security.Username
                                         ,
                                         string.Format(emailTemp, Security.Username, Request.UserHostAddress,
                                                       DateTime.Now.ToString("HH:mm dd/MM/yyyy")
                                                       , itemSave.Ten, itemSave.NoiDung, itemSave.ID, domain)
                                         , null, null);
                        itemSave = TinDal.Insert(itemSave);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "projectMgr.plugin.backend.tinTuc.CongTacVien.DangChoDuyet.JScript1.js"));
                    break;
                    #endregion
                default:
                    #region nạp
                    FunctionCollection listFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                    sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "CongTacVien.DangChoDuyet.mdl.htm"));
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "projectMgr.plugin.backend.tinTuc.CongTacVien.DangChoDuyet.JScript1.js")
                        , "{tinCongTacVienDangChoDuyetfn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #13
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 "autoCompleteLangBasedNoChild":
                    #region xóa

                    var list1 = DanhMucDal.SelectByLDMMa(_LDM_Ma);
                    var list2 = from p in list1
                                where p.PID==Guid.Empty
                                select p;
                    sb.Append(JavaScriptConvert.SerializeObject(getTree(list2.ToList())));
                    break;
                    #endregion
                case "autoCompleteByPid":
                    #region xóa
                    sb.Append(JavaScriptConvert.SerializeObject(DanhMucDal.SelectByPid(_ID)));
                    break;
                    #endregion
                case "autoCompleteLdmMa":
                    #region xóa
                    sb.Append(JavaScriptConvert.SerializeObject(getTree(DanhMucDal.SelectByLDMMa(_LDM_Ma))));
                    break;
                    #endregion
                case "autoCompleteLangBasedByDM":
                    #region xóa
                    sb.Append(JavaScriptConvert.SerializeObject(getTree(DanhMucDal.SelectTreeByDmMa(DAL.con(), _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);
        }
Beispiel #14
0
        protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();
            var cs = this.Page.ClientScript;
            #region Variables
            var ID = Request["ID"];
            var KM_ID = Request["KM_ID"];
            var Ma = Request["Ma"];
            var KH_ID = Request["KH_ID"];
            var DVTC_ID = Request["DVTC_ID"];
            var GiaNY = Request["GiaNY"];
            var Gia = Request["Gia"];
            var HanSuDung = Request["HanSuDung"];
            var HanDoiThe = Request["HanDoiThe"];
            var TinhTrang = Request["TinhTrang"];
            var DV_ID = Request["DV_ID"];
            var NgayPhatHanh = Request["NgayPhatHanh"];
            var NgayNhan = Request["NgayNhan"];
            var NguoiNhan = Request["NguoiNhan"];
            var NgayTao = Request["NgayTao"];
            var NgayCapNhat = Request["NgayCapNhat"];
            var NguoiTao = Request["NguoiTao"];
            var NguoiCapNhat = Request["NguoiCapNhat"];
            var DaDung = Request["DaDung"];

            var EmailTitle = Request["EmailTitle"];
            var EmailBody = Request["EmailBody"];

            var _q = Request["q"];
            #endregion

            var ListRow = new List<jgridRow>();
            switch (subAct)
            {
                case "get":
                    #region get

                    var pagerGet = TheKhuyenMaiDal.pagerAll("a.TKM_" + jgrsidx + " " + jgrsord, _q,
                                                            Convert.ToInt32(jgRows), KM_ID, DVTC_ID, DV_ID, TinhTrang, DaDung);
                    foreach (var item in pagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {

                            item.ID.ToString()
                            , item.DVTC_Ten
                            , item.KM_Ten
                            , item.Ma
                            , Lib.TienVietNam(item.Gia)
                            , Lib.TienVietNam(item.GiaNY)
                            , item.KH_Ten
                            , item.DV_Ten
                            , item.NgayPhatHanh== DateTime.MinValue ? "" : item.NgayPhatHanh.ToString("dd/MM/yyyy")
                            , item.HanSuDung== DateTime.MinValue ? "" : item.HanSuDung.ToString("dd/MM/yyyy")
                            , item.HanDoiThe== DateTime.MinValue ? "" : item.HanDoiThe.ToString("dd/MM/yyyy")
                            , item.TinhTrang.ToString()
                            , item.DaDung.ToString()
                            , 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 "save":
                    #region chỉnh sửa
                    if (Security.IsAuthenticated())
                    {
                        var item = new TheKhuyenMai();
                        if (!string.IsNullOrEmpty(ID))
                        {
                            item = TheKhuyenMaiDal.SelectById(new Guid(ID));
                        }

                        if (!string.IsNullOrEmpty(DVTC_ID))
                        {
                            item.DVTC_ID = new Guid(DVTC_ID);
                        }
                        if (!string.IsNullOrEmpty(DV_ID))
                        {
                            item.DV_ID = new Guid(DV_ID);
                        }
                        item.Gia = Convert.ToDouble(Gia);
                        item.GiaNY = Convert.ToDouble(GiaNY);
                        if (!string.IsNullOrEmpty(HanDoiThe))
                        {
                            item.HanDoiThe = Convert.ToDateTime(HanDoiThe, new CultureInfo("vi-Vn"));
                        }
                        if (!string.IsNullOrEmpty(HanSuDung))
                        {
                            item.HanSuDung = Convert.ToDateTime(HanSuDung, new CultureInfo("vi-Vn"));
                        }
                        if (!string.IsNullOrEmpty(KH_ID))
                        {
                            item.KH_ID = new Guid(KH_ID);
                        }
                        if (!string.IsNullOrEmpty(KM_ID))
                        {
                            item.KM_ID = new Guid(KM_ID);
                        }
                        item.Ma = Ma;
                        if (!string.IsNullOrEmpty(NgayNhan))
                        {
                            item.NgayNhan = Convert.ToDateTime(NgayNhan, new CultureInfo("vi-Vn"));
                        }
                        if (!string.IsNullOrEmpty(NgayPhatHanh))
                        {
                            item.NgayPhatHanh = Convert.ToDateTime(NgayPhatHanh, new CultureInfo("vi-Vn"));
                        }
                        item.NgayCapNhat = DateTime.Now;
                        item.NguoiCapNhat = Security.Username;
                        item.NguoiNhan = NguoiNhan;
                        item.TinhTrang = Convert.ToBoolean(TinhTrang);
                        if (!string.IsNullOrEmpty(ID))
                        {
                            item = TheKhuyenMaiDal.Update(item);
                        }
                        else
                        {
                            item.ID = Guid.NewGuid();
                            item.NgayTao = DateTime.Now;
                            item.NguoiTao = Security.Username;
                            item = TheKhuyenMaiDal.Insert(item);
                        }
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(item));
                    }

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

                    }
                    break;
                    #endregion
                case "del":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        TheKhuyenMaiDal.DeleteById(new Guid(ID));

                    }
                    break;
                    #endregion
                case "sendmail":
                    #region sendmail
                    if (!string.IsNullOrEmpty(ID))
                    {
                        using (var con = DAL.con())
                        {
                            string[] _email = ID.Split(new char[] { ',' });
                            sendEmailDelegate _send = new sendEmailDelegate(sendMail);
                            foreach (var eitem in _email)
                            {
                                if (eitem != "")
                                {
                                    var kh = KhachHangDal.SelectById(new Guid(eitem), con);
                                    if (!string.IsNullOrEmpty(kh.Email))
                                    {
                                        _send.BeginInvoke(kh.Email, string.Format(EmailTitle,kh.Ten,kh.Email), string.Format(EmailBody,kh.Ten,kh.Email), null, null);
                                    }
                                }
                            }
                        }
                    }
                    break;
                    #endregion
                case "search":
                    #region get
                    var pagerSearch = TheKhuyenMaiDal.pagerNormal("", false, "a.KH_Ten", _q, 20);
                    sb.Append(JavaScriptConvert.SerializeObject(pagerSearch.List));
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "appStore.pmSpa.theKhuyenMaiMgr.quanLyThe.JScript1.js"));
                    break;
                    #endregion
                default:
                    #region default
                    {
                        var ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                        sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "quanLyThe.mdl.htm"));
                        sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                            , cs.GetWebResourceUrl(typeof(Class1), "appStore.pmSpa.theKhuyenMaiMgr.quanLyThe.JScript1.js")
                            , "{quanLyTheFn.loadgrid();}");
                        sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                        break;
                    }
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #15
0
        protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();
            var cs = this.Page.ClientScript;
            var c = HttpContext.Current;
            #region Variables
            var ID = c.Request["ID"];
            var Ten = c.Request["Ten"];
            var DiaChi = c.Request["DiaChi"];
            var Ma = c.Request["Ma"];
            var KV_ID = c.Request["KV_ID"];
            var HH_ID = c.Request["HH_ID"];
            if(!Security.IsAuthenticated())
            {
                Response.Clear();
                Response.End();
            }
            var _q = c.Request["q"];
            #endregion

            var listRow = new List<jgridRow>();
            switch (subAct)
            {
                case "get":
                    #region get
                    var pagerGet = KhoHangDal.pagerNormal("", false, "KH_" + jgrsidx + " " + jgrsord, _q, Convert.ToInt32(jgRows));
                    foreach (var item in pagerGet.List)
                    {
                        listRow.Add(new jgridRow(item.ID.ToString(), new string[] {

                            item.ID.ToString()
                            , item.Ma
                            , item.Ten
                            , item.DiaChi
                            , item.KV_Ten
                        }));
                    }
                    jgrid gridSPAdm = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage
                        , pagerGet.TotalPages.ToString()
                        , pagerGet.Total.ToString()
                        , listRow);
                    sb.Append(JavaScriptConvert.SerializeObject(gridSPAdm));
                    break;
                #endregion
                case "search":
                    #region search
                    var pagerGetSearch = KhoHangDal.pagerNormal("", false, "KH_Ten", _q, 20);
                    sb.Append(JavaScriptConvert.SerializeObject(pagerGetSearch.List));
                    break;
                    #endregion
                case "searchByHangHoa":
                    #region search
                    var pagerGetSearchByHangHoa = KhoHangDal.SelectByHangHoa(HH_ID);
                    sb.Append(JavaScriptConvert.SerializeObject(pagerGetSearchByHangHoa));
                    break;
                    #endregion
                case "save":
                    #region chỉnh sửa
                    if (Security.IsAuthenticated())
                    {
                        var item = new KhoHang();
                        if (!string.IsNullOrEmpty(ID))
                        {
                            item = KhoHangDal.SelectById(new Guid(ID));
                        }
                        item.Ma = Ma;
                        item.DiaChi = DiaChi;
                        item.Ten = Ten;
                        if(!string.IsNullOrEmpty(KV_ID))
                        {
                            item.KV_ID = new Guid(KV_ID);
                        }
                        if (!string.IsNullOrEmpty(ID))
                        {
                            item = KhoHangDal.Update(item);
                        }
                        else
                        {
                            item.ID = Guid.NewGuid();
                            item = KhoHangDal.Insert(item);
                        }
                        sb.Append("1");
                    }
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(KhoHangDal.SelectById(new Guid(ID))));

                    }
                    break;
                    #endregion
                case "del":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        KhoHangDal.DeleteById(new Guid(ID));
                    }
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "appStore.pmSpa.khoHangMgr.JScript1.js"));
                    break;
                    #endregion
                default:
                    #region default
                    {
                        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.pmSpa.khoHangMgr.JScript1.js")
                            , "{KhoHangMgrFn.loadgrid();}");
                        sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                        break;
                    }
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #16
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 _DM_ID = Request["DM_ID"];
            string _ThuTu = Request["ThuTu"];
            string _Active = Request["Active"];
            string _Hot = Request["Hot"];
            string _Hot1 = Request["Hot1"];
            string _Hot2 = Request["Hot2"];
            string _Hot3 = Request["Hot3"];
            Nhom ItemSave;
            List<jgridRow> ListRow = new List<jgridRow>();
            #endregion

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

                    List<Nhom> List = NhomDal.SelectAll();
                    ListRow = new List<jgridRow>();
                    foreach (Nhom dm in List)
                    {
                        ListRow.Add(new jgridRow(dm.ID.ToString(), new string[] {
                              dm.ID.ToString()
                            , dm._DanhMuc.Ten
                            , dm.Ten
                            , dm.ThuTu.ToString()
                            , dm.Active.ToString()
                            , dm.Hot.ToString()
                            , dm.Hot1.ToString()
                            , dm.Hot2.ToString()
                            , dm.Hot3.ToString()
                        }));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, List.Count.ToString(), List.Count.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "del":
                    #region xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        NhomDal.DeleteById(Convert.ToInt32(_ID));
                    }
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.Append("(" + JavaScriptConvert.SerializeObject(NhomDal.SelectById(Convert.ToInt32(_ID))) + ")");
                    }
                    break;
                    #endregion
                case "save":
                    #region lưu
                    ItemSave = new Nhom();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemSave = NhomDal.SelectById(Convert.ToInt32(_ID));
                    }
                    else
                    {
                        ItemSave = new Nhom();
                    }
                    ItemSave.Ten = _Ten;
                    ItemSave.ThuTu = Convert.ToInt32(_ThuTu);
                    ItemSave.Active = Convert.ToBoolean(_Active);
                    ItemSave.Hot = Convert.ToBoolean(_Hot);
                    ItemSave.Hot1 = Convert.ToBoolean(_Hot1);
                    ItemSave.Hot2 = Convert.ToBoolean(_Hot2);
                    ItemSave.Hot3 = Convert.ToBoolean(_Hot3);
                    if (!string.IsNullOrEmpty(_DM_ID))
                    {
                        ItemSave.DM_ID = Convert.ToInt32(_DM_ID);
                    }
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemSave = NhomDal.Update(ItemSave);
                    }
                    else
                    {
                        ItemSave = NhomDal.Insert(ItemSave);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "getautoComplete":
                    #region Lấy danh sách danh mục
                    sb.Append(JavaScriptConvert.SerializeObject(NhomDal.SelectAll()));
                    break;
                    #endregion
                case "getSubTin":
                    #region getSubTin: Lấy tin theo topic
                    NhomTinCollection List1 = NhomTinDal.SelectByNhomId(_ID);
                    foreach (NhomTin dm in List1)
                    {
                        ListRow.Add(new jgridRow(dm.ID.ToString(), new string[] {
                             string.Format("{0}",dm.ID)
                            , string.Format("<img src=\"http://tintuc.me/lib/up/{0}\" />", linh.common.Lib.imgSize(dm._Tin.Anh,"100x100"))
                            , dm._Tin.Ten
                            , dm._Tin.MoTa
                            , dm._Tin.Url
                            , dm._Tin.NgayTao.ToString("hh:mm - dd/MM/yyyy")
                        }));
                    }
                    grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, List1.Count.ToString(), List1.Count.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "addSubTin":
                    #region addSubTin: Thêm tin vào topic
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        NhomTinDal.Insert(new NhomTin(null
                            , Convert.ToInt32(_ID)
                            , Convert.ToInt32(Request["N_ID"])
                            ));
                    }
                    break;
                    #endregion
                case "delSubTin":
                    #region delSubTin:Xóa bỏ tin
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        NhomTinDal.DeleteTinListByNid(_ID, Request["IDs"]);
                    }
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "plugin.rss.nhom.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-nhomMdl"" />
            </span>
            <a class=""mdl-head-btn mdl-head-add"" id=""nhomMdl-addBtn"" href=""javascript:nhomFn.add();"">Thêm</a>
            <a class=""mdl-head-btn mdl-head-edit"" id=""nhomMdl-editBtn"" href=""javascript:nhomFn.edit();"">Sửa</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""nhomMdl-delBtn"" href=""javascript:nhomFn.del();"">Xóa</a>
            </div>
            <table id=""nhomMdl-List"" class=""mdl-list""></table>
            <div id=""nhomMdl-Pager""></div>

            <div class=""sub-mdl"">
            <ul>
            <li><a id=""nhomMdl-subTinMdl-Btn"" href=""#nhomMdl-subTinMdl-Box"">Tin</a></li>
            </ul>
            <div>
            <div class=""mdl-submdl-panel"" id=""nhomMdl-subTinMdl-Box"">
            <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-subTinMdl-nhomMdl"" />
            </span>
            <a class=""mdl-head-btn mdl-head-del"" id=""nhomMdl-subTinMdl-delBtn"" href=""javascript:nhomFn.delSubTin();"">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-nhomMdlSearchTin""/>
            </span>
            <a class=""mdl-head-btn mdl-head-del"" id=""nhomMdl-subTinMdl-addBtn"" _id="""" href=""javascript:;"">Thêm</a>
            </div>
            <table id=""nhomMdl-subTinMdl-List"" class=""mdl-list""></table>
            <div  id=""nhomMdl-subTinMdl-Pager""></div>
            </div>
            </div>
            </div>
            ");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "plugin.rss.nhom.JScript1.js")
                        , "{nhomFn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #17
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            #region Tham số
            string _ID = Request["ID"];
            string _LangBased = Request["LangBased"];
            string _LangBased_ID = Request["LangBased_ID"];
            string _DM_ID = Request["DM_ID"];
            string _Ten = Request["Ten"];
            string _Ma = Request["Ma"];
            string _Alias = Request["Alias"];
            string _Lang = Request["Lang"];
            string _XuatXu_ID = Request["XuatXu_ID"];
            string _DonVi_ID = Request["DonVi_ID"];
            string _SoLuong = Request["SoLuong"];
            string _GNY = Request["GNY"];
            string _GiaNhap = Request["GiaNhap"];
            string _KeyWords = Request["KeyWords"];
            string _Description = Request["Description"];
            string _MoTa = Request["MoTa"];
            string _Anh = Request["Anh"];
            string _NoiDung = Request["NoiDung"];
            string _Active = Request["Active"];
            string _Publish = Request["Publish"];
            string _Hot = Request["Hot"];
            string _Hot1 = Request["Hot1"];
            string _Hot2 = Request["Hot2"];
            string _Hot3 = Request["Hot3"];
            string _Hot4 = Request["Hot4"];
            string _q = Request["q"];
            HangHoa Item;
            List<HangHoa> List = new List<HangHoa>();
            List<jgridRow> ListRow = new List<jgridRow>();
            #endregion

            switch (subAct)
            {
                case "get":
                    #region lấy dữ liệu cho grid
                    Pager<HangHoa> PagerGet = HangHoaDal.pagerLangBased("HH_" + jgrsidx + " " + jgrsord, Convert.ToInt32(jgRows));
                    foreach (HangHoa item in PagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                              item.ID.ToString()
                            , item.LangBased.ToString()
                            , item.Lang
                            , string.Format(@"<img src=""../up/i/{0}"" />",Lib.imgSize(item.Anh,"50x50"))
                            , item._DM_Ten
                            , item.Ma
                            , item.Ten
                            , item.GNY.ToString("###.###")
                            , string.Format("{0:dd/MM/yy}",item.NgayCapNhat)
                        }));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage
                        , List.Count.ToString()
                        , List.Count.ToString()
                        , ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "del":
                    #region xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        HangHoaDal.DeleteById(Convert.ToInt32(_ID));
                    }
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(HangHoaDal.SelectByIdHoangDa(Convert.ToInt32(_ID))));
                    }
                    break;
                    #endregion
                case "save":
                    #region lưu
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        Item = HangHoaDal.SelectByIdHoangDa(Convert.ToInt32(_ID));
                    }
                    else
                    {
                        Item = new HangHoa();
                    }
                    Item.LangBased = Convert.ToBoolean(_LangBased);
                    if (!string.IsNullOrEmpty(_LangBased_ID))
                    {
                        Item.LangBased_ID = Convert.ToInt32(_LangBased_ID);
                    }
                    if (!string.IsNullOrEmpty(_DM_ID))
                    {
                        Item.DM_ID = Convert.ToInt32(_DM_ID);
                    }
                    Item.Ten = _Ten;
                    Item.Ma = _Ma;
                    Item.Alias = _Alias;
                    Item.Lang = _Lang;
                    if (!string.IsNullOrEmpty(_XuatXu_ID))
                    {
                        Item.XuatXu_ID = Convert.ToInt32(_XuatXu_ID);
                    }
                    if (!string.IsNullOrEmpty(_DonVi_ID))
                    {
                        Item.DonVi_ID = Convert.ToInt32(_DonVi_ID);
                    }
                    if (!string.IsNullOrEmpty(_SoLuong))
                    {
                        Item.GiaNhap = Convert.ToDouble(_GiaNhap);
                    }
                    Item.Keywords = _KeyWords;
                    Item.Description = _Description;
                    Item.Anh = _Anh;
                    Item.NoiDung = _NoiDung;
                    Item.Active = Convert.ToBoolean(_Active);
                    Item.Publish = Convert.ToBoolean(_Publish);
                    Item.Hot1 = Convert.ToBoolean(_Hot1);
                    Item.Hot2 = Convert.ToBoolean(_Hot2);
                    Item.Hot3 = Convert.ToBoolean(_Hot3);
                    Item.Hot4 = Convert.ToBoolean(_Hot4);
                    Item.NgayCapNhat = DateTime.Now;
                    Item.NguoiCapNhat = Security.Username;
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        Item = HangHoaDal.Update(Item);
                    }
                    else
                    {
                        Item.NgayTao = DateTime.Now;
                        Item.RowId = Guid.NewGuid();
                        Item.NguoiTao = Security.Username;
                        Item = HangHoaDal.Insert(Item);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "autoCompleteLangBased":
                    #region Lấy danh sách danh mục
                    //Item = new hangHoa();
                    //Item.ID = 0;
                    //Item.Ten = "Chọn";
                    //List = getTree(HangHoaDal.SelectLangBased(_ID));
                    //List.Insert(0, Item);
                    //sb.Append(JavaScriptConvert.SerializeObject(List));
                    break;
                    #endregion
                case "getByLangBasedId":
                    #region getByLangBasedId: Lấy danh sách các ngôn ngữ khác theo ngôn ngữ gốc

                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.QuanLySanPham.User.UserSPMoi.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-UserSanPhamMoiFn"" />
            </span>
            <a class=""mdl-head-btn mdl-head-add"" id=""UserSanPhamMoiFnMdl-addBtn"" href=""javascript:"" onclick=""UserSanPhamMoiFn.add();"">Thêm</a>
            <a class=""mdl-head-btn mdl-head-add"" id=""UserSanPhamMoiFnMdl-addBtn"" href=""javascript:"" onclick=""UserSanPhamMoiFn.addLang();"" >Thêm ngôn ngứ phụ</a>
            <a class=""mdl-head-btn mdl-head-edit"" id=""UserSanPhamMoiFnMdl-editBtn"" href=""javascript:"" onclick=""UserSanPhamMoiFn.edit();"">Sửa</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""UserSanPhamMoiFnMdl-delBtn"" href=""javascript:"" onclick=""UserSanPhamMoiFn.del();"" >Xóa</a>
            <select class=""slt"" onchange=""UserSanPhamMoiFn.search();"" id=""UserSanPhamMoiFnMdl-changeLangSlt""></select>
            <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-filterDanhMucUserSanPhamMoiFn""/>
            </span>
            </div>

            <table id=""UserSanPhamMoiFnMdl-List"" class=""mdl-list""></table>
            <div id=""UserSanPhamMoiFnMdl-Pager""></div>
            <div class=""sub-mdl-list"" id=""UserSanPhamMoiFnMdl-subMdl"">
            <ul>
            <li><a href=""#UserSanPhamMoiFnMdl-subLangMdl"">Ngôn ngữ</a></li>
            <li><a href=""#UserSanPhamMoiFnMdl-subNhomMdl"">Nhóm</a></li>
            <li><a href=""#UserSanPhamMoiFnMdl-subAnhMdl"">Ảnh</a></li>
            </ul>
            <div  id=""UserSanPhamMoiFnMdl-subLangMdl"" class=""sub-mdl-list-item"">
            <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-tinMdl-subTinNhomMdl"" />
            </span>
            </div>
            <table id=""UserSanPhamMoiFnMdl-subLangMdl-List"" class=""mdl-list""></table>
            </div>
            <div id=""UserSanPhamMoiFnMdl-subNhomMdl"" class=""sub-mdl-list-item"">
            <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-tinMdl-subTinTopicMdl"" />
            </span>
            </div>
            <table id=""UserSanPhamMoiFnMdl-subNhomMdl-List"" class=""mdl-list""></table>
            </div>
            <div id=""UserSanPhamMoiFnMdl-subAnhMdl"" class=""sub-mdl-list-item"">
            <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-tinMdl-subTinBinhLuanMdl"" />
            </span>
            </div>
            <table id=""UserSanPhamMoiFnMdl-subAnhMdl-List"" class=""mdl-list""></table>
            </div>
            </div>
            ");
                    sb.AppendFormat(@"<script>$.getScript('{0}', function () { 1 });</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.QuanLySanPham.User.UserSPMoi.JScript1.js")
                        , "{UserSanPhamMoiFn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #18
0
        protected override void Render(HtmlTextWriter writer)
        {
            #region biến
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            string _ID = Request["ID"];
            string _F_ID = Request["F_ID"];
            string _Lang = Request["Lang"];
            string _Alias = Request["Alias"];
            string _LangBased_ID = Request["LangBased_ID"];
            string _LangBased = Request["LangBased"];
            string _KeyWords = Request["KeyWords"];
            string _Description = Request["Description"];
            string _PID = Request["DMIDvb_ktnn"];
            string _PTen = Request["DMTen"];
            string _Ten = Request["Ten"];
            string _Mota = Request["Mota"];
            string _NoiDungvb_ktnn = Request["NoiDungvb_ktnn"];
            string _ThuTu = Request["ThuTu"];
            string _Anh = Request["Anh"];
            string _Hot = Request["Hot"];
            string _q = Request["q"];
            string _HetHan = Request["HetHan"];
            string _NgayHetHan = Request["NgayHetHan"];
            string _NgayCapNhat = Request["NgayCapNhat"];
            string _Status = Request["Status"];
            string _Nguon = Request["Nguon"];
            List<jgridRow> ListRow;
            #endregion
            switch (subAct)
            {
                case "get":
                    #region lấy danh sách
                    if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "KTNN_NgayCapNhat";
                    if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc";
                    string _NguoiTao = Security.Username;
                    int _acp = 1;
                    if (string.IsNullOrEmpty(_Lang))
                    {
                        _Lang = "Vi-vn";
                    }
                    Pager<KTNN> PagerGet = KTNNDal.pagerNormalTin("", false, jgrsidx + " " + jgrsord, _q, _PID, _NguoiTao, _acp, "KT_NN", _Lang,"10");

                    ListRow = new List<jgridRow>();
                    foreach (KTNN item in PagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                            item.ID.ToString()
                            ,item.LangBased.ToString()
                            ,item._ID.ToString()
                            ,item.Lang
                            ,item.ThuTu.ToString()
                            ,string.Format("<img src=\"../up/KTNN/{0}\"/>",item.Anh)
                            ,item.Ten
                            ,item.MoTa
                           // ,item.DM_ID.ToString()
                            ,item.DM_Ten
                            ,item.Nguon
                            ,item.Views.ToString()
                            ,item.NguoiTao
                            ,item.NgayCapNhat.ToString("dd/MM/yyyy")
                            ,item.Active.ToString()
                            ,item.Hot.ToString()
                            ,item.HetHan.ToString()
                        }));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGet.TotalPages.ToString(), PagerGet.Total.ToString(), ListRow);
                    //jgrid grid = new jgrid("1", "1", pager.Total.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "getPid":
                    #region danh sách chọn sẵn

                    break;
                    #endregion
                case "add":
                    #region thêm mới
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    KTNN itemGetVanBan = KTNNDal.SelectByIdView(Convert.ToInt32(_ID));
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        if (itemGetVanBan.Filelist.Count > 0)
                        {
                            if (itemGetVanBan.Filelist[0].ID != 0)
                            {
                                foreach (Files item in itemGetVanBan.Filelist)
                                {
                                    itemGetVanBan.FileListStr += string.Format(@"<span _value=""{0}"" class=""adm-token-item"">{1}{2}<a href=""javascript:;"">x</a></span>"
                                        , item.ID, item.Ten, item.MimeType);
                                }
                            }
                            sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(itemGetVanBan));
                        }
                        // sb.Append("(" + JavaScriptConvert.SerializeObject(TinDal.SelectById(Convert.ToInt32(_ID))) + ")");
                    }
                    break;
                    #endregion
                case "del":
                    #region Xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        KTNNDal.DeleteMultiById(_ID, "KTNN_TUC");
                    }
                    break;
                    #endregion
                case "duyet":
                    #region Duyệt tin hàng loạt
                    KTNN ItemDuyet = new KTNN();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemDuyet.multiID = _ID;
                        ItemDuyet.Active = Convert.ToBoolean(_Status);
                        KTNNDal.UpdateMulti(ItemDuyet);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "hot":
                    #region Chuyển thành tin hot
                    KTNN ItemHot = new KTNN();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemHot.multiID = _ID;
                        ItemHot.Hot = Convert.ToBoolean(_Status);
                        KTNNDal.UpdateHotMulti(ItemHot);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "hethan":
                    #region Hết hạn
                    KTNN ItemHetHan = new KTNN();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemHetHan.multiID = _ID;
                        ItemHetHan.HetHan = Convert.ToBoolean(_Status);
                        if (ItemHetHan.HetHan == true)
                        {
                            ItemHetHan.NgayHetHan = DateTime.Now;
                        }
                        KTNNDal.UpdateHetHanMulti(ItemHetHan);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "save":
                    #region lưu
                    KTNN ItemSave = new KTNN();
                    if (string.IsNullOrEmpty(_Ten))
                    {
                        sb.Append("0");
                        break;
                    }
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemSave = KTNNDal.SelectById(Convert.ToInt32(_ID));
                    }
                    if (!string.IsNullOrEmpty(_Nguon))
                    {
                        ItemSave.Nguon = (_Nguon);
                    }
                    ItemSave.Ten = _Ten;
                    ItemSave.DM_ID = Int32.Parse(_PID);
                    // ItemSave.DM_Ten = _PTen;
                    ItemSave.Anh = _Anh;
                    if (string.IsNullOrEmpty(_ThuTu))
                    {
                        _ThuTu = "0";
                    }
                    ItemSave.ThuTu = Convert.ToInt32(_ThuTu);
                    ItemSave.MoTa = _Mota;
                    ItemSave.NoiDung = _NoiDungvb_ktnn;
                    ItemSave.KeyWords = _KeyWords;
                    ItemSave.Description = _Description;
                    ItemSave.Alias = _Alias;
                    ItemSave.Lang = _Lang;
                    ItemSave.LangBased = Convert.ToBoolean(_LangBased);
                    if (!string.IsNullOrEmpty(_LangBased_ID))
                    {
                        ItemSave.LangBased_ID = Convert.ToInt32(_LangBased_ID);
                    }
                    ItemSave.Hot = Convert.ToBoolean(_Hot);
                    ItemSave.NgayCapNhat = DateTime.Now;
                    if (_Public == "1")
                    {
                        ItemSave.NgayDang = DateTime.Now;
                    }
                    ItemSave.NguoiCapNhat = Security.Username;
                    ItemSave.HetHan = Convert.ToBoolean(_HetHan);
                    if (!string.IsNullOrEmpty(_NgayHetHan))
                    {
                        ItemSave.NgayHetHan =Convert.ToDateTime(_NgayHetHan, new CultureInfo("vi-Vn"));
                    }
                    if (!string.IsNullOrEmpty(_NgayCapNhat))
                    {
                        DateTime dt = new DateTime();

                        ItemSave.NgayCapNhat = DateTime.Now;// Convert.ToDateTime(_NgayCapNhat, new CultureInfo("vi-Vn"));//.AddHours(dt.Hour).AddMinutes(dt.Minute).AddSeconds(dt.Second);
                    }
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemSave = KTNNDal.Update(ItemSave);
                    }
                    else
                    {
                        ItemSave.NguoiTao = Security.Username;
                        ItemSave.NgayTao = DateTime.Now;
                        ItemSave.RowId = Guid.NewGuid();
                        ItemSave = KTNNDal.Insert(ItemSave);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.ktnn.vietbai.JScript1.js"));
                    break;
                    #endregion
                case "saveDoc":
                    #region Lưu tài liệu
                    if (!string.IsNullOrEmpty(_F_ID))
                    {
                        Files item = FilesDal.SelectById(Convert.ToInt32(_F_ID));
                        item.VB_ID = Convert.ToInt32(0);
                        Guid g = new Guid(_ID);

                        item.PID = g;
                        item = FilesDal.Update(item);
                    }
                    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 _directory = Server.MapPath("~/up/d/") + item.ThuMuc;
                        string _files = Server.MapPath("~/up/d/") + item.ThuMuc + "/" + item.Ten + item.MimeType;
                        if (Directory.Exists(_files))
                        {
                            File.Delete(_files);
                            Directory.Delete(_directory);
                        }
                        FilesDal.DeleteById(item.ID);
                    }
                    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-ktnn-vb"" />
            </span>
            <a class=""mdl-head-btn mdl-head-add"" id=""vbtinmdlktnn-addBtn"" href=""javascript:vbtinfn.add();"">Viết bài</a>
            <a class=""mdl-head-btn mdl-head-add"" id=""danhMucMdl-addBtn"" href=""javascript:"" onclick=""vbtinfn.addLang();"" >Bài viết ngôn ngữ khác</a>
            <a class=""mdl-head-btn mdl-head-edit"" id=""vbtinmdlktnn-editBtn"" href=""javascript:vbtinfn.edit();"">Sửa bài viết</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""vbtinmdlktnn-delBtn"" href=""javascript:vbtinfn.del();"">Xóa bài viết</a>
            <select class=""slt"" onchange=""vbtinfn.search();"" id=""vbTintucdl-changeLangSlt""></select>

            <a class=""mdl-head-btn mdl-headTask-Loc"" href=""javascript:;"" style='display:none'>
            <span class=""mdl-headTask-Loc-Title"" style='display:none'>
            <span class=""ui-icon ui-icon-triangle-1-s""></span>
            Tin hot <span class=""mdl-headTask-Loc-Title-Display""></span>
            </span>
            <span class=""mdl-headTask-Loc-Box"" style='display:none'>
            <span class=""mdl-headTask-Loc-Box-Pnl ui-widget-content ui-corner-bottom"">
            <span class=""mdl-headTask-Loc-Box-Content ui-corner-all"">
                <span onclick=""javascript:vbtinfn.tinhot('true');"">Chuyển tin hot</span>
                <span onclick=""javascript:vbtinfn.tinhot('false');"">Chuyển tin thường</span>
            </span>
            </span>
            </span>
            </a>
            <a class=""mdl-head-btn mdl-headTask-Loc"" href=""javascript:;"" style='display:none'>
            <span class=""mdl-headTask-Loc-Title"">
            <span class=""ui-icon ui-icon-triangle-1-s""></span>
            Hết hạn <span class=""mdl-headTask-Loc-Title-Display""></span>
            </span>
            <span class=""mdl-headTask-Loc-Box"" >
            <span class=""mdl-headTask-Loc-Box-Pnl ui-widget-content ui-corner-bottom"">
            <span class=""mdl-headTask-Loc-Box-Content ui-corner-all"">
                <span onclick=""javascript:vbtinfn.hethan('true');"">Chuyển hết hạn</span>
                <span onclick=""javascript:vbtinfn.hethan('false');"">Gia hạn</span>
            </span>
            </span>
            </span>
            </a>
            <a class=""mdl-head-btn mdl-headTask-Loc"" href=""javascript:;"" style='display:none'>
            <span class=""mdl-headTask-Loc-Title"" style='display:none'>
            <span class=""ui-icon ui-icon-triangle-1-s""></span>
            Lọc tin <span class=""mdl-headTask-Loc-Title-Display""></span>
            </span>
            <span class=""mdl-headTask-Loc-Box"" style='display:none'>
            <span class=""mdl-headTask-Loc-Box-Pnl ui-widget-content ui-corner-bottom"" style='display:none'>
            <span class=""mdl-headTask-Loc-Box-Content ui-corner-all"" style='display:none'>
                <span onclick=""javascript:vbtinfn.hethan('true');"">Tin kích hoạt</span>
                <span onclick=""javascript:vbtinfn.hethan('false');"">Tin hot</span>
                <span onclick=""javascript:vbtinfn.hethan('false');"">Hết hạn</span>
            </span>
            </span>
            </span>
            </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-vbfilterdanhmuc""/>
            </span>
            </div>
            <table id=""vbtinmdlktnn-List"" class=""mdl-list""></table>
            <div id=""vbtinmdlktnn-Pagerql""></div>");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.ktnn.vietbai.JScript1.js")
                        , "{vbtinfn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #19
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);
                    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 = false;
                        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(), "quanLyThu.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.quanLyThu.JScript1.js"));
                    //sb.AppendFormat(@"{0}"
                    //    , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.quanLyThu.Publish.js"));
                    break;
                    #endregion
                default:
                    #region nạp
                    var listFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                    sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "quanLyThu.mdl.htm"));
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.thuChiMgr.quanLyThu.JScript1.js")
                        , "{quanLyThuFn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #20
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            #region Tham số
            string _ID = Request["ID"];
            string _DM_ID = Request["DM_ID"];
            string _Ten = Request["Ten"];
            string _Phone = Request["Phone"];
            string _KV_ID = Request["KV_ID"];
            string _Sao = Request["Sao"];
            string _Alias = Request["Alias"];
            string _Diem = Request["Diem"];
            string _ToaDo = Request["ToaDo"];
            string _MoTa = Request["MoTa"];
            string _DiaChi = Request["DiaChi"];
            string _NoiDung = Request["NoiDung"];
            string _Publish = Request["Publish"];
            string _Moi = Request["Moi"];
            string _KhuyenMai = Request["KhuyenMai"];
            string _KhaiTruong = Request["KhaiTruong"];
            string _Anh = Request["Anh"];

            string _LoaiThanhVien = Request["LoaiThanhVien"];
            string _Website = Request["Website"];
            string _Email = Request["Email"];
            string _BaoDam = Request["BaoDam"];
            Spa Item;
            List<jgridRow> ListRow = new List<jgridRow>();
            Pager<Spa> PagerGet;
            #endregion

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

                    PagerGet = SpaDal.pagerByQ(Request["q"], jgrsidx + " " + jgrsord, 10);
                    foreach (Spa dm in PagerGet.List)
                    {
                        ListRow.Add(new jgridRow(dm.ID.ToString(), new string[] {
                             string.Format("{0}",dm.ID)
                            , string.Format("<img style=\"width: 50px;\"  src=\"../up/i/{0}\" />", linh.common.Lib.imgSize(dm.Anh,"150x115"))
                            , dm.KV_Ten
                            , dm.Ten
                            , dm.DiaChi
                            , dm.Phone
                            , dm.NgayTao.ToString("hh:mm - dd/MM/yyyy")
                            , dm.Moi.ToString()
                            , dm.KhaiTruong.ToString()
                            , dm.KhuyenMai.ToString()
                            , dm.Publish.ToString()
                            , dm.Sao.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 "del":
                    #region xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        SpaDal.DeleteById(Convert.ToInt32(_ID));
                    }
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.Append("(" + JavaScriptConvert.SerializeObject(SpaDal.SelectById(Convert.ToInt32(_ID))) + ")");
                    }
                    break;
                    #endregion
                case "save":
                    #region lưu
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        Item = SpaDal.SelectById(Convert.ToInt32(_ID));
                    }
                    else
                    {
                        Item = new Spa();
                    }
                    if (!string.IsNullOrEmpty(_DM_ID))
                    {
                        Item.DM_ID = Convert.ToInt32(_DM_ID);
                    }
                    Item.Alias = _Alias;
                    Item.Anh = _Anh;
                    Item.DiaChi = _DiaChi;
                    Item.Diem = Convert.ToInt32(_Diem);
                    Item.KhaiTruong = Convert.ToBoolean(_KhaiTruong);
                    Item.KhuyenMai = Convert.ToBoolean(_KhuyenMai);
                    Item.Website = _Website;
                    Item.Email = _Email;
                    Item.BaoDam = Convert.ToBoolean(_BaoDam);
                    if (!string.IsNullOrEmpty(_LoaiThanhVien))
                    {
                        Item.LoaiThanhVien = Convert.ToInt32(_LoaiThanhVien);
                    }

                    if (!string.IsNullOrEmpty(_KV_ID))
                    {
                        Item.KV_ID = Convert.ToInt32(_KV_ID);
                    }
                    if (!string.IsNullOrEmpty(_DM_ID))
                    {
                        Item.DM_ID = Convert.ToInt32(_DM_ID);
                    }
                    Item.Mobile = string.Empty;
                    Item.Moi = Convert.ToBoolean(_Moi);
                    Item.Mota = _MoTa;
                    Item.NgayCapNhat = DateTime.Now;
                    Item.NoiDung = _NoiDung;
                    Item.Phone = _Phone;
                    Item.Publish = Convert.ToBoolean(_Publish);
                    Item.Sao = Convert.ToByte(_Sao);
                    Item.SolanDanhGia = 0;
                    Item.Ten = _Ten;
                    Item.ToaDo = _ToaDo;

                    if (!string.IsNullOrEmpty(_ID))
                    {
                        Item = SpaDal.Update(Item);
                    }
                    else
                    {
                        Item.NgayTao = DateTime.Now;
                        Item.RowId = Guid.NewGuid();
                        Item = SpaDal.Insert(Item);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "autoComplete":
                    #region lưu
                    PagerGet = SpaDal.pagerByQ(Request["q"], string.Empty, 20);
                    sb.Append(JavaScriptConvert.SerializeObject(PagerGet.List));
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "plugin.spa.quanLySpa.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-quanLySpaMdl"" />
            </span>
            <a class=""mdl-head-btn mdl-head-add"" id=""quanLySpaMdl-addBtn"" href=""javascript:quanLySpaFn.add();"">Thêm</a>
            <a class=""mdl-head-btn mdl-head-edit"" id=""quanLySpaMdl-editBtn"" href=""javascript:quanLySpaFn.edit();"">Sửa</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""quanLySpaMdl-delBtn"" href=""javascript:quanLySpaFn.del();"">Xóa</a>
            <a class=""mdl-head-btn mdl-head-del""  href=""javascript:;"" onclick=""$('#quanLySpaMdl-List').trigger('reloadGrid');"">Nạp</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-spaFilterByKv""/>
            </span>
            <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-spaFilterByDm""/>
            </span>
            </div>
            <table id=""quanLySpaMdl-List"" class=""mdl-list""></table>
            <div id=""quanLySpaMdl-Pager""></div>
            ");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "plugin.spa.quanLySpa.JScript1.js")
                        , "{quanLySpaFn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #21
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            #region Tham số
            string _ID = Request["_ID"];
            string _DM_ID = Request["_DM_ID"];
            string _HD_ID = Request["_HD_ID"];
            string _Ten = Request["_Ten"];
            string _NguoiTao = Request["_NguoiTao"];
            string _Email = Request["_Email"];
            string _Mobile = Request["_Mobile"];
            string _NoiDung = Request["_NoiDung"];
            string _Active = Request["_Active"];
            string _DaTraLoi = Request["_DaTraLoi"];
            string _Hot = Request["_Hot"];
            string _q = Request["_q"];
            SpaHoiDap Item;
            List<jgridRow> ListRow = new List<jgridRow>();
            Pager<SpaHoiDap> PagerGet;
            #endregion
            switch (subAct)
            {
                case "get":
                    #region lấy dữ liệu cho grid
                    if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "HD_ID";
                    if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc";

                    PagerGet = SpaHoiDapDal.pagerByDichVu(jgrsidx + " " + jgrsord, _q, _DM_ID, 10);
                    foreach (SpaHoiDap item in PagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                             string.Format("{0}",item.ID)
                             , item.Ten
                            , item.NguoiTao
                            , item.Email
                            , item.Mobile
                            , item.HD_Ten
                            ,item.Active.ToString()
                            ,item.DaTraLoi.ToString()
                            ,item.Hot.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 "del":
                    #region xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        SpaHoiDapDal.DeleteById(Convert.ToInt32(_ID));
                    }
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.Append("(" + JavaScriptConvert.SerializeObject(SpaHoiDapDal.SelectById(Convert.ToInt32(_ID))) + ")");
                    }
                    break;
                    #endregion
                case "save":
                    #region lưu
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        Item = SpaHoiDapDal.SelectById(Convert.ToInt32(_ID));
                    }
                    else
                    {
                        Item = new SpaHoiDap();
                    }
                    Item.Ten = _Ten;
                    Item.NguoiTao = _NguoiTao;
                    Item.Email = _Email;
                    Item.Mobile = _Mobile;
                    Item.NoiDung = _NoiDung;
                    if (!string.IsNullOrEmpty(_DM_ID))
                    {
                        Item.DM_ID = Convert.ToInt32(_DM_ID);
                    }
                    if (!string.IsNullOrEmpty(_HD_ID))
                    {
                        Item.HD_ID = Convert.ToInt32(_HD_ID);
                    }
                    Item.Active = Convert.ToBoolean(_Active);
                    Item.DaTraLoi = Convert.ToBoolean(_DaTraLoi);
                    Item.Hot = Convert.ToBoolean(_Hot);
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        Item = SpaHoiDapDal.Update(Item);
                    }
                    else
                    {
                        Item.NgayTao = DateTime.Now;
                        Item = SpaHoiDapDal.Insert(Item);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "autocomplete":
                    #region Lấy danh sách autocomplete
                    if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "HD_ID";
                    if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc";
                    PagerGet = SpaHoiDapDal.pagerByDichVu(jgrsidx + " " + jgrsord, _q, _DM_ID, 10);
                    sb.Append(JavaScriptConvert.SerializeObject(PagerGet.List));
                    break;
                    #endregion
                case "autoCompleteCauHoi":
                    #region Lấy danh sách autocompleteCauHoi
                    PagerGet = SpaHoiDapDal.pagerCauHoi(_q, 10);
                    sb.Append(JavaScriptConvert.SerializeObject(PagerGet.List));
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "plugin.spa.SpaHoiDapMgr.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-spaHoiDapMgrMdl"" />
            </span>
            <a class=""mdl-head-btn mdl-head-add"" id=""spaHoiDapMgrMdl-addBtn"" href=""javascript:spaHoiDapMgrFn.add();"">Thêm</a>
            <a class=""mdl-head-btn mdl-head-edit"" id=""spaHoiDapMgrMdl-editBtn"" href=""javascript:spaHoiDapMgrFn.edit();"">Sửa</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""spaHoiDapMgrMdl-delBtn"" href=""javascript:spaHoiDapMgrFn.del();"">Xóa</a>
            <a class=""mdl-head-btn mdl-head-del""  href=""javascript:;"" onclick=""$('#spaHoiDapMgrMdl-List').trigger('reloadGrid');"">Nạp</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-spaHoiDapMgrMdlFilterByDm""/>
            </span>
            </div>
            <table id=""spaHoiDapMgrMdl-List"" class=""mdl-list""></table>
            <div id=""spaHoiDapMgrMdl-Pager""></div>
            ");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "plugin.spa.SpaHoiDapMgr.JScript1.js")
                        , "{spaHoiDapMgrFn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #22
0
        protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();
            var cs = this.Page.ClientScript;
            var c = HttpContext.Current;
            #region Variables
            var ID = c.Request["ID"];
            var Ten = c.Request["Ten"];
            var MoTa = c.Request["MoTa"];
            var Ma = c.Request["Ma"];
            var NoiDung = c.Request["NoiDung"];
            var TuNgay = c.Request["TuNgay"];
            var DenNgay = c.Request["DenNgay"];
            var SoLuong = c.Request["SoLuong"];
            var ChietKhau = c.Request["ChietKhau"];
            var TienChietKhau = c.Request["TienChietKhau"];
            var Active = c.Request["Active"];
            var ThuTu = c.Request["ThuTu"];
            var NgayTao = c.Request["NgayTao"];
            var NgayCapNhat = c.Request["NgayCapNhat"];
            var NguoiTao = c.Request["NguoiTao"];
            var NguoiCapNhat = c.Request["NguoiCapNhat"];

            if(!Security.IsAuthenticated())
            {
                Response.Clear();
                Response.End();
            }
            var _q = c.Request["q"];
            #endregion

            List<jgridRow> ListRow = new List<jgridRow>();
            switch (subAct)
            {
                case "get":
                    #region get
                    var pagerGet = KhuyenMaiDal.pagerNormal("", false, "KM_" + jgrsidx + " " + jgrsord, _q, Convert.ToInt32(jgRows));
                    foreach (var item in pagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {

                            item.ID.ToString()
                            , item.Ma
                            , item.Ten
                            , item.SoLuong.ToString()
                            , string.Format("{0:dd-MM-yy}-{1:dd-MM-yy}",item.TuNgay,item.DenNgay)
                            , Lib.TienVietNam(item.TienChietKhau)
                            , item.ChietKhau.ToString()
                            , item.Active.ToString()
                            , item.ThuTu.ToString()
                            , 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 "search":
                    #region search
                    var pagerSearch = KhuyenMaiDal.pagerNormal("", false, "KM_NgayTao desc", _q, 20);
                    sb.Append(JavaScriptConvert.SerializeObject(pagerSearch.List));
                    break;
                    #endregion
                case "save":
                    #region chỉnh sửa
                    if (Security.IsAuthenticated())
                    {
                        var item = new KhuyenMai();
                        if (!string.IsNullOrEmpty(ID))
                        {
                            item = KhuyenMaiDal.SelectById(new Guid(ID));
                        }
                        item.Active = Convert.ToBoolean(Active);
                        item.ChietKhau = Convert.ToDouble(ChietKhau);
                        item.DenNgay = Convert.ToDateTime(DenNgay, new CultureInfo("vi-Vn"));
                        item.Ma = Ma;
                        item.MoTa = MoTa;
                        item.NgayCapNhat = DateTime.Now;
                        item.NguoiCapNhat = Security.Username;
                        item.NoiDung = NoiDung;
                        item.SoLuong = Convert.ToInt32(SoLuong);
                        item.Ten = Ten;
                        item.ThuTu = Convert.ToInt32(ThuTu);
                        item.TienChietKhau = Convert.ToDouble(TienChietKhau);
                        item.TuNgay = Convert.ToDateTime(TuNgay, new CultureInfo("vi-Vn"));
                        if (!string.IsNullOrEmpty(ID))
                        {
                            item = KhuyenMaiDal.Update(item);
                        }
                        else
                        {
                            item.ID = Guid.NewGuid();
                            item.NgayTao = DateTime.Now;
                            item.NguoiTao = Security.Username;
                            item = KhuyenMaiDal.Insert(item);
                        }
                        sb.Append("1");
                    }

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

                    }
                    break;
                    #endregion
                case "del":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        KhuyenMaiDal.DeleteById(new Guid(ID));
                    }
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "appStore.pmSpa.khuyenMaiMgr.JScript1.js"));
                    break;
                    #endregion
                default:
                    #region default
                    {
                        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.pmSpa.khuyenMaiMgr.JScript1.js")
                            , "{KhuyenMaiMgrFn.loadgrid();}");
                        sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                        break;
                    }
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #23
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 _Url = Request["Url"];
            string _RssUrl = Request["RssUrl"];
            Bao ItemSave;
            #endregion

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

                    Pager<Bao> PagerGet = BaoDal.pagerNormal("", false, jgrsidx + " " + jgrsord);
                    List<jgridRow> ListRow = new List<jgridRow>();
                    foreach (Bao dm in PagerGet.List)
                    {
                        ListRow.Add(new jgridRow(dm.ID.ToString(), new string[] {
                              dm.ID.ToString()
                            , dm.Ten
                            , dm.Url
                            , dm.RssUrl
                        }));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGet.TotalPages.ToString(), PagerGet.Total.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "del":
                    #region xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        BaoDal.DeleteById(Convert.ToInt32(_ID));
                    }
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.Append("(" + JavaScriptConvert.SerializeObject(BaoDal.SelectById(Convert.ToInt32(_ID))) + ")");
                    }
                    break;
                    #endregion
                case "save":
                    #region lưu
                    ItemSave = new Bao();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemSave = BaoDal.SelectById(Convert.ToInt32(_ID));
                    }
                    else
                    {
                        ItemSave = new Bao();
                    }
                    ItemSave.Ten = _Ten;
                    ItemSave.Url = _Url;
                    ItemSave.RssUrl = _RssUrl;
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemSave = BaoDal.Update(ItemSave);
                    }
                    else
                    {
                        ItemSave = BaoDal.Insert(ItemSave);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "getautoComplete":
                    #region Lấy danh sách danh mục
                    sb.Append(JavaScriptConvert.SerializeObject(BaoDal.SelectAll()));
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "plugin.rss.bao.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-baoMdl"" />
            </span>
            <a class=""mdl-head-btn mdl-head-add"" id=""baoMdl-addBtn"" href=""javascript:baoFn.add();"">Thêm</a>
            <a class=""mdl-head-btn mdl-head-edit"" id=""baoMdl-editBtn"" href=""javascript:baoFn.edit();"">Sửa</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""baoMdl-delBtn"" href=""javascript:baoFn.del();"">Xóa</a>
            </div>
            <table id=""baoMdl-List"" class=""mdl-list""></table>
            <div id=""baoMdl-Pager""></div>");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "plugin.rss.bao.JScript1.js")
                        , "{baoFn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #24
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"];
            List<jgridRow> ListRow = new List<jgridRow>();
            Language Item;
            jgrid grid = new jgrid();
            #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<DatHang> PagerGet = DatHangDal.pagerNormalChuaGiao("", false, "DH_" + jgrsidx + " " + jgrsord, "", Convert.ToInt32(Request["rows"]));
                    foreach (DatHang item in PagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(),
                            new string[] { item.ID.ToString()
                                , item.KH_Ten
                                , item.KH_Mobile
                                , item.KH_DiaChi
                                ,string.Format("{0}.000đ",item.Tong)
                                ,string.Format("{0:dd-MM-yy HH:mm}",item.NgayTao)
                                ,string.Format(@"<input onclick=""datHangMoiFn.daGiao('{0}');"" type=""checkbox"" _id=""{0}"" {1}/>",item.ID,item.GiaoHang ? @" checked=""checked""" : "")
                            }));
                    }
                    grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGet.TotalPages.ToString(), PagerGet.Total.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "reports":
                    #region bao cao
                    Pager<DatHang> pagerGetReport = DatHangDal.pagerNormalChuaGiao("", false, "DH_ID desc", "", Convert.ToInt32(Request["rows"]));
                    RenderReport(pagerGetReport.List, "WORD");
                    #endregion
                    break;
                case "reportsNgay":
                    #region bao cao
                    Pager<DatHang> pagerGetReportDay = DatHangDal.pagerNormalChuaGiao("", false, "DH_ID desc", "", Convert.ToInt32(Request["rows"]));
                    RenderReport(pagerGetReportDay.List, "WORD");
                    #endregion
                    break;
                case "getSubGrid":
                #region getSubGrid
                    foreach (DatHangChiTiet item in DatHangChiTietDal.SelectByDhId(_ID))
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(),
                            new string[] { item.ID.ToString()
                                , item.HH_Ten
                                , string.Format("{0}.000đ",item.HH_Gia)
                                , item.HH_SoLuong.ToString()
                                ,string.Format("{0}.000đ",item.HH_Gia * item.HH_SoLuong)
                            }));
                    }
                    grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, "100", "100", 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))
                    {
                        DatHangDal.DeleteById(Convert.ToInt32(_ID));
                    }
                    break;
                    #endregion
                case "giao":
                    #region xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        DatHangDal.GiaoById(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), "mamvui.plugin.datHang.moi.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.del"" class=""mdl-head-btn mdl-head-del"" id=""datHangMoiMdl-delBtn"" href=""javascript:datHangMoiFn.del();"">Xóa</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""giaoViecMdl-delBtn"" href=""javascript:datHangMoiFn.nap();"">Nạp lại</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""giaoViecMdl-delBtn"" href=""javascript:datHangMoiFn.baocao();"">Báo cáo</a>
            </div>

            <table id=""datHangMoiMdl-List"" class=""mdl-list""></table>
            <div id=""datHangMoiMdl-Pager""></div>
            <div class=""sub-mdl"">
            <div class=""mdl-head"">
            </div>
            <table id=""datHangChiTietMdl-List"" class=""mdl-list""></table>
            </div>
            ");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "mamvui.plugin.datHang.moi.JScript1.js")
                        , "{datHangMoiFn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #25
0
        protected override void Render(HtmlTextWriter writer)
        {
            #region biến
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            string _ID = Request["ID"];
            string _F_ID = Request["F_ID"];
            string _GH_ID = Request["GH_ID"];
            string _Lang = Request["Lang"];
            string _Alias = Request["Alias"];
            string _LangBased_ID = Request["LangBased_ID"];
            string _LangBased = Request["LangBased"];
            string _KeyWords = Request["KeyWords"];
            string _Description = Request["Description"];
            string _PID = Request["DMID"];
            string _PTen = Request["DMTen"];
            string _Ten = Request["Ten"];
            string _Mota = Request["Mota"];
            string _NoiDung_tt = Request["NoiDung_tt"];
            string _ThuTu = Request["ThuTu"];
            string _Anh = Request["Anh"];
            string _Hot = Request["Hot"];
            string _q = Request["q"];
            string _HetHan = Request["HetHan"];
            string _NgayHetHan = Request["NgayHetHan"];
            string _NgayCapNhat = Request["NgayCapNhat"];
            string _Status = Request["status"];
            string _Nguon = Request["Nguon"];
            string _CID = Request["CID"];
            List<jgridRow> ListRow;
            #endregion
            string _NguoiTao = Security.Username;
            var admin = false;
            if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "TIN_NgayCapNhat";
            if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc";
            switch (subAct)
            {
                case "get":
                    #region lấy danh sách

                    var pagerGet = TinDal.PagerQuanTri(string.Empty, false, Convert.ToInt32(jgRows), jgrsidx + " " + jgrsord, _PID, _q, null, Security.Username, null, true);

                    ListRow = new List<jgridRow>();
                    foreach (Tin item in pagerGet.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                            item.ID.ToString()
                            ,item.LangBased.ToString()
                            ,item._ID.ToString()
                            ,item.Lang
                            ,item.ThuTu.ToString()
                            ,item.Active.ToString()
                            ,item.Hot.ToString()
                            ,string.Format("<img src=\"../up/tintuc/{0}\" style=\"width:50px;height:50px; \"/>",item.Anh)
                            ,item.Ten
                            ,item.MoTa
                            ,item.DM_Ten
                            ,item.Views.ToString()
                            ,item.NguoiTao
                            ,item.NgayCapNhat.ToString("dd/MM/yyyy")
                            ,item.HetHan.ToString()
                        }));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, pagerGet.TotalPages.ToString(), pagerGet.Total.ToString(), ListRow);
                    //jgrid grid = new jgrid("1", "1", pager.Total.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "getSubTin":
                    #region lấy danh sách
                    var listTinRelation = TinDal.tinLienQuanByRelationPid(Convert.ToInt32(jgRows) , _ID);
                    ListRow = new List<jgridRow>();
                    foreach (var item in listTinRelation)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                            item.ID.ToString()
                            ,string.Format("<img src=\"../up/tintuc/{0}\" style=\"width:50px;height:50px; \"/>",item.Anh)
                            ,item.Ten
                            ,item.MoTa
                            ,item.NguoiTao
                            ,item.NgayCapNhat.ToString("dd/MM/yyyy")
                        }));
                    }
                    jgrid grid1 = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, listTinRelation.Count.ToString(), listTinRelation.Count.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid1));
                    break;
                    #endregion
                case "addSubTin":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        RelationDal.Insert(new Relation()
                                               {
                                                   CID = new Guid(_CID),
                                                   PID = new Guid(_ID),
                                                   RowId = Guid.NewGuid()
                                               });
                    }
                    break;
                    #endregion
                case "delSubTin":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        RelationDal.DeleteByCidPid(_CID,_ID);
                    }
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(TinDal.SelectByIdView(_ID)));
                    }
                    break;
                    #endregion
                case "del":
                    #region Xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        TinDal.DeleteMultiById(_ID, "TIN_TUC");
                    }
                    break;
                    #endregion
                case "duyet":
                    #region Duyệt tin hàng loạt
                    var itemDuyet = new Tin();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        itemDuyet.multiID = _ID;
                        itemDuyet.Active = Convert.ToBoolean(_Status);
                        TinDal.UpdateMulti(itemDuyet);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "autoCompleteSearch":
                    #region autoCompleteSearch
                    var pagerSearch = TinDal.PagerQuanTri(string.Empty, false, Convert.ToInt32(20),
                                                          jgrsidx + " " + jgrsord, string.Empty, _q, true, Security.Username,
                                                          null, true);
                    sb.Append(JavaScriptConvert.SerializeObject(pagerSearch.List));
                    break;
                    #endregion
                case "hot":
                    #region Chuyển thành tin hot
                    Tin ItemHot = new Tin();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemHot.multiID = _ID;
                        ItemHot.Hot = Convert.ToBoolean(_Status);
                        TinDal.UpdateHotMulti(ItemHot);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "hethan":
                    #region Hết hạn
                    Tin ItemHetHan = new Tin();
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemHetHan.multiID = _ID;
                        ItemHetHan.HetHan = Convert.ToBoolean(_Status);
                        if (ItemHetHan.HetHan == true)
                        {
                            ItemHetHan.NgayHetHan = DateTime.Now;
                        }
                        TinDal.UpdateHetHanMulti(ItemHetHan);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "save":
                    #region lưu
                    var itemSave = new Tin();
                    if (string.IsNullOrEmpty(_Ten))
                    {
                        sb.Append("0");
                        break;
                    }
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        itemSave = TinDal.SelectById(_ID);
                    }
                    if (!string.IsNullOrEmpty(_Nguon))
                    {
                        itemSave.Nguon = (_Nguon);
                    }
                    itemSave.Ten = _Ten;
                    itemSave.DM_ID = new Guid(_PID);
                    // ItemSave.DM_Ten = _PTen;
                    itemSave.Anh = _Anh;
                    if (string.IsNullOrEmpty(_ThuTu))
                    {
                        _ThuTu = "0";
                    }
                    if (!string.IsNullOrEmpty(_GH_ID))
                    {
                        itemSave.GH_ID = new Guid(_GH_ID);
                    }
                    itemSave.ThuTu = Convert.ToInt32(_ThuTu);
                    itemSave.MoTa = _Mota;
                    itemSave.NoiDung = _NoiDung_tt;
                    itemSave.KeyWords = _KeyWords;
                    itemSave.Description = _Description;
                    itemSave.Alias = _Alias;
                    //itemSave.Lang = _Lang;
                    itemSave.LangBased = Convert.ToBoolean(_LangBased);
                    if (!string.IsNullOrEmpty(_LangBased_ID))
                    {
                        itemSave.LangBased_ID = new Guid(_LangBased_ID);
                    }
                    itemSave.Hot = Convert.ToBoolean(_Hot);
                    itemSave.NgayCapNhat = DateTime.Now;
                    if (_Public == "1")
                    {
                        itemSave.NgayDang = DateTime.Now;
                    }
                    itemSave.NguoiCapNhat = Security.Username;
                    itemSave.HetHan = Convert.ToBoolean(_HetHan);
                    if (!string.IsNullOrEmpty(_NgayHetHan))
                    {
                        itemSave.NgayHetHan = Convert.ToDateTime(_NgayHetHan, new CultureInfo("vi-Vn"));
                    }
                    if (!string.IsNullOrEmpty(_NgayCapNhat))
                    {
                        itemSave.NgayCapNhat = Convert.ToDateTime(_NgayCapNhat, new CultureInfo("vi-Vn"));//.AddHours(dt.Hour).AddMinutes(dt.Minute).AddSeconds(dt.Second);
                    }
                    else
                    {
                        itemSave.NgayCapNhat = DateTime.Now;
                    }
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        itemSave = TinDal.Update(itemSave);
                    }
                    else
                    {
                        itemSave.NguoiTao = Security.Username;
                        itemSave.NgayTao = DateTime.Now;
                        itemSave.RowId = Guid.NewGuid();
                        itemSave.ID = Guid.NewGuid();
                        itemSave = TinDal.Insert(itemSave);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "projectMgr.plugin.backend.tinTuc.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), "projectMgr.plugin.backend.tinTuc.JScript1.js")
                        , "{tinfn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #26
0
        protected override void Render(HtmlTextWriter writer)
        {
            #region biến
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            var _ID = Request["ID"];
            string _q = Request["q"];

            var ID = Request["ID"];
            var DM_ID = Request["DM_ID"];
            var Ten = Request["Ten"];
            var Duyet = Request["Duyet"];
            var NoiDung = Request["NoiDung"];
            var P_RowId = Request["P_RowId"];
            var Url = Request["Url"];
            List<jgridRow> ListRow;
            #endregion

            var dele = new sendEmailDele(sendmailThongbao);
            var emailTemp = Lib.GetResource(Assembly.GetExecutingAssembly(), "Admin.email-comment-new.htm");
            switch (subAct)
            {
                case "get":
                    #region lấy danh sách
                    if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "BL_NgayTao";
                    if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc";
                    var pg = BinhLuanDal.pagerNormal(string.Empty, false, jgrsidx + " " + jgrsord, null, Convert.ToInt32(jgRows),
                                                     null, null);

                    ListRow=new List<jgridRow>();
                    foreach (var item in pg.List)
                    {
                        ListRow.Add(new jgridRow(
                            item.ID.ToString(), new string[]
                                                    {
                                                        item.ID.ToString(),
                                                        item._Member.Ten,
                                                        string.Format("<b>{0}</b><br/>{1}",item.Ten,item.NoiDung),
                                                        item.NgayTao.ToString("dd-MM-yy HH:mm"),
                                                        item.Duyet.ToString(),
                                                        string.Format(@"<a href=""{0}#{1}"" target=""_blank"">>></a>",item.Url,item.ID )
                                                    }
                            ));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, pg.TotalPages.ToString(), pg.Total.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(BinhLuanDal.SelectById(new Guid(ID))));
                    }
                    break;
                    #endregion
                case "del":
                    #region Xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        BinhLuanDal.DeleteMultiById(ID);
                    }
                    break;
                    #endregion
                case "duyet":
                    #region Xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        BinhLuanDal.DuyetMultiById(ID, Duyet == "1");
                    }
                    break;
                    #endregion
                case "save":
                    #region lưu

                    var Item = string.IsNullOrEmpty(ID) ? new BinhLuan() : BinhLuanDal.SelectById(new Guid(ID));
                    if (!string.IsNullOrEmpty(Duyet))
                    {
                        Item.Duyet = Convert.ToBoolean(Duyet);
                    }
                    Item.NoiDung = NoiDung;
                    Item.Ten = Ten;
                    if (!string.IsNullOrEmpty(P_RowId))
                    {
                        Item.P_RowId = new Guid(P_RowId);
                    }
                    Item.Url = Url;
                    if(!string.IsNullOrEmpty(ID))
                    {
                        Item = BinhLuanDal.Update(Item);
                    }
                    else
                    {
                        Item.ID = Guid.NewGuid();
                        Item.NgayTao = DateTime.Now;
                        Item.NguoiTao = Security.Username;
                        dele.BeginInvoke("*****@*****.**", "Cangtin comment new " + Security.Username
                                         , string.Format(emailTemp, Security.Username
                                                         , Request.UserHostAddress
                                                         , DateTime.Now.ToString("HH:mm dd/MM/yyyy")
                                                         , Item.Ten
                                                         , Item.Url
                                                         , Item.NoiDung), null, null);
                        Item = BinhLuanDal.Insert(Item);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "cangtin.plugins.binhLuanMgr.Admin.JScript1.js"));
                    break;
                    #endregion
                default:
                    #region nạp
                    FunctionCollection listFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                    sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "Admin.mdl.htm"));
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "cangtin.plugins.binhLuanMgr.Admin.JScript1.js")
                        , "{binhLuanMgrFn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #27
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);
        }
Beispiel #28
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);
        }
Beispiel #29
0
        protected override void Render(HtmlTextWriter writer)
        {
            #region biến
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            string _ID = Request["ID"];
            string _PID = Request["DMID"];
            string _PTen = Request["DMTen"];
            string _Ten = Request["Ten"];
            string _ThuTu = Request["ThuTu"];
            string _Anh = Request["Anh"];
            string _Url = Request["QUrl"];
            string _q = Request["q"];
            List<jgridRow> ListRow;
            #endregion
            switch (subAct)
            {
                case "get":
                    #region lấy danh sách
                    if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "ADV_ThuTu";
                    if (string.IsNullOrEmpty(jgrsord)) jgrsord = "asc";

                    Pager<QuangCao> pager = QuangCaoDal.pagerNormal("", false, jgrsidx + " " + jgrsord, _q, _PID);

                    ListRow = new List<jgridRow>();
                    foreach (QuangCao item in pager.List)
                    {
                        ListRow.Add(new jgridRow(item.ID.ToString(), new string[] {
                            item.ID.ToString()
                            ,item.ThuTu.ToString()
                            ,string.Format("<img src=\"../up/i/{0}\"/>",item.Anh)
                            ,item.Ten
                            ,item.Url
                            ,item.ViTri.ToString()
                            ,item.ViTri_Ten
                            ,item.Active.ToString()
                        }));
                    }
                    jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, pager.TotalPages.ToString(), pager.Total.ToString(), ListRow);
                   // jgrid grid = new jgrid("1", "1", pager.Total.ToString(), ListRow);
                    sb.Append(JavaScriptConvert.SerializeObject(grid));
                    break;
                    #endregion
                case "add":
                    #region thêm mới
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.Append("(" + JavaScriptConvert.SerializeObject(QuangCaoDal.SelectById(Convert.ToInt32(_ID))) + ")");
                    }
                    break;
                    #endregion
                case "del":
                    #region Xóa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                       QuangCaoDal.DeleteMultiById(_ID);
                    }
                    break;
                    #endregion
                case "duyet":
                    #region Duyệt quảng cáo hàng loạt
                        QuangCao ItemDuyet = new QuangCao();
                        if (!string.IsNullOrEmpty(_ID))
                        {
                            QuangCaoDal.UpdateMulti(_ID);
                        }
                        sb.Append("1");
                        break;
                    #endregion
                case "save":
                    #region lưu
                    QuangCao ItemSave = new QuangCao();
                    if (string.IsNullOrEmpty(_Ten))
                    {
                        sb.Append("0");
                        break;
                    }
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemSave = QuangCaoDal.SelectById(Convert.ToInt32(_ID));
                    }
                    ItemSave.Ten = _Ten;
                    ItemSave.ViTri = Int32.Parse(_PID);
                    ItemSave.ViTri_Ten = _PTen;
                    ItemSave.Anh = _Anh;
                    if (string.IsNullOrEmpty(_ThuTu))
                    {
                        _ThuTu = "1";
                    }
                    ItemSave.ThuTu = Convert.ToInt32(_ThuTu);
                    ItemSave.Url = _Url;

                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemSave = QuangCaoDal.Update(ItemSave);
                    }
                    else
                    {
                        //ItemSave.NguoiTao = Security.Username;
                        //ItemSave.NgayTao = DateTime.Now;
                        ItemSave.RowId = Guid.NewGuid();
                        ItemSave = QuangCaoDal.Insert(ItemSave);
                    }
                    sb.Append("1");
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "projectMgr.plugin.backend.quangCao.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-quangcao"" />
            </span>
            <a class=""mdl-head-btn mdl-head-add"" id=""quangcaomdl-addBtn"" href=""javascript:quangcaofn.add();"">Thêm mới</a>
            <a class=""mdl-head-btn mdl-head-edit"" id=""quangcaomdl-editBtn"" href=""javascript:quangcaofn.edit();"">Sửa</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""quangcaomdl-delBtn"" href=""javascript:quangcaofn.del();"">Xóa</a>
            <a class=""mdl-head-btn mdl-head-del"" id=""quangcaomdl-delBtn"" href=""javascript:quangcaofn.duyet();"">Duyệt quảng cáo</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-filterdanhmuc""/>
            </span>
            </div>
            <table id=""quangcaomdl-List"" class=""mdl-list""></table>
            <div id=""quangcaomdl-Pager""></div>");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "projectMgr.plugin.backend.quangCao.JScript1.js")
                        , "{quangcaofn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
Beispiel #30
0
        protected override void Render(HtmlTextWriter writer)
        {
            var sb = new StringBuilder();
            var cs = this.Page.ClientScript;
            #region Tham số
            var ID = Request["ID"];

            var XN_ID = Request["XN_ID"];
            var HH_ID = Request["HH_ID"];
            var DV_ID = Request["DV_ID"];
            var SoLuong = Request["SoLuong"];
            var DonGia = Request["DonGia"];
            var Tong = Request["Tong"];
            var VAT = Request["VAT"];
            var CKTyLe = Request["CKTyLe"];
            var CKTien = Request["CKTien"];
            var NgayTao = Request["NgayTao"];
            var NguoiTao = Request["NguoiTao"];
            var NgayCapNhat = Request["NgayCapNhat"];
            var NguoiCapNhat = Request["NguoiCapNhat"];
            var GhiChu = Request["GhiChu"];
            var TV_ID = Request["TV_ID"];

            var GH_ID = Request["GH_ID"];
            var LOAI_ID = Request["LOAI_ID"];
            var Ma = Request["Ma"];
            var KH_ID = Request["KH_ID"];
            var NgayHoaDon = Request["NgayHoaDon"];
            var NhanVien = Request["NhanVien"];
            var CongTienHang = Request["CongTienHang"];
            var DienGiai = Request["DienGiai"];
            var ThanhToan = Request["ThanhToan"];
            var ConNo = Request["ConNo"];
            var ChietKhau = Request["ChietKhau"];
            var KHO_ID = Request["KHO_ID"];
            var _q = Request["q"];
            var draff = Request["draff"];
            var Loai = Request["Loai"];
            var Rep_Ten = Request["Rep_Ten"];
            var Rep_Ngay = Request["Rep_Ngay"];
            List<jgridRow> ListRow = new List<jgridRow>();

            var danhMucLoaiXuatNhap = DanhMucDal.SelectByMa("LXN-X");
            var isXuat = true;
            #endregion
            switch (subAct)
            {
                case "get":
                    #region lấy dữ liệu cho grid

                    var pagerGet = XuatNhapDal.pagerXuatNhap(true.ToString(), false.ToString(), true.ToString(),
                        false.ToString(), null,
                        jgrsidx + " " + jgrsord, _q,
                                                             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 "del":
                    #region xóa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        XuatNhapDal.DeleteById(new Guid(ID));
                        XuatNhapChiTietDal.DeleteByXnId(new Guid(ID));
                        var thuChi = ThuChiDal.SelectByXnId(ID);
                        ThuChiDal.DeleteById(thuChi.ID);
                    }
                    break;
                    #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(ID))
                    {
                        var item = XuatNhapDal.SelectById(new Guid(ID));
                        string prefixMa = danhMucLoaiXuatNhap.KyHieu;
                        item.Ma = prefixMa + item.Ma;
                        item.XNCT = XuatNhapChiTietDal.SelectByXN_ID(item.ID.ToString());
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(item));
                    }
                    break;
                    #endregion
                case "draff":
                    #region draff
                    if (Security.IsAuthenticated())
                    {
                        var item = XuatNhapDal.SelectByDraff(isXuat);
                        string prefixMa = danhMucLoaiXuatNhap.KyHieu;
                        item.Ma = prefixMa + item.Ma;
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(item));
                    }
                    break;
                    #endregion
                case "autoCompleteByQ":
                    #region lấy dữ liệu cho grid
                    //var pagerByQ = HangHoaDal.ByDm("", false, string.Empty, _q, 10, string.Empty);
                    //sb.Append(JavaScriptConvert.SerializeObject(pagerByQ.List));
                    break;
                    #endregion
                case "save":
                    #region save
                    if (Security.IsAuthenticated())
                    {
                        var item = draff == "1" ? new XuatNhap() : XuatNhapDal.SelectById(new Guid(ID));
                        item.ChietKhau = 0;
                        item.CongTienHang = 0;
                        item.ConNo = 0;
                        item.GhiChu = GhiChu;
                        item.LOAI_ID = danhMucLoaiXuatNhap.ID;
                        item.Xuat = isXuat;
                        var prefixMa = danhMucLoaiXuatNhap.KyHieu;
                        Ma = Ma.Replace(prefixMa, "");
                        item.Ma = Ma;

                        if (!string.IsNullOrEmpty(KHO_ID))
                        {
                            item.KHO_ID = new Guid(KHO_ID);
                        }
                        if (!string.IsNullOrEmpty(TV_ID))
                        {
                            item.TVDV_ID = new Guid(TV_ID);
                        }
                        item.NoiBo = true;
                        item.NgayCapNhat = DateTime.Now;
                        item.NgayHoaDon = Convert.ToDateTime(NgayHoaDon, new CultureInfo("vi-Vn"));
                        item.NguoiCapNhat = Security.Username;
                        item.NhanVien = NhanVien;
                        item.ThanhToan = 0;
                        item.VAT = 0;
                        item.ID = new Guid(ID);
                        if (draff == "1")
                        {
                            item.NgayTao = DateTime.Now;
                            item.NguoiTao = Security.Username;
                            item = XuatNhapDal.Insert(item);
                        }
                        else
                        {
                            item = XuatNhapDal.Update(item);
                        }
                        sb.Append("1");
                    }
                    break;
                    #endregion
                case "SaveXNChiTiet":
                    #region SaveXNChiTiet
                    if (Security.IsAuthenticated())
                    {
                        var item = XuatNhapChiTietDal.SelectById(new Guid(ID));
                        item.CKTien = Convert.ToDouble(CKTien);
                        item.CKTyLe = Convert.ToDouble(CKTyLe);
                        item.DonGia = Convert.ToDouble(DonGia);
                        item.DV_ID = new Guid(DV_ID);
                        item.GhiChu = GhiChu;
                        item.NgayCapNhat = DateTime.Now;
                        item.NguoiCapNhat = Security.Username;
                        item.SoLuong = Convert.ToDouble(SoLuong);
                        item.Tong = Convert.ToDouble(Tong);
                        item.VAT = Convert.ToDouble(VAT);
                        if(!string.IsNullOrEmpty(KH_ID))
                        {
                            item.KH_ID = new Guid(KH_ID);
                        }
                        item = XuatNhapChiTietDal.Update(item);
                        sb.Append("1");
                    }
                    break;
                    #endregion
                case "XoaXNChiTiet":
                    #region Xóa tài liệu đính kèm
                    if (!string.IsNullOrEmpty(ID))
                    {
                        XuatNhapChiTietDal.DeleteById(new Guid(ID));
                    }
                    break;
                    #endregion
                case "ThemXNChiTiet":
                    #region Them xuat nhap chi tiet
                    if (!string.IsNullOrEmpty(ID))
                    {
                        var itemHH = docsoft.entities.HangHoaDal.SelectById(new Guid(HH_ID));
                        var itemXNCT = new XuatNhapChiTiet();
                        itemXNCT.CKTien = 0;
                        itemXNCT.CKTyLe = 0;
                        itemXNCT.DonGia = itemHH.GiaNhap;
                        itemXNCT.DV_ID = itemHH.DonVi_ID;
                        itemXNCT.HH_ID = itemHH.ID;
                        itemXNCT.ID = Guid.NewGuid();
                        itemXNCT.NgayCapNhat = DateTime.Now;
                        itemXNCT.NgayTao = DateTime.Now;
                        itemXNCT.NguoiCapNhat = Security.Username;
                        itemXNCT.NguoiTao = Security.Username;
                        itemXNCT.SoLuong = 1;
                        itemXNCT.Tong = itemXNCT.SoLuong * itemXNCT.DonGia;
                        itemXNCT.VAT = Convert.ToDouble(VAT);
                        itemXNCT.XN_ID = new Guid(ID);
                        itemXNCT.Draff = true;
                        itemXNCT.DraffDate = DateTime.Now;
                        itemXNCT = XuatNhapChiTietDal.Insert(itemXNCT);
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(itemXNCT));
                    }
                    break;
                    #endregion
                case "reports":
                    #region bao cao
                    if (!string.IsNullOrEmpty(ID))
                    {
                        var item = XuatNhapDal.SelectById(new Guid(ID));
                        string prefixMa = danhMucLoaiXuatNhap.KyHieu;
                        item.Ma = prefixMa + item.Ma;
                        item.XNCT = XuatNhapChiTietDal.SelectByXN_ID(item.ID.ToString());
                        var itemIn = Lib.GetResource(Assembly.GetExecutingAssembly(), "noiBoXuat.in.htm");
                        var itemInRow = Lib.GetResource(Assembly.GetExecutingAssembly(), "noiBoXuat.in-row.htm");
                        var danhMucReportHeader = DanhMucDal.SelectByMa("BAOCAO-HEADER-THUCHI");

                        var sbRow = new StringBuilder();
                        var stt = 0;
                        foreach (var xnct in item.XNCT)
                        {
                            stt++;
                            sbRow.AppendFormat(itemInRow
                                , stt
                                , xnct.HH_Ten
                                , xnct.HH_Ma
                                , xnct.DV_Ten
                                , Lib.TienVietNam(xnct.DonGia)
                                , xnct.SoLuong
                                , Lib.TienVietNam(xnct.CKTien)
                                , Lib.TienVietNam(xnct.VAT)
                                , Lib.TienVietNam(xnct.Tong));
                        }

                        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.Ma
                            , item.KH_Ten
                            , item.GhiChu
                            , item.KHO_Ten
                            , 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)
                            , danhMucReportHeader.Description
                            , domain
                            , sbRow
                            , Lib.So_chu(item.CongTienHang)
                            , item.NhanVien
                            );
                    }

                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.xuatNhapMgr.noiBoXuat.JScript1.js"));
                    //sb.AppendFormat(@"{0}"
                    //    , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.xuatNhapMgr.noiBoXuat.Publish.js"));
                    break;
                    #endregion
                default:
                    #region nạp
                    var listFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);
                    sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "noiBoXuat.mdl.htm"));
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "appStore.commonStore.xuatNhapMgr.noiBoXuat.JScript1.js")
                        , "{noiBoXuatFn.loadgrid();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }