Exemple #1
0
        public int Nopdonungtuyen(int customerId, int customerNTDId, int newsId, int newsId_Ungtuyen, int typeId, string tieudethu, string noidungthu)
        {//customerId là ứng viên, newsId là hồ sơ tuyển dụng,
            try
            {
                VL_CUSTOMER_ESHOP_NEW insert = new VL_CUSTOMER_ESHOP_NEW();
                insert.CUSTOMER_ID      = customerId;
                insert.CUSTOMER_NTD_ID  = customerNTDId;
                insert.NEWS_ID          = newsId;
                insert.NEWS_ID_UNGTUYEN = newsId_Ungtuyen;
                insert.TYPE             = 2;//tự ứng tuyển
                insert.TIEUDETHU        = tieudethu;
                insert.NOIDUNGTHU       = noidungthu;
                insert.PUBLISHDATE      = DateTime.Now;
                insert.DATE_XULY        = DateTime.Now;

                db.VL_CUSTOMER_ESHOP_NEWs.InsertOnSubmit(insert);

                db.SubmitChanges();
                return(1);
            }
            catch (Exception ex)
            {
                clsVproErrorHandler.HandlerError(ex);
                return(0);
            }
        }
        protected void lnkLuutin_Click(object sender, EventArgs e)
        {
            int customerId = Utils.CIntDef(Session["userId"]);

            if (customerId == 0 || Utils.CIntDef(Session["user_quyen"]) != Cost.QUYEN_NTD)
            {
                MessageBox1.ShowMessage("Bạn cần đăng nhập tài khoản nhà tuyển để sử dụng chức năng này!", "Thông báo");
                return;
            }
            int i = 0;
            int j = 0;
            HtmlInputCheckBox check = new HtmlInputCheckBox();

            //int[] items = new int[GridItemList_Xemnhieu.Items.Count];

            foreach (DataGridItem item in GridItemList.Items)
            {
                check = new HtmlInputCheckBox();
                check = (HtmlInputCheckBox)item.Cells[1].FindControl("chkSelect");
                HiddenField hddCusId = (HiddenField)item.Cells[1].FindControl("hddCusId");
                if (check.Checked)
                {
                    //items[j] = Utils.CIntDef(GridItemList_Xemnhieu.DataKeys[i]);
                    j++;
                    int newsId = Utils.CIntDef(GridItemList.DataKeys[i]);
                    var list   = db.VL_CUSTOMER_ESHOP_NEWs.Where(a => a.CUSTOMER_NTD_ID == customerId &&
                                                                 a.NEWS_ID_UNGTUYEN == newsId && a.TYPE == 5);
                    if (list != null && list.ToList().Count > 0)
                    {
                        //
                    }
                    else
                    {
                        VL_CUSTOMER_ESHOP_NEW insert = new VL_CUSTOMER_ESHOP_NEW();
                        insert.CUSTOMER_ID      = Utils.CIntDef(hddCusId.Value);
                        insert.CUSTOMER_NTD_ID  = customerId;
                        insert.NEWS_ID_UNGTUYEN = newsId;
                        insert.TYPE             = 5;
                        insert.PUBLISHDATE      = DateTime.Now;
                        insert.DATE_XULY        = DateTime.Now;

                        db.VL_CUSTOMER_ESHOP_NEWs.InsertOnSubmit(insert);
                        db.SubmitChanges();
                    }
                }

                i++;
            }
            if (j > 0)
            {
                MessageBox1.ShowMessage("Lưu hồ sơ thành công!", "Thông báo");
            }
            else
            {
                MessageBox1.ShowMessage("Chưa chọn hồ sơ để lưu!", "Thông báo");
            }
        }
        protected void lnkLuutin_Click(object sender, EventArgs e)
        {
            int customerId = Utils.CIntDef(Session["userId"]);
            int newsId     = Utils.CIntDef(Session["newsid"]);

            if (customerId == 0 || Utils.CIntDef(Session["user_quyen"]) != Cost.QUYEN_NTV)
            {
                MessageBox1.ShowMessage("Bạn cần đăng nhập tài khoản người tìm việc để sử dụng chức năng này!", "Thông báo");
                //Response.Write("<script>alert('Bạn cần đăng nhập tài khoản người tìm việc để sử dụng chức năng này!');'</script>");
                return;
            }
            var list = db.VL_CUSTOMER_ESHOP_NEWs.Where(a => a.CUSTOMER_ID == customerId &&
                                                       a.TYPE == 1 &&
                                                       a.NEWS_ID == newsId);

            if (list != null && list.ToList().Count > 0)
            {
                //Response.Write("<script>alert('Bạn lưu tin này trước đó!');'</script>");
                MessageBox1.ShowMessage("Bạn đã lưu tin này trước đó!", "Thông báo");
                return;
            }
            if (newsId > 0)
            {
                VL_CUSTOMER_ESHOP_NEW insert = new VL_CUSTOMER_ESHOP_NEW();
                insert.CUSTOMER_ID = customerId;
                insert.NEWS_ID     = newsId;
                insert.TYPE        = 1;
                insert.PUBLISHDATE = DateTime.Now;

                db.VL_CUSTOMER_ESHOP_NEWs.InsertOnSubmit(insert);
                db.SubmitChanges();
                MessageBox1.ShowMessage("Lưu tin thành công!", "Thông báo");
            }
            else
            {
                Response.Redirect(Request.RawUrl);
            }
        }
        protected void lnkLuutin_Click(object sender, EventArgs e)
        {
            int userId = Utils.CIntDef(Session["userId"]);
            int newsId = Utils.CIntDef(Session["newsid"]);
            int cusId  = Utils.CIntDef(Session["customerid"]);

            if (userId == 0 || Utils.CIntDef(Session["user_quyen"]) != Cost.QUYEN_NTD)
            {
                MessageBox1.ShowMessage("Bạn cần đăng nhập tài khoản nhà tuyển để sử dụng chức năng này!", "Thông báo");
                return;
            }
            var list = db.VL_CUSTOMER_ESHOP_NEWs.Where(a => a.CUSTOMER_NTD_ID == userId &&
                                                       a.NEWS_ID_UNGTUYEN == newsId && a.TYPE == 5);

            if (list != null && list.ToList().Count > 0)
            {
                MessageBox1.ShowMessage("Bạn lưu hồ sơ này trước đó!", "Thông báo");
                return;
            }
            if (newsId > 0)
            {
                VL_CUSTOMER_ESHOP_NEW insert = new VL_CUSTOMER_ESHOP_NEW();
                insert.CUSTOMER_ID      = cusId;
                insert.CUSTOMER_NTD_ID  = userId;
                insert.NEWS_ID_UNGTUYEN = newsId;
                insert.TYPE             = 5;
                insert.PUBLISHDATE      = DateTime.Now;
                insert.DATE_XULY        = DateTime.Now;

                db.VL_CUSTOMER_ESHOP_NEWs.InsertOnSubmit(insert);
                db.SubmitChanges();
                MessageBox1.ShowMessage("Lưu hồ sơ thành công!", "Thông báo");
            }
            else
            {
                Response.Redirect("/nha-tuyen-dung.html");
            }
        }
        private void LoadInfo()
        {
            var item = vlnews.GetEshopNewsByNews_seo_url(_sNews_Seo_Url);

            if (item != null)
            {
                int news_count = Utils.CIntDef(item.NEWS_COUNT);
                //+ số lần xem việc làm
                List <int> arr = new List <int>();
                if (Session["viewCount"] != null)
                {
                    arr = (List <int>)Session["viewCount"];
                }
                int i = arr.Find(a => a == item.NEWS_ID);
                if (i != item.NEWS_ID)
                {
                    arr.Add(item.NEWS_ID);
                    Session["viewCount"] = arr;
                    var listcount = db.ESHOP_NEWs.Where(a => a.NEWS_ID == item.NEWS_ID);
                    if (listcount != null && listcount.ToList().Count > 0)
                    {
                        listcount.ToList()[0].NEWS_COUNT++;
                        news_count = Utils.CIntDef(listcount.ToList()[0].NEWS_COUNT);
                        db.SubmitChanges();
                    }
                }
                Session["newsid"] = item.NEWS_ID;
                //linkNophoso.HRef = linkNophoso2.HRef = "/ntv-nop-ho-so-truc-tuyen/" + _sNews_Seo_Url;

                lbTitle.Text   = lbVitrituyendung.Text = lbVitrituyendung2.Text = Utils.CStrDef(item.NEWS_TITLE);
                lbLuotxem.Text = cls.FormatMoneyNoVND(news_count);
                //lbMaNTD.Text = Utils.CStrDef(item.NEWS_CODE);
                lbNgaylammoi.Text      = string.Format("{0:dd/MM/yyyy}", item.NEWS_UPDATEFRERESH);
                lbChucvu.Text          = getCapbac(item.VL_CAOBAC_ID);
                lbNganhnghe.Text       = getNganhnghe(item.NEWS_ID);
                lbHinhthuclamviec.Text = getHinhthuclamviec(item.VL_HINHTHUCLAMVIEC_ID);
                lbDiadiemlamviec.Text  = getDiadiemlamviec(item.NEWS_ID);
                lbMucluong.Text        = getMucluong(item.VL_MUCLUONG_ID);
                lbMotacongviec.Text    = Utils.CStrDef(item.MOTACONGVIEC).Replace("\r\n", "<br />");
                lbQuyenloi.Text        = Utils.CStrDef(item.QUYENLOI).Replace("\r\n", "<br />");
                lbYeucaukhac.Text      = Utils.CStrDef(item.YEUCAUKHAC).Replace("\r\n", "<br />");
                lbHosogom.Text         = Utils.CStrDef(item.HOSO).Replace("\r\n", "<br />");
                lbHannop.Text          = string.Format("{0:dd/MM/yyyy}", item.NEWS_DEALINE);
                lbHinhthucnophoso.Text = getHinhthucnop(item.VL_HINHTHUCNOPHOSO_ID);
                lbKinhnghiem.Text      = getKinhnghiem(item.VL_KINHNGHIEM_ID);
                lbBangcap.Text         = getTrinhdohocvan(item.VL_TRINHDOHOCVAN_ID);
                lbGioitinh.Text        = Utils.CIntDef(item.YEUCAUGIOITINH, 0) == 1 ? "Nam" : (Utils.CIntDef(item.YEUCAUGIOITINH, 0) == 2 ? "Nữ" : (Utils.CIntDef(item.YEUCAUGIOITINH, 0) == 3 ? "Khác" :  "Không yêu cầu"));
                lbDotuoi.Text          = getDotuoi(item.VL_DOTUOI_ID);
                lbSoluongtuyen.Text    = Utils.CStrDef(item.SOLUONGTUYEN);

                string url = "http://" + Request.Url.Host + Page.ResolveUrl(Request.RawUrl);
                Lbface.Text = "<div class='fb-like' data-href='" + url + "' data-layout='button_count' data-action='like' data-show-faces='true' data-share='true'></div>";

                int customerId = Utils.CIntDef(item.CUSTOMER_ID);
                Session["customerId"] = customerId;
                var customer = db.ESHOP_CUSTOMERs.Where(n => n.CUSTOMER_ID == customerId);
                if (customer != null && customer.ToList().Count > 0)
                {
                    lbNguoilienhe.Text     = Utils.CStrDef(customer.ToList()[0].CUSTOMER_CONTACTNAME);
                    lbDiachilienhe.Text    = Utils.CStrDef(customer.ToList()[0].CUSTOMER_CONTACTADDRESS);
                    lbEmaillienhe.Text     = Utils.CStrDef(customer.ToList()[0].CUSTOMER_CONTACTEMAIL);
                    lbDienthoailienhe.Text = Utils.CStrDef(customer.ToList()[0].CUSTOMER_CONTACTPHONE);

                    lbTencongty.Text       = Utils.CStrDef(customer.ToList()[0].CUSTOMER_FULLNAME);
                    lbDiachicongty.Text    = Utils.CStrDef(customer.ToList()[0].CUSTOMER_ADDRESS);
                    lbWebsite.Text         = Utils.CStrDef(customer.ToList()[0].CUSTOMER_WEBSITE);
                    lbDienthoaicongty.Text = Utils.CStrDef(customer.ToList()[0].CUSTOMER_PHONE1);
                    lbGioithieucongty.Text = Utils.CStrDef(customer.ToList()[0].CUSTOMER_SOLUOC).Replace("\r\n", "<br />");
                    lbQuymoconty.Text      = Utils.CStrDef(customer.ToList()[0].CUSTOMER_QUYMO);
                    if (customer.ToList()[0].CUSTOMER_LOGO != "" && customer.ToList()[0].CUSTOMER_LOGO != null)
                    {
                        imgLogo.ImageUrl = "~/data/customer/logo/" + customer.ToList()[0].CUSTOMER_LOGO;
                    }
                }
                var list2 = vlnews.GetEshopNewsByOtherOfNTD(_sNews_Seo_Url, Utils.CIntDef(item.CUSTOMER_ID));
                if (list2 != null && list2.Count > 0)
                {
                    rptViecLam_Other.DataSource = list2.OrderByDescending(n => n.NEWS_COUNT);
                    rptViecLam_Other.DataBind();
                }

                //check người tìm việc xem tuyển dụng
                if (Utils.CIntDef(Session["user_quyen"]) == Cost.QUYEN_NTV)
                {
                    int userId = Utils.CIntDef(Session["userId"]);
                    var list   = db.VL_CUSTOMER_ESHOP_NEWs.Where(a => a.CUSTOMER_ID == userId &&
                                                                 a.NEWS_ID == item.NEWS_ID && a.TYPE == 3);
                    if (list != null && list.ToList().Count > 0)
                    {
                        list.ToList()[0].PUBLISHDATE = DateTime.Now;

                        db.SubmitChanges();
                    }
                    else
                    {
                        VL_CUSTOMER_ESHOP_NEW insert = new VL_CUSTOMER_ESHOP_NEW();
                        insert.CUSTOMER_ID     = userId;
                        insert.CUSTOMER_NTD_ID = customerId;
                        insert.NEWS_ID         = item.NEWS_ID;
                        insert.TYPE            = 3;
                        insert.PUBLISHDATE     = DateTime.Now;

                        db.VL_CUSTOMER_ESHOP_NEWs.InsertOnSubmit(insert);
                        db.SubmitChanges();
                    }
                }
            }
        }
        private void LoadInfo()
        {
            var item = vlnews.GetEshopNewsByNews_seo_url(_sNews_Seo_Url);

            if (item != null)
            {
                int news_count = Utils.CIntDef(item.NEWS_COUNT);
                //+ số lần xem việc làm
                List <int> arr = new List <int>();
                if (Session["viewCount"] != null)
                {
                    arr = (List <int>)Session["viewCount"];
                }
                int i = arr.Find(a => a == item.NEWS_ID);
                if (i != item.NEWS_ID)
                {
                    arr.Add(item.NEWS_ID);
                    Session["viewCount"] = arr;
                    var listcount = db.ESHOP_NEWs.Where(a => a.NEWS_ID == item.NEWS_ID);
                    if (listcount != null && listcount.ToList().Count > 0)
                    {
                        listcount.ToList()[0].NEWS_COUNT++;
                        news_count = Utils.CIntDef(listcount.ToList()[0].NEWS_COUNT);
                        db.SubmitChanges();
                    }
                }
                Session["newsid"] = item.NEWS_ID;

                lbLuotxem.Text = cls.FormatMoneyNoVND(news_count);
                //lbMaNTD.Text = Utils.CStrDef(item.NEWS_CODE);
                lbNgaylammoi.Text = string.Format("{0:dd/MM/yyyy}", item.NEWS_UPDATEFRERESH);

                lbBangcap.Text  = getTrinhdohocvan(item.VL_TRINHDOHOCVAN_ID);
                lbNganhhoc.Text = item.NGANHHOC;
                string loaitotnghiep = GetCusLoaitotnghiepNTV(item.LOAITOTNGHIEP);
                lbTotnghiepnam.Text       = Utils.CStrDef(item.NAMTOTNGHIEP) + " (" + loaitotnghiep + ")";
                lbTotnghieptaitruong.Text = getTruongtotnghiep(item.VL_TRUONGTOTNGHIEP_ID);
                lbNgoaingu.Text           = getNgoaingu(item.VL_TRUONGTOTNGHIEP_ID);
                lbTrinhdotinhoc.Text      = Utils.CStrDef(item.TRINHDOTINHOC).Replace("\r\n", "<br />");
                lbBangcapkhac.Text        = Utils.CStrDef(item.BANGCAPKHAC).Replace("\r\n", "<br />");
                lbSonamkinhnghiem.Text    = getKinhnghiem(item.VL_KINHNGHIEM_ID);
                lbKinhnghiem.Text         = Utils.CStrDef(item.QUATRINHLAMVIEC).Replace("\r\n", "<br />");
                lbCackynang.Text          = Utils.CStrDef(item.KYNANG).Replace("\r\n", "<br />");

                lbVitrimongmuon.Text     = Utils.CStrDef(item.NEWS_TITLE);
                lbCapbacmongmuon.Text    = getCapbac(item.VL_CAOBAC_ID);
                lbNgangnghe.Text         = getNganhnghe(item.NEWS_ID);
                lbHinhthuclamviec.Text   = getHinhthuclamviec(item.VL_HINHTHUCLAMVIEC_ID);
                lbDiadiemlamviec.Text    = getDiadiemlamviec(item.NEWS_ID);
                lbMucluongmongmuon.Text  = getMucluong(item.VL_MUCLUONG_ID);
                lbMuctieunghenghiep.Text = Utils.CStrDef(item.MUCTIEUNGHENGHIEP);

                int customerId = Utils.CIntDef(item.CUSTOMER_ID);
                Session["customerid"] = customerId;
                var customer = db.ESHOP_CUSTOMERs.Where(n => n.CUSTOMER_ID == customerId);
                if (customer != null && customer.ToList().Count > 0)
                {
                    lbHoTen.Text = Utils.CStrDef(customer.ToList()[0].CUSTOMER_FULLNAME);
                    DateTime birthday = Utils.CDateDef(customer.ToList()[0].CUSTOMER_BIRTHDAY, DateTime.MinValue);
                    lbNgaysinh.Text = "";
                    if (birthday != DateTime.MinValue)
                    {
                        lbNgaysinh.Text = birthday.ToString("dd/MM/yyyy");
                    }
                    lbGioitinh.Text         = GetCusSexNTV(customer.ToList()[0].CUSTOMER_SEX);
                    lbTinhtranghonnhan.Text = GetCusHonnhanNTV(customer.ToList()[0].CUSTOMER_HONNHAN);
                    if (customer.ToList()[0].CUSTOMER_LOGO != "" && customer.ToList()[0].CUSTOMER_LOGO != null)
                    {
                        imgLogo.ImageUrl = "~/data/customer/logo/" + customer.ToList()[0].CUSTOMER_LOGO;
                    }
                }
                int catId = getNganhngheID(item.NEWS_ID);
                var list2 = vlnews.GetEshopNewsByOtherOfCat(_sNews_Seo_Url, catId);
                if (list2 != null && list2.Count > 0)
                {
                    rptHoso_Tuongtu.DataSource = list2;//.OrderByDescending(n => n.NEWS_COUNT);
                    rptHoso_Tuongtu.DataBind();
                }

                var itemCat = db.ESHOP_CATEGORies.Where(n => n.CAT_ID == catId);
                if (itemCat != null && itemCat.ToList().Count > 0)
                {
                    linkUngvientuongtu.HRef = GetLinkCat(itemCat.ToList()[0].CAT_URL, itemCat.ToList()[0].CAT_SEO_URL, 1);
                }
                //check nhà tuyển dung xem hồ sơ
                if (Utils.CIntDef(Session["user_quyen"]) == Cost.QUYEN_NTD)
                {
                    int userId = Utils.CIntDef(Session["userId"]);
                    var list   = db.VL_CUSTOMER_ESHOP_NEWs.Where(a => a.CUSTOMER_NTD_ID == userId &&
                                                                 a.NEWS_ID_UNGTUYEN == item.NEWS_ID && a.TYPE == 4);
                    if (list != null && list.ToList().Count > 0)
                    {
                        list.ToList()[0].VIEWCOUNT++;
                        list.ToList()[0].PUBLISHDATE = DateTime.Now;

                        db.SubmitChanges();
                    }
                    else
                    {
                        VL_CUSTOMER_ESHOP_NEW insert = new VL_CUSTOMER_ESHOP_NEW();
                        insert.CUSTOMER_ID      = customerId;
                        insert.CUSTOMER_NTD_ID  = userId;
                        insert.NEWS_ID_UNGTUYEN = item.NEWS_ID;
                        insert.TYPE             = 4;
                        insert.VIEWCOUNT        = 1;
                        insert.PUBLISHDATE      = DateTime.Now;

                        db.VL_CUSTOMER_ESHOP_NEWs.InsertOnSubmit(insert);
                        db.SubmitChanges();
                    }
                }
            }
        }