public string Put(AgencyModel agencyModel)
        {
            string success = "";

            try
            {
                using (GetaJobContext db = new GetaJobContext())
                {
                    Agency agency = db.Agencies.Where(a => a.Id == agencyModel.Id).FirstOrDefault();

                    JobCompany jobCompany = db.JobCompanies.Where(j => j.Id == agency.CompanyId).FirstOrDefault();
                    jobCompany.CompanyName    = agencyModel.CompanyName;
                    jobCompany.CompanyAddress = agencyModel.CompanyAddress;
                    jobCompany.Email          = agencyModel.Email;
                    jobCompany.OfficePhone    = agencyModel.Phone;
                    jobCompany.CompanyZip     = agencyModel.CompanyZip;
                    jobCompany.Website        = agencyModel.Website;;

                    db.SaveChanges();
                    success = "ok";
                }
            }
            catch (Exception ex) { success = Helpers.ErrorDetails(ex); }
            return(success);
        }
        public string Post(AgencyModel agencyModel)
        {
            string success = "ERROR: ";

            try
            {
                using (GetaJobContext db = new GetaJobContext())
                {
                    JobCompany jobCompany = new JobCompany()
                    {
                        Id             = Guid.NewGuid().ToString(),
                        CompanyTypeRef = "AGE",
                        CompanyName    = agencyModel.CompanyName,
                        CompanyAddress = agencyModel.CompanyAddress,
                        CompanyZip     = agencyModel.CompanyZip,
                        Email          = agencyModel.Email,
                        OfficePhone    = agencyModel.Phone,
                        Website        = agencyModel.Website
                    };
                    db.JobCompanies.Add(jobCompany);
                    db.SaveChanges();

                    Agency agency = new Agency();
                    agency.Id        = Guid.NewGuid().ToString();
                    agency.CompanyId = jobCompany.Id;

                    db.Agencies.Add(agency);
                    db.SaveChanges();
                    success = agency.Id;
                }
            }
            catch (Exception ex) { success = Helpers.ErrorDetails(ex); }
            return(success);
        }
Example #3
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");
        }
Example #4
0
        void ReleaseDesignerOutlets()
        {
            if (JobCompany != null)
            {
                JobCompany.Dispose();
                JobCompany = null;
            }

            if (JobDesription != null)
            {
                JobDesription.Dispose();
                JobDesription = null;
            }

            if (JobLocation != null)
            {
                JobLocation.Dispose();
                JobLocation = null;
            }

            if (JobTitle != null)
            {
                JobTitle.Dispose();
                JobTitle = null;
            }

            if (JobType != null)
            {
                JobType.Dispose();
                JobType = null;
            }
        }
Example #5
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();
        }
Example #6
0
 public void AddToJobCompany(JobCompany jobCompany)
 {
     base.AddObject("JobCompany", jobCompany);
 }
Example #7
0
 public static JobCompany CreateJobCompany(int id)
 {
     JobCompany jobCompany = new JobCompany();
     jobCompany.ID = id;
     return jobCompany;
 }