Exemple #1
0
        public ActionResult SuaCauHinh(CauHinh ch, HttpPostedFileBase Hinh)
        {
            if (Session["DangNhap"] == null)
            {
                return(RedirectToAction("DangNhap", "QuanTri"));
            }

            if (ModelState.IsValid)
            {
                if (Hinh != null)
                {
                    CauHinh chcu       = db.CauHinhs.AsNoTracking().SingleOrDefault(n => n.MaCauHinh == ch.MaCauHinh);
                    var     deletePath = Server.MapPath("~/Upload/" + chcu.DuLieu);
                    if (System.IO.File.Exists(deletePath))
                    {
                        System.IO.File.Delete(deletePath);
                    }

                    var fileName = Path.GetFileName(Hinh.FileName);
                    var path     = Path.Combine(Server.MapPath("~/Upload/"), fileName);

                    Hinh.SaveAs(path);
                    ch.DuLieu = fileName;
                }

                db.Entry(ch).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                TempData["thongbao"] = "<script> $('#div-pthongbao').text('Cập nhật thành công !'); $('#div-thongbao').show(); $('#div-thongbao').fadeOut(5000);</script>";
            }
            return(RedirectToAction("DSCauHinh"));
        }
Exemple #2
0
        public List <UngVien> Run(CauHinh ch, List <JobLink> lst_job_link)
        {
            is_authenticated = false;
            List <UngVien> lst_ung_vien = new List <UngVien>();

            using (var browser = new XBrowser(user_profile_path, cv_save_path, string.Empty, false, show_browser))
            {
                foreach (var job in lst_job_link)
                {
                    string url = browser.GoTo(job.link);
                    is_authenticated = url.Contains(ch.url_login) ? browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out string msg) : browser.GetUrl().Contains(url);
                    if (is_authenticated)
                    {
                        string r_url = browser.GoTo(job.link);

                        if (r_url.Contains(job.link))
                        {
                            var lst_cv_by_job = XuLyCV(browser, job);

                            lst_ung_vien.AddRange(lst_cv_by_job);
                            job.tong_so_cv = lst_cv_by_job.Count;
                            ES.JobLinkRepository.Instance.UpdateTrangThaiXuLy(job);
                        }
                    }
                }
            }

            return(new List <UngVien>(lst_ung_vien));
        }
Exemple #3
0
        public ActionResult Index(int?id, CauHinh objCauHinh)
        {
            CauHinh objCH    = null;
            bool    isInsert = true;

            if (id.HasValue && id.Value > 0)
            {
                objCH = DataProvider.Entities.CauHinhs.Where(c => c.Id == id).FirstOrDefault();
            }

            if (objCH != null)
            {
                isInsert = false;
            }
            else
            {
                objCH = new CauHinh();
            }

            if (isInsert)
            {
                DataProvider.Entities.CauHinhs.Add(objCauHinh);
            }
            else
            {
                DataProvider.Entities.Entry(objCH).CurrentValues.SetValues(objCauHinh);
            }

            //Lưu thông tin thay đổi
            DataProvider.Entities.SaveChanges();
            return(View());
        }
Exemple #4
0
 //object sender, System.Timers.ElapsedEventArgs ee
 public void _timer_Elapsed()
 {
     try
     {
         var jsp = new JobStreetPost();
         jsp.AutoUpdate();
         var ch = new CauHinh();
         CauHinhAccount.CauHinhTopCv(ch);
         var mwb = new MyWorkPost();
         mwb.AutoUpdate();
         var tcv = new TopCvPost();
         tcv.AutoUpdate(ch);
         var crl = new CareerLinkPost();
         crl.AutoUpdate();
     }
     catch (Exception ex)
     {
         _logger.Error(ex);
     }
     finally
     {
         var set_time = System.Configuration.ConfigurationManager.AppSettings["TimeIntervalMinutes"];
         _timer.Interval = TimeSpan.FromMinutes(int.Parse(set_time)).TotalMilliseconds;
     }
 }
