protected void Button_SaveDescription_Click(object sender, EventArgs e) { int year = int.Parse(DropDownList_Year.SelectedItem.Value); int month = int.Parse(DropDownList_Month.SelectedItem.Value); Scheduling_Description_BLL bll = new Scheduling_Description_BLL(); Scheduling_Description model = bll.Get(a => a.Year == year && a.Month == month); if (model == null) { model = new Scheduling_Description() { SchDesID = Guid.NewGuid(), Year = year, Month = month, Description = TextBox_Description.Text.Trim(), CreateTime = DateTime.Now, UpdateTime = DateTime.Now }; bll.Add(model); } else { model.Description = TextBox_Description.Text.Trim(); model.UpdateTime = DateTime.Now; bll.Update(model); } Response.Write("<script language=javascript defer>alert('保存成功!');</script>"); }
public void GetDescription() { int year = int.Parse(DropDownList_Year.SelectedItem.Value); int month = int.Parse(DropDownList_Month.SelectedItem.Value); Scheduling_Description_BLL bll = new Scheduling_Description_BLL(); Scheduling_Description model = bll.Get(a => a.Year == year && a.Month == month); if (model != null) { Label_Description.Text = model.Description.Replace("\n", "<br/>"); } else { Label_Description.Text = ""; } }