protected void btnSave_Click(object sender, EventArgs e) { if (txtTitle.Text.Trim() == "") { AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("danger", "请填写标题"); return; } MojoCube.Web.Express.List list = new MojoCube.Web.Express.List(); //修改 if (ViewState["pk_Express"] != null) { list.GetData(int.Parse(ViewState["pk_Express"].ToString())); list.Title = txtTitle.Text.Trim(); list.Subtitle = txtSubtitle.Text.Trim(); list.TypeID = int.Parse(ddlType.SelectedValue); list.Gateway = txtGateway.Text.Trim(); list.AppID = txtAppID.Text.Trim(); list.KeyCode = txtKeyCode.Text.Trim(); list.Visible = cbVisible.Checked; list.SortID = MojoCube.Web.String.ToInt(txtSortID.Text.Trim()); list.ModifyDate = DateTime.Now.ToString(); list.ModifyUserID = int.Parse(Session["UserID"].ToString()); list.UpdateData(list.pk_Express); } //新增 else { list.Title = txtTitle.Text.Trim(); list.Subtitle = txtSubtitle.Text.Trim(); list.TypeID = int.Parse(ddlType.SelectedValue); list.Gateway = txtGateway.Text.Trim(); list.AppID = txtAppID.Text.Trim(); list.KeyCode = txtKeyCode.Text.Trim(); list.Visible = cbVisible.Checked; list.SortID = MojoCube.Web.String.ToInt(txtSortID.Text.Trim()); list.ImagePath = string.Empty; list.CreateDate = DateTime.Now.ToString(); list.CreateUserID = int.Parse(Session["UserID"].ToString()); list.ModifyDate = DateTime.Now.ToString(); list.ModifyUserID = 0; ViewState["pk_Express"] = list.InsertData(); } AlertDiv.InnerHtml = MojoCube.Web.String.ShowAlert("success", "数据保存成功"); }