Exemple #5
0
        public CauHinh GetCauHinh(string domain)
        {
            CauHinh config = new CauHinh();

            try
            {
                var re = client.Search <JobLink>(s => s.Query(q => q.Term(t => t.Field("link").Value(domain)) && q.Term(t => t.Field("loai").Value(LoaiLink.CONFIG))));

                if (re.Total > 0)
                {
                    var jso = (JObject)re.Documents.First().json;
                    if (jso != null)
                    {
                        config          = jso.ToObject <CauHinh>();
                        config.password = "";
                        config.username = "";
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(config);
        }
Exemple #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //Kiem tra xem la trường hợp sửa hay là thêm mới
         if (Request.QueryString["Ma"] == null || Request.QueryString["Ma"].ToString() == "")
         {
             //Đây là trường hợp thêm mới
             btnLuu.Visible     = false;
             btnThemMoi.Visible = true;
         }
         else
         {
             //đây là trường hợp sửa
             btnLuu.Visible       = true;
             btnThemMoi.Visible   = false;
             txtMaCauHinh.Enabled = false;
             //Đổ dữ liệu lên form
             string ID = Request.QueryString["Ma"].ToString();
             QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
             CauHinh obj = db.CauHinh.FirstOrDefault(x => x.ID == ID);
             if (obj != null)
             {
                 txtMaCauHinh.Text    = obj.ID;
                 txtTenCongTy.Text    = obj.TenCongTy;
                 txtDiaChiCongTy.Text = obj.DiaChiCongTy;
                 txtSoDienThoai.Text  = obj.SoDienThoai;
                 txtMaSoThue.Text     = obj.MaSoThue;
                 txtVAT.Text          = obj.VAT.ToString();
             }
         }
     }
 }
Exemple #7
0
        protected void btnThemMoi_Click(object sender, EventArgs e)
        {
            try
            {
                //Trường hợp thêm mới
                CauHinh obj = new CauHinh();
                obj.ID           = txtMaCauHinh.Text;
                obj.TenCongTy    = txtTenCongTy.Text;
                obj.DiaChiCongTy = txtDiaChiCongTy.Text;
                obj.SoDienThoai  = txtSoDienThoai.Text;
                obj.MaSoThue     = txtMaSoThue.Text;
                obj.VAT          = Convert.ToInt32(txtVAT.Text);
                //lưu dữ liệu vào db
                QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
                db.CauHinh.Add(obj);
                db.SaveChanges();


                Response.Redirect("QLCauHinh.aspx");
            }
            catch
            {
                pnError.Visible = true;
            }
        }
        //Hàm xử lý cập nhật.
        public int CapNhat(CauHinh cauHinh)
        {
            SqlCommand cmd    = new SqlCommand();
            string     update = "UPDATE dtb_CauHinh ",
                       set    = "SET TenCauHinh = @tenCauHinh, ManHinh = @manHinh, Chuot = @chuot, BanPhim = @banPhim, Thung = @thung, CPU = @CPU, MainBoard = @mainBoard, RAM = @RAM, OCung = @oCung, VGA = @VGA, PSU = @PSU, HeDieuHanh = @heDieuHanh ",
            where = "WHERE MaCauHinh = @maCauHinh";

            cmd.CommandText = update + set + where;

            cmd.Parameters.Add("maCauHinh", SqlDbType.Int).Value       = cauHinh.MaCauHinh;
            cmd.Parameters.Add("tenCauHinh", SqlDbType.NVarChar).Value = cauHinh.TenCauHinh;
            cmd.Parameters.Add("manHinh", SqlDbType.Int).Value         = cauHinh.ManHinh;
            cmd.Parameters.Add("banPhim", SqlDbType.Int).Value         = cauHinh.BanPhim;
            cmd.Parameters.Add("chuot", SqlDbType.Int).Value           = cauHinh.Chuot;
            cmd.Parameters.Add("thung", SqlDbType.Int).Value           = cauHinh.Case;
            cmd.Parameters.Add("CPU", SqlDbType.Int).Value             = cauHinh.CPU;
            cmd.Parameters.Add("mainBoard", SqlDbType.Int).Value       = cauHinh.MainBoard;
            cmd.Parameters.Add("RAM", SqlDbType.Int).Value             = cauHinh.RAM;
            cmd.Parameters.Add("oCung", SqlDbType.Int).Value           = cauHinh.OCung;
            cmd.Parameters.Add("VGA", SqlDbType.Int).Value             = cauHinh.VGA;
            cmd.Parameters.Add("PSU", SqlDbType.Int).Value             = cauHinh.PSU;
            cmd.Parameters.Add("heDieuHanh", SqlDbType.Int).Value      = cauHinh.HDH;

            return(cls.CapNhatDL(cmd));
        }
        public ActionResult DangNhap(string TenDangNhap, string MatKhau)
        {
            CauHinh  chkTenDanhNhap = db.CauHinhs.SingleOrDefault(n => n.MaCauHinh == "EMAIL-CONGTY");
            NhanVien ktEmail        = db.NhanViens.SingleOrDefault(n => n.Email == TenDangNhap);

            if (ktEmail == null)
            {
                if (TenDangNhap.Contains(chkTenDanhNhap.DuLieu) == true)
                {
                    NhanVien themNV = new NhanVien();
                    themNV.HoTen       = TenDangNhap;
                    themNV.TenDangNhap = TenDangNhap;
                    themNV.Email       = TenDangNhap;
                    themNV.MatKhau     = Tools.md5(TenDangNhap);
                    themNV.KichHoat    = true;
                    db.NhanViens.Add(themNV);
                    db.SaveChanges();

                    Session["DangNhap"] = themNV;
                    return(Content("1"));
                }
            }
            string   md5MatKhau = Tools.md5(MatKhau);
            NhanVien ktNV       = db.NhanViens.SingleOrDefault(n => (n.Email == TenDangNhap || n.TenDangNhap == TenDangNhap) && n.MatKhau == md5MatKhau);

            if (ktNV != null)
            {
                if (ktNV.KichHoat.Value == false)
                {
                    return(Content("2"));
                }
                Session["DangNhap"] = ktNV;

                string sRoles = "";
                //gán quyền
                //lay nhom tu tai khoan
                IEnumerable <Nhom_Nhanvien> ieNhanVienVaNhom = db.Nhom_Nhanvien.Where(n => n.IdNhanVien == ktNV.Id);
                foreach (var item in ieNhanVienVaNhom)
                {
                    //lay quyen tu nhom
                    IEnumerable <Nhom_Quyen> ieNhomVaVaiTro = db.Nhom_Quyen.Where(n => n.MaNhom == item.MaNhom);
                    //them quyen
                    foreach (var item2 in ieNhomVaVaiTro)
                    {
                        sRoles += item2.MaQuyen + ",";
                    }
                }
                //bo dau , cuoi
                if (sRoles.Length != 0)
                {
                    sRoles = sRoles.Substring(0, sRoles.Length - 1);
                }
                GanQuyen(ktNV.Id.ToString(), sRoles);

                return(Content("1"));
            }

            return(Content("0"));
        }
Exemple #10
0
 public static void CauHinhJobStreet(CauHinh ch)
 {
     ch.username       = "******";
     ch.password       = "******";
     ch.url_login      = "******";
     ch.xpath_password = "******";
     ch.xpath_username = "******";
 }
Exemple #11
0
 public static void CauHinhMyWork(CauHinh ch)
 {
     ch.username       = "******";
     ch.password       = XMedia.XUtil.Encode("xm123456");
     ch.url_login      = "******";
     ch.xpath_password = "******";
     ch.xpath_username = "******";
 }
Exemple #12
0
 public static void CauHinhTopCv(CauHinh ch)
 {
     ch.username       = "******";
     ch.password       = "******";
     ch.url_login      = "******";
     ch.xpath_password = "******";
     ch.xpath_username = "******";
 }
Exemple #13
0
 public static void CauHinhCareer(CauHinh ch)
 {
     ch.username       = "******";
     ch.password       = "******";
     ch.url_login      = "******";
     ch.xpath_password = "******";
     ch.xpath_username = "******";
 }
Exemple #14
0
 public static void CauHinhJobsGo(CauHinh ch)
 {
     ch.username       = "******";
     ch.password       = "******";
     ch.url_login      = "******";
     ch.xpath_password = "******";
     ch.xpath_username = "******";
 }
Exemple #15
0
        public List <JobLink> ExtractJobLink(CauHinh ch, string link, string app_id, out string msg)
        {
            is_authenticated = false;
            msg = "";
            List <JobLink> lst = new List <JobLink>();

            using (var browser = new XBrowser(user_profile_path, string.Empty, false, show_browser))
            {
                string url        = browser.GoTo(ch.url_login);
                string wait_xpath = ".//div[@class='kv_login']/div/span";
                System.Threading.Thread.Sleep(2000);
                var home = browser.GetUrl();
                if (browser.Find(wait_xpath).Count > 0)
                {
                    is_authenticated = true;
                }
                else
                {
                    is_authenticated = home == "https://careerbuilder.vn/vi/employers/hrcentral" || (link != url
                        ? browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username,
                                        ch.xpath_password, out msg, wait_xpath, false)
                        : browser.GetUrl().Contains(url));
                }

                if (is_authenticated)
                {
                    browser.GoTo(link);
                    System.Threading.Thread.Sleep(2000);
                    List <string> lst_links = new List <string>();

                    var ds_tin =
                        browser.Find(
                            "//div[@id='gird_standard']//dd//span[@class='rc_col_title3 info_jobseeker']/a[1]");

                    foreach (var tin in ds_tin)
                    {
                        var get_tin = browser.GetAttribute(tin, "href");
                        var ten_job = tin.Text;

                        if (!string.IsNullOrEmpty(get_tin))
                        {
                            JobLink job = new JobLink(LoaiLink.JOB_LINK)
                            {
                                app_id           = app_id,
                                link             = get_tin,
                                trang_thai       = TrangThai.DANG_SU_DUNG,
                                trang_thai_xu_ly = TrangThaiXuLy.CHUA_XU_LY,
                                nguoi_tao        = ch.username,
                                ten_job          = ten_job
                            };
                            lst.Add(job);
                        }
                    }
                }
            }
            return(lst);
        }
