예제 #1
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            int id = WS.RequestInt("id");
            //int userid = WS.RequestInt("uid");
            DataEntities ent = new DataEntities();

            JobCompany com = new JobCompany();
            if (id > 0)
            {
                com = (from l in ent.JobCompany where l.ID == id select l).FirstOrDefault();
            }

            com.CompanyName = txt_CompanyName.Text;
            com.CompanyType = ddl_CompanyType.SelectedValue.ToInt32();
            com.EmployeeCount = ddl_EmployeeCount.SelectedValue.ToInt32();
            com.Industry = txt_Industry.Text;
            com.Intro = txt_Intro.Text;
            com.UserID = ddl_User.SelectedValue.ToInt32();
            com.DayClick = txt_DayClick.Text.ToInt32(0);
            com.IsSetTop = chk_Settop.Checked;
            com.SetTopTime = DateTime.Now;
            com.MailAddress = txt_MailAddress.Text;

            if (id > 0 && com != null)
            {

            }
            else
            {

                ent.AddToJobCompany(com);
            }
            ent.SaveChanges();
            ent.Dispose();
            Js.AlertAndChangUrl("保存成功!","List.aspx");
        }
예제 #2
0
        protected void LoadInfo()
        {
            long id = WS.RequestLong("id");

            if (id < 0)
            {
                return;
            }

            DataEntities ent = new DataEntities();

            Comapny = (from l in ent.JobCompany where l.ID == id select l).FirstOrDefault();
            CompanyName = Comapny.CompanyName;
            Industry = Comapny.Industry;
            CompanyType = JobAction.GetCompanyTypeName(Comapny.CompanyType.ToInt32());
            EmployeeCount = JobAction.GetEmployeeCountName(Comapny.EmployeeCount.ToInt32());
            Intro = Comapny.Intro;

            Comapny.DayClick += 1;

            ent.SaveChanges();

            var db_list = from p in ent.JobPost
                          from c in ent.JobCompany
                          from pro in ent.Province
                          from ct in ent.City
                          where p.CompanyID == c.ID
                          && p.Province == pro.ID
                          && p.City == ct.id
                          select new
                          {
                              p.City,
                              p.CompanyID,
                              p.Edu,
                              p.PostTime,
                              p.EmployNumber,
                              p.Expressions,
                              p.ID,
                              p.Intro,
                              p.Province,
                              p.Salary,
                              p.Title,
                              c.CompanyName,
                              c.Industry,
                              c.EmployeeCount,
                              ProvinceName = pro.province1,
                              CityName = ct.city1

                          };
            db_list = from l in db_list where l.CompanyID == id select l;

            pager.RecordCount = db_list.Count();
            int page = WS.RequestInt("page", 1);
            db_list = db_list.OrderByDescending(p => p.ID).Skip((page - 1) * pager.PageSize).Take(pager.PageSize);

            pager.UrlRewritePattern = "Company.aspx?id="+ WS.RequestString("id") +"&page={0}";
            // pager.CurrentPageIndex = page;
            if (db_list.Count() == 0)
            {
                return;
            }
            var list = from l in db_list.ToList()
                       from e in JobAction.EmployeeCount
                       from ed in JobAction.Edu
                       from ex in JobAction.Expressions
                       from sa in JobAction.SalaryDegree
                       where l.EmployeeCount == e.Key
                       && l.Edu == ed.Key
                       && l.Expressions == ex.Key
                       && l.Salary == sa.Key
                       select new
                       {
                           l.City,
                           l.CompanyID,
                           Edu = ed.Value,
                           l.PostTime,
                           l.EmployNumber,
                           Expressions = ex.Value,
                           l.ID,
                           l.Intro,
                           l.Province,
                           Salary = sa.Value,
                           l.Title,
                           l.CompanyName,
                           l.Industry,
                           EmployeeCount = e.Value

                       };

            rp_list.DataSource = list;
            rp_list.DataBind();

            ent.Dispose();
        }