protected void SubmitButton_Click(object sender, EventArgs e) { AdviceType adviceType = new AdviceType(); adviceType.CreateDate = DateTime.Now; int index; if (int.TryParse(SortNumber.Text, out index)) { adviceType.Index = index; } adviceType.Title = AdviceNameText.Text.Trim(); adviceType.Description = RemarkText.Text.Trim(); if (string.IsNullOrEmpty(adviceType.Title)) { Messages.ShowError("模型名称不能为空"); return; } if (AdviceTypeID == null || AdviceTypeID == "") // 新建 { adviceType.AccountID = AccountID; string adviceTypeID = We7Helper.CreateNewID(); adviceType.ID = adviceTypeID; AdviceTypeHelper.AddAdviceType(adviceType); } else // 修改 { adviceType.ID = AdviceTypeID; AdviceTypeHelper.UpdateAdviceType(adviceType); Messages.ShowMessage("" + AdviceNameText.Text + " 模型修改成功!!"); } //记录日志 string content = string.Format("编辑了模型“{0}”的信息", adviceType.Title); AddLog("编辑反馈模型", content); if (AdviceTypeID == null || AdviceTypeID == "") { string rawurl = We7Helper.AddParamToUrl(Request.RawUrl, "saved", "1"); rawurl = We7Helper.RemoveParamFromUrl(rawurl, "adviceTypeID"); rawurl = We7Helper.AddParamToUrl(rawurl, "adviceTypeID", We7Helper.GUIDToFormatString(adviceType.ID)); Response.Redirect(rawurl); } }