Exemple #16
0
        public ActionResult AddUser(Account model)
        {
            var user = new TaiKhoan();
            var ImportTeacherAfterCreateAccount = new GiangVien();
            var ImportTeacherConfig             = new CauHinh();

            if (ModelState.IsValid)
            {
                using (Sep2018Entities db = new Sep2018Entities())
                {
                    //int LastestID = db.TaiKhoans.Max(k => k.ID);
                    if (db.TaiKhoans.Any(x => x.TenTK == model.TenTK))
                    {
                        //ViewBag.DuplicateMessage = "This name has already used.";
                        ModelState.AddModelError("", "Tài khoản đã tồn tại");
                        return(View("AddUser", model));
                    }
                    if (model.matkhau == model.nhaplaimatkhau)
                    {
                        user.HoTen = model.HoTen;
                        //model.ID = LastestID + 1;
                        user.TenTK = model.TenTK;
                        //user.matkhau = Crypto.Hash(model.matkhau);
                        user.matkhau   = HomeController.MD5Hash(model.matkhau);
                        user.Vaitro    = model.Vaitro;
                        user.Trangthai = model.Trangthai;
                        //user.ConfirmPassword = Crypto.Hash(user.ConfirmPassword);
                        db.TaiKhoans.Add(user);
                        db.SaveChanges();
                        int ID_Keeper = user.ID;
                        // Import teacher account & configuration
                        if (user.Vaitro == 1)
                        {
                            // assign account
                            ImportTeacherAfterCreateAccount.IDTaiKhoan = ID_Keeper;
                            int x = ImportTeacherAfterCreateAccount.IDTaiKhoan;
                            ImportTeacherAfterCreateAccount.IDConf = ID_Keeper;
                            int y = ImportTeacherAfterCreateAccount.IDConf;
                            ImportTeacherAfterCreateAccount.HoTen = user.HoTen;
                            ImportTeacherAfterCreateAccount.MGV   = model.MGV;
                            db.GiangViens.Add(ImportTeacherAfterCreateAccount);
                            // assign config
                            ImportTeacherConfig.ID = ID_Keeper;
                            int z = ImportTeacherConfig.ID;
                            ImportTeacherConfig.Attend = "#e74c3c";
                            ImportTeacherConfig.Absent = "#2ecc71";
                            db.CauHinhs.Add(ImportTeacherConfig);
                            db.SaveChanges();
                        }
                        db.SaveChanges();
                        ViewBag.SuccessMessage = "The user has been added";
                    }
                }
                ModelState.Clear();
            }
            return(View("AddUser", new Account()));
        }
