protected override void btnSave_Click(object sender, EventArgs e) { if (action.Equals("add")) { serv = new cmsServicer(); } else { serv = ss.GetModel(id); serv.Attach(); } serv.LangId = CurrentLanguageId; serv.Name = txtName.Text; serv.QQ = txtQQ.Text; serv.MSN = txtMSN.Text; serv.TaobaoWW = txtTaobao.Text; serv.AliWW = txtAli.Text; serv.SKYPE = txtSkype.Text; serv.OrderNo = Convert.ToInt32(txtOrder.Text); serv.IsEnabled = chkEnabled.Checked ? 1 : 0; try { long r = ss.SaveModel(serv); if (action.Equals("edit")) r = serv.Id; hidID.Value = r.ToString(); if (action.Equals("add")) { ScriptUtil.ConfirmAndRedirect(@"客服添加成功!\n“确定”继续添加,“取消”则跳转到列表页。", "ServicerAdd.aspx?node=" + NodeCode, "ServicerList.aspx?node=" + NodeCode); } else { ScriptUtil.ConfirmAndRedirect(@"客服修改成功!\n“确定”留在本页,“取消”则跳转到列表页。", "ServicerAdd.aspx?node=" + NodeCode + "&id=" + id, "ServicerList.aspx?node=" + NodeCode); } } catch (Exception ex) { ScriptUtil.Alert(ex.Message); Logger.Error(ex.Message); } }
private void InitData() { serv = ss.GetModel(id); if (serv != null) { hidID.Value = serv.Id.ToString(); txtName.Text = serv.Name; txtQQ.Text = serv.QQ; txtMSN.Text = serv.MSN; txtTaobao.Text = serv.TaobaoWW; txtAli.Text = serv.AliWW; txtSkype.Text = serv.SKYPE; txtOrder.Text = serv.OrderNo.ToString(); chkEnabled.Checked = serv.IsEnabled.HasValue ? serv.IsEnabled.Value == 1 : false; } }