protected void btnSave_Click(object sender, EventArgs e) { int id = int.Parse(hiddenID.Text); FineOffice.Modules.ADM_LetterFollow model = followBll.GetModel(p => p.ID == id); if (ddlHandler.SelectedIndex > 0) { model.Handler = int.Parse(ddlHandler.SelectedValue); } else { model.Handler = null; } model.HandleTime = DateTime.Parse(dtpDate.Text + " " + dtpTime.Text); model.Linkman = txtLinkman.Text.Trim(); model.Matter = txtMatter.Text.Trim(); model.Mobile = txtMoblie.Text.Trim(); model.Result = txtResult.Text.Trim(); try { followBll.Update(model); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("subwin_close")); } catch (Exception ex) { Alert.Show(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { LoadData(); int id = int.Parse(Request["ID"]); FineOffice.Modules.ADM_LetterFollow model = followBll.GetModel(p => p.ID == id); DataBind(model); } }
private void DataBind(FineOffice.Modules.ADM_LetterFollow model) { hiddenID.Text = model.ID.ToString(); if (model.HandleDepartmentID != null) { ddlHandleDepartment.SelectedValue = model.HandleDepartmentID.ToString(); ddlHandleDepartment_SelectedIndexChanged(null, null); ddlHandler.SelectedValue = model.Handler.ToString(); } dtpDate.Text = string.Format("{0:yyyy-MM-dd}", model.HandleTime); dtpTime.Text = string.Format("{0:HH:mm}", model.HandleTime); txtLinkman.Text = model.Linkman; txtMatter.Text = model.Matter; txtMoblie.Text = model.Mobile; txtResult.Text = model.Result; }