Exemple #17
0
        // GET: Admin/CauHinh
        public ActionResult Index()
        {
            CauHinh objCH = DataProvider.Entities.CauHinhs.FirstOrDefault();

            if (objCH != null)
            {
                return(View(objCH));
            }
            return(View());
        }
Exemple #18
0
        public List <UngVien> Run(CauHinh ch, List <JobLink> lst_job_link, ToolStripStatusLabel label)
        {
            is_authenticated = false;
            List <UngVien> lst_ung_vien = new List <UngVien>();
            string         wait_xpath   = ".//div[@class='kv_login']/div/span";

            using (var browser = new XBrowser(user_profile_path, cv_save_path, string.Empty, false, show_browser))
            {
                if (lst_job_link.Count < 1)
                {
                    label.Text = "Không có tin nào đang được đăng trực tuyến";
                }
                else
                {
                    foreach (var job in lst_job_link)
                    {
                        string url = browser.GoTo(job.link);
                        is_authenticated = url.Contains(ch.url_login) ? browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out string msg, wait_xpath, false) : browser.GetUrl().Contains(url);
                        if (is_authenticated)
                        {
                            //string r_url = browser.GoTo(job.link);
                            System.Threading.Thread.Sleep(1000);
                            browser.FindAndClick("//div[@class='top']/ul//div/a");
                            System.Threading.Thread.Sleep(1000);
                            var lst_url_uv = new List <string>();
                            var ung_vien   =
                                browser.Find(".//form[@id='editFrm1']/dd/span[@class='rc_col_310px info_jobseeker']/div/a");
                            if (ung_vien.Count > 0)
                            {
                                foreach (var uv in ung_vien)
                                {
                                    var url_uv = browser.GetAttribute(uv, "href");
                                    lst_url_uv.Add(url_uv);
                                }
                            }
                            if (lst_url_uv.Count > 0)
                            {
                                foreach (var item in lst_url_uv)
                                {
                                    label.Text = $"Đang xử lý link: {job.link}";
                                    browser.GoTo(item);
                                    var lst_cv_by_job = XuLyCV(browser, job);
                                    lst_ung_vien.AddRange(lst_cv_by_job);
                                }
                            }
                            job.tong_so_cv = lst_url_uv.Count;
                            ES.JobLinkRepository.Instance.UpdateTrangThaiXuLy(job);
                        }
                    }
                }
            }

            return(new List <UngVien>(lst_ung_vien));
        }
