Beispiel #1
0
        public ActionResult XoaQC(int id)
        {
            QuangCao qc = db.QuangCaos.SingleOrDefault(n => n.ID == id);

            if (qc == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            db.QuangCaos.DeleteOnSubmit(qc);
            db.SubmitChanges();
            return(RedirectToAction("QuangCao"));
        }
Beispiel #2
0
 public QuangCaoMap(QuangCao qc)
 {
     this.id            = qc.id;
     this.id_chien_dich = qc.id_chien_dich;
     this.ten_hien_thi  = qc.ten_hien_thi;
     this.link_dich     = qc.link_dich;
     this.link_hien_thi = qc.link_hien_thi;
     this.tieu_de_1     = qc.tieu_de_1;
     this.tieu_de_2     = qc.tieu_de_2;
     this.mo_ta_1       = qc.mo_ta_1;
     this.mo_ta_2       = qc.mo_ta_2;
     this.ids_tu_khoa   = qc.ids_tu_khoa;
 }
Beispiel #3
0
        // GET: QuangCaos/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            QuangCao quangCao = db.quangCaos.Find(id);

            if (quangCao == null)
            {
                return(HttpNotFound());
            }
            return(View(quangCao));
        }
Beispiel #4
0
        public QuangCao LoadQuangCao(string mavitri)
        {
            QuangCao qc = new QuangCao();

            qc = context.QuangCao.Where(gh => gh.IdGoiQuangCaoNavigation.IdViTriNavigation.MaViTri == mavitri && gh.NgayBatDau <= DateTime.Now && gh.NgayKetThuc > DateTime.Now && gh.TinhTrang == "Không khoá")

                 .SingleOrDefault();
            // qc = context.QuangCao.Where(gh => gh.MaQuangCao=="QC-2001").SingleOrDefault();
            if (qc == null)
            {
                return(null);
            }

            return(qc);
        }
        public ActionResult LoadQuangCao(string mavitri)
        {
            QuangCaoBUS quangcao = new QuangCaoBUS();
            QuangCao    qc       = new QuangCao();

            qc = quangcao.LoadQuangCao(mavitri);
            var json = JsonConvert.SerializeObject(qc, Formatting.Indented,
                                                   new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Serialize
            });
            var json2 = JsonConvert.DeserializeObject(json);

            return(Json(json2));
        }
Beispiel #6
0
        public ActionResult SuaQC(int id)
        {
            if (Session["TaikhoanAdmin"] != null)
            {
                QuangCao qc = db.QuangCaos.SingleOrDefault(n => n.ID == id);

                if (qc == null)
                {
                    Response.StatusCode = 404;
                    return(null);
                }
                ViewBag.IDNCC = new SelectList(db.NhaCungCaps.ToList().OrderBy(n => n.TenNCC), "ID", "TenNCC");
                return(View(qc));
            }
            return(RedirectToAction("Login", "Nguoidung"));
        }
Beispiel #7
0
 public QuangCao CreateTintuc([FromBody] QuangCao model)
 {
     /* if (model.hinhanh != null)
      * {
      *   var arrData = model.hinhanh.Split(';');
      *   if (arrData.Length == 3)
      *   {
      *       var savePath = $@"assets/images/{arrData[0]}";
      *       model.hinhanh = $"{savePath}";
      *       SaveFileFromBase64String(savePath, arrData[2]);
      *   }
      * }*/
     //model.id = Guid.NewGuid().ToString();
     _itemBusiness.Create(model);
     return(model);
 }
Beispiel #8
0
        public async Task <bool> Update(QuangCao quangcao)
        {
            if (!await db.QuangCao.Where(x => x.ID == quangcao.ID).AnyAsync())
            {
                return(false);
            }

            //db.QuangCao.Attach(quangcao);
            //db.Entry(quangcao).State = EntityState.Modified;
            var QC = await db.QuangCao.FirstAsync(x => x.ID == quangcao.ID);

            QC.TinhTrang = QC.TinhTrang != true;
            await db.SaveChangesAsync();

            return(true);
        }
Beispiel #9
0
        public string EditQuangCao(string ma, string goiquangcao, string taikhoan, string hinh, DateTime ngaybatdau, DateTime ngayketthuc, string duongdan, string chuthich)
        {
            QuangCao    quangcao = new QuangCao();
            GoiQuangCao goi;

            //Sửa
            quangcao = context.QuangCao.Where(gh => gh.MaQuangCao == ma).SingleOrDefault();
            if (hinh != null)
            {
                quangcao.Hinh = hinh;
            }
            quangcao.DuongDan = duongdan;
            quangcao.ChuThich = chuthich;
            context.SaveChanges();
            return("Sửa thành công");
        }
