// GET: Contact public ActionResult addcontact(LienHe model) { model.DateCreate = DateTime.Now; db.LienHes.Add(model); db.SaveChanges(); return(View()); }
public bool LienHe_Update(LienHe data) { bool check = false; try { using (SqlCommand dbCmd = new SqlCommand("sp_LienHe_Update", openConnection())) { dbCmd.CommandType = CommandType.StoredProcedure; dbCmd.Parameters.Add(new SqlParameter("@ID", data.ID)); dbCmd.Parameters.Add(new SqlParameter("@IDKhachHang", data.IDKhachHang)); dbCmd.Parameters.Add(new SqlParameter("@HoTen", data.HoTen)); dbCmd.Parameters.Add(new SqlParameter("@DiaChi", data.DiaChi)); dbCmd.Parameters.Add(new SqlParameter("@DienThoai", data.DienThoai)); dbCmd.Parameters.Add(new SqlParameter("@Email", data.Email)); dbCmd.Parameters.Add(new SqlParameter("@NgayLH", data.NgayLH)); dbCmd.Parameters.Add(new SqlParameter("@TieuDe", data.TieuDe)); dbCmd.Parameters.Add(new SqlParameter("@NoiDung", data.NoiDung)); dbCmd.Parameters.Add(new SqlParameter("@PhanHoi", data.PhanHoi)); dbCmd.Parameters.Add(new SqlParameter("@NguoiPH", data.NguoiPH)); int r = dbCmd.ExecuteNonQuery(); if (r > 0) { check = true; } } //Clear cache System.Web.HttpContext.Current.Cache.Remove("LienHe"); } catch { } return(check); }
public JsonResult _LienHe([Bind(Exclude = "")] LienHe model) { var respone = new { mess = 0 }; //mặc định là gửi thất bại if (ModelState.IsValid) { //if (CaptchaText == HttpContext.Session["captchastring"].ToString()) //{ _lienHeRepos.Insert(model); //gửi email string template = "<h2 stype='text-align: center; font-size: 16px; color: #3c763d; padding: 10px 0px; background: #dff0d8'>Khách hàng liên hệ</h2>"; template += "<table style= 'width: 100%; margin-top: 15px;'>"; template += "<tr><td style='width: 150px; border-color: #bce8f1; background-color: #d9edf7; color: #31708f; padding: 15px;'>Họ và tên: </td><td> " + model.HoTen + "</td></tr>"; template += "<tr><td style='width: 150px; border-color: #bce8f1; background-color: #d9edf7; color: #31708f; padding: 15px;'>Email: </td><td> " + model.Email + "</td></tr>"; template += "<tr><td style='width: 150px; border-color: #bce8f1; background-color: #d9edf7; color: #31708f; padding: 15px;'>Điện thoại: </td><td> " + model.DienThoai + "</td></tr>"; template += "<tr><td style='width: 150px; border-color: #bce8f1; background-color: #d9edf7; color: #31708f; padding: 15px;'>Tiêu đề: </td><td> " + model.TieuDe + "</td></tr>"; template += "<tr><td style='width: 150px; border-color: #bce8f1; background-color: #d9edf7; color: #31708f; padding: 15px;'>Lời nhắn: </td><td> " + model.LoiNhan + "</td></tr>"; template += "</table>"; template += "<b>Note: Đây là email tự động được gửi, quý khách vui lòng không phản hồi trực tiếp email này.</b>"; Helpers.CommonHelper.SendMail(Helpers.SystemConfigHelper.GetSettingValue("NameEmail"), "Liên hệ từ khách hàng", template, Helpers.SystemConfigHelper.GetSettingValue("Email")); respone = new { mess = 1 }; // gửi đi thành công //} //else // respone = new { mess = 2 }; // không đúng mã capthca } return(Json(respone, JsonRequestBehavior.AllowGet)); }
public ActionResult Contact(LienHe model) { if (ModelState.IsValid) { var home = new HomeProcess(); var lh = new LienHe(); //gán dữ liệu từ client vào model lh.Ten = model.Ten; lh.Ho = model.Ho; lh.Email = model.Email; lh.DienThoai = model.DienThoai; lh.NoiDung = model.NoiDung; lh.NgayCapNhat = DateTime.Now; //gọi hàm lưu thông tin phản hồi từ khách hàng var result = home.InsertContact(lh); if (result > 0) { ViewBag.success = "Đã ghi nhận phản hồi của bạn"; ModelState.Clear(); return(View()); } else { ModelState.AddModelError("", "Lỗi ghi nhận"); } } return(View(model)); }
public ActionResult Contact(LienHe lienHe) { lienHe.NgayGui = DateTime.Now; lienHeRepository.Add(lienHe); ViewBag.Message = "1"; return(View()); }
protected void btGuiLienHe_Click(object sender, EventArgs e) { try { CaptchaControlLienHe.ValidateCaptcha(txtCapcha.Text.Trim()); if (CaptchaControlLienHe.UserValidated) { //Thanh cong xuat ra cai label if (Page.IsValid)//If tat ca dATA hop le { bool result = false; LienHe data = GetData(); result = LienHe.Add(data); lbResultThongBao.Text = result ? "Cảm ơn bạn đã góp ý. Chúc các bạn một ngày may mắn" : "Gửi góp ý không thành công"; if (result) { Reset(); } } } else { //that bai lbResult.Text = "Nhập sai mã bảo vệ"; } } catch (SqlException sql) { lbResult.Text = "" + sql.Message; } catch (Exception ex) { lbResult.Text = "" + ex.Message; } }
public IHttpActionResult PutLienHe(int id, LienHe lienHe) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != lienHe.MaLH) { return(BadRequest()); } db.Entry(lienHe).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LienHeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Index(FormCollection collection) { string fullname = collection.Get("fullName"); string email = collection.Get("email"); string phoneNumber = collection.Get("phonenumber"); string address = collection.Get("address"); string content = collection.Get("content"); LienHe lh = new LienHe() { hoten = fullname, email = email, sdt = phoneNumber, diachi = address, noidung = content }; LienHeDAO lienHeDAO = new LienHeDAO(); lienHeDAO.AddLH(lh); TempData["msg"] = "<script>alert('Shop đã nhận liên hệ của quý khách');</script>"; return(View()); }
/// <summary> /// hàm lưu phản hồi từ khách hàng vào db /// </summary> /// <param name="entity">LienHe</param> /// <returns>int</returns> public int InsertContact(LienHe entity) { db.LienHes.Add(entity); db.SaveChanges(); return(entity.MaLH); }
private void DgvContacts_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (dgvContacts.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null) { string tenGoi = dgvContacts.Rows[e.RowIndex].Cells[0].FormattedValue.ToString(); if (tenGoi != null) { LienHe lh = LienHe.GetLienHe(tenGoi); label1.Text = "Địa chỉ:"; label2.Text = "Email:"; label3.Text = "Số điện thoại:"; lblTenGoi.Text = lh.TenGoi; lblDiaChi.Text = lh.DiaChi; lblEmail.Text = lh.Email; lblSDT.Text = lh.SDT; } else { lblTenGoi.Text = ""; lblDiaChi.Text = ""; lblEmail.Text = ""; lblSDT.Text = ""; label1.Text = ""; label2.Text = ""; label3.Text = ""; } } }catch (Exception ex) {} }
public List <LienHe> LienHe_GetByTop(string Top, string Where, string Order) { List <LienHe> list = new List <LienHe>(); using (SqlCommand dbCmd = new SqlCommand("sp_LienHe_getByTop", openConnection())) { LienHe obj = new LienHe(); dbCmd.CommandType = CommandType.StoredProcedure; dbCmd.Parameters.Add(new SqlParameter("@Top", Top)); dbCmd.Parameters.Add(new SqlParameter("@Where", Where)); dbCmd.Parameters.Add(new SqlParameter("@Order", Order)); SqlDataReader dr = dbCmd.ExecuteReader(); dr.Close(); dr = dbCmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { list.Add(obj.LienHeIDataReader(dr)); } } dr.Close(); obj = null; } return(list); }
public async Task <IHttpActionResult> Update(int lienHeID, [FromBody] LienHe lienHe) { if (lienHe.LienHeID != lienHeID) { return(BadRequest("Id mismatch")); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } using (var db = new ApplicationDbContext()) { db.Entry(lienHe).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException ducEx) { bool exists = db.LienHe.Count(o => o.LienHeID == lienHeID) > 0; if (!exists) { return(NotFound()); } else { throw ducEx; } } return(Ok(lienHe)); } }
private void TsbXoaLienLac_Click(object sender, EventArgs e) { try { int hanghientai = dgvContacts.CurrentCell.RowIndex; String tenGoi = dgvContacts.Rows[hanghientai].Cells[0].Value.ToString(); if (tenGoi != null) { if (MessageBox.Show("Bạn có thực sự muốn xóa liên hệ này không?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.OK) { dgvContacts.Rows.RemoveAt(dgvContacts.CurrentCell.RowIndex); bdsContacts.DataSource = dgvContacts.DataSource; LienHe.Remove(tenGoi); List <LienHe> dslh = LienHe.GetList(dgvGroup.CurrentCell.Value.ToString()); if (dslh.Count >= 1) { String tenGoiMoi = dgvContacts.Rows[0].Cells[0].Value.ToString(); if (tenGoiMoi != null) { LienHe lh = LienHe.GetLienHe(tenGoiMoi); label1.Text = "Địa chỉ:"; label2.Text = "Email:"; label3.Text = "Số điện thoại:"; lblTenGoi.Text = lh.TenGoi; lblDiaChi.Text = lh.DiaChi; lblEmail.Text = lh.Email; lblSDT.Text = lh.SDT; } else { lblTenGoi.Text = ""; lblDiaChi.Text = ""; lblEmail.Text = ""; lblSDT.Text = ""; label1.Text = ""; label2.Text = ""; label3.Text = ""; } } else { lblTenGoi.Text = ""; lblDiaChi.Text = ""; lblEmail.Text = ""; lblSDT.Text = ""; label1.Text = ""; label2.Text = ""; label3.Text = ""; } } } } catch (Exception ex) { MessageBox.Show("Vui lòng chọn liên hệ muốn xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public ActionResult DeleteConfirmed(int id) { LienHe lienHe = db.LienHes.Find(id); db.LienHes.Remove(lienHe); db.SaveChanges(); return(RedirectToAction("Index")); }
private void btnThemSuKien_Click(object sender, EventArgs e) { LienHe lienHe = cbNguoiPhuTrach.SelectedItem as LienHe; SuKienDAO.Instance.InsertSuKien(txbTenSuKien.Text, rtNoiDungSuKien.Text, dtpkNgayBatDau.Value, dtpkNgayKetThuc.Value, rtThanhPhan.Text, rtDiaDiem.Text, rtHoTroMuonDo.Text, lienHe.Id); LoadSuKienByDate(dtpkNgayBatDauLoc.Value, dtpkNgayKetThucLoc.Value); }
public IActionResult subri() { LienHe lh = new LienHe { ProductTypes = _context.ProductTypes.ToList() }; return(View(lh)); }
public IActionResult About() { LienHe lh = new LienHe { ProductTypes = _context.ProductTypes.ToList(), productBrands = _context.ProductBrands.ToList() }; return(View(lh)); }
public ActionResult Edit([Bind(Include = "MaLH,HoTenKH,Email,SDT,DiaChi,NoiDung")] LienHe lienHe) { if (ModelState.IsValid) { db.Entry(lienHe).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(lienHe)); }
public bool themLienHe(LienHe lh) { if (!db.LienHes.Contains(lh)) { db.LienHes.InsertOnSubmit(lh); db.SubmitChanges(); return(true); } return(false); }
public ActionResult ChinhSua(LienHe lh) { if (ModelState.IsValid) { db.Entry(lh).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Edit([Bind(Include = "maLH,sdt,diachi,email,hoten,noidung")] LienHe lienHe) { if (ModelState.IsValid) { db.Entry(lienHe).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(lienHe)); }
public ActionResult ThemMoi(LienHe lh) { if (ModelState.IsValid) { db.LienHe.Add(lh); db.SaveChanges(); return(RedirectToAction("Index", "QuanLyThongTinLienHe")); } return(View()); }
private void TsbXoaNhom_Click(object sender, EventArgs e) { try { int hanghientai = dgvGroup.CurrentCell.RowIndex; String tenNhom = dgvGroup.Rows[hanghientai].Cells[0].Value.ToString(); if (tenNhom != null) { if (MessageBox.Show("Bạn có thực sự muốn xóa nhóm này không?", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.OK) { dgvGroup.Rows.RemoveAt(dgvGroup.CurrentCell.RowIndex); bdsGroups.DataSource = dgvGroup.DataSource; LienHe.RemoveListContact(tenNhom); Nhom.Remove(tenNhom); dgvContacts.Rows.Clear(); List <LienHe> dslh = LienHe.GetList(dgvGroup.Rows[0].Cells[0].FormattedValue.ToString()); if (dslh != null) { foreach (var i in dslh) { dgvContacts.Rows.Add(i.TenGoi, i.Email, i.SDT); } LienHe lh = LienHe.GetLienHe(dgvContacts.Rows[0].Cells[0].FormattedValue.ToString()); if (lh != null) { label1.Text = "Địa chỉ:"; label2.Text = "Email:"; label3.Text = "Số điện thoại:"; lblTenGoi.Text = lh.TenGoi; lblDiaChi.Text = lh.DiaChi; lblEmail.Text = lh.Email; lblSDT.Text = lh.SDT; } else { lblTenGoi.Text = ""; lblDiaChi.Text = ""; lblEmail.Text = ""; lblSDT.Text = ""; label1.Text = ""; label2.Text = ""; label3.Text = ""; } } } } } catch (Exception ex) { MessageBox.Show("Vui lòng chọn nhóm muốn xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public ActionResult Create([Bind(Include = "maLH,sdt,diachi,email,hoten,noidung")] LienHe lienHe) { if (ModelState.IsValid) { db.LienHes.Add(lienHe); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(lienHe)); }
public IHttpActionResult GetLienHe(int id) { LienHe lienHe = db.LienHes.Find(id); if (lienHe == null) { return(NotFound()); } return(Ok(lienHe)); }
//Xoá public ActionResult Xoa(int?makhuvuc) { LienHe lh = db.LienHe.SingleOrDefault(n => n.makhuvuc == makhuvuc); if (lh == null) { Response.StatusCode = 404; return(null); } return(View(lh)); }
public ActionResult Create([Bind(Include = "MaLH,HoTenKH,Email,SDT,DiaChi,NoiDung")] LienHe lienHe) { if (ModelState.IsValid) { db.LienHes.Add(lienHe); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(lienHe)); }
public IHttpActionResult PostLienHe(LienHe lienHe) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.LienHes.Add(lienHe); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = lienHe.MaLH }, lienHe)); }
public void ResetListLienHe() { SelectedLienHe = null; if (DSLienHe.Count != 0) { DSLienHe.Clear(); } foreach (LienHe item in LienHe.DB) { DSLienHe.Add(item); } }
public LienHe GetYeuCauTuVan(int id) { var tour = new LienHe(); using (var conn = new SqlConnection(this._db.Database.GetDbConnection().ConnectionString)) { conn.Open(); tour = conn.Query <LienHe>(@"select * from LienHe where ID = " + id).FirstOrDefault(); conn.Close(); } return(tour); }
//Lay du lieu tu form de them moi or cap nhat private LienHe GetData() { LienHe data = null; if (lbMaLH.Text != "") { data = LienHe.LienHe_Single(lbMaLH.Text); } else { data = new LienHe(); } data.HoTen = txtHoVaTen.Text; data.DiaChi = txtDiaChi.Text; data.Email = txtEmail.Text; data.DienThoai = txtDienThoai.Text; data.TieuDe = txtTieuDe.Text; data.NoiDung = txtNoiDung.Text; return data; }
public ActionResult Contact(LienHe contact) { if (ModelState.IsValid) { try { ContactService ctService = new ContactService(); if (ctService.PostContact(contact)) { return RedirectToAction("Contact", new { message = "Thông tin của bạn đã gửi thành công" }); } ModelState.AddModelError("", "Đã có lỗi xảy ra, vui lòng thử lại"); } catch (Exception) { ModelState.AddModelError("", "Đã có lỗi xảy ra, vui lòng thử lại"); } } return View(); }
protected void btnbtnGui_Click(object sender, EventArgs e) { // Neu tat ca du lieu deu duoc nhap hop le if (Page.IsValid) { CaptchaProvider captchaPro = new CaptchaProvider(); if (captchaPro.IsValidCode(txtInputString.Text)) { lbcapcha.Visible = false; bool rs = false; LienHe data = new LienHe(); data.HoTen = txtHoTen.Text; data.Email = txtEmail.Text; data.TieuDe = txtTieuDe.Text; data.NoiDung = txtNoiDung.Text; data.DiaChi = txtDiaChi.Text; data.NgayGui = DateTime.Now; data.TrangThai = 0; data.TheLoai = 1; rs = LienHe.Them(data); if (rs) { succesfull.Visible = true; refesh(); succesfull.Text = "Sent Successfull!"; } else { succesfull.Visible = true; succesfull.Text = "Failed send!"; } } else { lbcapcha.Visible = true; succesfull.Visible = false; lbcapcha.Text = "Incorrect code!"; } } }
protected override void Render(HtmlTextWriter writer) { StringBuilder sb = new StringBuilder(); ClientScriptManager cs = this.Page.ClientScript; #region tham số String socanbo = Request["SoCanBo"]; String quymonhamay = Request["QuyMoNhaMay"]; String xuatkhau = Request["TyLeXuatKhau"]; String doanhthu = Request["DoanhThuHangNam"]; String solaodong = Request["SoLaoDong"]; String vonphapdinh = Request["VonPhapDinh"]; String tinhid = Request["TenTinh"]; String namThanhLap = Request["NamThanhLap"]; String imgLH = Request["ImageLienHe"]; String diaChiLH = Request["DiaChiNguoiLienHe"]; String yahoo = Request["Yahoo"]; String chucDanh = Request["ChucDanh"]; String diDong = Request["DiDong"]; String dienThoai = Request["DienThoai"]; String emailLienHe = Request["EmailLienHe"]; String gioiTinh = Request["GioiTinh"]; String tenLienHe = Request["TenNguoiLienHe"]; String diaChiNhaMay = Request["DiaChiNhaMay"]; String chinhanh = Request["ChiNhanhDN"]; String nguoiDaiDien = Request["NguoiDaiDien"]; String diachiDN = Request["DiaChiDN"]; String tenDN = Request["TenDN"]; String dienthoaiDN = Request["DienThoaiDN"]; String faxDN = Request["FaxDN"]; String web = Request["Web"]; String mota = Request["ChiTietCongTy"]; String logo = Request["AnhLogo"]; String spdv= Request["SPDV"]; String arrthitruong=Request["ThiTruong"]; String arrchatluong = Request["ChatLuong"]; String arrloaiDN = Request["LoaiDN"]; //// string msg = Request["NoiDungLienHe"]; string msgtitle = Request["msgtitle"]; sendEmailDele _dele = new sendEmailDele(sendmailThongbao); string ldm_ma = Request["LDM_Ma"]; #endregion switch (subAct) { 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 "LoadThongTin": #region load thong tin doanh nghiep( gian hang) sb.Append("(" + JavaScriptConvert.SerializeObject(GianHangDal.SelectDmIdByGhUser(Security.Username)) + ")"); break; #endregion case "infoSave": #region lưu dữ liệu thông tin doanh nghiệp GianHang itemGH = new GianHang(); Relation itemRLT = new Relation(); LienHe itemLH = new LienHe(); Member itemMember = MemberDal.Select_InsertIntoLhByUser(Security.Username); //update vào gian hàng itemGH = GianHangDal.SelectByUserName(Security.Username); //itemGH = GianHangDal.SelectByUserName("*****@*****.**"); itemGH.ID = itemGH.ID; itemGH.Anh = logo; itemGH.MoTa = mota; if (itemGH.Website != "http://" || itemGH.Website!=null) { itemGH.Website = web; } itemGH.Ten = tenDN; itemGH.DiaChi = diachiDN; itemGH.NguoiDaiDien = nguoiDaiDien; itemGH.TomTat = chinhanh; itemGH.GioiThieu = diaChiNhaMay; itemGH.Active = true; itemGH.DamBao = false; itemGH.DienThoai = dienthoaiDN; itemGH.Fax = faxDN; itemGH.NamThanhLap = int.Parse(namThanhLap); itemGH.ActiveDate = DateTime.Now; itemGH.NgayTao = DateTime.Now; if (tinhid != null) { itemGH.TINH_ID = int.Parse(tinhid); } else { itemGH.TINH_ID = 0; } itemGH.LTV_ID = 11021; //itemGH.RowId = Guid.NewGuid(); itemGH = GianHangDal.Update(itemGH); //Save vào tblLienHe Người liên hệ itemLH=LienHeDal.SelectByPId(itemMember.RowId.ToString()); if(gioiTinh=="Nam"){ itemLH.GioiTinh =true; } else { itemLH.GioiTinh = false; } itemLH.Ten = tenLienHe; itemLH.Email = emailLienHe; itemLH.Phone = dienThoai; itemLH.Mobile = diDong; itemLH.ChucDanh = chucDanh; itemLH.Ym = yahoo; itemLH.DiaChi = diaChiLH; itemLH.Anh = imgLH; itemLH.NgayCapNhat = DateTime.Now; itemLH.NguoiCapNhat = Security.Username; itemLH.Active = true; itemLH = LienHeDal.Update(itemLH); //itemLH = LienHeDal.Insert(itemLH); //combox, check box Insert vào tblRelation Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(arrchatluong, itemGH.RowId.ToString(), "TV_ISO"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(arrthitruong, itemGH.RowId.ToString(), "TV_TTRUONG"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(arrloaiDN, itemGH.RowId.ToString(), "DN_LOAI"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(vonphapdinh, itemGH.RowId.ToString(), "TV_VON"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(spdv, itemGH.RowId.ToString(), "SP_NHOM"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(tinhid, itemGH.RowId.ToString(), "KV_TINH"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(solaodong, itemGH.RowId.ToString(), "TV_LD"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(socanbo, itemGH.RowId.ToString(), "TV_R&D"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(doanhthu, itemGH.RowId.ToString(), "TV_DTHU"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(xuatkhau, itemGH.RowId.ToString(), "TV_XK"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(quymonhamay, itemGH.RowId.ToString(), "TV_QUYMONM"); break; #endregion case "EmailMember": sb.Append(JavaScriptConvert.SerializeObject(MemberDal.SelectByUser(Security.Username))); break; case "loadDM": #region load hỗ trợ đăng ký doanh nghiệp sb.Append(JavaScriptConvert.SerializeObject(DanhMucDal.SelectLangBasedByPID("", ldm_ma,"0"))); break; #endregion case "scpt": #region Nạp js sb.AppendFormat(@"{0}" , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.thongTinDonVi.thongTinChung.JScript1.js")); break; #endregion default: #region FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId); sb.Append(@" <div id=""form-mdl""></div>"); sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>" , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.thongTinDonVi.thongTinChung.JScript1.js") , "{thongTinDonViFn.loadForm();}"); 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 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); }
protected override void Render(HtmlTextWriter writer) { StringBuilder sb = new StringBuilder(); ClientScriptManager cs = this.Page.ClientScript; #region Tham số String socanbo = Request["SoCanBo"]; String quymonhamay = Request["QuyMoNhaMay"]; String xuatkhau = Request["TyLeXuatKhau"]; String doanhthu = Request["DoanhThuHangNam"]; String solaodong = Request["SoLaoDong"]; String vonphapdinh = Request["VonPhapDinh"]; String spdv = Request["SPDV"]; String arrthitruong = Request["ThiTruong"]; String arrchatluong = Request["ChatLuong"]; String arrloaiDN = Request["LoaiDN"]; String imgLH = Request["ImageLienHe"]; String diaChiLH = Request["DiaChiNguoiLienHe"]; String yahoo = Request["Yahoo"]; String chucDanh = Request["ChucDanh"]; String diDong = Request["DiDong"]; String dienThoai = Request["DienThoai"]; String emailLienHe = Request["EmailLienHe"]; String gioiTinh = Request["GioiTinh"]; String tenLienHe = Request["TenNguoiLienHe"]; String diaChiNhaMay = Request["DiaChiNhaMay"]; String chinhanh = Request["ChiNhanhDN"]; String nguoiDaiDien = Request["NguoiDaiDien"]; #region Tham so GianHang string _GH_ID = Request["ID"]; string _CQ_ID = Request["CQ_ID"]; string _TINH_ID = Request["TINH_ID"]; string _NhomDN_ID = Request["NhomDN_ID"]; string _LTV_ID = Request["LTV_ID"]; string _LDN_ID = Request["LDN_ID"]; string _MEM_ID = Request["MEM_ID"]; string _Lang = Request["Lang"]; string _LangBased = Request["LangBased"]; string _LangBasedId = Request["LangBasedId"]; string _Ma = Request["Ma"]; string _Ten = Request["Ten"]; string _TomTat = Request["TomTat"]; string _MoTa = Request["MoTa"]; string _LienHe = Request["LienHe"]; String _NguoiDaiDien = Request["NguoiDaiDien"]; string _ChinhSach = Request["ChinhSach"]; string _Footer = Request["Footer"]; string _GioiThieu = Request["GioiThieu"]; string _Anh = Request["Anh"]; string _Flash = Request["Flash"]; string _FlashFile = Request["FlashFile"]; string _FlashWidth = Request["FlashWidth"]; string _FlashHeight = Request["FlashHeight"]; string _Slogan = Request["Slogan"]; string _Banner = Request["Banner"]; string _BannerType = Request["BannerType"]; string _DungGiaoDien = Request["DungGiaoDien"]; string _GD_ID = Request["GD_ID"]; string _DiaChi = Request["DiaChi"]; string _website = Request["Website"]; string _dienthoai = Request["DienthoaiDN"]; string _Email = Request["Email"]; string _NamThanhLap = Request["NamThanhLap"]; string _ToaDo = Request["ToaDo"]; string _Xem = Request["Xem"]; string _BinhChon = Request["BinhChon"]; string _Diem = Request["Diem"]; string _Hotline = Request["Hotline"]; string _NgayTao = Request["NgayTao"]; string _NgayCapNhat = Request["NgayCapNhat"]; string _KichHoat = Request["KichHoat"]; string _NgayKichHoat = Request["NgayKichHoat"]; string _DamBao = Request["DamBao"]; string _NgayDamBao = Request["NgayDamBao"]; string _rows_id = Request["Rows_ID"]; string _q = Request["q"]; string _startDateLTV = Request["GH_NgayBatDau"]; string _endDateLTV = Request["GH_NgayKetThuc"]; string ldm_ma = Request["LDM_Ma"]; #endregion #region Tham so ChungChi string _cc_id = Request["CC_ID"]; string _cc_gh_id = Request["CC_GH_ID"]; string _cc_thutu = Request["CC_TT"]; string _cc_anh = Request["CC_Anh"]; string _cc_ten = Request["CC_Ten"]; string _cc_so = Request["CC_So"]; string _cc_gioihan = Request["CC_GioiHan"]; string _cc_donvicap = Request["CC_DonViCap"]; string _cc_ngaycap = Request["CC_NgayCap"]; string _cc_active = Request["CC_Active"]; #endregion #region Tham so ThuVien string _tv_id = Request["TV_ID"]; string _tv_gh_id = Request["TV_GH_ID"]; string _tv_ten = Request["TV_Ten"]; string _tv_mota = Request["TV_Mota"]; string _tv_keyword = Request["TV_Keyword"]; string _tv_UrlImage = Request["TV_UrlImage"]; string _tv_Url = Request["TV_Url"]; string _tv_thutu = Request["TV_Thutu"]; string _tv_loai = Request["TV_Loai"]; string _tv_ngaytao = Request["TV_Ngaytao"]; string _tv_active = Request["TV_Active"]; string _tv_nguoitao = Request["TV_NguoiTao"]; string _rows = Request["rows"]; #endregion #region Tham so Flash string _flh_id = Request["Flh_ID"]; string _flh_gh_id = Request["Flh_GH_ID"]; string _flh_vitri = Request["Flh_Vitri"]; string _flh_ten = Request["Flh_Ten"]; string _flh_mota = Request["Flh_Mota"]; string _flh_pathimg = Request["Flh_UrlImage"]; string _flh_pathflash = Request["Flh_Url"]; string _flh_link = Request["Flh_Link"]; string _flh_thutu = Request["Flh_Thutu"]; string _flh_nguoitao = Request["Flh_NguoiTao"]; string _flh_ngaytao = Request["Flh_NgayTao"]; string _flh_active = Request["Flh_Active"]; #endregion #region Tham so Hình Ảnh doanh nghiệp string _ha_id = Request["HA_ID"]; string _ha_gh_id = Request["HA_GH_ID"]; string _ha_vitri = Request["HA_Vitri"]; string _ha_ten = Request["HA_Ten"]; string _ha_mota = Request["HA_Mota"]; string _ha_pathimg = Request["HA_UrlImage"]; string _ha_link = Request["HA_Link"]; string _ha_nguoitao = Request["HA_NguoiTao"]; string _ha_ngaytao = Request["HA_NgayTao"]; string _ha_active = Request["HA_Active"]; #endregion string lienhe = ""; string msgDN = Request["NoiDungLienHeDN"]; string Repass = Request["RePass"]; sendEmailDele _dele = new sendEmailDele(sendmailThongbao); #endregion switch (subAct) { case "getChuaDuyet": #region Get du lieu cho grid if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "ID"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc"; Pager<GianHang> PageGet = GianHangDal.pagerNormal("", false, "GH_" + jgrsidx + " " + jgrsord, "0", "1", _q, _NhomDN_ID, _TINH_ID, _LTV_ID, _LDN_ID, "", Request["rows"]); List<jgridRow> ListRow = new List<jgridRow>(); int a = 0; foreach (GianHang gh in PageGet.List) { a = a + 1; ListRow.Add(new jgridRow(gh.ID.ToString(), new string[] { gh.ID.ToString(), a.ToString(), string.Format(gh.Ten==null?"":gh.Ten), string.Format(gh.DiaChi==null? "":gh.DiaChi), string.Format(gh.TenTinh==null?"":gh.TenTinh), gh.NgayTao.ToString("dd/MM/yyyy"), gh.NguoiTao, string.Format(gh.Website==null?"":gh.Website), string.Format(gh.LH_Ten==null?"":gh.LH_Ten), string.Format(gh.LH_Mobile==null?"":gh.LH_Mobile), //string.Format(DanhMucDal.SelectById(gh.LTV_ID)==null? "":DanhMucDal.SelectById(gh.LTV_ID).Ma), string.Format(gh.NguoiDaiDien==null?"":gh.NguoiDaiDien), string.Format(MemberDal.SelectAllByUserName(gh.NguoiTao).Email==null?"":MemberDal.SelectAllByUserName(gh.NguoiTao).Email), string.Format(gh.DienThoai==null?"":gh.DienThoai) })); } jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PageGet.TotalPages.ToString(), PageGet.Total.ToString(), ListRow); sb.Append(JavaScriptConvert.SerializeObject(grid)); break; #endregion case "getDuyet": #region Get du lieu cho grid if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "NgayTao"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc"; Pager<GianHang> PageGetDuyet = GianHangDal.pagerNormal("", false, "GH_" + jgrsidx + " " + jgrsord, "1", "1", _q, _NhomDN_ID, _TINH_ID, _LTV_ID, _LDN_ID, "", Request["rows"]); List<jgridRow> ListRowDuyet = new List<jgridRow>(); int b = 0; foreach (GianHang gh in PageGetDuyet.List) { b = b + 1; ListRowDuyet.Add(new jgridRow(gh.ID.ToString(), new string[] { gh.ID.ToString(), b.ToString(), string.Format(gh.Ten==null?"":gh.Ten), string.Format(gh.DiaChi==null? "":gh.DiaChi), string.Format(gh.TenTinh==null?"":gh.TenTinh), gh.NgayTao.ToString("dd/MM/yyyy"), gh.NguoiTao, string.Format(gh.Website==null?"":gh.Website), string.Format(gh.LH_Ten==null?"":gh.LH_Ten), string.Format(gh.LH_Mobile==null?"":gh.LH_Mobile), string.Format(gh.NguoiDaiDien==null?"":gh.NguoiDaiDien), string.Format(MemberDal.SelectAllByUserName(gh.NguoiTao).Email==null?"":MemberDal.SelectAllByUserName(gh.NguoiTao).Email), string.Format(gh.DienThoai==null?"":gh.DienThoai) })); } jgrid gridDuyet = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PageGetDuyet.TotalPages.ToString(), PageGetDuyet.Total.ToString(), ListRowDuyet); sb.Append(JavaScriptConvert.SerializeObject(gridDuyet)); break; #endregion case "getTVV": #region Get du lieu cho grid if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "NgayTao"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc"; Pager<GianHang> PageGetTVV = GianHangDal.pagerNormal("", false, "GH_" + jgrsidx + " " + jgrsord, "1", "1", _q, _NhomDN_ID, _TINH_ID, _LTV_ID, _LDN_ID, "TV_VANG", Request["rows"]); List<jgridRow> ListRowTVV = new List<jgridRow>(); int c = 0; foreach (GianHang gh in PageGetTVV.List) { c = c + 1; ListRowTVV.Add(new jgridRow(gh.ID.ToString(), new string[] { gh.ID.ToString(), c.ToString(), string.Format(gh.Ten==null?"":gh.Ten), string.Format(gh.DiaChi==null? "":gh.DiaChi), string.Format(gh.TenTinh==null?"":gh.TenTinh), gh.NgayTao.ToString("dd/MM/yyyy"), gh.NguoiTao, string.Format(gh.Website==null?"":gh.Website), string.Format(gh.LH_Ten==null?"":gh.LH_Ten), string.Format(gh.LH_Mobile==null?"":gh.LH_Mobile), string.Format(gh.NguoiDaiDien==null?"":gh.NguoiDaiDien), string.Format(MemberDal.SelectAllByUserName(gh.NguoiTao).Email==null?"":MemberDal.SelectAllByUserName(gh.NguoiTao).Email), string.Format(gh.DienThoai==null?"":gh.DienThoai) })); } jgrid gridTVV = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PageGetTVV.TotalPages.ToString(), PageGetTVV.Total.ToString(), ListRowTVV); sb.Append(JavaScriptConvert.SerializeObject(gridTVV)); break; #endregion case "getTVB": #region Get du lieu cho grid if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "NgayTao"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc"; Pager<GianHang> PageGetTVB = GianHangDal.pagerNormal("", false, "GH_" + jgrsidx + " " + jgrsord, "1", "1", _q, _NhomDN_ID, _TINH_ID, _LTV_ID, _LDN_ID, "TV_BAC", Request["rows"]); List<jgridRow> ListRowTVB = new List<jgridRow>(); int d = 0; foreach (GianHang gh in PageGetTVB.List) { d = d + 1; ListRowTVB.Add(new jgridRow(gh.ID.ToString(), new string[] { gh.ID.ToString(), d.ToString(), string.Format(gh.Ten==null?"":gh.Ten), string.Format(gh.DiaChi==null? "":gh.DiaChi), string.Format(gh.TenTinh==null?"":gh.TenTinh), gh.NgayTao.ToString("dd/MM/yyyy"), gh.NguoiTao, string.Format(gh.Website==null?"":gh.Website), string.Format(gh.LH_Ten==null?"":gh.LH_Ten), string.Format(gh.LH_Mobile==null?"":gh.LH_Mobile), string.Format(gh.NguoiDaiDien==null?"":gh.NguoiDaiDien), string.Format(MemberDal.SelectAllByUserName(gh.NguoiTao).Email==null?"":MemberDal.SelectAllByUserName(gh.NguoiTao).Email), string.Format(gh.DienThoai==null?"":gh.DienThoai) })); } jgrid gridTVB = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PageGetTVB.TotalPages.ToString(), PageGetTVB.Total.ToString(), ListRowTVB); sb.Append(JavaScriptConvert.SerializeObject(gridTVB)); break; #endregion case "getTVD": #region Get du lieu cho grid if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "NgayTao"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc"; Pager<GianHang> PageGetTVD = GianHangDal.pagerNormal("", false, "GH_" + jgrsidx + " " + jgrsord, "1", "1", _q, _NhomDN_ID, _TINH_ID, _LTV_ID, _LDN_ID, "TV_DONG", Request["rows"]); List<jgridRow> ListRowTVD = new List<jgridRow>(); int e = 0; foreach (GianHang gh in PageGetTVD.List) { e = e + 1; ListRowTVD.Add(new jgridRow(gh.ID.ToString(), new string[] { gh.ID.ToString(), e.ToString(), string.Format(gh.Ten==null?"":gh.Ten), string.Format(gh.DiaChi==null? "":gh.DiaChi), string.Format(gh.TenTinh==null?"":gh.TenTinh), gh.NgayTao.ToString("dd/MM/yyyy"), gh.NguoiTao, string.Format(gh.Website==null?"":gh.Website), string.Format(gh.LH_Ten==null?"":gh.LH_Ten), string.Format(gh.LH_Mobile==null?"":gh.LH_Mobile), string.Format(gh.NguoiDaiDien==null?"":gh.NguoiDaiDien), string.Format(MemberDal.SelectAllByUserName(gh.NguoiTao).Email==null?"":MemberDal.SelectAllByUserName(gh.NguoiTao).Email), string.Format(gh.DienThoai==null?"":gh.DienThoai) })); } jgrid gridTVD = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PageGetTVD.TotalPages.ToString(), PageGetTVD.Total.ToString(), ListRowTVD); sb.Append(JavaScriptConvert.SerializeObject(gridTVD)); break; #endregion case "getTVMP": #region Get du lieu cho grid if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "NgayTao"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc"; Pager<GianHang> PageGetTVMP = GianHangDal.pagerNormal("", false, "GH_" + jgrsidx + " " + jgrsord, "1", "1", _q, _NhomDN_ID, _TINH_ID, _LTV_ID, _LDN_ID, "TV_FREE", Request["rows"]); List<jgridRow> ListRowTVMP = new List<jgridRow>(); int f = 0; foreach (GianHang gh in PageGetTVMP.List) { f = f + 1; ListRowTVMP.Add(new jgridRow(gh.ID.ToString(), new string[] { gh.ID.ToString(), f.ToString(), string.Format(gh.Ten==null?"":gh.Ten), string.Format(gh.DiaChi==null? "":gh.DiaChi), string.Format(gh.TenTinh==null?"":gh.TenTinh), gh.NgayTao.ToString("dd/MM/yyyy"), gh.NguoiTao, string.Format(gh.Website==null?"":gh.Website), string.Format(gh.LH_Ten==null?"":gh.LH_Ten), string.Format(gh.LH_Mobile==null?"":gh.LH_Mobile), string.Format(gh.NguoiDaiDien==null?"":gh.NguoiDaiDien), string.Format(MemberDal.SelectAllByUserName(gh.NguoiTao).Email==null?"":MemberDal.SelectAllByUserName(gh.NguoiTao).Email), string.Format(gh.DienThoai==null?"":gh.DienThoai) })); } jgrid gridTVMP = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PageGetTVMP.TotalPages.ToString(), PageGetTVMP.Total.ToString(), ListRowTVMP); sb.Append(JavaScriptConvert.SerializeObject(gridTVMP)); break; #endregion case "getTVBK": #region Get du lieu cho grid if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "NgayTao"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc"; Pager<GianHang> PageGetTVK = GianHangDal.pagerNormal("", false, "GH_" + jgrsidx + " " + jgrsord, null, "0", _q, _NhomDN_ID, _TINH_ID, _LTV_ID, _LDN_ID, "TV_FREE", Request["rows"]); List<jgridRow> ListRowTVK = new List<jgridRow>(); int g = 0; foreach (GianHang gh in PageGetTVK.List) { g = g + 1; ListRowTVK.Add(new jgridRow(gh.ID.ToString(), new string[] { gh.ID.ToString(), g.ToString(), string.Format(gh.Ten==null?"":gh.Ten), string.Format(gh.DiaChi==null? "":gh.DiaChi), string.Format(gh.TenTinh==null?"":gh.TenTinh), gh.NgayTao.ToString("dd/MM/yyyy"), gh.NguoiTao, string.Format(gh.Website==null?"":gh.Website), string.Format(gh.LH_Ten==null?"":gh.LH_Ten), string.Format(gh.LH_Mobile==null?"":gh.LH_Mobile), string.Format(gh.NguoiDaiDien==null?"":gh.NguoiDaiDien), string.Format(MemberDal.SelectAllByUserName(gh.NguoiTao).Email==null?"":MemberDal.SelectAllByUserName(gh.NguoiTao).Email), string.Format(gh.DienThoai==null?"":gh.DienThoai) })); } jgrid gridTVK = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PageGetTVK.TotalPages.ToString(), PageGetTVK.Total.ToString(), ListRowTVK); sb.Append(JavaScriptConvert.SerializeObject(gridTVK)); break; #endregion case "NangCapThanhVien": #region if (!string.IsNullOrEmpty(_GH_ID)) { sb.Append("(" + JavaScriptConvert.SerializeObject(GianHangDal.SelectByGh_IdAndLdm_ma(Convert.ToInt32(_GH_ID), "TV_LOAI")) + ")"); } break; #endregion case "boxacnhan": #region if (!string.IsNullOrEmpty(_GH_ID)) { GianHangDal.Xacnhan(_GH_ID, "0", "1"); } foreach (LienHe lh in LienHeDal.SelectByActive(true)) { lienhe += lh.Ten.ToString() + ", Điện thoại: " + lh.Mobile + ", Email: " + lh.Email + "<br/>"; } foreach (GianHang item in GianHangDal.SelectByListId(_GH_ID)) { _dele.BeginInvoke(item.Email , string.Format("Thống báo từ chonongnghiep.com") , string.Format(inviMailBody , item.Ten , item.DiaChi , item.Email , string.Format("bỏ xác nhận") , DateTime.Now , lienhe.ToString() ) , null, null); } break; #endregion case "saveNangCapLTV": #region lưu dữ liệu thông tin doanh nghiệp GianHang ghItem = new GianHang(); Relation rltItem = new Relation(); //update vào gian hàng string LTV_Ma = DanhMucDal.SelectById(int.Parse(_LTV_ID)).Ma; ghItem = GianHangDal.SelectById(int.Parse(_GH_ID)); if (LTV_Ma == "TV_VANG") { ghItem.NgayDKTV_Vang = Convert.ToDateTime(_startDateLTV,new CultureInfo("vi-vn")); ghItem.NgayKTTV_Vang = Convert.ToDateTime(_endDateLTV, new CultureInfo("vi-vn")); } if (LTV_Ma == "TV_BAC") { ghItem.NgayDKTV_Bac = Convert.ToDateTime(_startDateLTV, new CultureInfo("vi-vn")); ghItem.NgayKTTV_Bac = Convert.ToDateTime(_endDateLTV, new CultureInfo("vi-vn")); } if (LTV_Ma == "TV_DONG") { ghItem.NgayDKTV_Dong = Convert.ToDateTime(_startDateLTV, new CultureInfo("vi-vn")); ghItem.NgayKTTV_Dong = Convert.ToDateTime(_endDateLTV, new CultureInfo("vi-vn")); } ghItem.LTV_ID = int.Parse(_LTV_ID); ghItem = GianHangDal.Update(ghItem); //combox, check box Insert vào tblRelation Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(_LTV_ID, ghItem.RowId.ToString(), "TV_LOAI"); break; #endregion case "editGianHang": #region Edit doanh nghiệp if (!string.IsNullOrEmpty(_GH_ID)) { sb.Append("(" + JavaScriptConvert.SerializeObject(GianHangDal.SelectDmIdByGhId(Convert.ToInt32(_GH_ID))) + ")"); } break; #endregion case "LoadThongTinDN": #region load thong tin doanh nghiep( gian hang) sb.Append("(" + JavaScriptConvert.SerializeObject(GianHangDal.SelectDmIdByGhId(int.Parse(_GH_ID))) + ")"); break; #endregion case "loadDM": #region load hỗ trợ đăng ký doanh nghiệp sb.Append(JavaScriptConvert.SerializeObject(DanhMucDal.SelectLangBasedByPID("", ldm_ma, "0"))); break; #endregion case "infoBusinessSave": #region lưu dữ liệu thông tin doanh nghiệp GianHang itemGH = new GianHang(); Relation itemRLT = new Relation(); LienHe itemLH = new LienHe(); //update vào gian hàng itemGH = GianHangDal.SelectById(int.Parse(_GH_ID)); itemGH.ID = itemGH.ID; itemGH.Anh = _Anh; itemGH.MoTa = _MoTa; if (_website != "http://" || _website != null) { itemGH.Website = _website; } itemGH.Ten = _Ten; itemGH.DiaChi = _DiaChi; itemGH.NguoiDaiDien = _NguoiDaiDien; itemGH.TomTat = _TomTat; itemGH.GioiThieu = _GioiThieu; itemGH.Active = true; itemGH.DamBao = false; itemGH.DienThoai = _dienthoai; itemGH.NamThanhLap = int.Parse(_NamThanhLap); itemGH.ActiveDate = DateTime.Now; itemGH.NgayTao = DateTime.Now; itemGH.TINH_ID = int.Parse(_TINH_ID); itemGH.LTV_ID = 11021; itemGH = GianHangDal.Update(itemGH); //Save vào tblLienHe Người liên hệ itemLH = LienHeDal.SelectByGhId(int.Parse(_GH_ID)); if (gioiTinh == "Nam") { itemLH.GioiTinh = true; } else { itemLH.GioiTinh = false; } itemLH.Ten = tenLienHe; itemLH.Email = emailLienHe; itemLH.Phone = dienThoai; itemLH.Mobile = diDong; itemLH.ChucDanh = chucDanh; itemLH.Ym = yahoo; itemLH.DiaChi = diaChiLH; itemLH.Anh = imgLH; itemLH.NgayCapNhat = DateTime.Now; itemLH.NguoiCapNhat = Security.Username; itemLH.Active = true; itemLH = LienHeDal.Update(itemLH); //itemLH = LienHeDal.Insert(itemLH); //combox, check box Insert vào tblRelation //Relation_danhMuc_GianHangDal.InsertArrDMByGianHang("11019", itemGH.RowId.ToString(), "TV_LOAI"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(arrchatluong, itemGH.RowId.ToString(), "TV_ISO"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(arrthitruong, itemGH.RowId.ToString(), "TV_TTRUONG"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(arrloaiDN, itemGH.RowId.ToString(), "DN_LOAI"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(vonphapdinh, itemGH.RowId.ToString(), "TV_VON"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(spdv, itemGH.RowId.ToString(), "SP_NHOM"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(_TINH_ID, itemGH.RowId.ToString(), "KV_TINH"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(solaodong, itemGH.RowId.ToString(), "TV_LD"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(socanbo, itemGH.RowId.ToString(), "TV_R&D"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(doanhthu, itemGH.RowId.ToString(), "TV_DTHU"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(xuatkhau, itemGH.RowId.ToString(), "TV_XK"); Relation_danhMuc_GianHangDal.InsertArrDMByGianHang(quymonhamay, itemGH.RowId.ToString(), "TV_QUYMONM"); break; #endregion case "EmailMember": sb.Append(JavaScriptConvert.SerializeObject(MemberDal.SelectByUser(Security.Username))); break; case "getPid": #region get Setautocomplete gian hang GianHang _GHItem = new GianHang(); _GHItem.ID = 0; _GHItem.Ten = "Chọn"; GianHangCollection ListGetPid = new GianHangCollection(); ListGetPid = GianHangDal.SelectTree(_q); ListGetPid.Insert(0, _GHItem); sb.Append(JavaScriptConvert.SerializeObject(ListGetPid)); break; #endregion case "lienHeDN": #region lienheDN foreach (LienHe lh in LienHeDal.SelectByActive(true)) { lienhe += lh.Ten.ToString() + ", Điện thoại: " + lh.Mobile + ", Email: " + lh.Email + "<br/>"; } foreach (GianHang item in GianHangDal.SelectByListId(_GH_ID)) { _dele.BeginInvoke(item.Email , string.Format("Thông báo từ chonongnghiep.com") , string.Format(NoiDungLienHeDN , item.Ten , item.DiaChi , item.Email , msgDN , lienhe.ToString() ) , null, null); } break; #endregion case "xacnhan": #region if (!string.IsNullOrEmpty(_GH_ID)) { GianHangDal.Xacnhan(_GH_ID, "1", "1"); } foreach (LienHe lh in LienHeDal.SelectByActive(true)) { lienhe += lh.Ten.ToString() + ", Điện thoại: " + lh.Mobile + ", Email: " + lh.Email + "<br/>"; } foreach (GianHang item in GianHangDal.SelectByListId(_GH_ID)) { _dele.BeginInvoke(item.Email , string.Format("Thống báo từ chonongnghiep.com") , string.Format(inviMailBody , item.Ten , item.DiaChi , item.Email , string.Format("được xác nhận") , DateTime.Now , lienhe.ToString() ) , null, null); } break; #endregion case "Active": #region if (!string.IsNullOrEmpty(_GH_ID)) { GianHangDal.DungGH(_GH_ID, "0", DateTime.Now.ToString()); } foreach (LienHe lh in LienHeDal.SelectByActive(true)) { lienhe += " - " + lh.Ten.ToString() + ", Điện thoại: " + lh.Mobile + ", Email: " + lh.Email + "<br/>"; } foreach (GianHang item in GianHangDal.SelectByListId(_GH_ID)) { _dele.BeginInvoke(item.Email , string.Format("Thống báo từ chonongnghiep.com") , string.Format(inviMailBody , item.Ten , item.DiaChi , item.Email , string.Format("bị khóa") , DateTime.Now , lienhe.ToString() ) , null, null); } break; #endregion case "ActiveTVBK": #region if (!string.IsNullOrEmpty(_GH_ID)) { GianHangDal.DungGH(_GH_ID, "1", DateTime.Now.ToString()); } foreach (LienHe lh in LienHeDal.SelectByActive(true)) { lienhe += " - " + lh.Ten.ToString() + ", Điện thoại: " + lh.Mobile + ", Email: " + lh.Email + "<br/>"; } foreach (GianHang item in GianHangDal.SelectByListId(_GH_ID)) { _dele.BeginInvoke(item.Email , string.Format("Thống báo từ chonongnghiep.com") , string.Format(inviMailBody , item.Ten , item.DiaChi , item.Email , string.Format("được kích hoạt") , DateTime.Now , lienhe.ToString() ) , null, null); } break; #endregion case "del": #region xóa if (!string.IsNullOrEmpty(_GH_ID)) { GianHangDal.DeleteByIdList(_GH_ID); } foreach (LienHe lh in LienHeDal.SelectByActive(true)) { lienhe += lh.Ten.ToString() + ", Điện thoại: " + lh.Mobile + ", Email: " + lh.Email + "<br/>"; } foreach (GianHang item in GianHangDal.SelectByListId(_GH_ID)) { _dele.BeginInvoke(item.Email , string.Format("Thống báo từ chonongnghiep.com") , string.Format(inviMailBody , item.Ten , item.DiaChi , item.Email , string.Format("bị xóa") , DateTime.Now , lienhe.ToString() ) , null, null); } break; #endregion case "getChungChi": #region get chung chi if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "CC_ID"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc"; Pager<ChungChi> PagerGetCC = ChungChiDal.pagerNormal("", false, jgrsidx + " " + jgrsord, _q, Request["rows"], _cc_gh_id); List<jgridRow> ListRowCC = new List<jgridRow>(); foreach (ChungChi cc in PagerGetCC.List) { ListRowCC.Add(new jgridRow(cc.ID.ToString(), new string[] { cc.ID.ToString(), cc.TT.ToString(), string.Format(@"<img src=""../up/i/{0}"" />",Lib.imgSize(cc.Anh,"50x50")), cc.Ten.ToString(), cc.So, cc.GioiHan, cc.DonViCap, cc.NgayCap.ToString("dd/MM/yyyy"), cc.Active.ToString() })); } grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGetCC.TotalPages.ToString(), PagerGetCC.Total.ToString(), ListRowCC); sb.Append(JavaScriptConvert.SerializeObject(grid)); break; #endregion case "editChungChi": #region Edit chứng chỉ if (!string.IsNullOrEmpty(_cc_id)) { sb.Append("(" + JavaScriptConvert.SerializeObject(ChungChiDal.SelectById(Convert.ToInt32(_cc_id))) + ")"); } break; #endregion case "delChungChi": #region xóa if (!string.IsNullOrEmpty(_cc_id)) { ChungChiDal.DeleteByIdList(_cc_id); } break; #endregion case "ActiveChungChi": #region active Chứng chỉ if (!string.IsNullOrEmpty(_cc_id)) { ChungChiDal.ActiveCC(_cc_id, "1"); } break; #endregion case "saveChungChi": #region luu chung chi ChungChi ItemSave = new ChungChi(); if (string.IsNullOrEmpty(_cc_ten)) { sb.Append("0"); break; } if (!string.IsNullOrEmpty(_cc_id)) { ItemSave = ChungChiDal.SelectById(Convert.ToInt32(_cc_id)); } ItemSave.TT = int.Parse(_cc_thutu); ItemSave.GH_ID = int.Parse(_cc_gh_id); ItemSave.Ten = _cc_ten; ItemSave.So = _cc_so; ItemSave.NgayCap = Convert.ToDateTime(_cc_ngaycap, new CultureInfo("vi-vn")); ItemSave.GioiHan = _cc_gioihan; ItemSave.DonViCap = _cc_donvicap; ItemSave.Anh = _cc_anh; ItemSave.Active = Convert.ToBoolean(_cc_active); if (!string.IsNullOrEmpty(_cc_id)) { ItemSave = ChungChiDal.Update(ItemSave); } else { ItemSave = ChungChiDal.Insert(ItemSave); } sb.Append("1"); break; #endregion case "getVideo": #region lấy danh sách if (string.IsNullOrEmpty(jgRows)) jgRows = "10"; if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "TV_Thutu"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "asc"; Pager<Thuvien> PagerGet = ThuvienDal.pagerNormal("", false, jgrsidx + " " + jgrsord , int.Parse(_rows) , Request["q"] , _CQ_ID , 0 , _tv_nguoitao , _tv_gh_id); List<jgridRow> ListRowVideo = new List<jgridRow>(); foreach (Thuvien item in PagerGet.List) { ListRowVideo.Add(new jgridRow(item.ID.ToString(), new string[]{ item.ID.ToString() ,(item.Thutu.ToString()) ,string.Format("<img class=\"adm-pro-icon\" src=\"../up/v/{0}\" />", string.IsNullOrEmpty(item.UrlImage) ? "no-image.png" :item.UrlImage) ,item.Ten ,item.Mota ,item.Ngaytao.ToString("dd/MM/yy") ,item.NguoiTao ,item.Active.ToString() })); } grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGet.TotalPages.ToString(), PagerGet.Total.ToString(), ListRowVideo); sb.Append(JavaScriptConvert.SerializeObject(grid)); break; #endregion case "saveVideo": #region lưu dữ liệu Thuvien ItemSaveVideo = new Thuvien(); if (!string.IsNullOrEmpty(_tv_id)) { ItemSaveVideo = ThuvienDal.SelectById(Convert.ToInt32(_tv_id)); } ItemSaveVideo.Ngaytao = DateTime.Now; ItemSaveVideo.Ten = _tv_ten; ItemSaveVideo.GH_ID = int.Parse(_tv_gh_id); ItemSaveVideo.Mota = string.IsNullOrEmpty(_tv_mota) ? "" : _tv_mota; ItemSaveVideo.Active = Convert.ToBoolean(_tv_active); ItemSaveVideo.UrlImage = _tv_UrlImage; ItemSaveVideo.Url = _tv_Url; ItemSaveVideo.Thutu = Convert.ToInt16(_tv_thutu); ItemSaveVideo.Loai = 1; ItemSaveVideo.Keyword = ""; ItemSaveVideo.CateID = 0; ItemSaveVideo.NguoiTao = Security.Username; // ItemSave.PID = Convert.ToInt32(_PID); if (!string.IsNullOrEmpty(_tv_id)) { ItemSaveVideo = ThuvienDal.Update(ItemSaveVideo); } else { ItemSaveVideo.RowId = Guid.NewGuid(); ItemSaveVideo = ThuvienDal.Insert(ItemSaveVideo); } sb.Append("1"); break; #endregion case "delVideo": #region xóa if (!string.IsNullOrEmpty(_tv_id)) { char[] step = { ',' }; string[] arrID = _tv_id.Split(step); for (int j = 0; j < arrID.Length; j++) { if (arrID[j] != "") { Thuvien o = new Thuvien(); o = ThuvienDal.SelectById(Convert.ToInt32(arrID[j])); try { System.IO.File.Delete(Server.MapPath("~/up/v/" + o.UrlImage)); System.IO.File.Delete(Server.MapPath("~/up/v/" + o.Url)); } catch { } ThuvienDal.DeleteById(Convert.ToInt32(arrID[j])); } } } break; #endregion case "duyetVideo": #region Duyệt if (!string.IsNullOrEmpty(_tv_id)) { char[] step = { ',' }; string[] arrID = _tv_id.Split(step); for (int j = 0; j < arrID.Length; j++) { if (arrID[j] != "") { Thuvien o = new Thuvien(); o = ThuvienDal.SelectById(Convert.ToInt32(arrID[j])); o.Active = true; ThuvienDal.Update(o); } } } break; #endregion case "dungVideo": #region Dừng if (!string.IsNullOrEmpty(_tv_id)) { char[] step = { ',' }; string[] arrID = _tv_id.Split(step); for (int j = 0; j < arrID.Length; j++) { if (arrID[j] != "") { Thuvien o = new Thuvien(); o = ThuvienDal.SelectById(Convert.ToInt32(arrID[j])); o.Active = false; ThuvienDal.Update(o); } } } break; #endregion case "editVideo": #region chỉnh sửa if (!string.IsNullOrEmpty(_tv_id)) { sb.Append("(" + JavaScriptConvert.SerializeObject(ThuvienDal.SelectById(Convert.ToInt32(_tv_id))) + ")"); } break; #endregion case "getFlash": #region lấy danh sách if (string.IsNullOrEmpty(jgRows)) jgRows = "5"; if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "Flh_ID"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "asc"; Pager<Flash> PagerGetFlash = FlashDal.pagerNormal("", false, jgrsidx + " " + jgrsord, _q, _flh_gh_id, Request["rows"]); List<jgridRow> ListRowFlash = new List<jgridRow>(); foreach (Flash item in PagerGetFlash.List) { if (item.PathImage != "") { ListRowFlash.Add(new jgridRow(item.ID.ToString(), new string[]{ item.ID.ToString() ,(item.Thutu.ToString()) ,string.Format("<img class=\"adm-pro-icon\" src=\"../up/i/{0}\" />", string.IsNullOrEmpty(item.PathImage) ? "no-image.png" :item.PathImage) ,item.Ten ,item.Ngaytao.ToString("dd/MM/yyyy") ,item.NguoiTao ,item.Active.ToString() })); } else { ListRowFlash.Add(new jgridRow(item.ID.ToString(), new string[]{ item.ID.ToString() ,(item.Thutu.ToString()) ,string.Format("<embed class=\"adm-pro-icon\" src=\"../up/v/{0}\" />", string.IsNullOrEmpty(item.PathFlash) ? "no-image.png" :item.PathFlash) ,item.Ten ,item.Ngaytao.ToString("dd/MM/yyyy") ,item.NguoiTao ,item.Active.ToString() })); } } grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGetFlash.TotalPages.ToString(), PagerGetFlash.Total.ToString(), ListRowFlash); sb.Append(JavaScriptConvert.SerializeObject(grid)); break; #endregion case "saveFlash": #region lưu dữ liệu Flash ItemSaveFlash = new Flash(); if (!string.IsNullOrEmpty(_flh_id)) { ItemSaveFlash = FlashDal.SelectById(Convert.ToInt32(_flh_id)); } ItemSaveFlash.Ngaytao = DateTime.Now; ItemSaveFlash.Ten = _flh_ten; ItemSaveFlash.GH_ID = int.Parse(_flh_gh_id); ItemSaveFlash.Mota = string.IsNullOrEmpty(_flh_mota) ? "" : _flh_mota; ItemSaveFlash.Active = Convert.ToBoolean(_flh_active); if (_flh_pathimg !=null) { ItemSaveFlash.PathImage = _flh_pathimg; ItemSaveFlash.PathFlash = ""; } if (_flh_pathflash !=null) { ItemSaveFlash.PathImage = ""; ItemSaveFlash.PathFlash = _flh_pathflash; } ItemSaveFlash.Thutu = Convert.ToInt16(_flh_thutu); ItemSaveFlash.NguoiTao = Security.Username; // ItemSave.PID = Convert.ToInt32(_PID); if (!string.IsNullOrEmpty(_flh_id)) { ItemSaveFlash = FlashDal.Update(ItemSaveFlash); } else { ItemSaveFlash.RowId = Guid.NewGuid(); ItemSaveFlash = FlashDal.Insert(ItemSaveFlash); } sb.Append("1"); break; #endregion case "delFlash": #region xóa FlashDal.DeleteById(Convert.ToInt32(_flh_id)); break; #endregion case "duyetFlash": #region Duyệt Flash duyetflash = new Flash(); duyetflash = FlashDal.SelectById(Convert.ToInt32(_flh_id)); duyetflash.Active = true; FlashDal.Update(duyetflash); break; #endregion case "dungFlash": #region Dừng Flash dungflash = new Flash(); dungflash = FlashDal.SelectById(Convert.ToInt32(_flh_id)); dungflash.Active = false; FlashDal.Update(dungflash); break; #endregion case "editFlash": #region chỉnh sửa if (!string.IsNullOrEmpty(_flh_id)) { sb.Append("(" + JavaScriptConvert.SerializeObject(FlashDal.SelectById(Convert.ToInt32(_flh_id))) + ")"); } break; #endregion case "getHinhAnh": #region lấy danh sách if (string.IsNullOrEmpty(jgRows)) jgRows = "5"; if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "HA_ID"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "asc"; Pager<HinhAnh> PagerGetHA = HinhAnhDal.pagerNormal("", false, jgrsidx + " " + jgrsord, _q, _ha_gh_id, Request["rows"]); List<jgridRow> ListRowHA = new List<jgridRow>(); foreach (HinhAnh item in PagerGetHA.List) { ListRowHA.Add(new jgridRow(item.ID.ToString(), new string[]{ item.ID.ToString() ,string.Format("<img class=\"adm-pro-icon\" src=\"../up/i/{0}\" />", string.IsNullOrEmpty(item.PathImage) ? "no-image.png" :item.PathImage) ,item.Ten ,item.Link ,item.Ngaytao.ToString("dd/MM/yyyy") ,item.NguoiTao ,item.Active.ToString() })); } grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGetHA.TotalPages.ToString(), PagerGetHA.Total.ToString(), ListRowHA); sb.Append(JavaScriptConvert.SerializeObject(grid)); break; #endregion case "saveHinhAnh": #region lưu dữ liệu HinhAnh ItemSaveAnh = new HinhAnh(); if (!string.IsNullOrEmpty(_ha_id)) { ItemSaveAnh = HinhAnhDal.SelectById(Convert.ToInt32(_ha_id)); } ItemSaveAnh.Ngaytao = DateTime.Now; ItemSaveAnh.Ten = _ha_ten; ItemSaveAnh.GH_ID = int.Parse(_ha_gh_id); ItemSaveAnh.Mota = string.IsNullOrEmpty(_ha_mota) ? "" : _ha_mota; ItemSaveAnh.Active = Convert.ToBoolean(_ha_active); ItemSaveAnh.PathImage = _ha_pathimg; ItemSaveAnh.Link = _ha_link; ItemSaveAnh.NguoiTao = Security.Username; if (!string.IsNullOrEmpty(_ha_id)) { ItemSaveAnh = HinhAnhDal.Update(ItemSaveAnh); } else { ItemSaveAnh.RowId = Guid.NewGuid(); ItemSaveAnh = HinhAnhDal.Insert(ItemSaveAnh); } sb.Append("1"); break; #endregion case "editHinhAnh": #region chỉnh sửa if (!string.IsNullOrEmpty(_ha_id)) { sb.Append("(" + JavaScriptConvert.SerializeObject(HinhAnhDal.SelectById(Convert.ToInt32(_ha_id))) + ")"); } break; #endregion case "delHinhAnh": #region xóa if (!string.IsNullOrEmpty(_ha_id)) { char[] step = { ',' }; string[] arrID = _ha_id.Split(step); for (int j = 0; j < arrID.Length; j++) { if (arrID[j] != "") { HinhAnh o = new HinhAnh(); o = HinhAnhDal.SelectById(Convert.ToInt32(arrID[j])); try { System.IO.File.Delete(Server.MapPath("~/up/i/" + o.PathImage)); } catch { } HinhAnhDal.DeleteById(Convert.ToInt32(arrID[j])); } } } break; #endregion case "duyetHinhAnh": #region Duyệt if (!string.IsNullOrEmpty(_ha_id)) { char[] step = { ',' }; string[] arrID = _ha_id.Split(step); for (int j = 0; j < arrID.Length; j++) { if (arrID[j] != "") { HinhAnh o = new HinhAnh(); o = HinhAnhDal.SelectById(Convert.ToInt32(arrID[j])); o.Active = true; HinhAnhDal.Update(o); } } } break; #endregion case "dungHinhAnh": #region Dừng if (!string.IsNullOrEmpty(_ha_id)) { char[] step = { ',' }; string[] arrID = _ha_id.Split(step); for (int j = 0; j < arrID.Length; j++) { if (arrID[j] != "") { HinhAnh o = new HinhAnh(); o = HinhAnhDal.SelectById(Convert.ToInt32(arrID[j])); o.Active = false; HinhAnhDal.Update(o); } } } break; #endregion case "scpt": #region Nạp js sb.AppendFormat(@"{0}" , cs.GetWebResourceUrl(typeof(doanhNghiep), "cnn.plugin.doanhNghiep.doanhNghiep.js")); //sb.AppendFormat(@"{0}" // , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.QuanLySanPham.Publish.js")); break; #endregion default: #region Nap FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId); //Kiem tra quyen sb.Append(@"<div id =""DoanhNghiepChuaDuyet-Main-NewDlg""> </div> "); sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>" , cs.GetWebResourceUrl(typeof(doanhNghiep), "cnn.plugin.doanhNghiep.doanhNghiep.js") , "{doanhNghiepFn.loadForm();}"); sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn)); break; #endregion } writer.Write(sb.ToString()); base.Render(writer); }