Exemple #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         CauHinh ch = data.GetCauHinh();
         txtTieude.Text = ch.tieuDe;
         txtMota.Text   = ch.moTa;
         txtTuKhoa.Text = ch.tuKhoa;
         logo.ImageUrl  = ch.logo;
     }
 }
        public ActionResult GuiYKien(int MaVanBan, string HoTen, string Email, string DienThoai, string NoiDung)
        {
            string sMailGui = System.Configuration.ConfigurationManager.AppSettings["MailSend"];
            string sPass    = System.Configuration.ConfigurationManager.AppSettings["MailPass"];
            string sHost    = System.Configuration.ConfigurationManager.AppSettings["MailHost"];
            string sPort    = System.Configuration.ConfigurationManager.AppSettings["MailPort"];
            string sTieuDe  = System.Configuration.ConfigurationManager.AppSettings["MailSubject"];
            // luu y kien
            FeedBack themFeedBack = new FeedBack();

            themFeedBack.HoTenGui  = HoTen;
            themFeedBack.Email     = Email;
            themFeedBack.DienThoai = DienThoai;
            themFeedBack.NoiDung   = NoiDung;
            themFeedBack.NgayGui   = DateTime.Now;
            db.FeedBacks.Add(themFeedBack);
            db.SaveChanges();
            TaiLieu tl = db.TaiLieux.SingleOrDefault(n => n.MaTaiLieu == MaVanBan);
            //lay mail ban he thong
            CauHinh ch = db.CauHinhs.SingleOrDefault(n => n.MaCauHinh == "EMAIL-FEEDBACK");

            // gui mail
            var    fromAddress  = new MailAddress(sMailGui, "Hệ thống Coteccons");
            var    toAddress    = new MailAddress(ch.DuLieu, "To Name");
            string fromPassword = sPass;
            string subject      = sTieuDe;
            string body         = "<b>Tên tài liệu: </b>" + tl.TenTaiLieu;

            body += "<br/ > <b>Họ tên người gửi: </b>" + HoTen;
            body += "<br /> <b>Email: </b>" + Email;
            body += "<br /> <b>Điện thoại: </b>" + DienThoai;
            body += "<br /> <b>Nội dung: </b> <br/>" + NoiDung;

            var smtp = new SmtpClient
            {
                Host                  = sHost,
                Port                  = int.Parse(sPort),
                EnableSsl             = true,
                DeliveryMethod        = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials           = new NetworkCredential(fromAddress.Address, fromPassword)
            };

            using (var message = new MailMessage(fromAddress, toAddress)
            {
                IsBodyHtml = true,
                Subject = subject,
                Body = body
            })
            {
                smtp.Send(message);
            }
            return(Content("1"));
        }
Exemple #21
0
      public void AutoUpdate(CauHinh ch)
      {
          var all_saved = ES.LinkSavedRepository.Instance.GetLinksByGiaTri(1, "https://topcv.vn/");

          if (all_saved.Count > 0)
          {
              using (var browser = new XBrowser())
              {
                  string url        = browser.GoTo(ch.url_login);
                  var    login_form = browser.Find(".//div[@class='panel-body']");
                  if (login_form.Count > 0)
                  {
                      try
                      {
                          foreach (var element in login_form)
                          {
                              element.FindElement(By.XPath(ch.xpath_username)).SendKeys(ch.username);
                              element.FindElement(By.XPath(ch.xpath_password)).SendKeys(ch.password);
                              element.FindElement(By.XPath(".//button")).Click();
                          }
                      }
                      catch
                      {
                      }
                  }
                  // top cv status
                  string showing     = "https://tuyendung.topcv.vn/tin-tuyen-dung?status=showing";
                  string waitting    = "https://tuyendung.topcv.vn/tin-tuyen-dung?status=waiting";
                  string not_publish = "https://tuyendung.topcv.vn/tin-tuyen-dung?status=not_publish";
                  string rejected    = "https://tuyendung.topcv.vn/tin-tuyen-dung?status=rejected";

                  var list_link_status = new List <string> {
                      showing, waitting, not_publish, rejected
                  };

                  foreach (string link in list_link_status)
                  {
                      browser.GoTo(link);
                      foreach (var tin in all_saved)
                      {
                          var job      = tin.ten_job.Remove(tin.ten_job.LastIndexOf(" ", StringComparison.Ordinal));
                          var find_new = browser.Find($".//a[@class='job-title']/strong[contains(text(),'{job}')]");
                          if (find_new.Count > 0)
                          {
                              string current_url = browser.GetUrl();
                              tin.thuoc_tinh = current_url != showing ? current_url != waitting ? current_url == not_publish ? 1 : 4 : 2 : 3;
                              ES.LinkSavedRepository.Instance.UpdateStatus(tin.id, tin.thuoc_tinh);
                          }
                      }
                  }
              }
          }
      }