Beispiel #10
0
        public async Task <bool> Add(QuangCao quangcao)
        {
            if (await db.QuangCao.Where(x => x.NgayKetThuc >= quangcao.NgayBatDau || x.NgayBatDau <= quangcao.NgayKetThuc).AnyAsync())
            {
                return(false);
            }
            quangcao.NgayDangKy = DateTime.Now;
            int Days = quangcao.NgayKetThuc.Day - quangcao.NgayBatDau.Day;

            quangcao.GiaThue = db.LoaiQuangCao.Find(quangcao.IDLoaiQC).Gia *Days;

            await db.QuangCao.AddAsync(quangcao);

            await db.SaveChangesAsync();

            return(true);
        }
Beispiel #11
0
 public bool Sua(QuangCao qc)
 {
     try
     {
         var quangcao = db.QuangCaos.Find(qc.Id);
         quangcao.LinkQc     = qc.LinkQc;
         quangcao.AnhQc      = qc.AnhQc;
         quangcao.TrangThai  = qc.TrangThai;
         quangcao.IdNguoiTao = qc.IdNguoiTao;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #12
0
        public ActionResult SuaBanner(QuangCao sp, HttpPostedFileBase fileUpload)
        {
            QuangCao spm = data.QuangCaos.SingleOrDefault(n => n.MaQC == sp.MaQC);

            ViewBag.MaQC = sp.MaQC;
            var HieuGiay = sp.HieuGiay;
            var BaiViet  = sp.BaiViet;
            var Url      = sp.Url;
            var Anh      = sp.Anh;

            spm.Anh      = Anh;
            spm.HieuGiay = HieuGiay;
            spm.BaiViet  = BaiViet;
            spm.Url      = Url;
            spm.Anh      = Anh;

            if (ModelState.IsValid)
            {
                if (fileUpload == null)
                {
                    spm.Anh = getImageGT(sp.MaQC);
                }
                else
                {
                    if (ModelState.IsValid)
                    {
                        var fileName = Path.GetFileName(fileUpload.FileName);
                        var path     = Path.Combine(Server.MapPath("~/images/shoes"), fileName);
                        if (System.IO.File.Exists(path))
                        {
                            sp.Anh           = fileName;
                            ViewBag.Thongbao = "Hình ảnh đã tồn tại";
                            return(View(sp));
                        }
                        else
                        {
                            fileUpload.SaveAs(path);
                            spm.Anh = fileName;
                        }
                    }
                }
                data.SubmitChanges();
            }
            return(RedirectToAction("Giay"));
        }
Beispiel #13
0
        public ActionResult DeleteQuangCao(int id)
        {
            QuangCao qc = db.QuangCaos.SingleOrDefault(n => n.QuangCaoID == id);

            if (qc == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            else if (Session["Taikhoanadmin"] == null || Session["Taikhoanadmin"].ToString() == "")
            {
                return(RedirectToAction("Login", "Admin"));
            }
            else
            {
                return(View(qc));
            }
        }
Beispiel #14
0
        public ActionResult Create([Bind(Include = "ID,TenQuangCao,Hinh,MoTa")] QuangCao quangCao, HttpPostedFileBase img)
        {
            if (ModelState.IsValid)
            {
                if (img != null && img.ContentLength > 0)
                {
                    string _file = Path.GetFileName(img.FileName);
                    quangCao.Hinh = _file;
                    string _path = Path.Combine(Server.MapPath("~/HinhAnh"), _file);
                    img.SaveAs(_path);
                }
                db.quangCaos.Add(quangCao);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(quangCao));
        }
 public int InsertAds(JObject ads)
 {
     try
     {
         QuangCao data = new QuangCao();
         data.MoTa    = ads["descrip"].ToString();
         data.Url     = ads["link"].ToString();
         data.urlHinh = ads["image"].ToString();
         data.vitri   = (int)ads["position"];
         db.QuangCaos.Add(data);
         db.SaveChanges();
         return(1);
     }
     catch (Exception)
     {
         return(0);
     }
 }
    private string LayAnhSlide(string nhomQuangCaoID)
    {
        string s = "";

        DataTable dt = new DataTable();

        dt = QuangCao.Thongtin_Quangcao_by_nhomquangcaoid(nhomQuangCaoID);
        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                s += @"
<div data-p='225.00' style='display: none;'>                      
    <img data-u='image' src='/pic/quangcao/" + dt.Rows[i]["AnhQC"] + @"' alt='" + dt.Rows[i]["TenQC"] + @"' />
</div>";
            }
        }

        return(s);
    }
Beispiel #17
0
        public bool Create(QuangCao model)
        {
            string msgError = "";

            try
            {
                var result = _dbHelper.ExecuteScalarSProcedureWithTransaction(out msgError, "sp_quangcao_create",
                                                                              //"@id", model.id,
                                                                              "@idqc", model.idqc,
                                                                              "@tieude", model.tieude,
                                                                              "@video", model.video);
                if ((result != null && !string.IsNullOrEmpty(result.ToString())) || !string.IsNullOrEmpty(msgError))
                {
                    throw new Exception(Convert.ToString(result) + msgError);
                }
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public ActionResult Them(QuangCao qc)
        {
            SetViewBag();
            if (ModelState.IsValid)
            {
                var dao = new QuangCaoDAO();

                long id = dao.Them(qc);
                if (id > 0)
                {
                    SetAlert("Thêm mới quảng cáo " + qc.Id + " thành công!", "success");
                    logger.Info("Thêm mới quảng cáo " + qc.Id + " thành công!");
                    return(RedirectToAction("Them"));
                }
                else
                {
                    SetAlert("Thêm mới quảng cáo " + qc.Id + " không thành công!", "error");
                    logger.Error("Thêm mới quảng cáo " + qc.Id + " không thành công!");
                }
            }
            return(View());
        }
Beispiel #19
0
        public List <QuangCao> AllQuangCao()
        {
            string sql = "select * from QuangCao";

            db = new DBACCESS();
            db.open();
            DataTable dt = db.getTable(sql);

            db.close();
            List <QuangCao> ds = new List <QuangCao>();

            foreach (DataRow dr in dt.Rows)
            {
                QuangCao qc = new QuangCao();
                qc.MaQC    = dr[0].ToString();
                qc.MaQC    = dr[1].ToString();
                qc.HinhAnh = dr[2].ToString();
                ds.Add(qc);
            }
            this.DanhSachLoaiTin = ds;
            return(ds);
        }
        public ActionResult ThemmoiQuangcao(QuangCao quangCao, HttpPostedFileBase fileUpload)
        {
            //Dua du lieu vao dropdownload

            //Kiem tra duong dan file
            if (fileUpload == null)
            {
                ViewBag.Thongbao = "Vui lòng chọn ảnh bìa";
                return(View());
            }
            //Them vao CSDL
            else
            {
                if (ModelState.IsValid)
                {
                    //Luu ten fie, luu y bo sung thu vien using System.IO;
                    var fileName = Path.GetFileName(fileUpload.FileName);
                    //Luu duong dan cua file
                    var path = Path.Combine(Server.MapPath("~/img"), fileName);
                    //Kiem tra hình anh ton tai chua?
                    if (System.IO.File.Exists(path))
                    {
                        ViewBag.Thongbao = "Hình ảnh đã tồn tại";
                    }
                    else
                    {
                        //Luu hinh anh vao duong dan
                        fileUpload.SaveAs(path);
                    }

                    quangCao.AnhQC = fileName;
                    //Luu vao CSDL
                    db.QuangCaos.InsertOnSubmit(quangCao);
                    db.SubmitChanges();
                }
                return(RedirectToAction("quangcao"));
            }
        }
    private string LayAnhLogo(string nhomQuangCaoID)
    {
        string s = "";

        DataTable dt = new DataTable();

        dt = QuangCao.Thongtin_Quangcao_by_nhomquangcaoid(nhomQuangCaoID);
        if (dt.Rows.Count > 0)
        {
            string lienKet = dt.Rows[0]["LienKet"].ToString();
            if (lienKet == "")
            {
                lienKet = "#";
            }

            s += @"
<a href='" + lienKet + @"' title='" + dt.Rows[0]["TenQC"] + @"'>
    <img src='/pic/quangcao/" + dt.Rows[0]["AnhQC"] + @"' alt='" + dt.Rows[0]["TenQC"] + @"'/>
</a>";
        }

        return(s);
    }
Beispiel #22
0
        public IActionResult Post([FromBody] QuangCao quang_cao)
        {
            DataResponse res = new DataResponse();

            try
            {
                res.success = true;
                //validate
                if (string.IsNullOrEmpty(quang_cao.ten_hien_thi))
                {
                    res.success = false;
                    res.msg     = "Đặt tên cho quảng cáo";
                }
                if (string.IsNullOrEmpty(quang_cao.id_chien_dich))
                {
                    res.success = false;
                    res.msg     = "Chưa có chiến dịch";
                }
                if (string.IsNullOrEmpty(quang_cao.tieu_de_1))
                {
                    res.success = false;
                    res.msg     = "Đặt tiêu đề cho quảng cáo";
                }
                if (string.IsNullOrEmpty(quang_cao.link_dich))
                {
                    res.success = false;
                    res.msg     = "Đặt link đích cho quảng cáo";
                }

                if (!IsValidUri(quang_cao.link_dich))
                {
                    res.success = false;
                    res.msg     = "Link đích chưa đúng định dạng";
                }

                if (!res.success)
                {
                    return(Ok(res));
                }

                SetMetaData(quang_cao, false);

                string ret_id = QuangCaoRepository.Instance.IndexRetId(quang_cao);

                res.success = !string.IsNullOrEmpty(ret_id);
                if (res.success)
                {
                    var id_chien_dich         = QuangCaoRepository.Instance.GetById(ret_id, new string[] { "*" })?.id_chien_dich;
                    var trang_thai_chien_dich =
                        ChienDichRepository.Instance.GetById(id_chien_dich, new[] { "*" })?.trang_thai;
                    QuangCaoRepository.Instance.UpdateTrangThaiQcTheoChienDich(ret_id, (int)trang_thai_chien_dich);

                    res.data = ret_id;
                }
            }
            catch (Exception ex)
            {
                res.msg = ex.Message; res.success = false;
            }

            return(Ok(res));
        }
 public bool Update(QuangCao model)
 {
     return(_res.Update(model));
 }
Beispiel #24
0
        public bool Update(QuangCao data)
        {
            var re = client.Update <QuangCao>(data.id, u => u.Doc(data));

            return(re.Result == Result.Updated || re.Result == Result.Noop);
        }
Beispiel #25
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder sb = new StringBuilder();
            ClientScriptManager cs = this.Page.ClientScript;
            DanhMuc Item;
            List<DanhMuc> List = new List<DanhMuc>();
            #region tham số
            string msg = Request["NoiDungLienHe"];
            string msgtitle = Request["msgtitle"];
            string MaDanhMuc = Request["MaDanhMuc"];
            string _LDM_Ma = Request["LDM_Ma"];
            sendEmailDele _dele = new sendEmailDele(sendmailThongbao);

            string _ID = Request["ID"];
            string _Ten = Request["Ten"];
            string _Anh = Request["Anh"];
            string _Url = Request["Url"];
            string _ThuTu = Request["ThuTu"];
            string _ViTri = Request["ViTri"];
            string _ViTri_Ten = Request["ViTri_Ten"];
            string _TrangQuangCao = Request["TrangQuangCao"];
            string _TrangQuangCao_Ten = Request["TrangQuangCao_Ten"];
            string _Active = Request["Active"];
            string _NgayHetHan = Request["NgayHetHan"];
            string _NgayDangKy = Request["NgayDangKy"];
            string _TenDonVi = Request["TenDonVi"];
            string _DiaChiDonVi = Request["DiaChiDonVi"];
            string _NguoiLienHe = Request["NguoiLienHe"];
            string _Email = Request["Email"];
            string _DienThoai = Request["DienThoai"];
            string _SoTienThanhToan = Request["SoTienThanhToan"];
            QuangCao ItemQC;
            #endregion
            //autoCompleteLangBasedDanhMuc
            switch (subAct)
            {
                case "SaveDKDVQC":
                #region Save Đăng ký dịch vụ quảng cáo
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemQC = QuangCaoDal.SelectByIdHoangDA(Convert.ToInt32(_ID));
                    }
                    else
                    {
                        ItemQC = new QuangCao();
                    }
                    ItemQC.Ten = _Ten;
                    ItemQC.Anh = _Anh;
                    ItemQC.Url = _Url;
                    //ItemQC.ThuTu = int.Parse(_ThuTu);
                    ItemQC.ViTri = int.Parse(_ViTri);
                    ItemQC.ViTri_Ten = _ViTri_Ten;
                    ItemQC.TrangQuangCao = int.Parse(_TrangQuangCao);
                    ItemQC.TrangQuangCao_Ten = _TrangQuangCao_Ten;
                    ItemQC.Active = Convert.ToBoolean(_Active);

                    ItemQC.NgayHetHan = Convert.ToDateTime(_NgayHetHan, new CultureInfo("vi-vn"));
                    ItemQC.NgayCapNhat = DateTime.Now;

                    ItemQC.NgayDangKy = Convert.ToDateTime(_NgayDangKy, new CultureInfo("vi-vn"));

                    ItemQC.TenDonVi = _TenDonVi;
                    ItemQC.DiaChiDonVi = _DiaChiDonVi;
                    ItemQC.NguoiLienHe = _NguoiLienHe;
                    ItemQC.Email = _Email;
                    ItemQC.DienThoai = _DienThoai;
                    ItemQC.SoTienThanhToan = Double.Parse(_SoTienThanhToan);

                    if (!string.IsNullOrEmpty(_ID))
                    {
                        ItemQC = QuangCaoDal.UpdateHoangDA(ItemQC);
                    }
                    else
                    {
                        ItemQC.NgayTao = DateTime.Now;
                        ItemQC.RowId = Guid.NewGuid();
                        ItemQC.NguoiTao = Security.Username;
                        ItemQC = QuangCaoDal.InsertHoangDA(ItemQC);
                    }
                    sb.Append("1");

                    break;
                #endregion
                case "edit":
                    #region chỉnh sửa
                    if (!string.IsNullOrEmpty(_ID))
                    {
                        sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(DanhMucDal.SelectById(Convert.ToInt32(_ID))));
                    }
                    break;
                    #endregion
                case "autoCompleteLangBasedByDanhMucId":
                    #region Lấy danh sách danh mục
                    DanhMuc ItemDanhMuc = new DanhMuc();
                    List<DanhMuc> ListDanhMuc = new List<DanhMuc>();
                    ListDanhMuc = DanhMucDal.SelectLangBasedByDanhMucId(_ID);
                    sb.Append(JavaScriptConvert.SerializeObject(ListDanhMuc));
                    break;
                    #endregion
                case "autoCompleteLangBased":
                    #region Lấy danh sách danh mục
                    Item = new DanhMuc();
                    List = getTree(DanhMucDal.SelectLangBasedFixHoangda(_ID, _LDM_Ma));
                    sb.Append(JavaScriptConvert.SerializeObject(List));
                    break;
                    #endregion
                case "LoadHoTroDKDV":
                    #region load hỗ trợ đăng ký dịch vụ
                    sb.Append(JavaScriptConvert.SerializeObject(DanhMucDal.SelectLangBased("", MaDanhMuc)));
                    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 "get":
                    #region lấy dữ liệu gian hàng
                    sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(GianHangDal.SelectByUserCoQuan(Security.Username)));
                    break;
                    #endregion
                case "scpt":
                    #region Nạp js
                    sb.AppendFormat(@"{0}"
                        , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.DangKyDichVu.DangKyDVQuangCao.JScript1.js"));
                    break;
                    #endregion
                default:
                    #region
                    FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId);

                    sb.Append(@"
                        <div id=""DangKyDVQuangCaoFn-Main""></div>
                    ");
                    sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>"
                        , cs.GetWebResourceUrl(typeof(Class1), "cnn.plugin.DangKyDichVu.DangKyDVQuangCao.JScript1.js")
                        , "{DangKyDVQuangCaoFn.LoadForm();}");
                    sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn));
                    break;
                    #endregion
            }
            writer.Write(sb.ToString());
            base.Render(writer);
        }
 public bool Create(QuangCao model)
 {
     return(_res.Create(model));
 }
 public bool QuangCao_Insert(QuangCao data)
 {
     return(obj.QuangCao_Insert(data));
 }
Beispiel #28
0
 public ActionResult ConfirmOnCreateQC(QuangCao qc)
 {
     db.QuangCaos.InsertOnSubmit(qc);
     db.SubmitChanges();
     return(RedirectToAction("QuangCao"));
 }
 public bool QuangCao_Update(QuangCao data)
 {
     return(obj.QuangCao_Update(data));
 }
Beispiel #30
0
 public QuangCao UpdateUser([FromBody] QuangCao model)
 {
     _itemBusiness.Update(model);
     return(model);
 }
Beispiel #31
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 #32
0
 public void SuaQuangCao(QuangCao qc)
 {
     bldal.SuaQuangCao(qc);
 }