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"); }