Exemple #22
0
        public ActionResult SaveEdit(CauHinh model)
        {
            CauHinh menu = _cauHinhRepository.GetById(model.Id);

            menu.Id      = model.Id;
            menu.TieuDe  = model.TieuDe;
            menu.NoiDung = model.NoiDung;
            _cauHinhRepository.Update(menu);
            _unitOfWork.Commit();

            return(RedirectToAction("Index"));
        }
Exemple #23
0
        public List <UngVien> Run(CauHinh ch, List <JobLink> lst_job_link)
        {
            is_authenticated = false;
            List <UngVien> lst_ung_vien = new List <UngVien>();

            using (var browser = new XBrowser(user_profile_path, cv_save_path, string.Empty, false, show_browser))
            {
                foreach (var job in lst_job_link)
                {
                    string url = browser.GoTo(job.link);
                    if (url.Contains(ch.url_login))
                    {
                        is_authenticated = browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out string msg);
                    }
                    else
                    {
                        is_authenticated = browser.GetUrl().Contains(url);
                    }
                    if (is_authenticated)
                    {
                        string r_url = browser.GoTo(job.link);

                        if (r_url.Contains(job.link))
                        {
                            var lst_cv_by_job = XuLyCV(browser, job);
                            //Phân trang CV
                            ////ul[@class='pagination']//a
                            var cv_paging_eles = browser.Find("//ul[@class='pagination']//a");
                            if (cv_paging_eles.Count > 0)
                            {
                                var lst_link_paging = new List <string>();
                                foreach (var pg_ele in cv_paging_eles)
                                {
                                    lst_link_paging.Add(browser.GetAttribute(pg_ele, "href"));
                                }
                                lst_link_paging = lst_link_paging.Distinct().ToList();
                                foreach (var item in lst_link_paging)
                                {
                                    browser.GoTo(item);
                                    lst_cv_by_job.AddRange(XuLyCV(browser, job));
                                    ES.JobLinkRepository.Instance.UpdateTrangThaiXuLy(job);
                                }
                            }

                            job.tong_so_cv = lst_cv_by_job.Count;
                            lst_ung_vien.AddRange(lst_cv_by_job);
                        }
                    }
                }
            }

            return(new List <UngVien>(lst_ung_vien));
        }
Exemple #24
0
        public static string GetHtml(string url, ref int solanlap, System.Windows.Forms.Label lblMessage2, string token)
        {
            Stream        stream = null;
            StringBuilder output = new StringBuilder();

            CauHinh cauHinh = SQLDatabase.LoadCauHinh("select * from cauhinh");

            while (stream == null)
            {
                try
                {
                    StreamReader    reader;
                    HttpWebResponse resp  = null;
                    HttpWebRequest  myReq = (HttpWebRequest)WebRequest.Create(url);
                    resp = (HttpWebResponse)myReq.GetResponse();

                    stream             = resp.GetResponseStream();
                    stream.ReadTimeout = cauHinh.TimerOut;
                    reader             = new StreamReader(resp.GetResponseStream());
                    output.Clear();
                    output.Append(reader.ReadToEnd());


                    lblMessage2.Text = string.Format("{0}-Load:{1}", solanlap > 1 ? string.Format("Quét Lần:{0}", solanlap):"", url.Replace("https://graph.facebook.com", "..."));
                    lblMessage2.Update();

                    Log(url, token);
                }
                catch (WebException ex)
                {
                    if (ex.ToString().Contains("time"))
                    {
                        if (solanlap <= cauHinh.GoiLai)
                        {
                            solanlap = solanlap + 1;
                            GetHtml(url, ref solanlap, lblMessage2, token);
                        }
                    }
                    else
                    {
                        //MessageBox.Show("Vui Lòng kiễm tra lại Token các thông tin sau:\n -Hết hạn\n- Hết Quata\nBạn thử reset lại account để lấy lại token mới, hoặc nhập 1 accout mới", "Cảnh Báo",MessageBoxButtons.OK,MessageBoxIcon.Asterisk);
                        return("");
                    }
                }
                catch (Exception e)
                {
                    return("");
                }
            }

            return(System.Net.WebUtility.HtmlDecode(output.ToString()));
        }
