protected override void Render(HtmlTextWriter writer) { StringBuilder sb = new StringBuilder(); ClientScriptManager cs = this.Page.ClientScript; #region tham số string msg = Request["NoiDungLienHe"]; string msgtitle = Request["msgtitle"]; sendEmailDele _dele = new sendEmailDele(sendmailThongbao); string _ID = Request["ID"]; string _LangBased = Request["LangBased"]; string _LangBased_ID = Request["LangBased_ID"]; string _DM_ID = Request["dm"]; string _TINH_ID = Request["dmkv"]; string _TINH_Ten = Request["TINH_Ten"]; string _NC_ID = Request["muaban"]; string _Lang = Request["Lang"]; string _Ten = Request["Ten"]; string _NoiDung = Request["NoiDung"]; string _NgayHetHan = Request["NgayHetHan"]; string _Anh1 = Request["Anh"]; string _Gia = Request["Gia"]; string _Active = Request["Active"]; string _q = Request["q"]; string _super = Request["_super"]; string _vip = Request["_vip"]; string _hot = Request["_hot"]; string _user = Request["_user"]; string _hethan = Request["_hethan"]; string _Publish = Request["Publish"]; string _DKhot = Request["DKhot"]; string _DKsuper = Request["DKsuper"]; string _DKvip = Request["DKvip"]; string _trangthai = Request["trangthai"]; string _NgayhethanSuper = Request["NgayHetHanSuper"]; string _NgayhethanVip = Request["NgayHetHanVip"]; string _NgayhethanHot = Request["NgayHetHanHot"]; string _Mota = Request["Mota"]; string _NgayDKSuper = Request["NgayDKSuper"]; string _NgayDKVip = Request["NgayDKVip"]; string _NgayDKHot = Request["NgayDKHot"]; string MaDanhMuc = Request["MaDanhMuc"]; RaoVat Item; List<RaoVat> List = new List<RaoVat>(); List<jgridRow> ListRow = new List<jgridRow>(); #endregion switch (subAct) { case "QuickSaveDichVu": if (!string.IsNullOrEmpty(_ID)) { if (Boolean.Parse(_vip)) { RaoVat ItemRVQS = RaoVatDal.SelectById(int.Parse(_ID)); RaoVatDal.UpdateDuyetRVTraPhi(_ID, _vip, ItemRVQS.VIP_VIP_NgayBatDau, ItemRVQS.VIP_VIP_NgayHetHan); } else { RaoVatDal.UpdateDuyetRVTraPhi(_ID, _vip, DateTime.MinValue, DateTime.MinValue); } } sb.Append("1"); break; case "DuyetDKDVRVTP": #region Duyệt dịch vụ if (!string.IsNullOrEmpty(_ID)) { DateTime dkviptime; DateTime dkbdviptime; #region VIP if (!string.IsNullOrEmpty(_NgayDKVip)) { dkbdviptime = Convert.ToDateTime(_NgayDKVip, new CultureInfo("vi-vn")); } else { dkbdviptime = DateTime.MinValue; } if (!string.IsNullOrEmpty(_NgayhethanVip)) { dkviptime = Convert.ToDateTime(_NgayhethanVip, new CultureInfo("vi-vn")); } else { dkviptime = DateTime.MinValue; } #endregion RaoVatDal.UpdateDuyetRVTraPhi(_ID, _vip, dkbdviptime, dkviptime); sb.Append("1"); } break; #endregion case "lienHe": Member memberinfo = MemberDal.SelectByUser(Security.Username); #region lienhe _dele.BeginInvoke("" , string.Format(msgtitle) , string.Format(NoiDungLienHe, memberinfo.Username, memberinfo.Ten, memberinfo.DiaChi, memberinfo.Email, memberinfo.Mobile, msg) , null, null); break; #endregion case "LoadHoTroDKDV": #region load hỗ trợ đăng ký dịch vụ sb.Append(JavaScriptConvert.SerializeObject(DanhMucDal.SelectLangBased("", MaDanhMuc))); break; #endregion case "LoadThanhToanDanhMuc": #region load hỗ trợ đăng ký dịch vụ sb.Append(JavaScriptConvert.SerializeObject(DanhMucDal.SelectLangBased("", "THANHTOAN"))); break; #endregion case "DKDV": #region Cập nhật đăng ký dịch vụ if (!string.IsNullOrEmpty(_ID)) { DateTime dksupertime; DateTime dkviptime; DateTime dkhottime; DateTime dkbdsupertime; DateTime dkbdhottime; DateTime dkbdviptime; #region VIP if (!string.IsNullOrEmpty(_NgayDKVip)) { dkbdviptime = Convert.ToDateTime(_NgayDKVip, new CultureInfo("vi-vn")); } else { dkbdviptime = DateTime.MinValue; } if (!string.IsNullOrEmpty(_NgayhethanVip)) { dkviptime = Convert.ToDateTime(_NgayhethanVip, new CultureInfo("vi-vn")); } else { dkviptime = DateTime.MinValue; } #endregion #region SUPER if (!string.IsNullOrEmpty(_NgayDKSuper)) { dkbdsupertime = Convert.ToDateTime(_NgayDKSuper, new CultureInfo("vi-vn")); } else { dkbdsupertime = DateTime.MinValue; } if (!string.IsNullOrEmpty(_NgayhethanSuper)) { dksupertime = Convert.ToDateTime(_NgayhethanSuper, new CultureInfo("vi-vn")); } else { dksupertime = DateTime.MinValue; } #endregion #region HOT if (!string.IsNullOrEmpty(_NgayDKHot)) { dkbdhottime = Convert.ToDateTime(_NgayDKHot, new CultureInfo("vi-vn")); } else { dkbdhottime = DateTime.MinValue; } if (!string.IsNullOrEmpty(_NgayhethanHot)) { dkhottime = Convert.ToDateTime(_NgayhethanHot, new CultureInfo("vi-vn")); } else { dkhottime = DateTime.MinValue; } #endregion RaoVatDal.UpdateDKDV(_ID, _DKsuper, _DKvip, _DKhot, dksupertime, dkviptime, dkhottime, dkbdsupertime, dkbdviptime, dkbdhottime); sb.Append("1"); } break; #endregion case "DangTinDungTin": #region Đăng tin if (!string.IsNullOrEmpty(_ID)) { RaoVatDal.DangTinDungTin(_ID, _Publish); } break; #endregion case "PheDuyet": #region duyệt if (!string.IsNullOrEmpty(_ID)) { RaoVatDal.DuyetList(_ID, _Active); } break; #endregion case "del": #region xóa if (!string.IsNullOrEmpty(_ID)) { RaoVatDal.DeleteByIdList(_ID); } break; #endregion case "get": #region lấy dữ liệu cho grid Pager<RaoVat> PagerGet = RaoVatDal.pagerNormalDKDVTIN("", false, jgrsidx + " " + jgrsord, _q, int.Parse(Request["rows"]), _trangthai); int countrv = 0; foreach (RaoVat item in PagerGet.List) { countrv++; ListRow.Add(new jgridRow(item.ID.ToString(), new string[]{ item.ID.ToString() ,countrv.ToString() ,string.Format(@"<img src=""../up/i/{0}"" />",Lib.imgSize(item.Anh1,"50x50")) ,item.Ten ,item._DM_Ten ,item._Nhucau_Ten ,item.NgayCapNhat.ToString("dd/MM/yyyy") ,item.TuNgay.ToString("dd/MM/yyyy") ,item.DenNgay.ToString("dd/MM/yyyy") })); } 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 chỉnh sửa if (!string.IsNullOrEmpty(_ID)) { sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(RaoVatDal.SelectById(Convert.ToInt32(_ID)))); } break; #endregion case "save": #region lưu if (!string.IsNullOrEmpty(_ID)) { Item = RaoVatDal.SelectById(Convert.ToInt32(_ID)); } else { Item = new RaoVat(); } 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); } if (!string.IsNullOrEmpty(_TINH_ID)) { Item.TINH_ID = Convert.ToInt32(_TINH_ID); } if (!string.IsNullOrEmpty(_NC_ID)) { Item.NC_ID = Convert.ToInt32(_NC_ID); } Item.Lang = _Lang; Item.Ten = _Ten; Item.Gia = _Gia; Item.NoiDung = _NoiDung; Item.MoTa = _Mota; Item.Anh1 = _Anh1; Item.NgayHetHan = Convert.ToDateTime(_NgayHetHan, new CultureInfo("vi-vn")); Item.NgayCapNhat = DateTime.Now; Item.Publish = Convert.ToBoolean(_Publish); if (!string.IsNullOrEmpty(_ID)) { Item = RaoVatDal.Update(Item); } else { Item.Active = true; Item.NgayDang = DateTime.Now; Item.TenNguoiDang = Security.Username; Item = RaoVatDal.Insert(Item); } sb.Append("1"); break; #endregion case "scpt": #region Nạp js sb.AppendFormat(@"{0}" , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.raoVatMgr.Admin.ChoDuyet.JScript1.js")); break; #endregion default: #region FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId); sb.Append(@" <div id=""RaoVatAdminChoDuyetFnMdl-main""> <div id=""RaoVatAdminChoDuyetFnMdl-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-RaoVatAdminChoDuyet"" /> </span> <a class=""mdl-head-btn mdl-head-edit"" id=""RaoVatAdminChoDuyetFnMdl-editBtn"" href=""javascript:"" onclick=""RaoVatAdminChoDuyetFn.edit();"">Sửa</a> <a class=""mdl-head-btn mdl-head-del"" id=""RaoVatAdminChoDuyetFnMdl-delBtn"" href=""javascript:"" onclick=""RaoVatAdminChoDuyetFn.del();"" >Xóa</a> <a class=""mdl-head-btn mdl-head-del"" id=""RaoVatAdminChoDuyetFnMdl-PheDuyetBtn"" href=""javascript:"" onclick=""RaoVatAdminChoDuyetFn.DangTinDungTin('False');"" >Dừng</a> <select class=""slt"" onchange=""RaoVatAdminChoDuyetFn.search();"" id=""RaoVatAdminChoDuyetFnMdl-changeLangSlt""></select> <select class=""TrangThai"" onchange=""RaoVatAdminChoDuyetFn.search();"" id=""RaoVatAdminChoDuyetFnMdl-TrangThai""></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-filterLoaiTinRaoVatAdminChoDuyet""/> </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-filterDanhMucRaoVatAdminChoDuyet""/> </span> <span class=""mdl-head-filterPnl ui-state-default ui-corner-all"" style=""display:none;""> <a href=""javascript:;"" class=""mdl-head-clearSearch""></a> <input type=""text"" _value="""" class=""mdl-head-filter mdl-head-filterKhuVucRaoVatAdminChoDuyet""/> </span> <a class=""mdl-head-btn mdl-head-DKDV"" id=""RaoVatAdminChoDuyetFnMdl-DuyetDKDVBtn"" href=""javascript:"" onclick=""RaoVatAdminChoDuyetFn.LoadFormDKDVTraPhi('#RaoVatAdminChoDuyetFnMdl-List');"" >Đăng ký tin dịch vụ</a> <a class=""mdl-head-btn mdl-head-DKDV"" id=""RaoVatAdminChoDuyetFnMdl-DuyetDKDVBtn"" href=""javascript:"" onclick=""RaoVatAdminChoDuyetFn.QuickSaveDichVu('True','#RaoVatAdminChoDuyetFnMdl-List');"" >Duyệt nhanh</a> <a class=""mdl-head-btn mdl-head-DKDV"" id=""RaoVatAdminChoDuyetFnMdl-DuyetDKDVBtn"" href=""javascript:"" onclick=""RaoVatAdminChoDuyetFn.QuickSaveDichVu('False','#RaoVatAdminChoDuyetFnMdl-List');"" >Hủy</a> </div> <table id=""RaoVatAdminChoDuyetFnMdl-List"" class=""mdl-list""></table> <div id=""RaoVatAdminChoDuyetFnMdl-Pager""></div> </div> "); sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>" , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.raoVatMgr.Admin.ChoDuyet.JScript1.js") , "{RaoVatAdminChoDuyetFn.loadgrid();}"); sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn)); break; #endregion } writer.Write(sb.ToString()); base.Render(writer); }
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"]; string _TINH_ID = Request["dmkv"]; string _TINH_Ten = Request["TINH_Ten"]; string _NC_ID = Request["muaban"]; string _Lang = Request["Lang"]; string _Ten = Request["Ten"]; string _NoiDung = Request["NoiDung"]; string _NgayHetHan = Request["NgayHetHan"]; string _Anh1 = Request["Anh"]; string _Gia = Request["Gia"]; string _Active = Request["Active"]; string _q = Request["q"]; string _super = Request["_super"]; string _vip = Request["_vip"]; string _hot = Request["_hot"]; string _calcelall = Request["_calcelall"]; string _user = Request["_user"]; string _hethan = Request["_hethan"]; string _Publish = Request["Publish"]; string _DKhot = Request["DKhot"]; string _DKsuper = Request["DKsuper"]; string _DKvip = Request["DKvip"]; string _trangthai = Request["trangthai"]; string _NgayhethanSuper = Request["NgayHetHanSuper"]; string _NgayhethanVip = Request["NgayHetHanVip"]; string _NgayhethanHot = Request["NgayHetHanHot"]; string _Mota = Request["Mota"]; string _NgayDKSuper = Request["NgayDKSuper"]; string _NgayDKVip = Request["NgayDKVip"]; string _NgayDKHot = Request["NgayDKHot"]; RaoVat Item; List<RaoVat> List = new List<RaoVat>(); List<jgridRow> ListRow = new List<jgridRow>(); #endregion switch (subAct) { case "DKDV": #region Cập nhật đăng ký dịch vụ if (!string.IsNullOrEmpty(_ID)) { DateTime dksupertime; DateTime dkviptime; DateTime dkhottime; DateTime dkbdsupertime; DateTime dkbdhottime; DateTime dkbdviptime; if (!string.IsNullOrEmpty(_NgayhethanVip)) { dkhottime = Convert.ToDateTime(_NgayhethanVip, new CultureInfo("vi-vn")); } else { dkhottime = DateTime.MinValue; } if (!string.IsNullOrEmpty(_NgayhethanSuper)) { dksupertime = Convert.ToDateTime(_NgayhethanSuper, new CultureInfo("vi-vn")); } else { dksupertime = DateTime.MinValue; } if (!string.IsNullOrEmpty(_NgayhethanHot)) { dkviptime = Convert.ToDateTime(_NgayhethanHot, new CultureInfo("vi-vn")); } else { dkviptime = DateTime.MinValue; } if (!string.IsNullOrEmpty(_NgayDKHot)) { dkbdhottime = Convert.ToDateTime(_NgayDKHot, new CultureInfo("vi-vn")); } else { dkbdhottime = DateTime.MinValue; } if (!string.IsNullOrEmpty(_NgayDKSuper)) { dkbdsupertime = Convert.ToDateTime(_NgayDKSuper, new CultureInfo("vi-vn")); } else { dkbdsupertime = DateTime.MinValue; } if (!string.IsNullOrEmpty(_NgayDKVip)) { dkbdviptime = Convert.ToDateTime(_NgayDKVip, new CultureInfo("vi-vn")); } else { dkbdviptime = DateTime.MinValue; } RaoVatDal.UpdateDKDV(_ID, _DKsuper, _DKvip, _DKhot, dksupertime, dkviptime, dkhottime, dkbdsupertime, dkbdviptime, dkbdhottime); sb.Append("1"); } break; #endregion case "HuyDichVu": #region duyệt if (!string.IsNullOrEmpty(_ID)) { //RaoVatDal.DuyetList(_ID, _calcelall,_super,_vip,_hot); } break; #endregion case "PheDuyet": #region duyệt if (!string.IsNullOrEmpty(_ID)) { RaoVatDal.DuyetList(_ID, _Active); } break; #endregion case "del": #region xóa if (!string.IsNullOrEmpty(_ID)) { RaoVatDal.DeleteByIdList(_ID); } break; #endregion case "get": #region lấy dữ liệu cho grid Pager<RaoVat> PagerGet = RaoVatDal.pagerNormal("", false, jgrsidx + " " + jgrsord, _q, Convert.ToInt32(Request["rows"]), _DM_ID, "", _NC_ID, Security.Username, _Lang, _Publish, _Active, "3"); int countrv = 0; foreach (RaoVat item in PagerGet.List) { countrv++; ListRow.Add(new jgridRow(item.ID.ToString(), new string[]{ item.ID.ToString() ,countrv.ToString() ,"RV-"+ item.ID.ToString() ,string.Format(@"<img src=""../up/i/{0}"" />",Lib.imgSize(item.Anh1,"50x50")) ,item.Ten ,item._DM_Ten ,item._Nhucau_Ten ,item.NgayDang.ToString("dd/MM/yyyy") ,item.DangKy_SUPER == true ? item.VIP_SUPER_NgayBatDau.ToString("dd/MM/yyyy")+"-"+item.VIP_SUPER_NgayHetHan.ToString("dd/MM/yyyy") : "Không đăng ký" ,item.DangKy_VIP == true ? item.VIP_VIP_NgayBatDau.ToString("dd/MM/yyyy")+"-"+ item.VIP_VIP_NgayHetHan.ToString("dd/MM/yyyy"): "Không đăng ký" ,item.DangKy_NoiBat == true ?item.VIP_NoiBat_NgayBatDau.ToString("dd/MM/yyyy")+"-"+ item.VIP_NoiBat_NgayHetHan.ToString("dd/MM/yyyy") : "Không đăng ký" })); } 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 chỉnh sửa if (!string.IsNullOrEmpty(_ID)) { sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(RaoVatDal.SelectById(Convert.ToInt32(_ID)))); } break; #endregion case "save": #region lưu if (!string.IsNullOrEmpty(_ID)) { Item = RaoVatDal.SelectById(Convert.ToInt32(_ID)); } else { Item = new RaoVat(); } 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); } if (!string.IsNullOrEmpty(_TINH_ID)) { Item.TINH_ID = Convert.ToInt32(_TINH_ID); } if (!string.IsNullOrEmpty(_NC_ID)) { Item.NC_ID = Convert.ToInt32(_NC_ID); } Item.Lang = _Lang; Item.Ten = _Ten; Item.Gia = _Gia; Item.NoiDung = _NoiDung; Item.MoTa = _Mota; Item.Anh1 = _Anh1; Item.NgayHetHan = Convert.ToDateTime(_NgayHetHan, new CultureInfo("vi-vn")); Item.NgayCapNhat = DateTime.Now; Item.Publish = Convert.ToBoolean(_Publish); if (!string.IsNullOrEmpty(_ID)) { Item = RaoVatDal.Update(Item); } else { Item.Active = true; Item.NgayDang = DateTime.Now; Item.TenNguoiDang = Security.Username; Item = RaoVatDal.Insert(Item); } sb.Append("1"); break; #endregion case "scpt": #region Nạp js sb.AppendFormat(@"{0}" , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.raoVatMgr.User.RaoVatVip.JScript1.js")); break; #endregion default: #region FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId); sb.Append(@" <div id=""UserRaoVatVipFnMdl-main""> <div id=""UserRaoVatVipFnMdl-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-UserRaoVatVip"" /> </span> <a class=""mdl-head-btn mdl-head-edit"" id=""UserRaoVatVipFnMdl-editBtn"" href=""javascript:"" onclick=""UserRaoVatVipFn.edit();"">Sửa</a> <a class=""mdl-head-btn mdl-head-del"" id=""UserRaoVatVipFnMdl-delBtn"" href=""javascript:"" onclick=""UserRaoVatVipFn.del();"" >Xóa</a> <a class=""mdl-head-btn mdl-head-del"" id=""UserRaoVatVipFnMdl-DKDVBtn"" href=""javascript:"" onclick=""UserRaoVatVipFn.DKDV();"" >Sửa Đăng ký dịch vụ trả phí</a> <select class=""slt"" onchange=""UserRaoVatVipFn.search();"" id=""UserRaoVatVipFnMdl-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-filterLoaiTinUserRaoVatVip""/> </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-filterDanhMucUserRaoVatVip""/> </span> <span class=""mdl-head-filterPnl ui-state-default ui-corner-all"" style=""display:none;""> <a href=""javascript:;"" class=""mdl-head-clearSearch""></a> <input type=""text"" _value="""" class=""mdl-head-filter mdl-head-filterKhuVucUserRaoVatVip""/> </span> </div> <table id=""UserRaoVatVipFnMdl-List"" class=""mdl-list""></table> <div id=""UserRaoVatVipFnMdl-Pager""></div> </div> "); sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>" , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.raoVatMgr.User.RaoVatVip.JScript1.js") , "{UserRaoVatVipFn.loadgrid();}"); sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn)); break; #endregion } writer.Write(sb.ToString()); base.Render(writer); }
protected override void Render(HtmlTextWriter writer) { StringBuilder sb = new StringBuilder(); ClientScriptManager cs = this.Page.ClientScript; #region tham số string msg = Request["NoiDungLienHe"]; string msgtitle = Request["msgtitle"]; sendEmailDele _dele = new sendEmailDele(sendmailThongbao); string _ID = Request["ID"]; string _LangBased = Request["LangBased"]; string _LangBased_ID = Request["LangBased_ID"]; string _DM_ID = Request["dm"]; string _TINH_ID = Request["dmkv"]; string _TINH_Ten = Request["TINH_Ten"]; string _NC_ID = Request["muaban"]; string _Lang = Request["Lang"]; string _Ten = Request["Ten"]; string _NoiDung = Request["NoiDung"]; string _NgayHetHan = Request["NgayHetHan"]; string _Anh1 = Request["Anh"]; string _Gia = Request["Gia"]; string _Active = Request["Active"]; string _q = Request["q"]; string _super = Request["_super"]; string _vip = Request["_vip"]; string _hot = Request["_hot"]; string _user = Request["_user"]; string _hethan = Request["_hethan"]; string _Publish = Request["Publish"]; string _DKhot = Request["DKhot"]; string _DKsuper = Request["DKsuper"]; string _DKvip = Request["DKvip"]; string _trangthai = Request["trangthai"]; string _NgayhethanSuper = Request["NgayHetHanSuper"]; string _NgayhethanVip = Request["NgayHetHanVip"]; string _NgayhethanHot = Request["NgayHetHanHot"]; string _Mota = Request["Mota"]; string _NgayDKSuper = Request["NgayDKSuper"]; string _NgayDKVip = Request["NgayDKVip"]; string _NgayDKHot = Request["NgayDKHot"]; string MaDanhMuc = Request["MaDanhMuc"]; RaoVat Item; DiaChiBanGiong ItemDCBG; List<RaoVat> List = new List<RaoVat>(); List<jgridRow> ListRow = new List<jgridRow>(); #endregion switch (subAct) { case "ChuyenThanhTinBanGiong": char[] delimiterChars = { ' ', ',', '.', ':', '\t' }; //string[] ArrID = _ID.Split(','); string[] ArrID = _ID.Split(delimiterChars); foreach (string ID in ArrID) { if (!string.IsNullOrEmpty(ID)) { Item = RaoVatDal.SelectById(int.Parse(ID)); if (Item.ChuyenBanGiong == false) { Member Itemmem = MemberDal.SelectByUser(Item.TenNguoiDang); DanhMuc ItemDM = DanhMucDal.SelectById(Item.DM_ID); DanhMucCollection ListDMBG = DanhMucDal.SelectLangBased("", "BANGIONG"); if (!string.IsNullOrEmpty(ItemDM.KeyWords)) { foreach (DanhMuc itemDMBG in ListDMBG) { if (ItemDM.KeyWords == itemDMBG.Ma) { ItemDCBG = new DiaChiBanGiong(); ItemDCBG.DM_ID = itemDMBG.ID; ItemDCBG.Ten = Item.Ten; //if (!string.IsNullOrEmpty(_DonVi_ID)) //{ // ItemDCBG.DonViTinh = Item.DonVi_ID; //} ItemDCBG.Anh = Item.Anh1; ItemDCBG.NoiDung = Item.NoiDung; ItemDCBG.Mota = Item.MoTa; ItemDCBG.NgayTao = DateTime.Now; ItemDCBG.NoiDang = "Toàn Quốc"; //if (!string.IsNullOrEmpty(_GNY)) //{ // ItemDCBG.Gia = Item.GNY; //} ItemDCBG.DiaChi = Itemmem.DiaChi; ItemDCBG.DienThoai = Itemmem.Mobile + " " + Itemmem.Phone; ItemDCBG.NguoiTao = Item.TenNguoiDang; ItemDCBG.RowId = Guid.NewGuid(); //ItemDCBG.PRowId = Item.RowId; ItemDCBG.Type = true;// tin bán giống lấy từ mục sản phẩm ItemDCBG.NguoiLienHe = Itemmem.Ten; ItemDCBG.Email = Itemmem.Email; ItemDCBG = DiaChiBanGiongDal.Insert(ItemDCBG); Item.ChuyenBanGiong = true; RaoVatDal.Update(Item); } } } } } } sb.Append("1"); break; case "lienHe": Member memberinfo = MemberDal.SelectByUser(Security.Username); #region lienhe _dele.BeginInvoke("" , string.Format(msgtitle) , string.Format(NoiDungLienHe, memberinfo.Username, memberinfo.Ten, memberinfo.DiaChi, memberinfo.Email, memberinfo.Mobile, msg) , null, null); break; #endregion case "LoadHoTroDKDV": #region load hỗ trợ đăng ký dịch vụ sb.Append(JavaScriptConvert.SerializeObject(DanhMucDal.SelectLangBased("", MaDanhMuc))); break; #endregion case "LoadThanhToanDanhMuc": #region load hỗ trợ đăng ký dịch vụ sb.Append(JavaScriptConvert.SerializeObject(DanhMucDal.SelectLangBased("", "THANHTOAN"))); break; #endregion case "DKDV": #region Cập nhật đăng ký dịch vụ if (!string.IsNullOrEmpty(_ID)) { DateTime dksupertime; DateTime dkviptime; DateTime dkhottime; DateTime dkbdsupertime; DateTime dkbdhottime; DateTime dkbdviptime; #region VIP if (!string.IsNullOrEmpty(_NgayDKVip)) { dkbdviptime = Convert.ToDateTime(_NgayDKVip, new CultureInfo("vi-vn")); } else { dkbdviptime = DateTime.MinValue; } if (!string.IsNullOrEmpty(_NgayhethanVip)) { dkviptime = Convert.ToDateTime(_NgayhethanVip, new CultureInfo("vi-vn")); } else { dkviptime = DateTime.MinValue; } #endregion #region SUPER if (!string.IsNullOrEmpty(_NgayDKSuper)) { dkbdsupertime = Convert.ToDateTime(_NgayDKSuper, new CultureInfo("vi-vn")); } else { dkbdsupertime = DateTime.MinValue; } if (!string.IsNullOrEmpty(_NgayhethanSuper)) { dksupertime = Convert.ToDateTime(_NgayhethanSuper, new CultureInfo("vi-vn")); } else { dksupertime = DateTime.MinValue; } #endregion #region HOT if (!string.IsNullOrEmpty(_NgayDKHot)) { dkbdhottime = Convert.ToDateTime(_NgayDKHot, new CultureInfo("vi-vn")); } else { dkbdhottime = DateTime.MinValue; } if (!string.IsNullOrEmpty(_NgayhethanHot)) { dkhottime = Convert.ToDateTime(_NgayhethanHot, new CultureInfo("vi-vn")); } else { dkhottime = DateTime.MinValue; } #endregion RaoVatDal.UpdateDKDV(_ID, _DKsuper, _DKvip, _DKhot, dksupertime, dkviptime, dkhottime, dkbdsupertime, dkbdviptime, dkbdhottime); sb.Append("1"); } break; #endregion case "DangTinDungTin": #region Đăng tin if (!string.IsNullOrEmpty(_ID)) { RaoVatDal.DangTinDungTin(_ID, _Publish); } break; #endregion case "PheDuyet": #region duyệt if (!string.IsNullOrEmpty(_ID)) { RaoVatDal.DuyetList(_ID, _Active); } break; #endregion case "del": #region xóa if (!string.IsNullOrEmpty(_ID)) { RaoVatDal.DeleteByIdList(_ID); } break; #endregion case "get": #region lấy dữ liệu cho grid Pager<RaoVat> PagerGet = RaoVatDal.pagerNormal("", false, jgrsidx + " " + jgrsord, _q,int.Parse(Request["rows"]), _DM_ID, "", _NC_ID, "", _Lang, "True", "", _trangthai); int countrv = 0; foreach (RaoVat item in PagerGet.List) { countrv++; ListRow.Add(new jgridRow(item.ID.ToString(), new string[]{ item.ID.ToString() ,countrv.ToString() ,"RV"+item.ID.ToString() ,string.Format(@"<img src=""../up/i/{0}"" />",Lib.imgSize(item.Anh1,"50x50")) ,item.Ten ,item.MoTa ,item._DM_Ten ,item._Nhucau_Ten ,item.NgayDang.ToString("dd/MM/yyyy") })); } 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 chỉnh sửa if (!string.IsNullOrEmpty(_ID)) { sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(RaoVatDal.SelectById(Convert.ToInt32(_ID)))); } break; #endregion case "save": #region lưu if (!string.IsNullOrEmpty(_ID)) { Item = RaoVatDal.SelectById(Convert.ToInt32(_ID)); } else { Item = new RaoVat(); } 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); } if (!string.IsNullOrEmpty(_TINH_ID)) { Item.TINH_ID = Convert.ToInt32(_TINH_ID); } if (!string.IsNullOrEmpty(_NC_ID)) { Item.NC_ID = Convert.ToInt32(_NC_ID); } Item.Lang = _Lang; Item.Ten = _Ten; Item.Gia = _Gia; Item.NoiDung = _NoiDung; Item.MoTa = _Mota; Item.Anh1 = _Anh1; Item.NgayHetHan = Convert.ToDateTime(_NgayHetHan, new CultureInfo("vi-vn")); Item.NgayCapNhat = DateTime.Now; Item.Publish = Convert.ToBoolean(_Publish); if (!string.IsNullOrEmpty(_ID)) { Item = RaoVatDal.Update(Item); } else { Item.Active = true; Item.NgayDang = DateTime.Now; Item.TenNguoiDang = Security.Username; Item = RaoVatDal.Insert(Item); } Member Itemmember = MemberDal.SelectByUser(Security.Username); if (string.IsNullOrEmpty(_ID)) { if (!string.IsNullOrEmpty(_DM_ID)) { DanhMuc ItemDanhMucSP = DanhMucDal.SelectById(Convert.ToInt32(_DM_ID)); DanhMucCollection ListDanhMucBanGiong = DanhMucDal.SelectLangBased("", "BANGIONG"); foreach (DanhMuc item in ListDanhMucBanGiong) { if (item.Ma == ItemDanhMucSP.KeyWords) { ItemDCBG = new DiaChiBanGiong(); ItemDCBG.DM_ID = item.ID; ItemDCBG.Ten = _Ten; //if (!string.IsNullOrEmpty(_DonVi_ID)) //{ // ItemDCBG.DonViTinh = Convert.ToInt32(_DonVi_ID); //} ItemDCBG.Anh = _Anh1; ItemDCBG.NoiDung = _NoiDung; ItemDCBG.Mota = _Mota; ItemDCBG.NgayTao = DateTime.Now; ItemDCBG.NoiDang = DanhMucDal.SelectById(int.Parse(_TINH_ID)).Ten; //if (!string.IsNullOrEmpty(_GNY)) //{ // ItemDCBG.Gia = double.Parse(_GNY); //} //ItemDCBG.Gia = _Gia; ItemDCBG.DiaChi = Itemmember.DiaChi; ItemDCBG.DienThoai = Itemmember.Mobile + " " + Itemmember.Phone; ItemDCBG.NguoiTao = Security.Username; ItemDCBG.RowId = Guid.NewGuid(); //ItemDCBG.PRowId = Item.RowId; ItemDCBG.Type = false;// tin bán giống lấy từ mục Raovat ItemDCBG.NgayTao = DateTime.Now; ItemDCBG.NguoiTao = Security.Username; ItemDCBG.NguoiLienHe = Itemmember.Ten; ItemDCBG.Email = Itemmember.Email; ItemDCBG = DiaChiBanGiongDal.Insert(ItemDCBG); } } } } sb.Append("1"); break; #endregion case "scpt": #region Nạp js sb.AppendFormat(@"{0}" , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.raoVatMgr.Admin.DaDuyet.JScript1.js")); break; #endregion default: #region FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId); sb.Append(@" <div id=""RaoVatAdminDaDuyetFnMdl-main""> <div id=""RaoVatAdminDaDuyetFnMdl-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-RaoVatAdminDaDuyet"" /> </span> <a class=""mdl-head-btn mdl-head-edit"" id=""RaoVatAdminDaDuyetFnMdl-editBtn"" href=""javascript:"" onclick=""RaoVatAdminDaDuyetFn.edit();"">Sửa</a> <a class=""mdl-head-btn mdl-head-del"" id=""RaoVatAdminDaDuyetFnMdl-delBtn"" href=""javascript:"" onclick=""RaoVatAdminDaDuyetFn.del();"" >Xóa</a> <a class=""mdl-head-btn mdl-head-del"" id=""RaoVatAdminDaDuyetFnMdl-PheDuyetBtn"" href=""javascript:"" onclick=""RaoVatAdminDaDuyetFn.DangTinDungTin('False');"" >Dừng</a> <a class=""mdl-head-btn mdl-head-del"" id=""RaoVatAdminDaDuyetFnMdl-PheDuyetBtn"" href=""javascript:"" onclick=""RaoVatAdminDaDuyetFn.ChuyenTinBanGiong('#RaoVatAdminDaDuyetFnMdl-List');"" >Chuyển đăng tin bán giống</a> <select class=""slt"" onchange=""RaoVatAdminDaDuyetFn.search();"" id=""RaoVatAdminDaDuyetFnMdl-changeLangSlt""></select> <select class=""TrangThai"" onchange=""RaoVatAdminDaDuyetFn.search();"" id=""RaoVatAdminDaDuyetFnMdl-TrangThai""></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-filterLoaiTinRaoVatAdminDaDuyet""/> </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-filterDanhMucRaoVatAdminDaDuyet""/> </span> <span class=""mdl-head-filterPnl ui-state-default ui-corner-all"" style=""display:none;""> <a href=""javascript:;"" class=""mdl-head-clearSearch""></a> <input type=""text"" _value="""" class=""mdl-head-filter mdl-head-filterKhuVucRaoVatAdminDaDuyet""/> </span> <a class=""mdl-head-btn mdl-head-DKDV"" id=""RaoVatAdminDaDuyetFnMdl-DKDVBtn"" href=""javascript:"" onclick=""RaoVatAdminDaDuyetFn.DKDV();"" >Đăng ký tin dịch vụ</a> </div> <table id=""RaoVatAdminDaDuyetFnMdl-List"" class=""mdl-list""></table> <div id=""RaoVatAdminDaDuyetFnMdl-Pager""></div> </div> "); sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>" , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.raoVatMgr.Admin.DaDuyet.JScript1.js") , "{RaoVatAdminDaDuyetFn.loadgrid();}"); sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn)); break; #endregion } writer.Write(sb.ToString()); base.Render(writer); }