protected void SubmitApply(object sender, EventArgs e) { if (isValidInput()) { JoinApply apply = new JoinApply() { CompanyName = txtCompanyName.Text.Trim(), Address = txtAddress.Text.Trim(), PhoneNo = txtPhone.Text.Trim(), LinkMan = txtLinkman.Text.Trim(), Email = txtEmail.Text.Trim(), CompanyType = ddlCompanyType.SelectedValue, PlantingSpecies = txtPlantingSpecies.Text.Trim(), PlantingRegion = txtPlantingRegion.Text.Trim(), SupplySeason = txtSupplySeason.Text.Trim(), RegisteredFund = ddlRegisteredFund.SelectedValue, Intention = ddlIntention.SelectedValue, Duration = ddlDuration.SelectedValue, CurrentAnnualOutput = ddlCurrentAnnualOutput.SelectedValue, BestAnnualOutput = ddlBestAnnualOutput.SelectedValue, AnnualIncome = ddlAnnualIncome.SelectedValue, PlantingArea = ddlPlantingArea.SelectedValue, StorageCapicity = ddlStorageCapicity.SelectedValue, Remark = txtRemark.InnerText.Trim(), ApplyState = 1,//默认状态 ApplyTime = DateTime.Now }; service.Add(apply); AlertGo("申请提交成功", Request.Url.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (applyid != "") { apply = service.GetDetail(applyid); } }
public void Add(JoinApply apply) { using (var context = new WSI.DataAccess.WSICmsContext()) { context.Entry(apply).State = EntityState.Added; context.SaveChanges(); } }