Exemple #25
0
        public List <UngVien> Run(CauHinh ch, List <JobLink> lst_job_link, ToolStripStatusLabel toolStripStatusLabel1)
        {
            is_authenticated = false;
            List <UngVien> lst_ung_vien = new List <UngVien>();
            string         wait_xpath   = ".//li[@class='dropdown dropdown-user']";

            using (var browser = new XBrowser(user_profile_path, cv_save_path, string.Empty, false, show_browser))
            {
                foreach (var job in lst_job_link)
                {
                    string url = browser.GoTo(job.link);
                    is_authenticated = url.Contains(ch.url_login) ? browser.Login(ch.url_login, ch.username, ch.password, ch.xpath_username, ch.xpath_password, out string msg, wait_xpath, false) : browser.GetUrl().Contains(url);
                    if (is_authenticated)
                    {
                        //string r_url = browser.GoTo(job.link);
                        System.Threading.Thread.Sleep(1000);
                        browser.FindAndClick(".//a[@href='#tab2']");

                        var ung_vien      = browser.Find(".//tbody[@id='applied']//strong/a");
                        var url_detail_uv = new List <string>();
                        foreach (var uv in ung_vien)
                        {
                            var link_uv = browser.GetAttribute(uv, "href");
                            url_detail_uv.Add(link_uv);
                        }

                        if (url_detail_uv.Count > 0)
                        {
                            foreach (var u_v in url_detail_uv)
                            {
                                browser.GoTo(u_v);
                                toolStripStatusLabel1.Text = $"Đang xử lý link:{job.link}";
                                var lst_cv_by_job = XuLyCV(browser, job);
                                lst_ung_vien.AddRange(lst_cv_by_job);
                            }
                        }
                        else
                        {
                            job.trang_thai_xu_ly       = TrangThaiXuLy.DA_XU_LY;
                            job.ngay_xu_ly             = XUtil.TimeInEpoch();
                            toolStripStatusLabel1.Text = $"Không tìm thấy ứng viên link:{job.link}";
                        }
                        job.tong_so_cv = url_detail_uv.Count;
                        ES.JobLinkRepository.Instance.UpdateTrangThaiXuLy(job);
                    }
                }
            }

            return(new List <UngVien>(lst_ung_vien));
        }
Exemple #26
0
    private CauHinh LayDonVi()
    {
        CauHinh objkh = new CauHinh();

        objkh.lan1         = int.Parse(txtlan1.Text.Trim());
        objkh.lan2         = int.Parse(txtlan2.Text.Trim());
        objkh.lan3         = int.Parse(txtlan3.Text.Trim());
        objkh.lan4         = int.Parse(txtlan4.Text.Trim());
        objkh.lan5         = int.Parse(txtlan5.Text.Trim());
        objkh.lan6         = int.Parse(txtlan6.Text.Trim());
        objkh.Hoatdong     = CheckBox1.Checked;
        objkh.GioNhanTinDK = int.Parse(txtgionhantindk.Text.Trim());
        objkh.GioNhanTinSN = int.Parse(txtgionhantinsn.Text.Trim());
        objkh.GhiChu       = txtghichu.Text.Trim();
        return(objkh);
    }
Exemple #27
0
 protected void btnCapNhat_Click(object sender, EventArgs e)
 {
     CauHinh ch = new CauHinh();
     ch.tieuDe = txtTieude.Text;
     ch.moTa = txtMota.Text;
     ch.tuKhoa = txtTuKhoa.Text;
     if (imgAnh.HasFile)
     {
         string path = Server.MapPath("~/Upload/") + imgAnh.FileName;
         imgAnh.PostedFile.SaveAs(path);
         ch.logo = "/Upload/" + imgAnh.FileName;
     }
     else ch.logo = logo.ImageUrl;
     data.SuaCauHinh(ch);
     Response.Redirect("CauHinh.aspx");
 }
Exemple #28
0
 private void GanDuLieu(CauHinh cauHinh)
 {
     LuuCbo(cboTemp);
     cauHinh.TenCauHinh = txtTenCauHinh.Text;
     cauHinh.ManHinh    = Convert.ToInt32(cboTemp[1].SelectedValue);
     cauHinh.Chuot      = Convert.ToInt32(cboTemp[2].SelectedValue);
     cauHinh.BanPhim    = Convert.ToInt32(cboTemp[3].SelectedValue);
     cauHinh.Case       = Convert.ToInt32(cboTemp[4].SelectedValue);
     cauHinh.CPU        = Convert.ToInt32(cboTemp[5].SelectedValue);
     cauHinh.MainBoard  = Convert.ToInt32(cboTemp[6].SelectedValue);
     cauHinh.RAM        = Convert.ToInt32(cboTemp[7].SelectedValue);
     cauHinh.OCung      = Convert.ToInt32(cboTemp[8].SelectedValue);
     cauHinh.VGA        = Convert.ToInt32(cboTemp[9].SelectedValue);
     cauHinh.PSU        = Convert.ToInt32(cboTemp[10].SelectedValue);
     cauHinh.HDH        = Convert.ToInt32(cboTemp[11].SelectedValue);
 }
Exemple #29
0
 private void FrmCauHinh_Load(object sender, EventArgs e)
 {
     try
     {
         cauHinh = SQLDatabase.LoadCauHinh("select * from cauhinh");
         txtsysLimitCallApi.Value = ConvertType.ToDecimal(cauHinh.LimitCallApi);
         txtTimerOut.Value        = ConvertType.ToDecimal(cauHinh.TimerOut);
         txtGoiLai.Value          = ConvertType.ToDecimal(cauHinh.GoiLai);
         txtTimkiemFB.Value       = ConvertType.ToDecimal(cauHinh.LimitTimKiemFb);
         BindNhom(txtSeachQuocGia.Text);
         BindColumn();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "FrmCauHinh_Load");
     }
 }
 /// <summary>
 /// Lấy dữ liệu các cấu hình liên quan đến development
 /// Author       :   QuyPN - 10/06/2018 - create
 /// </summary>
 /// <returns>Cấu hình đã lưu của hệ thống</returns>
 public static CauHinh LayCauHinh()
 {
     try
     {
         DataContext context = new DataContext();
         CauHinh     cauHinh = context.CauHinh.FirstOrDefault(x => x.Id == (int)OtherEnum.IdCauHinh);
         if (cauHinh != null)
         {
             return(cauHinh);
         }
         return(new CauHinh());
     }
     catch
     {
         return(new CauHinh());
     }
 }
Exemple #31
0
        protected void btnXoa_Command(object sender, CommandEventArgs e)
        {
            //code de xoa du lieu voi ma lop nien che luu trong commandArgument

            string ID = e.CommandArgument.ToString();
            //xoa du lieu trong database
            //tao doi tuong truy van
            QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
            CauHinh data             = db.CauHinh.FirstOrDefault(x => x.ID == ID);

            if (data != null)
            {
                db.CauHinh.Remove(data);
                db.SaveChanges();
                getData();
            }
        }
Exemple #32
0
 protected void btnCapNhat_Click(object sender, EventArgs e)
 {
     try
     {
         CauHinh ch = new CauHinh();
         ch.tieuDe = txtTieude.Text;
         ch.moTa = txtMota.Text;
         ch.tuKhoa = txtTuKhoa.Text;
         if (imgAnh.HasFile)
         {
             string path = Server.MapPath("~/Upload/") + imgAnh.FileName;
             imgAnh.PostedFile.SaveAs(path);
             ch.logo = "/Upload/" + imgAnh.FileName;
         }
         else ch.logo = logo.ImageUrl;
         data.SuaCauHinh(ch);
         Response.Redirect("CauHinh.aspx");
     }
     catch (Exception ex)
     {
         Response.Write("<script>alert("+ex.Message+");</script>");
     }
 }
Exemple #33
0
    public void SuaCauHinh(CauHinh ch)
    {
        string sql = @"UPDATE tblCauHinh  set   tieuDe=@tieuDe,
                                                moTa=@moTa,
                                                tuKhoa=@tuKhoa,
                                                logo=@logo where 1 = 1";
        con.Open();
        SqlCommand cmd = new SqlCommand(sql, con);
        cmd.Parameters.Add("@tieuDe", SqlDbType.NText);
        cmd.Parameters["@tieuDe"].Value = ch.tieuDe;

        cmd.Parameters.AddWithValue("@logo", ch.logo);

        cmd.Parameters.Add("@moTa", SqlDbType.NText);
        cmd.Parameters["@moTa"].Value = ch.moTa;

        cmd.Parameters.Add("@tuKhoa", SqlDbType.NText);
        cmd.Parameters["@tuKhoa"].Value = ch.tuKhoa;
        cmd.ExecuteNonQuery();
        con.Close();
    }
Exemple #34
0
 public CauHinh GetCauHinh()
 {
     con.Open();
     SqlCommand cmd = new SqlCommand();
     cmd.CommandText = "SELECT * From tblCauHinh";
     cmd.Connection = con;
     SqlDataReader rd = cmd.ExecuteReader();
     CauHinh ch = new CauHinh();
     if (rd.Read())
     {
         ch.tieuDe = Convert.ToString(rd["tieuDe"]);
         ch.moTa = Convert.ToString(rd["moTa"]);
         ch.tuKhoa = Convert.ToString(rd["tuKhoa"]);
         ch.logo = Convert.ToString(rd["logo"]);
     }
     con.Close();
     return ch;
 }